<!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>Seville, Spain, September</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Negation Cues Detection Using CRF on Spanish Product Review Texts</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Henry Loharja</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Llu s Padro</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Jordi Turmo</string-name>
          <email>turmog@cs.upc.edu</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Universitat Politecnica de Catalunya https://</institution>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2018</year>
      </pub-date>
      <volume>18</volume>
      <issue>2018</issue>
      <fpage>49</fpage>
      <lpage>54</lpage>
      <abstract>
        <p>This article describes the negation cue detection approach designed and built by UPC's team participating in NEGES 2018 Workshop on Negation in Spanish. The approach uses supervised CRFs as the base for training the model with several features engineered to tackle the task of negation cue detection in Spanish. The result is evaluated by the means of precision, recall, and F1 score in order to measure the performance of the approach. The approach was ranked in 1st position in the o cial testing results with average precision around 91%, average recall around 82%, and average F1 score around 86%.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        This paper describes the negation cue
detection model approaches presented by UPC's
team for the NEGES 2018 workshop task 2
(negation cues detection)
        <xref ref-type="bibr" rid="ref3 ref4">(Jimenez-Zafra et
al., 2018a)</xref>
        . The aim of the task is to
automatically detect negation cues in product
review texts in Spanish. To do this, the
participants must develop a system able to
identify all the negation cues present in the
documents. The SFU ReviewSP-NEG corpus
        <xref ref-type="bibr" rid="ref3 ref4">(Jimenez-Zafra et al., 2018b)</xref>
        will be used to
train and test the systems. The approach we
develop relies on a supervised learned model
using Conditional Random Fields (written as
CRF in the following contents) as the core
with specially engineered features for the
detection of negation cues in Spanish. The
approach is then implemented in Python and
we use NLTK1 as the toolkit to build the
system. The result is measured using the widely
used performance measurement of precision,
recall, and F1 score.
      </p>
      <p>The article is organized as follows.
