<!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>
      <journal-title-group>
        <journal-title>FIRE</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Team FalsePostive at HASOC 2019: Transfer-Learning for Detection and Classi cation of Hate Speech</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Indian Institute of Information Technology</institution>
          ,
          <addr-line>Guwahati Bongora, Assam</addr-line>
          ,
          <country country="IN">India</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2019</year>
      </pub-date>
      <volume>12</volume>
      <fpage>12</fpage>
      <lpage>15</lpage>
      <abstract>
        <p>This paper presents the results obtained by using a convolutional neural network (CNN) and bi-directional long short-term memory (BiLSTM) network on the three di erent datasets provided in HASOC 2019. The neural networks presented in this paper were rst trained to classify whether the document provided in the dataset is hate speech or not. And then, the networks were ne-tuned for the subsequent subtasks of ne-grained classi cation of hate speech and nding out the type of o ense.</p>
      </abstract>
      <kwd-group>
        <kwd>Transfer learning</kwd>
        <kwd>Neural network</kwd>
        <kwd>Hate speech</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        Social media platforms such as Facebook and Twitter have increased in
popularity over the recent decades and only continue to rise in popularity. While such
platforms are used by people for constructive purposes, they have also become
a convenient medium for dissemination of hate speech. As such, there is a dire
need to possibly limit and curb the spread of hate speech in online social media
platforms [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ].
      </p>
      <p>
        According to Davidson et al. [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] hate speech is language that is used to
expresses hatred towards a targeted group or is intended to be derogatory, to
humiliate, or to insult the members of the group. In their work, they conclude that
classifying hate speech is a di cult task, as we tend to classify it based on our
own subjective biases.
      </p>
      <p>
        The HASOC1 2019 [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] event presents the shared task of classifying hate
speech. The shared task is further divided into three subtask A, B and C. Subtask
A comprised of classifying the document into two categories, Hate and O ensive
and Non - Hate and o ensive. The items classi ed as hateful and o ensive in
subtask A are to be further classi ed into three ne-grained classes namely Hate
speech, O ensive, Profane for subtask B. In subtask C, we further classify the
hateful and o ensive items of subtask A into two types of o enses, Targeted
Insult and Untargeted. For the above tasks, the organizers provided datasets
created from Facebook and Twitter posts. The datasets were provided in three
di erent languages, English, German and code-mixed Hindi. The organizer de ne
not hateful or o ensive (NOT) as posts that do not contain any hate speech or
o ensive content. Hate and O ensive (HOF) as posts that contain hate, o ensive
and profane content. Hate speech (HATE) as posts that contain hate speech.
Profane(PRFN) when post contain profane words. When posts contain threats
contain insult/threat to an individual, group or others, it is labelled Targeted
(TIN). And when the post contains general profanity that are not targeted but
contain non-acceptable language, it is labelled Untargeted (UNT).
2
      </p>
    </sec>
    <sec id="sec-2">
      <title>Related Work</title>
      <p>
        Baruah et al. [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] trained BiLSTM models with and without attention to detect
hate speech against immigrants and women on twitter. This task was a part of
the SemEval 2019 workshop [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. They found that BiLSTM without attention
performed better than the one with attention. Indurthi et al. [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] evaluated
the performance of various sentence level embeddings for the same task. They
trained various simple machine learning models on these embeddings and found
that Google's Universal Sentence Encoder [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] coupled with SVM (with RBF
Kernel) outperformed all other models for the task. For the same task Ding
et al. [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] used a capsule network on top of a stacked BiGRU network. They
used the word level embeddings provided by FastText [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] to rst convert the
words into vector representations. Nobata et al. [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] used a regression model
and studied the performance of di erent features like word2vec, word n-grams,
etc. for detecting hate speech. They also developed an abusive language corpus
from annotated user comments. Davidson et al. [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] worked in identifying the
challenges in hate speech detection such as detecting hate speech when hate
words might not be used in the text.
3
      </p>
    </sec>
    <sec id="sec-3">
      <title>Data</title>
      <p>This section discusses more details about the datasets mentioned in Section 1.
The number of posts provided per label for English, German and code-mixed
Hindi is given in Table 1. The posts marked as HATE is further categorized as
given in Table 2 and Table 3. As apparent from the above-mentioned tables, the
datasets given is imbalanced.</p>
      <p>
        To balanced the datasets, it was shu ed once and then balanced using a
