<!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>IIIT-Hyderabad at HASOC 2019: Hate Speech Detection</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>NLP Lab</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>IIIT-Hyderabad</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>pruthwik.mishra</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>vandan.mug@research.iiit.ac.in</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>dipti@iiit.ac.in</string-name>
        </contrib>
      </contrib-group>
      <pub-date>
        <year>2019</year>
      </pub-date>
      <volume>12</volume>
      <fpage>12</fpage>
      <lpage>15</lpage>
      <abstract>
        <p>Automatic identi cation of o ensive language in various social media platforms especially Twitter poses a great challenge to the AI community. The repercussions of such writings are hazardous to individuals, communities, organizations and nations. The HASOC shared task attempts for automatic detection of abusive language on Twitter in English, German and Hindi languages. As a part of this task, we (team A3-108) submitted di erent machine learning and neural network based models for all the languages. Our best performing model was an ensemble model of SVM, Random Forest and Adaboost classi ers with majority voting.</p>
      </abstract>
      <kwd-group>
        <kwd>Machine Learning</kwd>
        <kwd>Neural Networks</kwd>
        <kwd>Adaboost</kwd>
        <kwd>LSTM</kwd>
        <kwd>Linear SVM</kwd>
        <kwd>Random Forest</kwd>
        <kwd>TF-IDF</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        Social media is a great platform to communicate with people from di erent
