<!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>Twitter Language Identi cation using Rational Kernels and its potential application to Sociolinguistics</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Jordi Porta</string-name>
          <email>porta@rae.es</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Departamento de Tecnolog a y Sistemas Centro de Estudios de la Real Academia Espan~ola c/ Serrano 187-189.</institution>
          <addr-line>Madrid 28002</addr-line>
        </aff>
      </contrib-group>
      <abstract>
        <p>This paper describes the techniques used by the system presented at the TweetLID shared task for Twitter language identi cation. The system is based on Support Vector Machines and Rational Kernels. An algorithm for multilanguage labeling is described. Its evaluation and application to Sociolinguistics is also included.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        The TweetLID shared task1 consists in
identifying the language or languages in which
tweets are written, focusing on events and
news generated within the Iberian Peninsula
        <xref ref-type="bibr" rid="ref6">(San Vicente et al., 2014)</xref>
        . However,
despite language identi cation (LI) has reached
a great success in discriminating between
distant languages, ne-grained identi cation is
still a challenge for language technologies and
there remain two major bottlenecks
according to
        <xref ref-type="bibr" rid="ref9">Zampieri (2013)</xref>
        : the discrimination
between similar languages, varieties and
dialects; and multilingualism, code-switching
and moreover, noisy or non-standard features
in texts. The rst problem was addressed
by the author with maximum entropy models
at word level
        <xref ref-type="bibr" rid="ref11 ref4 ref5">(Porta and Sancho, 2014)</xref>
        and
others in the DSL shared task
        <xref ref-type="bibr" rid="ref10">(Zampieri et
al., 2014)</xref>
        . Multilingualism was addressed by
Lui, Jey Han Lau, and Baldwin (2014) using
probabilistic mixture models and the identi
cation of language in short texts by
        <xref ref-type="bibr" rid="ref7">Vatanen,
Vayrynen, and Virpioja (2010</xref>
        ) with n-gram
language models. However, in this paper, to
address the task de ned in TweetLID, related
with the second of the aforementioned
bottlenecks in LI, we will use n-grams of
characters and support vector machines (SVMs)
with rational kernels.
2
      </p>
    </sec>
    <sec id="sec-2">
      <title>System Description</title>
      <p>
        Kernel functions are commonly used to
extend statistical learning methods such as
SVMs to de ne non-linear decision
boundaries. The most widely used kernels are the
linear, polynomial or Gaussian ones which
are applied over vector spaces
        <xref ref-type="bibr" rid="ref1">(Cortes and
Vapnik, 1995)</xref>
        . In the case of natural
language processing (NLP), it is common
practice to represent text sequences into vector
spaces as bags of words or n-grams of words
or characters. However, it is possible to use
string kernels to de ne other similarity
measures between sequences as the number of
common substrings of two sequences,
allowing mismatches, gaps or wildcards, or the
weights assignment to particular substrings
        <xref ref-type="bibr" rid="ref2 ref3">(Lodhi et al., 2002; Leslie, Kuang, and
Bennett, 2004)</xref>
        . Rational kernels are a family of
sequence kernels constructed from weighted
nite state transducers covering all string
kernels commonly used in machine
learning applications in bioinformatics and NLP
(Cortes et al., 2004).
      </p>
      <p>Lang. #Ex.</p>
      <p>ca 1,435
en 1,058
es 7,670
eu 478
gl 696
pt 1,920</p>
      <p>For TweetLID, the problem of labeling
