<!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>India
" sherzod.hakimov@tib.eu (S. Hakimov); ralph.ewerth@tib.eu (R. Ewerth)</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Combining Textual Features for the Detection of Hateful and Ofensive Language</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Sherzod Hakimov</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Ralph Ewerth</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Leibniz University Hannover, L3S Research Center</institution>
          ,
          <addr-line>Hannover</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>TIB - Leibniz Information Centre for Science and Technology</institution>
          ,
          <addr-line>Hannover</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2021</year>
      </pub-date>
      <volume>000</volume>
      <fpage>0</fpage>
      <lpage>0002</lpage>
      <abstract>
        <p>The detection of ofensive, hateful and profane language has become a critical challenge since many users in social networks are exposed to cyberbullying activities on a daily basis. In this paper, we present an analysis of combining diferent textual features for the detection of hateful or ofensive posts on Twitter. We provide a detailed experimental evaluation to understand the impact of each building block in a neural network architecture. The proposed architecture is evaluated on the English Subtask 1A: Identifying Hate, ofensive and profane content from the post datasets of HASOC-2021 dataset under the team name TIB-VA. We compared diferent variants of the contextual word embeddings combined with the character level embeddings and the encoding of collected hate terms.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;hate speech detection</kwd>
        <kwd>ofensive language detection</kwd>
        <kwd>abusive language detection</kwd>
        <kwd>social media mining</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>language or not. We proposed a combination of multiple textual features based on neural
network architecture and evaluated diferent configurations. Our experimental evaluation is
performed on all three datasets: HASOC-2019 [11], HASOC-2020 [12], HASOC-2021 [10].</p>
      <p>The remainder of the paper is structured as follows. In Section 2, we describe the proposed
model architecture. In Section 3, the experimental setup, challenge datasets, as well as
evaluations of model architectures are described in detail. Finally, the Section 4 concludes the
paper.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Approach</title>
      <p>Our model architecture is built on top of three textual features that are combined to predict
whether a given text contains hateful, ofensive or profane language. The neural network
architecture is shown in Figure 1. Input tokens are fed into BERT, Character and Hate Words
encoders to extract feature-specific vector representations. Once each feature representation
is extracted, the outputs are fed into separate components to obtain one-dimensional vector
representations. These vectors are concatenated and fed into three diferent blocks to obtain
binary class probabilities. Each block is composed of a linear layer, batch normalization and
a ReLU activation function. The source code and the resources described below are shared
publicly with the community4. Next, we describe the textual encoders in detail.
BERT Encoder: We used a pre-trained BERT [13] model to obtain contextual 768-dimensional
word vectors for each input token.</p>
      <p>Character Encoder: Each input token is converted into vector representation based on the
one-hot encoding of characters in English. We only use letters (a-z) to obtain a sequence of
character-level vectors.</p>
      <p>Hate Words Encoder: We collected a list of hate terms by combining the dictionary provided
by Gomez et al. [14] with additional online dictionaries5. We manually filtered out terms that do
not express hate concepts and obtained a list of 1493 hate terms. The list contains a variety of
terms with diferent lexical variations to increase the coverage of detecting such terms in tweets,
e.g., bitc*, border jumper, nig**, or chin*. This encoder outputs a 1493-dimensional vector, a
multi-hot encoding of hate terms in input tokens.</p>
    </sec>
    <sec id="sec-3">
      <title>3. Experimental Setup and Results</title>
      <p>In this section, we present the challenge datasets, details about data preprocessing and model
parameters, and finally explain the experimental setup along with the obtained results.</p>
      <sec id="sec-3-1">
        <title>3.1. Datasets</title>
        <p>
          Our model architecture is built for the HASOC-2021 [10] English Subtask 1A: Identifying Hate,
ofensive and profane content from the post [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ]. In Table 1, we provide the number of data points
for HASOC-2019[11], HASOC-2020 [12], and HASOC-2021 [10] editions of the challenge. The
4https://github.com/sherzod-hakimov/HASOC-2021---Hate-Speech-Detection
5https://www.noswearing.com/dictionary &amp; https://hatebase.org/
token1
token2
token3
        </p>
        <p>...
tokenn
Character</p>
        <p>Encoder
Hate Words</p>
        <p>Encoder
RNN</p>
        <p>Block-1</p>
        <p>Block-2</p>
        <p>Block-3 Block-4
Concatenation</p>
        <p>Softmax
Hate and Offensive
Not Hate or Offensive
1D Features</p>
        <p>Linear Layer</p>
        <p>Batch