Section 2 describes the approach used to learn
the negation cues detection model. Section 3
describes the system built based on the
approach explained in the previous section and
the details of the implementation. The
results achieved by our approach are presented
and brie y analyzed in Section 4. Finally,
Section 5 gives conclusion about the work
that has been done.</p>
      <p>1NLTK { the Natural Language Toolkit (Bird,
Klein, and Loper, 2009)</p>
    </sec>
    <sec id="sec-2">
      <title>Negation Cues Detection</title>
    </sec>
    <sec id="sec-3">
      <title>Approach</title>
      <p>Before describing the approach, let us
begin by addressing some de nitions. A
negative sentence n is de ned as a vector of
words (w1; w2; :::; wn) containing one or more
negation cues, where the latter can be a
word (e.g. no), a morpheme (e.g.in-capaz)
or a multi-word expression (e.g. ya no,
todav a no) which inherently expressing
negation. The goal of negation cue detection is to
predict vector c given the sentence n where
c 2 f1; 0gjnj is a vector of length same with
the length of n so that ci = 1 if wi is part of
the negation cue and ci = 0 otherwise.</p>
      <p>It is possible that more than one negation
cue can appear inside a sentence. In Spanish,
one of the special characteristic of negation
cue is that a cue can consist of more than
one word, not necessarily consecutive. This
special characteristic increases the
complexity of detecting whether two words recognized
as cue are indeed two separated cues or are
actually the same non-contiguous cue. This
also makes negation cue detection in Spanish
a more challenging task compared to
negation cue detection in English because that
case is scarce in English.</p>
      <p>
        The approach we use for this work will
be one of the state of the art approach: a
CRF based negation detection. We try to
reproduce the approach used by previous works
        <xref ref-type="bibr" rid="ref1">(Agarwal and Yu, 2010)</xref>
        which are using CRF
as its base and we use the corpus given by the
task in order to see how the approach perform
with the data provided in Spanish.
Conditional random elds (CRFs) are a type of
discriminative undirected probabilistic
graphical model used for structured prediction
        <xref ref-type="bibr" rid="ref5">(Lafferty, McCallum, and Pereira, 2001)</xref>
        . The
most important feature of a CRF model is
that it can take context into account: the
linear chain CRF predicts sequences of labels
for sequences of input samples. Thus, the
model does not work with local probabilities
like p(ytjxt) where t is the position of x within
the sequence, instead, it estimates the
conditional probability of the whole sequence:
p(yjx) =
      </p>
      <p>1
Z(x)</p>
      <p>K
expfX X j fj (x; yt; yt 1)g</p>
      <p>t j=1</p>
      <p>The estimation of weights ( j ) for each
feature fj is carried out by maximizing the
conditional log likelihood:
max l( ) = max</p>
      <p>N
X p(y(i)jx(i))
i=1
.</p>
      <p>where N is the number of observation
sequences x(i) and label sequences y(i).</p>
      <p>Training CRFs might be time-consuming
for some tasks since the time needed for
training depends quadratically on the number of
class labels and linearly on the number of
training instances and the average sequence
length. However, state-of-the-art solutions
use CRF models for many NLP tasks where
time consumption is still tolerable.</p>
      <p>As discussed before, the goal of
negation cue detection is to obtain vectors which
represent the sentence and give information
whether the token or words which are part
of the sentence is a part of the negation cue
in a value. Using the knowledge of named
entity recognition, we can infer that
negation detection is a type of NER in which we
would like to recognize entities that are parts
of negation. In other words, we would like
to classify whether each words inside a
sentence is part of negation cue or not a part of
it. From this, we de ne a three-class
classication problem for each word which we
observe: Begin-Cue(B-C), Inside-Cue(I-C), or
Out(O). A word classi ed as Out is not part
of a cue. In order to handle cues which
consist of more than one word, we give two kind
of classi cation for the cues which are
BeginCue for the rst words that identify that start
of a cue and Inside-Cue for the rest of the
words of a cue which are not the rst word
but is still identi ed as part of the same cue.
3</p>
    </sec>
    <sec id="sec-4">
      <title>Negation Cues Detection</title>
    </sec>
    <sec id="sec-5">
      <title>System</title>
      <sec id="sec-5-1">
        <title>3.1 Data Preprocessing</title>
        <p>For the preliminary, we do some
preprocessing to the data in the corpus provided in
order to match the input format of the system
we built. The corpus provided by this task is
using CoNLL format. Each line corresponds
to a token or word and each annotation is
provided in a column with empty lines
indicate end of sentence. We produce two set
of data with di erent format with respect to
their usage for each step:
1. Data format
(Ramshaw and
with BIO</p>
        <p>Marcus,</p>
        <p>tagging
1999) in
order to be used as input for training.
The annotated token is tagged with
"BC" if it is in the beginning of negation
cue; tagged with "I-C" if it is part of
the negation cue but not the rst word
of the cue; and tagged with "O" if it is
outside of the cue. One of the examples
of sentence in this format is:</p>
        <p>El|O coche|O funciona|O
estupendamente|O ,|O
es|O muy|O manejable|O
,|O por|O cierto|O ,|O
casi|B-C no|I-C consume|O
gasolina|O algo|O que|O
para|O mi|O es|O muy|O
importante|O .|O
2. Raw data format without any tagging in
order to be used for testing input.</p>
        <p>Las ruedas a los 15000
kms las tuve que
cambiar , todas , las cuatro
, por ser de una marca
coreana , que no da mucho
resultado .</p>
        <p>After the preprocessing is done, the
documents is ready to be used as input for the
next respective steps. This preprocessing
part did not alter any important information
contained in the data as the purpose is only
to change the format in order to make it
easier to be used in the following steps.</p>
      </sec>
      <sec id="sec-5-2">
        <title>3.2 Baseline System</title>
        <p>Before implementing the approach we have
explained before in the system, we developed
a baseline system to be used as starting point
and a comparison. Our aim is to see whether
the approach we have will perform better
than a baseline approach which used simple
techniques. To reach this, we use the
baseline system as comparison with the system
we develop using the approach we propose.
The baseline system we developed uses
simple techniques which are common such as
dictionary lookup combined with some rules for
detecting negation cues.</p>
        <p>The rst thing we did in this baseline was
to create a dictionary based on the training
dataset from the corpus. We collected all the
words which are tagged as negation cues from
all the documents in the training dataset
together with their frequency. After having
sorted the collected negation cues based on
the frequency from the most to the least, we
chose the top 25 words with the most
frequency. These 25 words became the
dictionary of negation cues in our baseline system.
We also developed several rules to capture
the characteristics of negation cues in
Spanish which we have explained before. These
rules are used to decide whether more than
one cues which appear in a sentence is
actually part of a cue or separated cues. The rule
checked whether a word is in a list of
special word which we created and then check
if it ful ll condition of having another cues
that precede it. Here are the algorithm from
baseline system which describe the rule:
if word in DICTIONARY then
if word in SPECIAL then
if exist cue before then</p>
        <p>word is part of cue
end if
else</p>
        <p>word is new cue
end if
end if</p>
        <p>After having implemented the
combination of dictionary lookup and rules we
developed, we then use the baseline system to
tag the documents from development testing
dataset. We use the result as the
preliminary result to be later compared with the
result from the system we developed using
our proposed approach. By doing this, we
could see whether the approach we have can
give more advantage compared to using
simple techniques.</p>
      </sec>
      <sec id="sec-5-3">
        <title>3.3 Learning The Model for</title>
      </sec>
      <sec id="sec-5-4">
        <title>Negation Cue Detection using CRF</title>
        <p>
          The system we built use a toolkit named
NLTK which is a Python based toolkit for
building Python programs to work with
human language data. NLTK provides
easyto-use text processing libraries for classi
cation, tokenization, stemming, tagging,
parsing, and semantic reasoning. One of the
modules in NLTK is an CRF tagger which can
be used for the tagging of text using Python
CRFSuite2 as it's core. This module are what
we mainly used in our approach for
negation detection by adapting a point of view
2Python CRFSuite -Python bindings to CRFSuite
          <xref ref-type="bibr" rid="ref6">(Okazaki, 2007)</xref>
          of named entity recognition. There are two
main parts in the system we built: Training
and testing. Training is the part in which we
use the CRF tagger module in NLTK to train
a model by using the training data which we
have prepared before. The result of the
training part is a model for detecting negation.
The training process will use orthographic
feature set which is designed for negation cue
detection and to capture the characteristics
of negation cue in Spanish. The simplest and
most clear feature set is the vocabulary from
the training data. We also include the
information about part of speech as feature in
order to enrich the feature set. Generalizations
over how the words written (capitalization,
a xes, etc.) are also important information
that are included as features. The present
approach includes training vocabulary,
several orthographic features based on regular
expressions as well as pre xes and su xes in
the character length ranged from two to four.
To model localization context, neighboring
words in the window [-6,1] are also added as
features. This size of window is selected from
several experiment using various window size
to acquire optimum result. We use bigram
in the process of including the information
about localization of six word before and one
word after the word being observed. Here
are the complete set of features used in the
training:
1. WORD: the vocabulary of word.
2. POS: the information of part of speech
of the word.
3. INIT CAP: word starts with
capitalization.
4. ALPHANUM: word consists of
alphanumeric characters.
5. HAS NUM: word contains number.
6. HAS CAP: word contains capitalized
letter.
7. HAS DASH: word contains dash (-).
8. HAS US: word contains underscore ( ).
9. PUNCTUATION: word contains
punctuation.
10. SUFn: su xes in the n character length
ranged from two to four.
11. PREFn: pre xes in the n character
length ranged from two to four.
12. 2GRAMBEFORE: bigram of up to 6
word before the observed word.
13. 2GRAMAFTER: bigram of up to 1 word
after the observed word.
14. BEFOREPOS: the information of part
of speech of up to 6 word before the
observed word.
15. AFTERPOS: the information of part of
speech of up to 1 word after the observed
word.
16. SPECIAL: word is one of the special
words in the special dictionary. The
words we included as special words
are: "nada", "ni", "nunca", "ningun",
"ninguno", "ninguna", "alguna",
"apenas", "para nada", and "ni siquiera".
These words have more tendency to be
part of negation cue with multiple words.
This feature is included in order to
capture the characteristic of negation cue
that can consist of more than one words
which are separated by other non-cue
words in between.
        </p>
        <p>By using the features mentioned above,
we do the training using the given data and
CRF module in NLTK to produce the model
which can be used to detect the negation
cue in Spanish. The parameters for
training the CRF are the default parameters used
in NLTK toolkit. This model will be used
as one of the input for the next step which
is testing. Testing is the process of detecting
negation from the testing data (data in which
negations are not annotated or raw data) by
using the model which we get from the
training process as the knowledge base. The result
of the testing process is an annotated
version of testing data in which words in each
sentence are classi ed into either part cue or
outside of them. The result we obtain after
the testing process will be in the format of
BIO tagged since this is the format which we
use to represent our data. Related to that, we
do some post-processing to change the format
of the result into the same original format as
the input (training data). We use the
original data format of CoNLL and then add the
information of negation cue which we obtain
from the testing.
4</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>Results</title>
      <p>After nished with the testing process, we
will obtain the result of the negation cue
detection as annotated documents of testing
data we provide as input. In order to
evaluate the performance of the approach used
in the system, we will use recall, precision,
and f1 score measurement. We use the
evaluation script provided by the organizers to
make sure that our output match the
requirement. In the rst phase, we use the
development testing data which is provided in order
to measure the performance of our system.
We perform the testing on each document
in the development testing dataset which are
divided based on the domain. Each
document is processed separately and also
evaluated separately. To give a general view of
the performance, we also calculate the micro
average of the whole result from the
development testing. Table 1 shows the result of
baseline system we have obtained using the
development testing data meanwhile Table 2
shows the result of system based on our
proposed approach using the same development
dataset.
which use simple techniques. The result also
gives a fairly high value of performance with
most of them reach over 80%. Especially in
precision, the average reach more than 90%.
This is possible due to a fairly simple task of
detecting negation cue detection. Most of the
cues consist of word such as "no","ni","nada"
and several other words which describe
negation with little variability of vocabulary. This
leads to a fairly easy detection of cues and
the small number of false positives. On the
other hand, the recall have much lower
result with some reach even lower than 80%.
This happens due to the higher number of
false negatives caused by the di culty of
detecting non-contiguous multi-token cues. In
most of the cases of false negative, our
system has di culties to detect such cases, for
example:</p>
      <p>No es cosa del paralelo ni del
equilibrado.</p>
      <p>In the example, no...ni is a negation cue
meanwhile our system recognize them as two
separated cues. Another kind of false
negative is the opposite, where two separated cues
is recognized as one cue. Those cases
contribute to most of the false negatives in the
development testing result.</p>
      <p>The o cial testing result measurement
can be observed in Table 3. This result is
obtained using the model we have and the
o cial testing dataset provided by the
organizers. The evaluation is done directly by
the organizers and we receive the
measurement result as can be seen in Table 3 after
we submit our testing result.</p>
      <p>Based on the evaluation from organizers,
our result is ranked rst compared to other
participants in the same task. As can be seen
on the table, the o cial testing result follows
the same pattern as the development testing
result with higher precision and lower recall.
Even though we can't observe the cases
happening in o cial testing result, we can
infer that similar cases in development testing
probably also can be found by looking at the
result. The percentage also have almost
similar value with precision reach around 91%,
recall around 82%, and F1 score around 86%.
The average of result in o cial testing has
slightly lower value compared to the one in
development testing but the di erence is not
signi cant.
5</p>
    </sec>
    <sec id="sec-7">
      <title>Conclusion</title>
      <p>In this article we have described the approach
and system we built for the participation
in NEGES 2018: Workshop on Negation in
Spanish task 2 of negation cues detection for
Spanish product review texts. Our approach
to detect the negation cues consisted of a
supervised approach combining CRF and
several features for negation cue detection in
Spanish for training the model. The model
will then be used to classify whether a word
in the observed data or testing data is a part
of negation cue or not. This approach was
ranked in 1st position in the o cial testing
results with average precision around 91%,
average recall around 82%, and average F1
score around 86%.</p>
    </sec>
    <sec id="sec-8">
      <title>Acknowledgements</title>
      <p>This works has been partially funded
by the Spanish Goverment and by the
European Union through GRAPHMED
project (TIN2016-77820-C3-3-R and</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          <string-name>
            <surname>Agarwal</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          and
          <string-name>
            <given-names>H.</given-names>
            <surname>Yu</surname>
          </string-name>
          .
          <year>2010</year>
          .
          <article-title>Biomedical negation scope detection with conditional random elds</article-title>
          .
          <volume>17</volume>
          :
          <issue>696</issue>
          {
          <fpage>701</fpage>
          ,
          <fpage>11</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          <string-name>
            <surname>Bird</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          , E. Klein, and
          <string-name>
            <given-names>E.</given-names>
            <surname>Loper</surname>
          </string-name>
          .
          <year>2009</year>
          .
          <article-title>Natural language processing with Python: analyzing text with the natural language toolkit. "</article-title>
          <string-name>
            <surname>O'Reilly Media</surname>
          </string-name>
          ,
          <source>Inc.".</source>
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          <string-name>
            <surname>Jimenez-Zafra</surname>
            ,
            <given-names>S. M.</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>N. P.</given-names>
            <surname>Cruz-D az</surname>
          </string-name>
          , R. Morante, and M.
          <source>T. Mart n-Valdivia. 2018a. Resumen de la Tarea 2 del Taller NEGES</source>
          <year>2018</year>
          : Deteccion de Claves de Negacion.
          <source>In Proceedings of NEGES 2018: Workshop on Negation in Spanish</source>
          , volume
          <volume>2174</volume>
          , pages
          <fpage>35</fpage>
          {
          <fpage>41</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          <string-name>
            <surname>Jimenez-Zafra</surname>
            ,
            <given-names>S. M.</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Taule</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. T.</given-names>
            <surname>Mart</surname>
          </string-name>
          n-Valdivia,
          <string-name>
            <given-names>L. A.</given-names>
            <surname>Uren</surname>
          </string-name>
          <article-title>~a-</article-title>
          <string-name>
            <surname>Lopez</surname>
            , and
            <given-names>M. A.</given-names>
          </string-name>
          <string-name>
            <surname>Mart</surname>
          </string-name>
          .
          <year>2018b</year>
          .
          <article-title>SFU Review SPNEG: a Spanish corpus annotated with negation for sentiment analysis. A typology of negation patterns</article-title>
          .
          <source>Language Resources and Evaluation</source>
          ,
          <volume>52</volume>
          (
          <issue>2</issue>
          ):
          <volume>533</volume>
          {
          <fpage>569</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          <string-name>
            <surname>La erty</surname>
            , J.,
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>McCallum</surname>
            , and
            <given-names>F. C.</given-names>
          </string-name>
          <string-name>
            <surname>Pereira</surname>
          </string-name>
          .
          <year>2001</year>
          .
          <article-title>Conditional random elds: Probabilistic models for segmenting and labeling sequence data</article-title>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          <string-name>
            <surname>Okazaki</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          <year>2007</year>
          .
          <article-title>CRFsuite: a fast implementation of Conditional Random Fields (CRFs).</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          <string-name>
            <surname>Ramshaw</surname>
            ,
            <given-names>L. A.</given-names>
          </string-name>
          and
          <string-name>
            <given-names>M. P.</given-names>
            <surname>Marcus</surname>
          </string-name>
          .
          <year>1999</year>
          .
          <article-title>Text chunking using transformation-based learning</article-title>
          .
          <source>In Natural language processing using very large corpora</source>
          . Springer, pages
          <volume>157</volume>
          {
          <fpage>176</fpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>