<!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>Tweets language identification using feature weighting</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Juglar Díaz Zamora</string-name>
          <email>juglar.diaz@cerpamid.co.cu</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Adrian Fonseca Bruzón Reynier Ortega Bueno CERPAMID Santiago de Cuba</institution>
          ,
          <country country="CU">Cuba</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Universidad de Oriente Santiago de Cuba</institution>
          ,
          <country country="CU">Cuba</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>This paper describes the language identification method presented in Twitter Language Identification Workshop (TweetLID-2014). The proposed method represents tweets by weighted character-level trigrams. We employed three different weighting schemes used in Text Categorization to obtain a numerical value that represents the relation between trigrams and languages. For each language, we add up the importance of each trigram. Afterward, tweet language is determined by simple majority voting. Finally, we analyze the results.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>With the growing interest in social networks
like Twitter and Facebook, the research
community has focused on applying data
mining techniques to such sources of
information. One of these sources are the
messages produced in the social network
Twitter, known as tweets. Tweets represent a
challenge to traditional Text Mining techniques
mainly due to two characteristics, the length of
the texts (only 140 characters allowed) and the
Internet Slang present in these texts. Because of
the limitations of 140 characters, people create
their own informal linguistic style by
shortening words and using acronyms.</p>
      <p>Language identification (LID) is the task of
identifying the language in which a text is
written. This is an important pre-processing
step necessary for traditional Text Mining
techniques; also, Natural Language Processing
tasks like machine translation, part of speech
tagging and parsing are language dependent.</p>
      <p>
        Some work has been done for LID in long
and well-formed texts; traditional approaches
are focused on words and n-grams (of
characters). In word-based features, we can find
short word-based and frequency-based
approaches.
        <xref ref-type="bibr" rid="ref5">(Grefenstette, 1995)</xref>
        proposed a
short word-based approach where he uses
words up to five characters that occurred at least
three times. The idea behind this approach is
the language specific significance of common
words like conjunctions having mostly only
marginal lengths. In frequency based approach,
        <xref ref-type="bibr" rid="ref11">(Souter et al., 1994)</xref>
        takes into account one
hundred high frequent words per language
extracted from training data for 9 languages and
91% of all documents were correctly identified.
      </p>
      <p>
        The n-gram based approach uses n-grams of
different
        <xref ref-type="bibr" rid="ref3">(Cavnar and Trenkle, 1994)</xref>
        or fixed
        <xref ref-type="bibr" rid="ref5 ref9">(Grefenstette, 1995; Prager, 1999)</xref>
        lengths from
tokenized words.
      </p>
      <p>
        <xref ref-type="bibr" rid="ref3">(Cavnar and Trenkle, 1994)</xref>
        evaluate their
algorithm on a corpus of 3713 documents in 14
languages, for language models of more than
300 n-grams very good results of 99.8% were
achieved.
      </p>
      <p>
        The n-gram technique described by
        <xref ref-type="bibr" rid="ref5">(Grefenstette, 1995)</xref>
        calculates the frequency of
trigrams in a language sample, the probability
of a trigram for a language is approximated by
summing the frequency of all trigrams for the
language and dividing the trigram frequency by
the sum of all frequencies in the language. The
probabilities are then used to guess the
language by dividing the test into trigrams and
calculating the probability of the sequence of
trigrams for each language, assigning a minimal
probability to trigrams without assigned
probabilities. The language with the highest
probability for the sequence of trigrams is
chosen.
      </p>
      <p>
        We consider that for LID to be effective, the
inflected forms of a root word should being
related to the same word, and knowing that the
character-level n-grams of different
morphological variations of a word tend to
produce many of the same n-grams, we
chose to use character-level n-grams as features
in our approach. Since trigrams have proven
good results in LID
        <xref ref-type="bibr" rid="ref5 ref9">(Grefenstette, 1995; Prager,
1999)</xref>
        , this is our n-grams selection.
      </p>
      <p>
        Some studies have shown that system
designed for other types of texts perform well
on tweet language identification (TLID) (Lui
and Baldwin, 2012), but some systems which
were specifically designed for the
characteristics of tweets performed
better.
        <xref ref-type="bibr" rid="ref2">(Carter et al., 2013)</xref>
        .
      </p>
      <p>
        There is also a body of work in TLID
employing different techniques, for example
graph representation of languages based in
trigrams
        <xref ref-type="bibr" rid="ref13">(Trompand and Pechenizkiy, 2011)</xref>
        ,
combination of systems
        <xref ref-type="bibr" rid="ref2">(Carter et al., 2013)</xref>
        ,