Normalization</p>
        <p>ReLU
datasets include tweet text as input data and two target labels: Hate and Ofensive (HOF) and
Not Hate or Ofensive (NOT) .</p>
        <p>The number of training samples for the 2019 and 2021 editions are not equally distributed
among the two classes. To overcome the class imbalance issue, we applied the oversampling
method to the training splits. We randomly selected a certain number of data points for the
minority class (HOF for 2019, NOT for 2021) and duplicated them to equalize with the number
of data points for the majority class.</p>
      </sec>
      <sec id="sec-3-2">
        <title>3.2. Data Preprocessing</title>
        <p>There are several challenges with working text from Twitter. In many cases, the tokens are
written in diferent forms to save space, capitalized, mixed with numbers etc. We apply the
following text preprocessing steps to normalize the tweet text: 1) remove hashtags, URLs, user
tags, retweets tags using Ekphrasis, 2) remove punctuations, 3) convert tokens into lowercase.</p>
      </sec>
      <sec id="sec-3-3">
        <title>3.3. Model Parameters</title>
        <p>In this section, we provide details about all parameters of the buildings blocks in the model
architecture show in Figure 1.</p>
        <p>BERT Encoder: We experiment with two diferent variants of BERT models. The first
variant is BERT-base, which is the default model provided by Devlin et al. [13]. The second
variant is HateBERT provided by Caselli et al. [15], which is a BERT-base model pre-trained
further on hateful comments corpus extracted from Reddit. Both variants output a sequence of
768-dimensional vectors for the given input tokens.</p>
        <p>Recurrent Neural Network (RNN) Layers: We experimented with diferent types of RNN
layers: Long-short Term Memory (LSTM), Gated Recurrent Unit (GRU), and Bidirectional Gated
Recurrent Unit (Bi-GRU). We also experimented with diferent layer sizes, which are 100, 200,
300.</p>
        <p>Linear Layers: The model architecture includes four blocks that are composed of three
consecutive layers: linear layer, batch normalization, and activation function (ReLU). The sizes
of the linear layers in the Block-1, Block-2, Block-3, Block-4 are 512, 512, 256, 128 respectively.</p>
        <p>Training Process: Each configuration of the model architecture is trained using Adam
optimizer [16] with a learning rate of 0.001, a batch size of 64 for maximum of 20 iterations.
We use the 90:10 splits for train and validation splits to find the optimal hyperparameters.</p>
        <p>Implementation: The model architecture is implemented in Python using the Tensorflow
Keras library. The source code is shared openly with the community6.</p>
      </sec>
      <sec id="sec-3-4">
        <title>3.4. Results</title>
        <p>
          We tested diferent model configurations as explained above for all three datasets. The results
are given in Table 2. The oficial evaluation metrics for the English Subtask 1A [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ] is Macro
F1-score. Additionally, we included accuracy and weighted F1-score since the number of data
points for each class are not balanced for test splits of the datasets (see Table 1). We included the
best performing models with the corresponding features. Based on the initial experiments, the
choice of Gated Recurrent Unit (GRU) with the layer size of 100 yielded the highest performance
on the validation set for three datasets in comparison to other model configurations. Therefore,
all model configurations listed in the table below use the GRU layer with the size 100.
        </p>
        <p>
          The results suggest that BERT-base embeddings have greater a impact than HateBERT
embeddings. Another important observation is that the feature based on the multi-hot encoding of hate
terms ( ) achieves high accuracy and weighted F1-score for all datasets. Specifically, every
model configuration that included the  feature yields the best results on the HASOC-2020
dataset. Our approach that combines BERT-base, character embeddings, and multi-hot encoding
of hate terms achieved a Macro F1-score of 0.77 on English Subtask 1A [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ] of the
HASOC2021 [10] dataset. We submitted the same model as a team TIB-VA to the oficial challenge. Our
model was ranked at the position 33 with the Macro-F1 score of 0.76.
        </p>
        <p>6https://github.com/sherzod-hakimov/HASOC-2021---Hate-Speech-Detection</p>
        <p>We present the confusion matrices in Figure 2 for two models with diferent pre-trained
variants of BERT models: BERT-base (BB) and HateBERT (HB). Both models were trained with
character level embeddings (CH) and multi-hot encoded hate words (HW). We can observe that
the model using BERT-base embeddings (Figure 2a) makes more correct predictions (614 vs. 577)
in detecting hateful content (HOF) when compared with the other model variant (Figure 2b).
A similar pattern exists for cases where the target class is NOT, and the model predicts HOF
where the model with the BB feature makes fewer mistakes (151 vs. 188) than the other model.
(a) Model with features:  +  + 
(b) Model with features:  +  +</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Conclusion</title>
      <p>In this paper, we have analyzed model architectures that combine multiple textual features to
