Opinion Detector Web Service

Example Usage

opinion-detector-server start
curl -d 'input=<?xml version="1.0" encoding="UTF-8" standalone="no"?><KAF version="v1.opener" xml:lang="en"><kafHeader><linguisticProcessors layer="text"><lp name="opennlp-en-tok" timestamp="2013-06-11T13:41:37Z" version="1.0"/><lp name="opennlp-en-sent" timestamp="2013-06-11T13:41:37Z" version="1.0"/></linguisticProcessors></kafHeader><text><wf length="4" offset="0" para="1" sent="1" wid="w1">this</wf><wf length="2" offset="5" para="1" sent="1" wid="w2">is</wf><wf length="2" offset="8" para="1" sent="1" wid="w3">an</wf><wf length="7" offset="11" para="1" sent="1" wid="w4">english</wf><wf length="4" offset="19" para="1" sent="1" wid="w5">text</wf></text></KAF>' http://localhost:9292 -XPOST
outputs:
        <?xml version='1.0' encoding='UTF-8'?>
        <KAF xml:lang="en">
          <kafHeader>
            <linguisticProcessors layer="text">
              <lp timestamp="2013-04-11T09:21:29CEST" version="1.0" name="Open-nlp sentence splitter"/>
              <lp timestamp="2013-04-11T09:21:29CEST" version="1.0" name="Open-nlp tokenizer"/>
            </linguisticProcessors>
            <linguisticProcessor layer="opinions">
              <lp timestamp="2013-06-27T17:56:32EEST" version="1.0" name="Crfsuite machine learning opinion miner"/>
            </linguisticProcessor>
            <linguisticProcessor layer="terms">
              <lp timestamp="2013-04-11T09:23:08CEST" version="1.0" name="Basic_polarity_tagger_with_pos"/>
            </linguisticProcessor>
            <linguisticProcessor layer="term">
              <lp timestamp="2013-04-11T09:23:07CEST" version="1.0" name="TreeTagger_from_kaf"/>
            </linguisticProcessor>
          </kafHeader>
          <text>
            <wf wid="w_1" sent="s_1">This</wf>
            <wf wid="w_2" sent="s_1">is</wf>
            <wf wid="w_3" sent="s_1">a</wf>
            <wf wid="w_4" sent="s_1">very</wf>
            <wf wid="w_5" sent="s_1">nice</wf>
            <wf wid="w_6" sent="s_1">hotel</wf>
            <wf wid="w_7" sent="s_1">in</wf>
            <wf wid="w_8" sent="s_1">Amsterdam</wf>
          </text>
          <terms>
            <term tid="t_1" lemma="this" morphofeat="DT" type="close" pos="D">
              <span>
                <target id="w_1"/>
              </span>
            </term>
            <term tid="t_2" lemma="be" morphofeat="VBZ" type="open" pos="V">
              <span>
                <target id="w_2"/>
              </span>
            </term>
            <term tid="t_3" lemma="a" morphofeat="DT" type="close" pos="D">
              <span>
                <target id="w_3"/>
              </span>
            </term>
            <term tid="t_4" lemma="very" morphofeat="RB" type="open" pos="A">
              <span>
                <target id="w_4"/>
              </span>
              <sentiment sentiment_modifier="intensifier" resource="VUA_olery_lexicon_en_lmf"/>
            </term>
            <term tid="t_5" lemma="nice" morphofeat="JJ" type="open" pos="G">
              <span>
                <target id="w_5"/>
              </span>
              <sentiment polarity="positive" resource="VUA_olery_lexicon_en_lmf"/>
            </term>
            <term tid="t_6" lemma="hotel" morphofeat="NN" type="open" pos="N">
              <span>
                <target id="w_6"/>
              </span>
            </term>
            <term tid="t_7" lemma="in" morphofeat="IN" type="close" pos="P">
              <span>
                <target id="w_7"/>
              </span>
            </term>
            <term tid="t_8" lemma="Amsterdam" morphofeat="NP" type="open" pos="R">
              <span>
                <target id="w_8"/>
              </span>
            </term>
          </terms>
          <entities>
            <entity eid="e15" type="location">
              <references>
                <span>
                  <!--Amsterdam -->
                  <target id="t_8"/>
                </span>
              </references>
            </entity>
          </entities>
          <opinions>
            <opinion oid="o_1">
              <opinion_holder>
                <span/>
              </opinion_holder>
              <opinion_target>
                <span>
                  <target id="t_1"/>
                </span>
              </opinion_target>
              <opinion_expression polarity="positive" strength="1">
                <span>
                  <target id="t_4"/>
                  <target id="t_5"/>
                  <target id="t_6"/>
                  <target id="t_7"/>
                  <target id="t_8"/>
                </span>
              </opinion_expression>
            </opinion>
          </opinions>
        </KAF>