user language profile, links and hashtags
        <xref ref-type="bibr" rid="ref2">(Carter et al., 2013)</xref>
        .
      </p>
      <p>We propose a language identification system
based on feature weighting schemes (FWS),
commonly used in Text Categorization (TC).
We obtain a numerical value that represents the
relation between features, trigrams of characters
in our case, and languages. This proposal can be
extended to words and longer or shorter
ngrams.</p>
      <p>The remainder of the paper is structured as
follows. In Section 2, we describe our tweet
language identification system
(CerpamidTLID2014) and the feature weighting schemes
tested. In Section 3, we present experiments
conducted for estimating the parameters of our
system and we analyze the effect of feature
weighting schemes in tweets language
identification. Finally, conclusions and
attractive directions for future work are
exposed.
2</p>
    </sec>
    <sec id="sec-2">
      <title>System description</title>
      <p>In this section, we describe our system and the
feature weighting schemes that we used in our
experiments.
2.1</p>
      <sec id="sec-2-1">
        <title>Feature weighting</title>
        <p>
          Dimensionality reduction (DR) is an important
step in Text Categorization. It can be defined as
the task of reducing the dimensionality of the
traditional vector space representation for
documents; these are two main approaches to
this task
          <xref ref-type="bibr" rid="ref10">(Sebastiani, 2002)</xref>
          :
•Dimensionality reduction by feature selection
(John, Kohavi and Pfleger, 1999): the chosen
features r’ are a subset of the original r
features (e.g. words, phrases, stems, lemmas).
•Dimensionality reduction by feature
extraction: chosen features are not a subset of
the original r features, but are obtained by
combinations or transformations of the
original ones.
        </p>
        <p>There are two distinct ways of viewing DR,
depending on whether the task is performed
locally (i.e., for each individual category) or
globally.</p>
        <p>We focus on local feature selection schemes,
since our interest is to obtain the importance of
every trigram (features) for every language
(categories).</p>
        <p>
          Many locally feature selection techniques
have been tried. We show in Table 1 those used
in this paper, GSS Coefficient (GSS)
          <xref ref-type="bibr" rid="ref4">(Galavotti, Sebastiani, and Simi, 2000)</xref>
          , NGL
Coefficient (NGL)
          <xref ref-type="bibr" rid="ref8">(Ng, Goh, and Low, 1997)</xref>
          and Mutual Information (MI)
          <xref ref-type="bibr" rid="ref1">(Battiti, 1994)</xref>
          .
        </p>
        <p>FWS
MI
NGL
GSS</p>
        <p>Mathematical form
log</p>
        <p>(  ,   )
 (  ) ∗  (  )
√ ∗ [ (  ,   ) ∗  ( ̅ , ̅ ) −  (  , ̅ ) ∗  ( ̅ ,   )]
√ (  ) ∗  (  ) ∗  ( ̅ ) ∗  (̅̅ )
 (  ,   ) ∗  ( ̅ , ̅ ) −  (  , ̅ ) ∗  ( ̅ ,   )</p>
        <p>
          In our case, in order to make the feature
weighting schemes depending of the available
amount of text of each language, and not of the
number of documents. The probabilities in
Table 1 are interpreted on an event space of
features
          <xref ref-type="bibr" rid="ref10">(Sebastiani, 2002)</xref>
          (e.g.,  ( ̅ ,   )
denotes the join probability that the trigram tk
does not occur in the language ci, computed as
rate between the number of trigram in ci
different to tk and the total number of trigrams
in corpus N).
        </p>
        <p>For each language, we keep the most
important trigrams and discard the rest.
Our system is a three-step procedure; first,
trigrams are extracted from the tweet, then a
filtering phase takes place, in this phase those
tweets that do not belong to the set of languages
that our system identify are labeled as other.
Finally, a language is assigned for the tweet.
We present these steps in Algorithm 1.</p>
        <p>Algorithm 1. Cerpamid-TLID2014
Considert the tweet to identify the language, c the
content of t and Lj the list of weighted trigrams
for language j.</p>
        <p>Step 1: Split c in trigrams
a) Split c in words.
b) Remove numbers, punctuation marks and
make all the text lowercase.
c) Add underscore in the beginning and the
ending of every word.
d) Obtain the list lt of trigrams that represent
t.</p>
        <p>Step 2: Filtering
a) Let trigrams_c be the number of trigrams
in lt and trigrams_in the number of
trigrams in lt that appear in any Lj.</p>
        <p>trigrams _ in
and θ a threshold of
b) Let n </p>
        <p>trigrams _ c
known trigrams in c.
c) If n &gt; θ go to step 3, else set language as
other.</p>
      </sec>
      <sec id="sec-2-2">
        <title>Step 3: Selecting Language</title>
        <p>a) For each language Lj:
