<!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>YNU wb at HASOC 2019: Ordered Neurons LSTM with Attention for Identifying Hate Speech and O ensive Language</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Bin Wang</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Yunxia Ding</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Shengyan Liu</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Xiaobing Zhou</string-name>
          <email>zhouxb@ynu.edu.cn</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>School of Information Science and Engineering Yunnan University</institution>
          ,
          <addr-line>Yunnan</addr-line>
          ,
          <country country="CN">P.R. China</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>The paper describes the system submitted to HASOC2019: Hate Speech and O ensive Content Identi cation in Indo-European Languages. The task aims to categorize o ensive language in social media, we only participated in Sub-task A for English, which aims to identify o ensive language and hate speech. In order to address this task, we proposed a system based on an ordered neurons LSTM with an attention model, and used a K-folding approach to ensemble. Our model achieved the Macro F1-score of 0.7882 and the Weighted F1-score of 0.8395 in the Subtask A for English language, and achieved the highest result.</p>
      </abstract>
      <kwd-group>
        <kwd>Hate speech o ensive language ordered neurons LSTM Attention</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        With the popularization of the Internet, more and more people are
communicating on online social platforms. Therefore, the hate speech and o ensive language
in the social network have been paid increasing attention by people[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. Hate
speech and o ensive language in online socialization have seriously a ected
people's daily life, such behavior could even lead to depression or suicide. Many
social media companies and technology companies are currently researching the
recognition of hate speech and o ensive language. So whether the system can
e ectively identify hate speech and o ensive language is a big challenge[
        <xref ref-type="bibr" rid="ref9">9</xref>
        ].
      </p>
      <p>
        HASOC2019 is proposed for identifying hate speech and o ensive content
in Indo-European Languages [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. Its purpose is to develop powerful
technologies that can cope with multilingual data, and to develop a transfer learning
method that can utilize the cross-language data. The task has three subtasks
and three languages(English, code-mixed Hindi and German), in which Subtask
A is a coarse-grained binary classi cation that the participating systems need
to classify tweets into two categories: hate and o ensive (HOF) and non-hate
and o ense (NOT), Subtask B is a ne-grained classi cation that is reclassi ed
on the hate speech and o ensive language that subtask A has distinguished and
Subtask C is to distinguish whether the target is an individual or a group.
      </p>
      <p>
        In this competition, we only participated in Subtask A for English language.
For Subtask A, we used a deep learning method to build an ordered neurons
LSTM(ON-LSTM) with an attention model. ON-LSTM di ers from the original
LSTM in the way that it encodes the hierarchical structure of sentences into
features to enhance the expressive power of LSTM[
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]. Our model used ordered
neurons LSTM to encoding sentences and used the attention mechanism to give
each word in the sentence a di erent weight. In the training process, we used the
OLID dataset[
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] as the training dataset to train the model of this task. Finally,
we used the K-folding method to ensemble, and got the highest result.
      </p>
      <p>The structure of this paper is as follows: In section 2 we introduce some
related work on identifying hate speech and o ensive language. In section 3, we
describe the datasets and how to build the model. In section 4 we describe the
experimental results and analysis.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Related Work</title>
      <p>
        In recent years, the topic of identifying hate speech and o ensive language has
attracted the attention of a large number of researchers in industry and academia.
Fortuna and Nunes believed that the eld of automatic detection of hate speech
in the text is very important for online social platforms and has unquestionable
social impact potential[
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. In this section, we will review some of the studies and
brie y discuss their ndings.
      </p>
      <p>
        Gemeval2018[
        <xref ref-type="bibr" rid="ref12">12</xref>
        ] is about the identi cation of o ensive language and the
purpose of this task is to promote the study of o ensive content recognition
in German language microposts. The optimal system used ve disjoint sets of
features sets to train three basic classi ers (maximum entropy and two
random forests ensembles), and then used a maximum entropy meta-level classi er
for nal classi cation[
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. HatEval is about the multilingual detection of hate
speech against immigrants and women in Twitter[
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. The FERMI team as the
best team for hatEval, proposed a SVM model with RBF kernel, exploiting
sentence embeddings from Google's Universal Sentence Encoder as features[
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
O ensEval[
        <xref ref-type="bibr" rid="ref14">14</xref>
        ] is about the identifying and categorizing o ensive language in
social media. NULI team as the best performers used BERT-base-uncased with
default-parameters[
        <xref ref-type="bibr" rid="ref6">6</xref>
        ].
      </p>
      <p>As can be seen from the above, most of the methods for obtaining optimal
results are machine learning models, and the deep learning models have not
achieved good results. However, in this task, the deep learning model we used
obtained the best results.</p>
    </sec>
    <sec id="sec-3">
      <title>Methodology and Data</title>
      <sec id="sec-3-1">
        <title>Data description</title>
        <p>
          In this task, we used an extra dataset OLID[
          <xref ref-type="bibr" rid="ref13">13</xref>
          ], which is proposed by O ensEval
mainly from Twitter. In Sub-task A, the purpose is to distinguish whether the
tweet is hate and o ensive (HOF) and non- hate and o ensive (NOT). In which
NOT: the text does not contain any hate speech, o ensive content. HOF: the
text contains Hate, o ensive, and profane content [
          <xref ref-type="bibr" rid="ref2">2</xref>
          ]. For English language, The
training dataset has a total of 5852 data, of which there are 3591 of NOT and
2261 of HOF, the ratio is about 3:2, the data is slightly unbalanced, for the
OLID dataset, there are 8840 of NOT and 4400 of OFF.
3.2
        </p>
      </sec>
      <sec id="sec-3-2">
        <title>ON-LSTM with an attention model</title>
        <p>
          Our network architecture is shown in Figure 1. Our model is built on
ONLSTM[
          <xref ref-type="bibr" rid="ref11">11</xref>
          ] with attention, where the ON-LSTM is a variant of LSTM. Next we
will explain the details of our system.
{ Input layer: This layer inputs all preprocessed text into the model.
{ Embedding layer: This layer vectorizes the words in the existing dictionary
that are entered by the pre-trained word vector model.
{ Encoding layer: In this layer, we encode vectorized text with ON-LSTM,
which sorts the neurons in a speci c order, allowing the hierarchical structure
(tree structure) to be integrated into the LSTM to express richer information.
The gate structure and output structure of ON-LSTM are still similar to the
original LSTM. The di erence is that the update mechanism from bct to ct
is di erent. The formula is as follows[
          <xref ref-type="bibr" rid="ref11">11</xref>
          ]:
fet = !cs(sof tmax(Wf xt + Uf ht 1 + bf ))
        </p>
        <p>e e e
eit = cs(sof tmax(Wixt + Uiht 1 + bi))</p>
        <p>
          e e e
!t = fet eit
(1)
(2)
(3)
(5)
(6)
(7)
ct = !t (ft ct 1 + it bct) + (fet !t) ct 1 + (fet !t) ct (4)
where cs and !cs represents the explain brie y to the left and right
respectively, the fet and eit are called master forget gate and master input gate
respectively. !t gives the vector where the intersection is 1 and the rest is
0. In this way, the high-level information may be stored for a long distance,
and the low-level information may be updated at each step of input, so the
hierarchical structure is embedded by information hierarchy.
{ Attention layer: The main function of this layer is to assign a weight to
each word in the sentence, making the words that are biased towards hate
speech and o ensive language more prominent, in order to classify the
sentence. Because all words in a sentence can be di erent in their expression of
emotions[
          <xref ref-type="bibr" rid="ref8">8</xref>
          ]. Some emotional words can greatly in uence whether a sentence
is hate speech and help identify the hate category.
        </p>
        <p>First, we feed the word annotation hi, and through a nonlinear layer to
get a deeper representation ui. Then, we calculate the similarity between ui
and the word-level context vector us and use the softmax function to get
the normalized weight i. Finally, we calculate the sentence vector s by the
weighted sum of the word annotation hi. The speci c formula is as follows:
ui = tanh(Ws</p>
        <p>hi + bs)
i =</p>
        <p>exp(uiT
Pi exp(uiT
us)</p>
        <p>us)
s = X</p>
        <p>i hi
i
{ Output layer: This layer classi es and predicts the nal aggregated
information. This layer consists of only one Dense layer with sigmoid activation
function.
3.3</p>
      </sec>
      <sec id="sec-3-3">
        <title>K-folding ensemble</title>
        <p>In this paper, we use a K-fold ensemble approach to enhance the performance
of the model. The idea of this method is to cross-validate the source and K-fold.
We randomly divide the training set into K parts and use the K 1 subsets to
do the training. The remaining subset is used as the veri cation set, and K times
are repeated. Finally, the K results are subjected to an accumulation averaging
operation to obtain the nal output. The k-fold ensemble approach is shown in
Figure 2.</p>
        <p>The purpose of this operation is that di erent data sets will be trained
during each training process, and di erent features will be extracted during the
process of extracting features from the model, which can further improve the
generalization ability of the model.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Experiment and results</title>
      <sec id="sec-4-1">
        <title>Data preprocessing</title>
        <p>Whether in o cial dataset or the OLID dataset, from Twitter or Facebook, the
data is very noisy because it is not processed. Tweets are rst processed using
the Tweetokenize tool 1. In order to extract the model into better features, we
further process the data, the speci c steps are as follows:
{ The word is retained for hashtags. Because it is very unique in itself, and it
may help with text categorization.
{ Username mentions, e.g.: words starting with "@", they are replaced with
'username'. Because we think that usernames don't contain emotional
expressions, and various usernames can bring a lot of unknown words, which
can lead to reduced model performance.
{ All contractions are split into two tokens(e.g.: "you're" is changed to "you"
and "are").
{ The emojis are replaced with the corresponding words by emotion lexicons2
to express the corresponding emotion.
{ Lemmatization is restored to general form by WordNetLemmatizer.
{ Tokens are converted to lower case.
1 https://www.github.com/jaredks/tweetokenize
2 https://emojipedia.org/</p>
        <p>Since the o cial veri cation set is not provided, we randomly extracted 500
tweets from the OLID data set and the o cially released training set as the
veri cation set, and the ratio of NOT and HOF in the veri cation set is 1:1.
4.2</p>
      </sec>
      <sec id="sec-4-2">
        <title>Experiment setting</title>
        <p>In our model, for this encoding layer, we set the hidden units to 128 and num
levels to 16; We added a layer of dropout between the encoding layer and the
attention layer. The purpose of this layer is to improve the generalization of the
model and prevent the model from over tting. Connected behind the Attention
layer is a layer of Dense with Relu activation function, and the number of hidden
units is 128. Finally, we added the Dropout layer and the BatchNormalization
layer, and the rate of all Dropout layers is 0.25. The activation function of the
nal output layer is sigmoid for binary classi cation. The loss function of this
model is binary crossentropy, and the optimizer is adam.</p>
        <p>
          By using 5-fold crossvalidation on the training data, we set the batch size to
512 and the epoch to 20 for training. And the pre-training word vector we used
is fastText, which is provided by Mikolov et al. [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ]. It is a 2 million word vector
trained using subword information on Common Crawl with 600B tokens, and its
dimension is 300.
4.3
        </p>
      </sec>
      <sec id="sec-4-3">
        <title>Result</title>
        <p>This Subtask A is to evaluate the classi cation system by calculating the Marco
F1 score and Weighted F1 score. According to the o cial results in Subtask A
for English language, the best Marco F1 score and Weighted F1 score of our
model are 0.7882 and 0.8395 respectively, ranked 1st place, and our result is
0.0188 higher than the second place for Marco F1 score. The three results we
submitted are shown in Table 1, and the top 5 teams from the o cial leaderboard
is shown in Table 2.
Run 1 is the result without using the k-fold ensemble method, while run 2
used the k-fold ensemble method. It can be seen that the model's performance
is increased by 0.02 for run 2, which is very e ective and provides more powerful
performance for the model. The parameters of run 3 are only slightly di erent
from those of run 2.</p>
        <p>From the detailed results provided by the o cial, our model's F1-score for
HOF is only 0.69, which is much lower than the 0.89 of NOT, indicating that
our model excels at distinguishing between NOT, which may be due to training
data. The number of HOFs is lower than NOT, and we have not dealt with the
imbalance of data. The detailed results of the run 2 are shown in Table 3.
In this paper, we presented a model to identify hate speech and o ensive language
for English language, and also used the k-fold ensemble method to improve the
generalization ability of the model, and achieved the best results in Subtask A for
English language. In future research, we will consider handling data imbalances
and introducing location features to try to further enhance the performance of
the model.</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Acknowledgments</title>
      <p>This work was supported by the Natural Science Foundations of China under
Grants 61463050, the NSF of Yunnan Province under Grant 2015FB113.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>Elizabeth</given-names>
            <surname>Whittaker and Robin M Kowalski</surname>
          </string-name>
          .
          <year>2015</year>
          .
          <article-title>Cyberbullying via social media</article-title>
          .
          <source>Journal of School Violence</source>
          ,
          <volume>14</volume>
          (
          <issue>1</issue>
          ):
          <fpage>11C29</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>Sandip</given-names>
            <surname>Modha</surname>
          </string-name>
          , Thomas Mandl, Prasenjit Majumder and
          <string-name>
            <given-names>Daksh</given-names>
            <surname>Patel</surname>
          </string-name>
          .
          <year>2019</year>
          .
          <article-title>Overview of the HASOC track at FIRE 2019: Hate Speech and O ensive Content Identi cation in Indo-European Languages</article-title>
          .
          <source>In Proceedings of the 11th annual meeting of the Forum for Information Retrieval Evaluation.</source>
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>Valerio</given-names>
            <surname>Basile</surname>
          </string-name>
          , Cristina Bosco, Elisabetta Fersini, Debora Nozza, Viviana Patti, Francisco Manuel Rangel Pardo, Paolo Rosso, and
          <string-name>
            <given-names>Manuela</given-names>
            <surname>Sanguinetti</surname>
          </string-name>
          .
          <year>2019</year>
          .
          <article-title>Semeval-2019 task 5: Multilingual detection of hate speech against immigrants and women in Twitter</article-title>
          .
          <source>In Proceedings of the 13th International Workshop on Semantic Evaluation</source>
          , pages
          <fpage>54</fpage>
          -
          <lpage>63</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>Paula</given-names>
            <surname>Fortuna</surname>
          </string-name>
          and
          <string-name>
            <given-names>Srgio</given-names>
            <surname>Nunes</surname>
          </string-name>
          .
          <year>2018</year>
          .
          <article-title>A Survey on Automatic Detection of Hate Speech in Text</article-title>
          .
          <source>ACM Computing Surveys (CSUR)</source>
          ,
          <volume>51</volume>
          (
          <issue>4</issue>
          ):
          <fpage>85</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>Vijayasaradhi</given-names>
            <surname>Indurthi</surname>
          </string-name>
          , Bakhtiyar Syed, Manish Shrivastava, Nikhil Chakravartula, Manish Gupta, and
          <string-name>
            <given-names>Vasudeva</given-names>
            <surname>Varma</surname>
          </string-name>
          .
          <year>2019</year>
          .
          <article-title>Fermi at semeval-2019 task 5: Using sentence embeddings to identify hate speech against immigrants and women in Twitter</article-title>
          .
          <source>In Proceedings of the 13th International Workshop on Semantic Evaluation</source>
          , pages
          <fpage>70C74</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Ping</surname>
            <given-names>Liu</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>Wen</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <given-names>and Liang</given-names>
            <surname>Zou</surname>
          </string-name>
          .
          <year>2019</year>
          .
          <article-title>Nuli at semeval-2019 task 6: Transfer learning for o ensive language detection using bidirectional transformers</article-title>
          .
          <source>In Proceedings of the 13th International Workshop on Semantic Evaluation</source>
          , pages
          <fpage>87C91</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>Tomas</given-names>
            <surname>Mikolov</surname>
          </string-name>
          , Edouard Grave, Piotr Bojanowski,
          <string-name>
            <given-names>Christian</given-names>
            <surname>Puhrsch</surname>
          </string-name>
          , and
          <string-name>
            <given-names>Armand</given-names>
            <surname>Joulin</surname>
          </string-name>
          .
          <year>2018</year>
          .
          <article-title>Advances in pre-training distributed word representations</article-title>
          .
          <source>In Proceedings of the International Conference on Language Resources and Evaluation (LREC</source>
          <year>2018</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>Zichao</given-names>
            <surname>Yang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Diyi</given-names>
            <surname>Yang</surname>
          </string-name>
          , Chris Dyer, Xiaodong He,
          <string-name>
            <surname>Alex Smola</surname>
            , and
            <given-names>Eduard</given-names>
          </string-name>
          <string-name>
            <surname>Hovy</surname>
          </string-name>
          .
          <year>2017</year>
          .
          <article-title>Hierarchical attention networks for document classi cation</article-title>
          .
          <source>In Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies</source>
          , pages
          <fpage>1480C1489</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <given-names>Ritesh</given-names>
            <surname>Kumar</surname>
          </string-name>
          , Atul Kr Ojha, Shervin Malmasi, and
          <string-name>
            <given-names>Marcos</given-names>
            <surname>Zampieri</surname>
          </string-name>
          .
          <year>2018</year>
          .
          <article-title>Benchmarking aggression identi cation in social media</article-title>
          .
          <source>In Proceedings of the First Workshop on Trolling, Aggression and Cyberbullying (TRAC-2018)</source>
          , pages
          <fpage>1C11</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Montani</surname>
          </string-name>
          , Joaqu n Padilla.
          <year>2018</year>
          . Tuwienkbs at germeval 2018:
          <article-title>German abusive tweet detection</article-title>
          .
          <source>In14thConference on Natural Language Processing KONVENS</source>
          <year>2018</year>
          , page 45.
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Yikang</surname>
            <given-names>Shen</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>Shawn</given-names>
            <surname>Tan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Alessandro</given-names>
            <surname>Sordoni</surname>
          </string-name>
          , and
          <string-name>
            <given-names>Aaron</given-names>
            <surname>Courville</surname>
          </string-name>
          .
          <year>2018</year>
          .
          <article-title>Ordered neurons: Integrating tree structures into recurrent neural networks</article-title>
          .
          <source>arXiv preprint arXiv:1810</source>
          .09536.
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Michael</surname>
            <given-names>Wiegand</given-names>
          </string-name>
          , Melanie Siegel, and
          <string-name>
            <given-names>Josef</given-names>
            <surname>Ruppenhofer</surname>
          </string-name>
          .
          <year>2018</year>
          .
          <article-title>Overview of the GermEval 2018 Shared Task on the Identi cation of O ensive Language</article-title>
          .
          <source>In Proceedings of GermEval.</source>
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <surname>Marcos</surname>
            <given-names>Zampieri</given-names>
          </string-name>
          , Shervin Malmasi, Preslav Nakov, Sara Rosenthal, Noura Farra, and
          <string-name>
            <given-names>Ritesh</given-names>
            <surname>Kumar</surname>
          </string-name>
          .
          <year>2019a</year>
          .
          <article-title>A Hierarchical Annotation of O ensive Posts in Social Media: The O ensive Language Identi cation Dataset</article-title>
          .
          <source>In arxiv preprint.</source>
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <surname>Marcos</surname>
            <given-names>Zampieri</given-names>
          </string-name>
          , Shervin Malmasi, Preslav Nakov, Sara Rosenthal, Noura Farra, and
          <string-name>
            <given-names>Ritesh</given-names>
            <surname>Kumar</surname>
          </string-name>
          .
          <year>2019b</year>
          . SemEval
          <article-title>-2019 Task 6: Identifying and Categorizing Offensive Language in Social Media (O ensEval)</article-title>
          .
          <source>In Proceedings of The 13th International Workshop on Semantic Evaluation (SemEval).</source>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>