<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Hate Speech Detection on Twitter</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Instituto Politécnico Nacional (IPN)</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Centro de Investigación en Computación (CIC)</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Juan de Dios Bátiz Avenue</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Mexico City</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Mexico</string-name>
        </contrib>
      </contrib-group>
      <pub-date>
        <year>2021</year>
      </pub-date>
      <abstract>
        <p>With the use of social networks, the automatic detection of hate speech has become of great importance to prevent people, being protected by anonymity, from feeling free to discriminate against diferent groups. This document describes two approaches taken to detect hate speech by author: the first based on the individual processing of tweets by the author, which establishes a threshold of hate tweets to identify hate speech; the second based in the concatenation of tweets by author for processing.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Hate speech</kwd>
        <kwd>Twitter</kwd>
        <kwd>SVM</kwd>
        <kwd>Deep Neural Network</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <sec id="sec-1-1">
        <title>1.1. Corpus Description</title>
        <p>The corpus for the development phase was divided into two languages (English and Spanish),
each language was made up of 200 authors, with 200 tweets each. The labels were at the author
level, that is, there were no tags for each tweet. For the test phase, for each language there were
100 authors with 200 tweets each.</p>
        <p>Links, user mentions, and hashtags were substitute, for all tweets, with #URL#, #USER# and
#HASHTAG#, respectively.</p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>2. Data Preprocessing</title>
      <p>The pre-processing steps for both languages were the same. Links, user mentions, hashtags,
and retweets were removed. All non-English and non-Spanish characters, respectively, were
removed. The occurrence of more than two consecutive characters (letters) was replaced by
only two characters. All punctuation was remove and all numbers were substituted with 0.
Emojis (emoticons) were decoded into their text equivalents. Then all the text was lowercase.</p>
    </sec>
    <sec id="sec-3">
      <title>3. Methodology</title>
      <p>Diferent approaches were followed for each language. For English, a manual labeling of the
tweets was carried out, so each tweet was considered individually for the training. For Spanish,
the original author labeling was used, concatenating all the tweets by author separated by a
special token. Each approach is detailed in the next subsection.</p>
      <sec id="sec-3-1">
        <title>3.1. English</title>
        <p>A manual labeling of tweets from 45 authors was made by us, based in the original labeling: 23
authors labeled as hate speech and 22 authors as non-hate speech. From these tweets, all tweets
labeled as hate speech were taken, 405 tweets; from the rest of the tweets, the same number of
tweets was randomly selected in order to have a balanced training corpus. GloVe was used for
the embeddings.</p>
        <p>A deep neural network was used for the classification 1, the architecture is defined in figure 1.
The activation function used for the inner dense layers was relu, for the last dense layer sigmoid
was used. To avoid overfitting, two Dropouts 0.8 and 0.5 were used, as can be seen in Figure 1.
For the inner dense layers, a kernel regularizer l2 with a value of 0.0001 was set. For the last
Dense layer a l2 activity regularizer was set with the same value. The model was configured
with binary crossentropy for the loss, an Adam optimizer and using accuracy as metric.</p>
        <p>A 10-Fold Cross-Validation was used in the training. Once the training was finished, the
rest of the tweets in the corpus were classified. Next, the sum of Hate Speech Tweets (HST)
by author was performed. Taking into account the original labeling (by author) and the HST
number, a threshold was defined i.e., if an author had more than a certain HST number, this
author was classified as a hate speech spreaders. The threshold was set to 30.</p>
        <sec id="sec-3-1-1">
          <title>1Using tensorflow 2</title>
        </sec>
      </sec>
      <sec id="sec-3-2">
        <title>3.2. Spanish</title>
        <p>All tweet per author were concatenated, using the token &lt;EOT&gt; as separation. For classification
a SVM was used2. A linear kernel was used and a max number of iterations of 2000 was set (all
the other parameters were left as default). For the training, 10-Fold Cross-Validation was used.
Tokenization was perform with CountVectorizer, using the default values.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Results</title>
      <p>
        Accuracy was used as evaluation metric according to the specifications of the organizer of PAN
