<!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>Profiling Hate Speech Spreaders using Characters and Words N-grams</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Daniel Yacob Espinosa</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Grigori Sidorov</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Instituto Politécnico Nacional, Centro de Investigación en Computación</institution>
          ,
          <addr-line>Mexico City</addr-line>
          ,
          <country country="MX">Mexico</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2021</year>
      </pub-date>
      <abstract>
        <p>With the increase interactions in social networks, it is important to take care of the health of information and relationships between the users.One of the big problems today are hate speech within them, this type of comments as well as the users who share them can be very dangerous for the integrity of society. In this occasion we show a solution based on N-grams of characters and words for the task of "Profiling Hate Speech Spreaders on Twitter", as classifier we use SVM Support Vector Machines (libSVM) for English and Spanish corpus.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        Today the use of social networks are useful for many things, from connections between friends
to online classes, according to reports from Twitter [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] in this period of pandemic there was an
increase in its audience of 30% worldwide . Due to the importance of health and communication
within social networks, Facebook has improved its detection by 59 % its hate detection algorithm
as of 2020. Where there are no large amounts of data to train the algorithm [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. Despite the fact
that these algorithms are relatively advanced, human verifiers are still needed for their correct
classification.
      </p>
      <p>
        Unfortunately, there are various investigations that mention how social networks are particularly
efective for sharing feelings of hatred, creating "hate chambers" where users express themselves
freely where they can go very far to the point of having incitements to annoy someone or carry
out crimes [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. This research shows how to create a community that supports political parties
with anti-refugee and anti-immigration ideas in Facebook Germany without any kind of rules of
conduct. The research indicates that many members of the community show extreme right-wing
behaviors which are related to municipalities where attacks on the refugee community are
registered.
      </p>
      <p>
        Although this problem is not new, it has reached levels which can threaten the life of any
person. Massimo’s research shows a combination of the use of bots with hate speech in social
networks showing how these feelings are easier to share via social networks [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. Although bots
are not real users, they can be programmed to share hate speech creating problems in human
user communities.
      </p>
      <p>
        Due to these inconveniences, this year PAN [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] shared a corpus for the task called "Profiling
Hate Speech Spreaders on Twitter" where we must obtain the best precision of an algorithm that
performs said classification. This time we decided to do a combination of word and character
N-grams to perform the classification, this task there are two languages to classify: English and
Spanish.
      </p>
    </sec>
    <sec id="sec-2">
      <title>2. Corpus</title>
      <p>
        The corpus provided by PAN consists of a set of Tweets which are messages published on the
social network Twitter. In these messages, photos, videos or GIFs can be attached, and they can
also be responded to by other users by creating a reply tweet[
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
      </p>
      <p>
        The training corpus for this task are: 400 files[
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], where 200 are in English and 200 are in
Spanish, show Table 1. All these files are tweets extracted from diferent Twitter users in xml
format. Each file is from a specific user and contains 200 tweets where links, user mentions
and hashtags were previously tagged. The emoticons remain in the texts; These tweets are 140
characters long.
      </p>
    </sec>
    <sec id="sec-3">
      <title>3. Methodology</title>
      <sec id="sec-3-1">
        <title>3.1. Pre-processing steps</title>
        <p>For the data preprocessing layer we carry out the following steps:
Digits For the digits we decided to remove it since for the extraction of characteristics we do
not see them useful.</p>
        <p>Emoticons In the emoticons, we assigned a specific label for each diferent emotion and
these were added to the bag of words.</p>
        <p>Punctuation marks For punctuation marks due to the bag of words we use, we decided
to have them removed.</p>
        <p>Other symbols For the symbols that are not within the reference Standard ASCII (American
Standard Code for Information Interchange) they were not considered important to be taken as</p>
        <p>Spanish English
2 Char-Ngrams 2 Char-Ngrams
3 Char-Ngrams 3 Char-Ngrams
5 Char-Ngrams 5 Char-Ngrams
1 Words-Ngrams 1 Words-Ngrams
2 Words-Ngrams 3 Words-Ngrams
characteristics and therefore were removed.</p>
      </sec>
      <sec id="sec-3-2">
        <title>3.2. Features</title>
        <p>To solve this task, a structure of N-grams shown in Table 2 were selected. These N-grams are
character and word N-grams and were selected in this way for their precision obtained by
testing the training set.</p>
        <p>It is important to say that the data sets for each language should not be mixed, so that these
procedures are similar for each language but with diferent N-gram structures.</p>
        <p>
          Let us remember that each file corresponds to the tweets of a specific user, then the structures
of Table 2 were applied for each file, after these N-grams are selected, now we must model these
structures in frequency matrices [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ], to That is why we will use a bag of words [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ] where we
will put all the N-grams, after this we will count the frequency of repetition of these structures
for each user. In this way we create a matrix with the occurrences of the N-grams within the
bag of words. Now this model is replicated for each of the files in the corpus, this is better
known as the Term-Document Matrix [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ].
        </p>
        <p>After having all those matrices, we create a matrix with N dimensions, where each new
dimension is is a user, these new matrices that are added to the N-dimensional matrix must be
organized and place their columns in relation to the N-grams of the previous one, if there is no
column because that N-gram did not come out of the bag of words is given a 0.</p>
        <p>
          When we complete the entire matrix of all the files for each language, we proceed to remove
the columns with 2 or less repetitions, we do this because they are minimum values, which
we can save processes when we use a classifier. We will call this matrix, already organized the
Vector Space Model [
          <xref ref-type="bibr" rid="ref7">7</xref>
          ].
        </p>
      </sec>
      <sec id="sec-3-3">
        <title>3.3. Vector Space Model for Texts</title>
        <p>
          The Vector space model helps us to find a hyperplane [
          <xref ref-type="bibr" rid="ref6">6</xref>
          ] which to try to separate or look for a
similarity between dimensions, we call this training since we intend to create a classification
learning model. As a classifier we decided to use SVM since with this model it gave us the best
performance to perform this classification, we can see the results in Table 3.
        </p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Experiments</title>
      <p>
        One of the main reasons we decided to use N-gram structures was that we had previously
worked with tweets; In previous works we participated in PAN 2019 [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] and PAN 2020 [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ].
These results are shown in the CLEF congresses which are held every year and show community
evaluation experiments with diferent laboratories and discussions around the world [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ].
      </p>
      <p>
        For 2019 we participate with the work with the name "Bots and Gender Profiling using
Character Bigrams" [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] and for 2020 with the work called "Profiling Fake News Spreaders
using Characters and Words N-grams" [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]. With the implementations carried out, we obtained
an accuracy greater than 80% in both investigations.
      </p>
      <p>
        To arrive at the solution of the use of the SVM as a classifier, we carried out several experiments
to obtain the best result in precision. One of our implementations in this research was to use a
neural network where the precision obtained was 64% for the corpus in English and 67% for
the language in Spanish. An important characteristic in this type of tasks organized by PAN
uses a TIRA platform [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] that serves to run your programs and these can be evaluated by the
committee, so that the virtual computers that share you do not have many resources to perform
large data handling or simultaneous processing, so you need to perform code optimizations so
that you do not lack resources to run your algorithms.
      </p>
    </sec>
    <sec id="sec-5">
      <title>5. Conclusions</title>
      <p>It is important to find a solution to these problems since they are experiments with real data
from the corpus and that can have a direct impact on society, we consider that currently these
types of problems can be better solved by applying sentiment analysis with deep networks,
since they have shown to work with better precision performed in this research. One problem
with this type of implementation is that we need large amounts of data to train the model,
although there is still the possibility of errors with the use of sarcasm or ironic teasing on social
media.</p>
      <p>We previously used hashtags as a new feature that helps improve accuracy, so we believe
these methods would improve performance by adding hashtags as well as considering add the
280 character length that Twitter currently allows for a tweet. Even with this, we believe that it
is an excellent task to solve because it represents a current problem and it is a challenge to train
a model with so little data.</p>
      <p>In the future we would like this type of methodologies and technologies to be implemented
directly in the most used social networks since these types of problems are really a social danger
that can be classified as terrorist weapons for a nation.
Information Retrieval Series, Springer, Berlin Heidelberg New York, 2019.
doi:10.1007/978-3-030-22948-1\_5.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>J.</given-names>
            <surname>Vives</surname>
          </string-name>
          , El coronavirus dispara el número de usuarios de Twitter, https://www.lavanguardia.com/tecnologia/20200324/4882705311/ coronavirus-dispara
          <article-title>-numero-usuarios-twitter</article-title>
          .html,
          <year>2020</year>
          . [Online].
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <surname>Time</surname>
          </string-name>
          ,
          <article-title>Facebook Says It's Removing More Hate Speech Than Ever Before</article-title>
          .
          <source>But There's a Catch</source>
          , https://time.com/5739688/facebook-hate
          <string-name>
            <surname>-</surname>
          </string-name>
          speech-languages/,
          <year>2019</year>
          . [Online].
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>K.</given-names>
            <surname>Müller</surname>
          </string-name>
          ,
          <string-name>
            <surname>C.</surname>
          </string-name>
          <article-title>Schwarz, Fanning the flames of hate: Social media and hate crime</article-title>
          ,
          <source>SSRN Electronic Journal</source>
          (
          <year>2017</year>
          ). doi:
          <volume>10</volume>
          .2139/ssrn.3082972.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>R.</given-names>
            <surname>Francisco</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L. D. L. P. S.</given-names>
            <surname>Gretel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>BERTa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Elisabetta</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Paolo</surname>
          </string-name>
          ,
          <source>Profiling Hate Speech Spreaders on Twitter Task at PAN</source>
          <year>2021</year>
          , in: A.
          <string-name>
            <surname>J. M. M. F. P. Guglielmo</surname>
            <given-names>Faggioli</given-names>
          </string-name>
          , Nicola Ferro (Ed.),
          <article-title>CLEF 2021 Labs and Workshops, Notebook Papers, CEUR-WS</article-title>
          .org,
          <year>2021</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <surname>M. D. D. Massimo</surname>
            <given-names>Stella</given-names>
          </string-name>
          , Emilio Ferrarab,
          <article-title>Bots increase exposure to negative and inflammatory content in online social systems</article-title>
          ,
          <source>PNSA</source>
          <volume>115</volume>
          (
          <year>2018</year>
          )
          <fpage>12435</fpage>
          -
          <lpage>12440</lpage>
          . URL: https://www.pnas.org/content/115/49/12435.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>G.</given-names>
            <surname>Sidorov</surname>
          </string-name>
          ,
          <article-title>Syntactic n-grams in Computational Linguistics</article-title>
          , SpringerBriefs in Computer Science, Springer,
          <year>2019</year>
          . doi:https://doi.org/10.1007/978-3-
          <fpage>030</fpage>
          -14771-6.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>G.</given-names>
            <surname>Sidorov</surname>
          </string-name>
          ,
          <article-title>Formalization in computational linguistics, in: Syntactic n-grams in Computational Linguistics</article-title>
          , SpringerBriefs in Computer Science, Springer,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>F.</given-names>
            <surname>Rangel</surname>
          </string-name>
          , P. Rosso,
          <article-title>CLEF 2019 Labs and Workshops, Notebook Papers</article-title>
          , in: C. L.,
          <string-name>
            <given-names>F. N.</given-names>
            ,
            <surname>M. H</surname>
          </string-name>
          , L. D. (Eds.),
          <source>Overview of the 7th Author Profiling Task at PAN</source>
          <year>2019</year>
          :
          <article-title>Bots and Gender Profiling</article-title>
          ,
          <source>CEUR Workshop Proceedings</source>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>F.</given-names>
            <surname>Rangel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Giachanou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Ghanem</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Rosso</surname>
          </string-name>
          ,
          <article-title>Overview of the 8th author profiling task at pan 2020: Profiling fake news spreaders on twitter</article-title>
          ,
          <source>in: CLEF</source>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>J.</given-names>
            <surname>Bevendorf</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Chulvi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G. L. D. L. P.</given-names>
            <surname>Sarracén</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Kestemont</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Manjavacas</surname>
          </string-name>
          , I. Markov,
          <string-name>
            <given-names>M.</given-names>
            <surname>Mayerl</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Potthast</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Rangel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Rosso</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Stamatatos</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Stein</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Wiegmann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Wolska</surname>
          </string-name>
          , , E. Zangerle, Overview of PAN 2021:
          <article-title>Authorship Verification,Profiling Hate Speech Spreaders on Twitter,and Style Change Detection</article-title>
          ,
          <source>in: 12th International Conference of the CLEF Association (CLEF</source>
          <year>2021</year>
          ), Springer,
          <year>2021</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>D.</given-names>
            <surname>Espinosa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Gómez-Adorno</surname>
          </string-name>
          ,
          <string-name>
            <surname>G.</surname>
          </string-name>
          <article-title>Sidorov, Bots and Gender Profiling using Character Bigrams</article-title>
          , in: L.
          <string-name>
            <surname>Cappellato</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          <string-name>
            <surname>Ferro</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          <string-name>
            <surname>Losada</surname>
          </string-name>
          , H. Müller (Eds.),
          <article-title>CLEF 2019 Labs and Workshops, Notebook Papers, CEUR-WS</article-title>
          .org,
          <year>2019</year>
          . URL: http://ceur-ws.
          <source>org/</source>
          Vol-
          <volume>2380</volume>
          /.
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>D.</given-names>
            <surname>Espinosa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Gómez-Adorno</surname>
          </string-name>
          ,
          <string-name>
            <surname>G.</surname>
          </string-name>
          <article-title>Sidorov, Profiling Fake News Spreaders using Characters and Words N-grams-Notebook for PAN at CLEF 2020</article-title>
          , in: L.
          <string-name>
            <surname>Cappellato</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          <string-name>
            <surname>Eickhof</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          <string-name>
            <surname>Ferro</surname>
            ,
            <given-names>A</given-names>
          </string-name>
          . Névéol (Eds.),
          <article-title>CLEF 2020 Labs and Workshops, Notebook Papers, CEUR-WS</article-title>
          .org,
          <year>2020</year>
          . URL: http://ceur-ws.
          <source>org/</source>
          Vol-
          <volume>2696</volume>
          /.
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>M.</given-names>
            <surname>Potthast</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            <surname>Gollub</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Wiegmann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Stein</surname>
          </string-name>
          , TIRA Integrated Research Architecture, in: N.
          <string-name>
            <surname>Ferro</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          Peters (Eds.),
          <source>Information Retrieval Evaluation in a Changing World</source>
          , The
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>