demographic groups. With the exponential rise of use of hand-held devices across
the world, people are spending considerable amount of time on social media
like Facebook, Twitter, Instagram. Recent studies [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] suggest that most of the
online content generated on these platforms contains di erent forms of abusive
language. Cyberbullying and cyberterrorism have become a big menace for the
human society. A lot of disparaging tweets [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ] target people based on their color,
race, ethnicity, nationality, religion, caste. The administrators of social media
have started employing methods to tackle the adversarial e ects of the contents
being generated at their ends. HASOC [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] tries to automatically identify hate
speech and hurtful language in 3 di erent languages namely English, German and
Hindi. The distribution of di erent labels across tasks for each language in the
provided training data is shown table 1. The rst task is a binary classi cation
task to identify whether a tweet is o ensive or not. The other two tasks deal
with ner categories of hate speech and o ensive posts.
Two kinds of approaches were employed for the identi cation tasks.
{ Machine Learning Techniques
{ Neural Network Approaches
2.1
      </p>
      <sec id="sec-1-1">
        <title>Prepossessing</title>
        <p>Preprocessing is essential when we are dealing with textual data. For machine
learning approaches, we used the spacy 1 tokenizer for English and German, the
nltk 2 Twitter tokenizer for tokenizing the input. We also normalized the Twitter
handles and hashtags as \USRTOK", and urls as \URLTOK".
2.2</p>
      </sec>
      <sec id="sec-1-2">
        <title>Feature Engineering</title>
        <p>
          We used generic features for the representation of each tweet as we did not want
to design any language speci c features. Each word appearing in the tweet was
reduced to its lemma for English and German. We did not lemmatize the Hindi
words as there was no publicly available spacy model. The features were TF-IDF
vectors at character and word levels for all the tasks. We also used length of a
tweet as a feature. We experimented with di erent kinds of classi ers. Each one
was trained either individually or was a part of an ensemble classi er. Di erent
voting procedures were also tried out. In hard voting, majority voting is carried
out among the participating classi ers to decide each label. A voting classi er
with soft voting selects the maximum from the computed sums of the predicted
probabilities for the constituent classi ers. The following were implemented using
scikit-learn [
          <xref ref-type="bibr" rid="ref10">10</xref>
          ] machine learning library.
        </p>
        <p>{ Linear SVM
{ Adaboost or Adaptive Boosting (AB)
{ Random Forest (RF)
{ Voting Classi er (VC)
We tried various combinations of word and character level n-grams for the
classication. By performing grid-search, we observed that combining word unigrams
and character n-grams where n f2; 3; 4; 5g TF-IDF vectors as well as the
combination of character and word level n-grams.</p>
        <sec id="sec-1-2-1">
          <title>1 https://spacy.io 2 http://www.nltk.org</title>
          <p>2.3</p>
        </sec>
      </sec>
      <sec id="sec-1-3">
        <title>Neural Network Models</title>
        <p>
          We also used LSTM based neural network classi ers for all subtasks. We used
word features, Embedding layer (300 dimensions) as the inputs to the LSTM
[
          <xref ref-type="bibr" rid="ref4">4</xref>
          ] (128 units) layer, softmax layer (for prediction) in the keras 3 toolkit. In
this pipeline, we used categorical crossentropy as the loss function, the Adam
optimizer to optimize the parameters [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ] and trained on 50 epochs. In section 3,
we show and discuss results in detail.
2.4
        </p>
      </sec>
      <sec id="sec-1-4">
        <title>Our Submissions</title>
        <p>We submitted 3 runs for each task in each language. The 1st run was the LSTM
based approach. The 2nd run was an ensemble of SVM, Random Forest and
Adaboost classi ers with hard voting. This classi er used TF-IDF features of
word unigrams and character 2, 3, 4, 5 grams. The 3rd submission was similar
to the 2nd one with an additional feature of length of every tweet.
3</p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>Results</title>
      <p>Di erent classi ers were trained to predict the class of each question. We include
the top performing system outputs in table 2. Each model and feature set is
shown in the table. Two metrics were used to evaluate the systems. Macro F1
score was the primary metric whereas weighted F1 was the secondary one. Macro
F1 is an unweighted mean of the metrics calculated for each label. Weighted F1
is obtained by assigning weights based on the number of samples for each true
label.
4</p>
    </sec>
    <sec id="sec-3">
      <title>Observations</title>
      <p>Some tweets are ambiguously labeled.</p>
      <p>{ \All the best to #TeamIndia for another swimming competition on Sunday
against #Pakistan. #INDvPAK #ShameOnICC #CWC19 #CWC19Rains
https://t.co/MG2cIE0zib"
{ \#ShameOnICC 1. ICC on Dhoni`s gloves Vs 2.ICC planning the World</p>
      <p>
        Cup https://t.co/4kO3zKt7ln"
The rst tweet is not o ensive while the second one is marked as o ensive in the
training set. Although both of them are related to a similar topic, a classi er
trained on these kinds of examples will predict them as non-o ensive as the
number of non-o ensive tweets was more. Adaboost [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] was the best performing
classi er among the three classi ers used in our submissions. This was due to
its ability to combine multiple weak classi ers to create a strong prediction
model. But an ensemble of SVM, Random Forest and Adaboost performed even
      </p>
      <sec id="sec-3-1">
        <title>3 https://keras.io</title>
        <p>English
German
Hindi
1
2
3
1
2
1
2
3
Language Task# Run# Model
better than each classi er. Soft voting performed worse than the technique of
hard voting while the nal predictions were made. In Twitter, the number of
spelling variations is high due to character constraints. So character n-gram
based TF-IDF was superior to its word counterparts individually. When we
combined both word and character n-gram, the increase in performance was
marginal. Adding length of the tweet as a feature did not improve the model. It is
wrong to assume that the tweets containing abusive language are usually short.
Machine learning approaches outperformed the neural networks in almost all
the tasks. This conforms to the hypothesis that the machine learning techniques
are superior their neural network counterparts in a low resource setting. This
could be due to the higher number of parameters that deep learning approaches
try to learn from a very limited amount of data. We also gured out that the
classi ers performed well when the classes were balanced. Predicting profane
tweets was di cult as the frequency of such tweets was the least across the
data for each language. All our classi ers performed very poorly for all the
tasks in German. The systems were unable to capture any form of hate speech.
A lexicon containing German slur, profane and abusive words can prove to be
useful. Usually an o ensive tweet is full of words portraying negative sentiments.
German sentiment lexicons can be looked up to identify such tweets.</p>
        <p>We also observed that we missed a lot of important cues when we replaced all
Twitter handles and hashtags by a generic token.
\#BorisJohnsonShouldNotBePM", \#bloodonhishands", \#TrumpIsATraitor" are made up of multiple
words. These words in isolation can be a useful feature for the identi cation
task.</p>
        <p>From the above results, one can do case by case analysis to nd out the
improvement possibilities that can help di erent classi ers on di erent tasks.</p>
        <p>
          We also performed an analysis to understand the complexity of the task by
automatically applying Latent Dirichlet Allocation (LDA) on the provided
training data. Before applying LDA [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ], by using Gensim toolkit [
          <xref ref-type="bibr" rid="ref11">11</xref>
          ], we performed
basic tokenizaion [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ], text normalization and stop-word removal. For this
analysis, we focused only on sub-task-1 ( Non Hate-O ensive vs Hate and O ensive)
to understand the task di culty on a coarse level. Figures 1, 2 and 3 show these
derived text clusters from LDA for English (EN), Hindi (HI), German (DE)
respectively. From this clusters, we can argue that they do not give any inherent
separation on given task labels.
        </p>
        <p>
          As a next step to this, we also used learned LDA model of subtask-A or
task-1 to visualise training data by plotting each instances using T-SNE [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ] in
2D. Figures 4, 4 and 4, represent the training text and corresponding labels that
we got from LDA (left) with blue and orange colors for respective languages .
The graph on the right represents the actual labeled data in two dimensions
for respective languages. We can observe from gures that the given task of
classi cation is quite di cult as simple topic modeling do not provide any major
incites for the classi cation. This also suggests the need of feature engineering
and use of external resources for further improvement.
We presented our supervised approaches for the FIRE task of Hate Speech and
O ensive Content Identi cation in Indo-European Languages (HASOC). Our
experiments provide strong cues to go for traditional machine learning algorithms
with feature engineering instead of recent neural network based approaches when
the number of samples is very few and the class distribution is heavily skewed.
An ensemble classi er with word and character TF-IDF features performed the
best among all the classi ers. Detecting o ensive language in tweets is hard
when explicit keywords indicative of such forms are missing e.g \I don`t know
how much more I can take! 45 is a compulsive liar! #Trump30Hours
#TrumpIsATraitor". We can explore unsupervised techniques on raw tweets for learning
a better representation of implicit form of hate speech. Convolutional neural
networks (CNN) could be used to model the interactions between character n-grams
in the tweets.
        </p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Blei</surname>
            ,
            <given-names>D.M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ng</surname>
            ,
            <given-names>A.Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Jordan</surname>
            ,
            <given-names>M.I.</given-names>
          </string-name>
          :
          <article-title>Latent dirichlet allocation</article-title>
          .
          <source>Journal of machine Learning research 3(Jan)</source>
          ,
          <volume>993</volume>
          {
          <fpage>1022</fpage>
          (
          <year>2003</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Chen</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Zhou</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Zhu</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Xu</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          :
          <article-title>Detecting o ensive language in social media to protect adolescent online safety</article-title>
          .
          <source>In: 2012 International Conference on Privacy, Security, Risk and Trust and 2012 International Confernece on Social Computing</source>
          . pp.
          <volume>71</volume>
          {
          <fpage>80</fpage>
          .
          <string-name>
            <surname>IEEE</surname>
          </string-name>
          (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Freund</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schapire</surname>
          </string-name>
          , R.E.:
          <article-title>A decision-theoretic generalization of on-line learning and an application to boosting</article-title>
          .
          <source>Journal of computer and system sciences 55(1)</source>
          ,
          <volume>119</volume>
          {
          <fpage>139</fpage>
          (
          <year>1997</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Hochreiter</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schmidhuber</surname>
            ,
            <given-names>J.:</given-names>
          </string-name>
          <article-title>Long short-term memory</article-title>
          .
          <source>Neural computation 9(8)</source>
          ,
          <volume>1735</volume>
          {
          <fpage>1780</fpage>
          (
          <year>1997</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Kingma</surname>
            ,
            <given-names>D.P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ba</surname>
          </string-name>
          , J.:
          <article-title>Adam: A method for stochastic optimization</article-title>
          .
          <source>arXiv preprint arXiv:1412.6980</source>
          (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Loper</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bird</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          :
          <article-title>Nltk: the natural language toolkit</article-title>
          .
          <source>arXiv preprint cs/0205028</source>
          (
          <year>2002</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Maaten</surname>
          </string-name>
          , L.v.d.,
          <string-name>
            <surname>Hinton</surname>
          </string-name>
          , G.:
          <article-title>Visualizing data using t-sne</article-title>
          .
          <source>Journal of machine learning research 9(Nov)</source>
          ,
          <volume>2579</volume>
          {
          <fpage>2605</fpage>
          (
          <year>2008</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <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="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Nockleby</surname>
          </string-name>
          , J.T.:
          <article-title>Hate speech</article-title>
          .
          <source>Encyclopedia of the American constitution 3</source>
          , 1277{
          <fpage>1279</fpage>
          (
          <year>2000</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Pedregosa</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Varoquaux</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gramfort</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Michel</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Thirion</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Grisel</surname>
            ,
            <given-names>O.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Blondel</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Prettenhofer</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Weiss</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dubourg</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Vanderplas</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Passos</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Cournapeau</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Brucher</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Perrot</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Duchesnay</surname>
          </string-name>
          , E.:
          <article-title>Scikit-learn: Machine learning in Python</article-title>
          .
          <source>Journal of Machine Learning Research</source>
          <volume>12</volume>
          ,
          <volume>2825</volume>
          {
          <fpage>2830</fpage>
          (
          <year>2011</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Rehurek</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sojka</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          :
          <article-title>Software Framework for Topic Modelling with Large Corpora</article-title>
          .
          <source>In: Proceedings of the LREC 2010 Workshop on New Challenges for NLP Frameworks</source>
          . pp.
          <volume>45</volume>
          {
          <fpage>50</fpage>
          . ELRA, Valletta, Malta (May
          <year>2010</year>
          ), http://is.muni.cz/ publication/884893/en
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>