2021 and TIRA [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. For the training dataset the accuracy for English was 80.11% ± 3.41, for
Spanish 79.12 ± 1.23, having around 79% of accuracy. For the testing phase, the result obtained
for English was 65% and for Spanish was 77%, getting an average of 71%.
      </p>
      <sec id="sec-4-1">
        <title>2Using scikit-learn</title>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>5. Conclusions</title>
      <p>Using the manual tweets labeling approach not only flawed the criteria for detecting hate speech
but also makes it impossible to recognize the full context by author thus, hate spreaders whose
individual tweets do not represent hate speech, but in a general way constantly attack a specific
group, cannot be identified with this approach. On the other hand, concatenate all the tweets
allows to analyze the complete context by author, but makes processing dificult (200 tweets
per author). The results obtained shows that the concatenate approach is better generalizing.</p>
      <p>As future work, a more in-depth analysis using deep neural network with tweets
concatenation and SVM with labeling of tweets is proposed. In the same way, using the concatenation
approach analyzes how the use of mini batches of tweets by author is carried out, maintaining
the author’s labels, so that part of the context is preserved and processing is facilitated.</p>
    </sec>
    <sec id="sec-6">
      <title>Acknowledgments</title>
      <p>The work was done with support of the Government of Mexico via CONACYT, SNI and the
Secretaría de Investigación y Posgrado of the Instituto Politécnico Nacional, Mexico</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>F.</given-names>
            <surname>Poletto</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Basile</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Sanguinetti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Bosco</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Patti</surname>
          </string-name>
          ,
          <article-title>Resources and benchmark corpora for hate speech detection: a systematic review</article-title>
          ,
          <source>in: LREC</source>
          <year>2020</year>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>P.</given-names>
            <surname>Fortuna</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Nunes</surname>
          </string-name>
          ,
          <article-title>A survey on automatic detection of hate speech in text, ACM Computing Surveys (CSUR) 51 (</article-title>
          <year>2018</year>
          )
          <fpage>1</fpage>
          -
          <lpage>30</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>M.</given-names>
            <surname>Anzovino</surname>
          </string-name>
          , E. Fersini,
          <string-name>
            <given-names>P.</given-names>
            <surname>Rosso</surname>
          </string-name>
          ,
          <article-title>Automatic identification and classification of misogynistic language on twitter</article-title>
          , in: M.
          <string-name>
            <surname>Silberztein</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          <string-name>
            <surname>Atigui</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          <string-name>
            <surname>Kornyshova</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          <string-name>
            <surname>Métais</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          <string-name>
            <surname>Meziane</surname>
          </string-name>
          (Eds.),
          <source>Natural Language Processing and Information Systems</source>
          , Springer International Publishing, Cham,
          <year>2018</year>
          , pp.
          <fpage>57</fpage>
          -
          <lpage>64</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>J.</given-names>
            <surname>Bevendorf</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Chulvi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G. L. D. L. P.</given-names>
            <surname>Sarracén</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Kestemont</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Manjavacas</surname>
          </string-name>
          , I. Markov,
          <string-name>
            <given-names>M.</given-names>
            <surname>Mayerl</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Potthast</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Rangel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Rosso</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Stamatatos</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Stein</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Wiegmann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Wolska</surname>
          </string-name>
          , , E. Zangerle, Overview of PAN 2021:
          <article-title>Authorship Verification,Profiling Hate Speech Spreaders on Twitter,and Style Change Detection</article-title>
          ,
          <source>in: 12th International Conference of the CLEF Association (CLEF</source>
          <year>2021</year>
          ), Springer,
          <year>2021</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>F.</given-names>
            <surname>Rangel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G. L. D. L. P.</given-names>
            <surname>Sarracén</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Chulvi</surname>
          </string-name>
          , E. Fersini,
          <string-name>
            <given-names>P.</given-names>
            <surname>Rosso</surname>
          </string-name>
          ,
          <source>Profiling Hate Speech Spreaders on Twitter Task at PAN</source>
          <year>2021</year>
          ,
          <article-title>in: CLEF 2021 Labs and Workshops, Notebook Papers, CEUR-WS</article-title>
          .org,
          <year>2021</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>M.</given-names>
            <surname>Potthast</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Gollub</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Wiegmann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Stein</surname>
          </string-name>
          , TIRA Integrated Research Architecture, in: N.
          <string-name>
            <surname>Ferro</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          Peters (Eds.),
          <source>Information Retrieval Evaluation in a Changing World, The Information Retrieval Series</source>
          , Springer, Berlin Heidelberg New York,
          <year>2019</year>
          . doi:
          <volume>10</volume>
          .1007/ 978-3-
          <fpage>030</fpage>
          -22948-1\_5.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>