detect hateful, ofensive and profane language. Our experimental results showed that simply
using the multi-hot encoding of collected 1493 hate terms yields significant performance. The
combination of BERT embeddings, character embeddings, and features based on hate terms
achieved the best performance on the English Subtask 1A, HASOC 2021 dataset. Another
observation of the evaluation is that a variant of the BERT model trained on domain-specific
(HateBERT ) text did not improve the results in comparison to the default pre-trained model
variant (BERT-base).
guages, in: Working Notes of FIRE 2021 - Forum for Information Retrieval Evaluation,
CEUR, 2021. URL: http://ceur-ws.org/.
[10] S. Modha, T. Mandl, G. K. Shahi, H. Madhu, S. Satapara, T. Ranasinghe, M. Zampieri,
Overview of the HASOC Subtrack at FIRE 2021: Hate Speech and Ofensive Content
Identification in English and Indo-Aryan Languages and Conversational Hate Speech, in:
FIRE 2021: Forum for Information Retrieval Evaluation, Virtual Event, 13th-17th December
2021, ACM, 2021.
[11] T. Mandl, S. Modha, P. Majumder, D. Patel, M. Dave, C. Mandalia, A. Patel, Overview of
the HASOC track at FIRE 2019: Hate speech and ofensive content identification in
indoeuropean languages, in: P. Majumder, M. Mitra, S. Gangopadhyay, P. Mehta (Eds.), FIRE ’19:
Forum for Information Retrieval Evaluation, Kolkata, India, December, 2019, ACM, 2019, pp.
14–17. URL: https://doi.org/10.1145/3368567.3368584. doi:10.1145/3368567.3368584.
[12] T. Mandl, S. Modha, A. K. M, B. R. Chakravarthi, Overview of the HASOC track at FIRE 2020:
Hate speech and ofensive language identification in tamil, malayalam, hindi, english and
german, in: P. Majumder, M. Mitra, S. Gangopadhyay, P. Mehta (Eds.), FIRE 2020: Forum for
Information Retrieval Evaluation, Hyderabad, India, December 16-20, 2020, ACM, 2020, pp.
29–32. URL: https://doi.org/10.1145/3441501.3441517. doi:10.1145/3441501.3441517.
[13] J. Devlin, M. Chang, K. Lee, K. Toutanova, BERT: pre-training of deep bidirectional
transformers for language understanding, in: J. Burstein, C. Doran, T. Solorio (Eds.), Proceedings
of the 2019 Conference of the North American Chapter of the Association for
Computational Linguistics: Human Language Technologies, NAACL-HLT 2019, Minneapolis, MN,
USA, June 2-7, 2019, Volume 1 (Long and Short Papers), Association for Computational
Linguistics, 2019, pp. 4171–4186.
[14] R. Gomez, J. Gibert, L. Gómez, D. Karatzas, Exploring hate speech detection in multimodal
publications, in: IEEE Winter Conference on Applications of Computer Vision, WACV
2020, Snowmass Village, CO, USA, March 1-5, 2020, IEEE, 2020, pp. 1459–1467. URL: https:
//doi.org/10.1109/WACV45572.2020.9093414. doi:10.1109/WACV45572.2020.9093414.
[15] T. Caselli, V. Basile, J. Mitrovic, M. Granitzer, Hatebert: Retraining BERT for abusive
language detection in english, CoRR abs/2010.12472 (2020). URL: https://arxiv.org/abs/
2010.12472. arXiv:2010.12472.
[16] D. P. Kingma, J. Ba, Adam: A method for stochastic optimization, in: Y. Bengio, Y. LeCun
(Eds.), 3rd International Conference on Learning Representations, ICLR 2015, San Diego,
CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015. URL: http://arxiv.org/abs/
1412.6980.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>R. M.</given-names>
            <surname>Kowalski</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G. W.</given-names>
            <surname>Giumetti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. N.</given-names>
            <surname>Schroeder</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. R.</given-names>
            <surname>Lattanner</surname>
          </string-name>
          ,
          <article-title>Bullying in the digital age: A critical review and meta-analysis of cyberbullying research among youth</article-title>
          .,
          <source>Psychological bulletin 140</source>
          (
          <year>2014</year>
          )
          <fpage>1073</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>P.</given-names>
            <surname>Badjatiya</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Gupta</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Gupta</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Varma</surname>
          </string-name>
          ,
          <article-title>Deep learning for hate speech detection in tweets</article-title>
          , in: R. Barrett,
          <string-name>
            <given-names>R.</given-names>
            <surname>Cummings</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Agichtein</surname>
          </string-name>
          , E. Gabrilovich (Eds.),
          <source>Proceedings of the 26th International Conference on World Wide Web Companion, Perth, Australia, April 3-7</source>
          ,
          <year>2017</year>
          , ACM,
          <year>2017</year>
          , pp.
          <fpage>759</fpage>
          -
          <lpage>760</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>T.</given-names>
            <surname>Davidson</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Warmsley</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. W.</given-names>
            <surname>Macy</surname>
          </string-name>
          ,
          <string-name>
            <surname>I. Weber</surname>
          </string-name>
          ,
          <article-title>Automated hate speech detection and the problem of ofensive language</article-title>
          ,
          <source>in: Proceedings of the Eleventh International Conference on Web and Social Media</source>
          ,
          <string-name>
            <surname>ICWSM</surname>
          </string-name>
          <year>2017</year>
          , Montréal, Québec, Canada, May
          <volume>15</volume>
          -18,
          <year>2017</year>
          , AAAI Press,
          <year>2017</year>
          , pp.
          <fpage>512</fpage>
          -
          <lpage>515</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <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</article-title>
          ,
          <source>ACM Comput. Surv</source>
          .
          <volume>51</volume>
          (
          <year>2018</year>
          )
          <volume>85</volume>
          :
          <fpage>1</fpage>
          -
          <lpage>85</lpage>
          :
          <fpage>30</fpage>
          . doi:
          <volume>10</volume>
          .1145/3232676.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>W.</given-names>
            <surname>Warner</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Hirschberg</surname>
          </string-name>
          ,
          <article-title>Detecting hate speech on the world wide web</article-title>
          ,
          <source>in: Proceedings of the second workshop on language in social media</source>
          ,
          <year>2012</year>
          , pp.
          <fpage>19</fpage>
          -
          <lpage>26</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <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>Lang. Resour. Evaluation</source>
          <volume>55</volume>
          (
          <year>2021</year>
          )
          <fpage>477</fpage>
          -
          <lpage>523</lpage>
          . URL: https://doi.org/10.1007/s10579-020-09502-8. doi:
          <volume>10</volume>
          .1007/s10579-020-09502-8.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>Z.</given-names>
            <surname>Zhang</surname>
          </string-name>
          , L. Luo,
          <article-title>Hate speech detection: A solved problem? the challenging case of long tail on twitter</article-title>
          ,
          <source>Semantic Web</source>
          <volume>10</volume>
          (
          <year>2019</year>
          )
          <fpage>925</fpage>
          -
          <lpage>945</lpage>
          . URL: https://doi.org/10.3233/SW-180338. doi:
          <volume>10</volume>
          .3233/SW-180338.
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>P.</given-names>
            <surname>Zeinert</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Inie</surname>
          </string-name>
          , L. Derczynski,
          <article-title>Annotating online misogyny</article-title>
          , in: C.
          <string-name>
            <surname>Zong</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          <string-name>
            <surname>Xia</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          <string-name>
            <surname>Li</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          <string-name>
            <surname>Navigli</surname>
          </string-name>
          (Eds.),
          <source>Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, ACL/IJCNLP</source>
          <year>2021</year>
          ,
          <article-title>(Volume 1: Long Papers)</article-title>
          ,
          <source>Virtual Event, August 1-6</source>
          ,
          <year>2021</year>
          , Association for Computational Linguistics,
          <year>2021</year>
          , pp.
          <fpage>3181</fpage>
          -
          <lpage>3197</lpage>
          . URL: https://doi.org/10.18653/v1/
          <year>2021</year>
          .
          <article-title>acl-long</article-title>
          .
          <volume>247</volume>
          . doi:
          <volume>10</volume>
          .18653/v1/
          <year>2021</year>
          .
          <article-title>acl-long</article-title>
          .
          <volume>247</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>T.</given-names>
            <surname>Mandl</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Modha</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G. K.</given-names>
            <surname>Shahi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Madhu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Satapara</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Majumder</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Schäfer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Ranasinghe</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Zampieri</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Nandini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. K.</given-names>
            <surname>Jaiswal</surname>
          </string-name>
          ,
          <article-title>Overview of the HASOC subtrack at FIRE 2021: Hate Speech and Ofensive Content Identification in English and Indo-Aryan Lan-</article-title>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>