Try the webservice

* required

** When entering a value no response will be displayed in the browser.

" method="POST">

<% 10.times do |t| %>

<% end %>

Actions

POST /
Detect opinion for input text. See arguments listing for more options.
GET /
Show this page

Arguments

The webservice takes the following arguments:

* required

text*
The input text in KAF format. Sample KAF input:
        <?xml version='1.0' encoding='UTF-8'?>
        <KAF xml:lang="en">
          <kafHeader>
            <linguisticProcessors layer="text">
              <lp timestamp="2013-04-11T09:21:29CEST" version="1.0" name="Open-nlp sentence splitter"/>
              <lp timestamp="2013-04-11T09:21:29CEST" version="1.0" name="Open-nlp tokenizer"/>
            </linguisticProcessors>
            <linguisticProcessor layer="terms">
              <lp timestamp="2013-04-11T09:23:08CEST" version="1.0" name="Basic_polarity_tagger_with_pos"/>
            </linguisticProcessor>
            <linguisticProcessor layer="term">
              <lp timestamp="2013-04-11T09:23:07CEST" version="1.0" name="TreeTagger_from_kaf"/>
            </linguisticProcessor>
          </kafHeader>
          <text>
            <wf wid="w_1" sent="s_1">This</wf>
            <wf wid="w_2" sent="s_1">is</wf>
            <wf wid="w_3" sent="s_1">a</wf>
            <wf wid="w_4" sent="s_1">very</wf>
            <wf wid="w_5" sent="s_1">nice</wf>
            <wf wid="w_6" sent="s_1">hotel</wf>
            <wf wid="w_7" sent="s_1">in</wf>
            <wf wid="w_8" sent="s_1">Amsterdam</wf>
          </text>
          <terms>
            <term tid="t_1" lemma="this" morphofeat="DT" type="close" pos="D">
              <span>
                <target id="w_1"/>
              </span>
            </term>
            <term tid="t_2" lemma="be" morphofeat="VBZ" type="open" pos="V">
              <span>
                <target id="w_2"/>
              </span>
            </term>
            <term tid="t_3" lemma="a" morphofeat="DT" type="close" pos="D">
              <span>
                <target id="w_3"/>
              </span>
            </term>
            <term tid="t_4" lemma="very" morphofeat="RB" type="open" pos="A">
              <span>
                <target id="w_4"/>
              </span>
              <sentiment sentiment_modifier="intensifier" resource="VUA_olery_lexicon_en_lmf"/>
            </term>
            <term tid="t_5" lemma="nice" morphofeat="JJ" type="open" pos="G">
              <span>
                <target id="w_5"/>
              </span>
              <sentiment polarity="positive" resource="VUA_olery_lexicon_en_lmf"/>
            </term>
            <term tid="t_6" lemma="hotel" morphofeat="NN" type="open" pos="N">
              <span>
                <target id="w_6"/>
              </span>
            </term>
            <term tid="t_7" lemma="in" morphofeat="IN" type="close" pos="P">
              <span>
                <target id="w_7"/>
              </span>
            </term>
            <term tid="t_8" lemma="Amsterdam" morphofeat="NP" type="open" pos="R">
              <span>
                <target id="w_8"/>
              </span>
            </term>
          </terms>
          <entities>
            <entity eid="e15" type="location">
        	<references>
                <span>
                  <!--Amsterdam -->
                  <target id="t_8" />
                </span>
        	</references>
            </entity>
          </entities>
        </KAF>
callbacks
You can provide a list of callback urls. If you provide callback urls the Opinion detector will run as a background job and a callback with the results will be performed (POST) to the first url in the callback list. The other urls in callback list will be provided in the "callbacks" argument.

Using callback you can chain together several OpeNER webservices in one call. The first, will call the second, which will call the third, etc. See for more information the webservice documentation online.
error_callback
URL to notify if errors occur in the background process. The error callback will do a POST with the error message in the 'error' field.