i) vote(Lj )   weightti , Lj 
ti lt
b) Label t with the most voted language.</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>Experiments</title>
      <p>In this section we explain the estimation of
threshold θ (see section 2.1, Algorithm 1, Step
2), the experiments over the feature weighting
schemes and results of our proposal in
TweetLID-2014. In order to evaluate the feature
weighting schemes and to estimate the
threshold of filtering θ, the corpus provided by
the organizers of TweetLID-2014 was divided
into training, test and development sets. The
training set is the 70% of the tweets not labeled
as language undefined or other. The remaining
30% was divided again in 70% and 30%.This
30% is our development set, this last 70% and
the tweets labeled undefined or other form the
test set.</p>
      <p>
        In TweetLID-2014 the organizers proposed
two modalities; constrained, where the training
only can be performed over the training set
provided at TweetLID-2014 and free training
(unconstrained) where is possible to use any
other resource. For the free training mode, we
decided increase the amount of text per
language provided at TweetLID-2014 in order
to provide our proposal with greater ability to
differentiate one language from another. For
English (161 mb), Portuguese (174mb) and
Spanish (174 mb) we used texts from the
Europarl corpus
        <xref ref-type="bibr" rid="ref7">(Koehn, 2005)</xref>
        , and for Catalan
(650 mb), Basque (181 mb) and Galician (157
mb), articles from Wikipedia. The training
corpus for our experiments in the free training
mode is the 70% of the tweets not labeled as
language undefined or other added to the
documents from Europarl and Wikipedia.
3.1
      </p>
      <sec id="sec-3-1">
        <title>Estimation of threshold θ</title>
        <p>For estimating θ, first we obtain the list of
trigrams weighted from the training set, even
when the weights are not used in this stage.
Later we obtain a list L of the values n (see
section 2.1, Algorithm 1, Step 2) for all the
tweets in the development set. Then, we repeat
10000 times a sampling with replacement over
L, in every one of these iterations we select the
lowest value different from zero. These values
are averaged and that is our threshold θ. The
idea is to estimate statistically the value of n for
a tweet written in one of the languages that we
identify. The value obtained in our experiment
was 0.9, and this was used for all runs.</p>
      </sec>
      <sec id="sec-3-2">
        <title>3.2 Selecting the best feature weighting scheme</title>
        <p>In Table 2 we show the results obtained with
each feature weighting scheme in our test sets,
in the two modalities, constrained and
unconstrained. The best FWS in both modes
was MI, while for every FWS the constrained
version obtained better results for LID.</p>
        <p>In order to make a deeper analysis of our
system, we show in Table 3 the precision and
the numbers of assignations to every language
for our best combinations of feature weighting
scheme and task mode (MI in Constrained
Mode).</p>
        <p>FWS