multiple languages has been tackled with
binary classi ers trained with the so-called
one-versus-all technique: learning k binary
classi ers, discriminating one language from
the rest. Di erent variable length n-gram
kernels have been used for each language.
The best parameters for each kernel have
been estimated from the results on the
unambiguous examples in the training dataset
by cross-validation. A preprocessing step is
carried out with a transducer that removes
URLs, hashtags (`#Buzz'), and username
mentions (`@justinbieber'); converts the text
to lower case; splits words and punctuation;
normalizes blanks; and removes reduplicates
(`hoooola' ! `hola'). Other manipulations
like diacritics removal has not found to
improve results. This transducer is
incorporated into the rational kernel in order to be
applied before the n-gram kernel. Classi ers
have been implemented with the
OpenKernel library2 with default parameters.
Accuracy results for each language are shown in
Table 1, where the improvement due to the
adding of the preprocessing step can be
noticed.</p>
      <p>To assign more than one language to
a tweet, the classifying function ck(x) =
sgn(sk(x)), mapping the score of each
example to f 1, +1g, has been replaced with the
2http://www.openkernel.org
underlying scoring function sk, whose values
can be interpreted as con dence scores and
can be used to compare classi ers without
calibration. The algorithm for assigning one
or more languages to a tweet combines the
output of the classi ers with heuristic
criteria in the form of a decision tree as follows:
For each text sample x and each language
k, the scores s1(x), . . . , sk(x) are computed.
There are three situations: (a) there exists
only one sk(x) &gt; 0; (b) there is more than one
sk(x) &gt; 0; and (c), there is no sk(x) &gt; 0. In
(a), language k is assigned to x. Case (b) has
several subcases, depending on the number
of languages with positive scores, the length
in words of x and the di erence in scores, x
is nally labeled either with many languages
or it is assigned the `und(e ned)' label. In
case (c), x is classi ed with the higher scored
language, if its value is over a given
empirically determined threshold, or as `other',
otherwise.
3</p>
    </sec>
    <sec id="sec-3">
      <title>Evaluation</title>
      <p>The distribution of errors of the classi er on
the test dataset is shown in Table 3. At the
level of single language tweets, Galician (gl)
obtains the worst results. As can be seen in
Table 2, most Galician tweets are incorrectly
classi ed as Portuguese (pt) or Spanish (es),
but Portuguese, which is genetically most
related to Galician3, does not su er from this
problem. A shift in classi cation from
underrepresented to overrepresented languages
could be caused by the unbalanced
representation of languages in the training set.
Precision and recall of `other' is rather low when
compared to speci c language gures.</p>
      <p>Due to restrictions on the distribution of
Twitter content, the tweets of the TweetLID
corpus were provided through their IDs.
Unfortunately, a number of tweets of the
reference were not always available to the
participants for di erent reasons, but are taken
into consideration in the o cial nal
evaluation, a ecting negatively recall and F-score
(see Table 3). An alternative evaluation
considering only the tweets in the reference
available to the system is shown in Table 4.
Results on both tables are similar, indicating
that performance estimation is sound.</p>
      <p>The evaluation of the multiple language
labelings has led to the following section.</p>
      <p>3Galician is genetically related to Portuguese but
orthographically related to Spanish.</p>
      <p>Lang.</p>
      <p>ca
en
es
eu
gl
pt
amb
und
Total
Lang.</p>
      <p>ca
en
es
eu
gl
pt
amb
und
Total</p>
      <p>Actual
ca
en
es
eu
gl
pt
other
amb
und
at the inter-sentential, intra-sentential and
even morphological levels. The system
presented in this paper could be applied to CS to
unveil part of the underlying sociolinguistic
structure of communities and, at the same
time, when this structure is known in
advance, it can also be used to evaluate the
predictive power of the method used by the
system. In the case of the Iberian
Peninsula, it is the westernmost southern
European peninsula separated from the rest of
Europe at the north-east edge by the
Pyrenees. In the Iberian Peninsula, the six top
languages found in tweets are Basque,
Catalan, Galician, Spanish, Portuguese and
English. Except for English, which is a global
language, and Basque, which is a language
isolate, the rest of Iberian languages descend
from Vulgar Latin spoken in the Peninsula.</p>
      <p>
        Spain has an o cial language, Castilian (also
known as Spanish) but the central
government has transferred some of its powers to
regional governments, known as autonomous
communities, some of them having co-o cial
languages. Table 5 contains two matrices
with the number of pairs of languages
cooccurring in tweets. Table 5.a is computed
using the manually labeled examples of the
training and test datasets while Table 5.b is
computed from the predictions on the test
dataset. There are four identi able blocks in
those matrices: (1) English (en), which is a
global language, and cooccurs with the rest
of languages; (2) Portuguese (pt), which is
a national language with little contact with
Spanish; (3) Spanish (es) a national
language cooccurring with the Spain's co-o cial
languages: Catalan (ca), Galician (gl) and
Basque (eu); and (4) the block of the
coo cials, which are not seen together in tweets
because they are not languages in contact.
Language contact has been a hot issue in
linguistics since the publication of Languages in
contact
        <xref ref-type="bibr" rid="ref8">(Weinreich, 1953)</xref>
        and represents one
of the most common scenarios for the study
of language variation and change, including
code-switching (CS). In informal
communication, CS is a pervasive phenomenon by
which multilingual speakers switch back and
forth between their languages. CS is present
(a) Labeled examples in TweetLID datasets (b) Predictions on the TweetLID test dataset
      </p>
      <p>
        Conclusions and Future Work
Results from the Evaluation Section suggest
there is still room for potential
improvements. A more balanced representation of
languages or the introduction of a cost
matrix could improve the performance of
underrepresented languages as Galician. The
labeling of tweets in the language category
`other' could improve both precision and
recall of other languages. Finally, it is also left
as future work to combine the output of the
individual classi ers with multilabel learning
methods
        <xref ref-type="bibr" rid="ref11 ref4 ref5">(Zhang and Zhou, 2014)</xref>
        , in order to
improve and replace the heuristic presented
in this paper for multilanguage labeling.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          <string-name>
            <surname>Cortes</surname>
            , Corinna and
            <given-names>Vladimir</given-names>
          </string-name>
          <string-name>
            <surname>Vapnik</surname>
          </string-name>
          .
          <year>1995</year>
          .
          <article-title>Support-vector networks</article-title>
          .
          <source>Machine learning</source>
          ,
          <volume>20</volume>
          (
          <issue>3</issue>
          ):
          <volume>273</volume>
          {
          <fpage>297</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          <string-name>
            <surname>Leslie</surname>
            , Christina,
            <given-names>Rui</given-names>
          </string-name>
          <string-name>
            <surname>Kuang</surname>
            , and
            <given-names>Kristin</given-names>
          </string-name>
          <string-name>
            <surname>Bennett</surname>
          </string-name>
          .
          <year>2004</year>
          .
          <article-title>Fast string kernels using inexact matching for protein sequences</article-title>
          .
          <source>Journal of Machine Learning Research</source>
          ,
          <volume>5</volume>
          :
          <fpage>1435</fpage>
          {
          <fpage>1455</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          <string-name>
            <surname>Lodhi</surname>
            , Huma, Craig Saunders, John ShaweTaylor, Nello Cristianini, and
            <given-names>Chris</given-names>
          </string-name>
          <string-name>
            <surname>Watkins</surname>
          </string-name>
          .
          <year>2002</year>
          .
          <article-title>Text classi cation using string kernels</article-title>
          .
          <source>Journal of Machine Learning Research</source>
          ,
          <volume>2</volume>
          :
          <fpage>419</fpage>
          {
          <fpage>444</fpage>
          ,
          <string-name>
            <surname>March</surname>
          </string-name>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          <string-name>
            <surname>Lui</surname>
            , Marco, Jey Han Lau, and
            <given-names>Timothy</given-names>
          </string-name>
          <string-name>
            <surname>Baldwin</surname>
          </string-name>
          .
          <year>2014</year>
          .
          <article-title>Automatic detection and language identi cation of multilingual documents</article-title>
          .
          <source>Transactions of the Association for Computational Linguistics</source>
          ,
          <volume>2</volume>
          :
          <fpage>27</fpage>
          {
          <fpage>40</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          <string-name>
            <surname>Porta</surname>
          </string-name>
          , Jordi and Jose-Luis Sancho.
          <year>2014</year>
          .
          <article-title>Using maximum entropy models to discriminate between similar languages and varieties</article-title>
          .
          <source>In Proceedings of the 1st Workshop on Applying NLP Tools to Similar Languages, Varieties and Dialects (VarDial14)</source>
          , Dublin, Ireland.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          <string-name>
            <given-names>San</given-names>
            <surname>Vicente</surname>
          </string-name>
          , In~aki, Arkaitz Zubiaga, Pablo Gamallo, Jose Ramon Pichel, In~aki Alegria, Nora Aranberri, Aitzol Ezeiza, and V ctor Fresno.
          <year>2014</year>
          .
          <article-title>Overview of TweetLID: Tweet language identi cation at SEPLN 2014</article-title>
          . In TweetLID @ SEPLN
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          <string-name>
            <surname>Vatanen</surname>
            , Tommi,
            <given-names>Jaakko J.</given-names>
          </string-name>
          <article-title>Vayrynen, and</article-title>
          <string-name>
            <given-names>Sami</given-names>
            <surname>Virpioja</surname>
          </string-name>
          .
          <year>2010</year>
          .
          <article-title>Language identi - cation of short text segments with n-gram models</article-title>
          .
          <source>In Proceedings of the Seventh International Conference on Language Resources and Evaluation (LREC-10)</source>
          .
          <source>European Language Resources Association (ELRA).</source>
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          <string-name>
            <surname>Weinreich</surname>
          </string-name>
          , Uriel.
          <year>1953</year>
          .
          <article-title>Languages in contact. Findings and Problems</article-title>
          . Mouton, Hague and Paris.
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          <string-name>
            <surname>Zampieri</surname>
          </string-name>
          , Marcos.
          <year>2013</year>
          .
          <article-title>Using bag-of-words to distinguish similar languages: How efcient are they</article-title>
          ?
          <source>In Proceedings of the 14th IEEE International Symposium on Computational Intelligence and Informatics (CINTI-13)</source>
          , pages
          <fpage>37</fpage>
          {
          <fpage>41</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          <string-name>
            <surname>Zampieri</surname>
          </string-name>
          , Marcos, Liling Tan,
          <source>Nikola Ljubesic, and Jorg Tiedemann</source>
          .
          <year>2014</year>
          .
          <article-title>A report on the DSL shared task 2014</article-title>
          .
          <source>In Proceedings of the First Workshop on Applying NLP Tools to Similar Languages, Varieties and Dialects</source>
          , pages
          <volume>58</volume>
          {
          <fpage>67</fpage>
          , Dublin, Ireland,
          <year>August</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          <string-name>
            <surname>Zhang</surname>
            , M.-L. and
            <given-names>Z.-H.</given-names>
          </string-name>
          <string-name>
            <surname>Zhou</surname>
          </string-name>
          .
          <year>2014</year>
          .
          <article-title>A review on multi-label learning algorithms</article-title>
          .
          <source>IEEE Transactions on Knowledge and Data Engineering</source>
          ,
          <volume>26</volume>
          (
          <issue>8</issue>
          ):
          <year>1819</year>
          {
          <year>1837</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>