simple interweaving algorithm. The interweaving algorithm for two labels is given
in Algorithm 1. The dataset is not shu ed again. This was done with the
intuition that when feeding data in batches to the models, the number of samples
of each category would be balanced in each epoch so that the model learns from
each class evenly. Before training any models, preprocessing was applied on the
dataset. The preprocessing applied is similar to the one applied by Davidson et
al. [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. The preprocessing steps are as follows.
1. Hashtags were segmented.
      </p>
      <p>For example #buildthewall is segmented into build the wall.
2. URLs were removed.
3. Redundant symbols were removed.
4. Redundant whitespaces were removed.
5. The @ symbol from user handles was removed.
6. RT pre xes were removed.</p>
      <p>Algorithm 1: Interweaving
input : M
output: B</p>
      <p>List of majority samples , m</p>
      <p>Interweaved balanced dataset
Init B Empty list ;
for i 1 to jM j do</p>
      <p>Append M [i] to B;
if i &gt;= jmj then</p>
      <p>Init r random integer between 1 to jmj ;</p>
      <p>Append m[r] to B;
else</p>
      <p>Append m[i] to B;
return B</p>
      <p>List of minority samples</p>
    </sec>
    <sec id="sec-4">
      <title>Experimental Settings</title>
      <p>
        Embeddings
The preprocessed posts mentioned in Section 3 were then converted into vector
representations using pre-trained embeddings via an embedding layer. If any
words in the posts were not found in the embeddings, a zero vector of appropriate
dimensions was used. For tokenizing the sentences, NLTK's [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] TweetTokenizer
was used. The embedding used for the three languages is given in Table 4.
In this section, the neural network models used are discussed. All the models
have been implemented using Keras [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. And for other tasks such as evaluating
the performance of the models and generating train-validation-test splits,
ScikitLearn has been used.
      </p>
      <p>Stacked BiLSTM This model was used for all the subtasks of the English
dataset. It was rst trained for subtask A. And then the model was further
netuned for subtask B and subtask C. The model architecture is given in Table
5. The bidirectional outputs were merged by multiplying. Fine-tuning was done
by resetting the weights of the 9th and 10th layer and replacing the nal output
layer with a new dense layer of appropriate units. All other layers were frozen.
The model was trained using Adam optimizer coupled with a cross-entropy loss
function for 20 epochs. The batch size used was 32.</p>
      <p>CNN This model was used for all subtasks of the German and code-mixed
Hindi dataset. Similar to the stacked BiLSTM, this model was rst trained for
subtask A and then ne-tuned for subtask B and C. This time, ne-tuning was
done by replacing the nal layer by a dense layer of the appropriate number
of units, i.e, number of categories to classify. Then all the layers were retrained
using a small learning rate ( 0:0005 ) and decay ( 0:000005 ). The optimizer used
was rmsprop and the same cross-entropy loss function. The batch size used is 32
and trained for 20 epochs.
5</p>
    </sec>
    <sec id="sec-5">
      <title>Results and Discussion</title>
      <p>The primary and secondary metric of evaluation for HASOC is weighted and
macro f1. The o cial results on the test set as published by the organisers for
each dataset is given in Table 12, Table 13 and Table 14. For the English dataset,
the BiLSTM model performed quite poorly achieving a macro average f1 of only
0:61. The model became biased on the posts that were not hate-speech as is
apparent from the confusion matrix shown in Table 7. On further ne-tuning
this model for subtask B and C, its performance degraded even further scoring
macro average f1's of 0:28 and 0:36 respectively. The CNN model used for the
Hindi subtasks achieved a macro average f1 of 0:76 which is around 0:05 shy from
the best performing model. However, this model also lost a lot of performance on
ne-tuning for subtask B and subtask C, achieving macro average f1 of 0:26 and
0:58 respectively. Both models su ered from false positives and false negatives.
NLTK's TweetTokenizer is not built for the Hindi language, hence it seems to
perform character-level tokenization on the Hindi words. In the subtasks for the
German language, the CNN model achieved a macro average f1 of 0:52, while
the best-achieved score is 0:61.The model was able to classify only 20 samples
as HOF. This could be due to the huge skew in the training set as shown in
Table 1. Oversampling by interweaving did not prove to be an e ective method
for balancing the dataset, especially when the imbalance is large. In subtask B,
the models performed poorly in classifying the OFFEN and PRFN labels. In the
German dataset, it completely failed to classify the PRFN class and performed
poorly on the OFFEN class. The same performance degradation can be observed
in subtask B and subtask C.
The problem of hate speech has become increasingly more prevalent. People
that post hateful tweets always nd news ways to skirt around detection systems.
With the velocity at which content is generated on social media, it is not feasible
to manually ag every post for toxicity. As such, it is of utmost importance to
develop automated systems that detect and purge hate speech and other toxic
content. It is hoped that the system models developed in this study can shed
some light on the task of detection of hate speech and its ner modalities. But
it leaves much to be desired.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Baruah</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Barbhuiya</surname>
            ,
            <given-names>F.A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dey</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          : Abaruah at semeval
          <article-title>-2019 task 5 : Bidirectional lstm for hate speech detection</article-title>
          . In: SemEval@
          <string-name>
            <surname>NAACL-HLT</surname>
          </string-name>
          (
          <year>2019</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Basile</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bosco</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Fersini</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nozza</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Patti</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Pardo</surname>
            ,
            <given-names>F.M.R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rosso</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sanguinetti</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Semeval-2019 task 5: Multilingual detection of hate speech against immigrants and women in twitter</article-title>
          . In: SemEval@
          <string-name>
            <surname>NAACL-HLT</surname>
          </string-name>
          (
          <year>2019</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Bird</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Klein</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Loper</surname>
            ,
            <given-names>E.: Natural</given-names>
          </string-name>
          <string-name>
            <surname>Language Processing with Python. O'Reilly Media</surname>
          </string-name>
          (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Cer</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Yang</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>yi Kong</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hua</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Limtiaco</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>John</surname>
          </string-name>
          , R.S.,
          <string-name>
            <surname>Constant</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Guajardo-Cespedes</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Yuan</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tar</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sung</surname>
            ,
            <given-names>Y.H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Strope</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kurzweil</surname>
          </string-name>
          , R.:
          <article-title>Universal sentence encoder</article-title>
          . ArXiv abs/
          <year>1803</year>
          .11175 (
          <year>2018</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Chollet</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          , et al.: Keras. https://keras.io (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Davidson</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Warmsley</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Macy</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Weber</surname>
            ,
            <given-names>I.</given-names>
          </string-name>
          :
          <article-title>Automated hate speech detection and the problem of o ensive language</article-title>
          .
          <source>In: Proceedings of the 11th International AAAI Conference on Web and Social Media</source>
          . pp.
          <volume>512</volume>
          {
          <fpage>515</fpage>
          . ICWSM '
          <volume>17</volume>
          (
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Ding</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Zhou</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Zhang</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          :
          <article-title>Ynudyx at semeval-2019 task 5: A stacked bigru model based on capsule network in detection of hate</article-title>
          . In: SemEval@
          <string-name>
            <surname>NAACL-HLT</surname>
          </string-name>
          (
          <year>2019</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Indurthi</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Syed</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Shrivastava</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Chakravartula</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gupta</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Varma</surname>
            ,
            <given-names>V.K.</given-names>
          </string-name>
          : Fermi at semeval
          <article-title>-2019 task 5: Using sentence embeddings to identify hate speech against immigrants and women in twitter</article-title>
          . In: SemEval@
          <string-name>
            <surname>NAACL-HLT</surname>
          </string-name>
          (
          <year>2019</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Mikolov</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Grave</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bojanowski</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Puhrsch</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Joulin</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Advances in pretraining distributed word representations</article-title>
          .
          <source>In: Proceedings of the International Conference on Language Resources and Evaluation (LREC</source>
          <year>2018</year>
          )
          <article-title>(</article-title>
          <year>2018</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Modha</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mandl</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Majumder</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Patel</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          :
          <article-title>Overview of the HASOC track at FIRE 2019: Hate Speech and O ensive Content Identi cation in Indo-European Languages</article-title>
          . In:
          <article-title>Proceedings of the 11th annual meeting of the Forum for Information Retrieval Evaluation (December</article-title>
          <year>2019</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Nobata</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tetreault</surname>
            ,
            <given-names>J.R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Thomas</surname>
            ,
            <given-names>A.O.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mehdad</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Chang</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          :
          <article-title>Abusive language detection in online user content</article-title>
          .
          <source>In: WWW</source>
          (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Pennington</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Socher</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Manning</surname>
          </string-name>
          , C.D.: Glove:
          <article-title>Global vectors for word representation</article-title>
          .
          <source>In: Empirical Methods in Natural Language Processing (EMNLP)</source>
          . pp.
          <volume>1532</volume>
          {
          <issue>1543</issue>
          (
          <year>2014</year>
          ), http://www.aclweb.org/anthology/D14-1162
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>