MI
MI
NGL
NGL
GSS
GSS
For our participation at TLID-2014 we used the
full corpus provided by the organizers and, in
addition, the documents extracted from
Europarl and Wikipedia for the free training
mode. In Table 4 and Table 5 we show our
results at TweetLID-2014. As can be seen we
placed 8th between 12 about runs and 5th
between 7 about groups in the constrained
mode (Table 4). Our results in precision at
TweetLID-2014 are similar to the results in
precision that we obtained with our own test
set, while the F1 measure was dropped for the
lows values in recall. About the unconstrained
version, we placed last with our two runs;
almost all team did worst in this mode.
We presented a tweet language identification
system based on trigrams of characters and
feature weighting schemes used for Text
Categorization. One of our run placed 8th
between 12 in the constrained version at
TLID2014 whilst in the free training version we
placed last. Most of the system performed
better in the constrained version. We found as
the main weakness of our proposal the
identification of tweets labeled other. As future
work; we consider exploring other features, test
others feature weighting schemes and tackle the
problem of the identification of tweets labeled
as other with the inclusion of lists of common
terms used in tweets in the step of filtering.</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          <string-name>
            <surname>Battiti</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          <year>1994</year>
          .
          <article-title>Using mutual information for selecting features in supervised neural net learning</article-title>
          .
          <source>Neural Networks</source>
          ,
          <volume>5</volume>
          (
          <issue>4</issue>
          ):
          <fpage>537</fpage>
          -
          <lpage>550</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          <string-name>
            <surname>Carter</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>W.</given-names>
            <surname>Weerkamp</surname>
          </string-name>
          , and MTsagkias.
          <year>2013</year>
          .
          <article-title>Microblog language identification: Overcoming the limitations of short, unedited and idiomatic text</article-title>
          .
          <source>Language Resources and Evaluation</source>
          , pages
          <fpage>1</fpage>
          -
          <lpage>21</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          <string-name>
            <surname>Cavnar</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Trenkle</surname>
          </string-name>
          .
          <year>1994</year>
          .
          <article-title>N-gram-based text categorization</article-title>
          .
          <source>In Proceedings of the Third Symposium on Document Analysis and Information Retrieval</source>
          , Las Vegas, USA.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          <string-name>
            <surname>Galavotti</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Sebastiani</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Simi</surname>
          </string-name>
          .
          <year>2000</year>
          .
          <article-title>Experiments on the use of feature selection and negative evidence in automated text categorization</article-title>
          .
          <source>In Proceedings of ECDL-00, 4th European Conference on Research and Advanced Technology for Digital Libraries</source>
          (Lisbon, Portugal,
          <year>2000</year>
          ),
          <fpage>59</fpage>
          -
          <lpage>68</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          <string-name>
            <surname>Grefenstette</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          <year>1995</year>
          .
          <article-title>Comparing two language identification schemes</article-title>
          .
          <source>In 3rd International conference On Statistical Analysis of Textual Data.</source>
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          <string-name>
            <surname>John</surname>
            ,
            <given-names>G. H.</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Kohavi</surname>
          </string-name>
          , and
          <string-name>
            <given-names>K.</given-names>
            <surname>Pfleger</surname>
          </string-name>
          ,
          <year>1994</year>
          .
          <article-title>Irrelevant features and the subset selection problem</article-title>
          .
          <source>In Proceedings of ICML-94, 11th International Conference on Machine Learning</source>
          (New Brunswick, NJ,
          <year>1994</year>
          ),
          <fpage>121</fpage>
          -
          <lpage>129</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          <string-name>
            <surname>Koehn</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <year>2005</year>
          .
          <article-title>Europarl: A Parallel Corpus for Statistical Machine Translation</article-title>
          . In: MT Summit.
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          <string-name>
            <surname>Ng</surname>
          </string-name>
          , H.T., W.B.
          <string-name>
            <surname>Goh</surname>
            , and
            <given-names>K. L.</given-names>
          </string-name>
          <string-name>
            <surname>Low</surname>
          </string-name>
          .
          <year>1997</year>
          .
          <article-title>Feature selection, perceptron learning, and a usability case study for text categorization</article-title>
          .
          <source>In Proceedings of SIGIR-97, 20th ACM International Conference on Research and Development in Information Retrieval</source>
          (Philadelphia, PA,
          <year>1997</year>
          ),
          <fpage>67</fpage>
          -
          <lpage>73</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          <string-name>
            <surname>Prager</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          <year>1999</year>
          .
          <article-title>Linguini: Language identification for multilingual documents</article-title>
          .
          <source>In Proceedings of the 32nd Hawaii International Conference on System Sciences.</source>
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          <string-name>
            <surname>Sebastiani</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          <year>2002</year>
          .
          <article-title>Machine learning in automated text categorization</article-title>
          .
          <source>ACM computing surveys (CSUR)</source>
          ,
          <volume>34</volume>
          (
          <issue>1</issue>
          ),
          <fpage>1</fpage>
          -
          <lpage>47</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          <string-name>
            <surname>Souter</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          <string-name>
            <surname>Churcher</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          <string-name>
            <surname>Hayes</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          <string-name>
            <surname>Hughes</surname>
            , and
            <given-names>S.</given-names>
          </string-name>
          <string-name>
            <surname>Johnson</surname>
          </string-name>
          .
          <year>1994</year>
          .
          <article-title>Natural language identification using corpus-based models</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          <source>Hermes Journal of Linguistics</source>
          ,
          <volume>13</volume>
          :
          <fpage>183</fpage>
          -
          <lpage>203</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          <string-name>
            <surname>Tromp</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          and
          <string-name>
            <given-names>M.</given-names>
            <surname>Pechenizkiy</surname>
          </string-name>
          .
          <year>2011</year>
          .
          <article-title>Graphbased n-gram language identification on short texts</article-title>
          .
          <source>In Proceedings of Benelearn</source>
          <year>2011</year>
          , pages
          <fpage>27</fpage>
          -
          <lpage>35</lpage>
          , The Hague, Netherlands.
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          <string-name>
            <surname>Vatanen</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>J. Vayrynen.</surname>
          </string-name>
          , and
          <string-name>
            <given-names>S.</given-names>
            <surname>Virpioja</surname>
          </string-name>
          .
          <year>2010</year>
          .
          <article-title>Language identification of short text segments with n-gram models</article-title>
          .
          <source>In LREC 2010</source>
          , pages
          <fpage>3423</fpage>
          -
          <lpage>3430</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>