opener-kaf2json 1.0.4-java → 1.0.6-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -35
- data/config/kaf2json.xsl +67 -30
- data/lib/opener/kaf_to_json/version.rb +1 -1
- data/lib/opener/kaf_to_json/views/index.erb +300 -160
- metadata +12 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7760c83a5ff35f56412e0828f6234912b304378f
|
4
|
+
data.tar.gz: 8a24fef977bb9966202796a3f9066ab1b31469f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3517429f1212c0c70cccc042d3f43706277c83db5b623dddd3fa7aeb0da973d34fc67e738e3681caaab3e42676f4ffa12c90e36b64e393aef9e311a39041986b
|
7
|
+
data.tar.gz: 76cb00baa6df22e33470145b78cf1d16c7a9080349aebf38a77cb7441f75432c814eff6829c3c05f73d9e532d946c373abc7248f80017ee7c41fbc6496057198
|
data/README.md
CHANGED
@@ -1,18 +1,12 @@
|
|
1
1
|
kaf2json
|
2
2
|
------------
|
3
3
|
|
4
|
-
Even if KAF is the true OpeNER data representation format, it is not very friendly for humans. It is also difficult to parse and work with it, specially for new users that are not familiarized with KAF.
|
5
|
-
This is part of the feedback we got from the OpeNER hackathon held in Amsterdam during first days of July.
|
6
|
-
To ease the post-processing of the results by any potential user, we are designing an alternative JSON format to output translate KAF, and turn its complexity into a much more usable format.
|
7
|
-
Although, the specification for this JSON is currently work in progress, we have already a version that covers the most relevant parts from the KAF representation.
|
4
|
+
Even if KAF is the true OpeNER data representation format, it is not very friendly for humans. It is also difficult to parse and work with it, specially for new users that are not familiarized with KAF. This is part of the feedback we got from the OpeNER hackathon held in Amsterdam during first days of July. To ease the post-processing of the results by any potential user, we are designing an alternative JSON format to output translate KAF, and turn its complexity into a much more usable format. Although, the specification for this JSON is currently work in progress, we have already a version that covers the most relevant parts from the KAF representation.
|
8
5
|
|
9
6
|
### Confused by some terminology?
|
10
7
|
|
11
|
-
This software is part of a larger collection of natural language processing
|
12
|
-
|
13
|
-
project at (the OpeNER portal)[http://opener-project.github.io]. There you can
|
14
|
-
also find references to terms like KAF (an XML standard to represent linguistic
|
15
|
-
annotations in texts), component, cores, scenario's and pipelines.
|
8
|
+
This software is part of a larger collection of natural language processing tools known as "the OpeNER project". You can find more information about the project at [the OpeNER portal](http://opener-project.github.io). There you can also find references to terms like KAF (an XML standard to represent linguistic annotations in texts), component, cores, scenario's and pipelines.
|
9
|
+
|
16
10
|
|
17
11
|
Quick Use Example
|
18
12
|
-----------------
|
@@ -21,13 +15,11 @@ Installing the kaf2json can be done by executing:
|
|
21
15
|
|
22
16
|
gem install opener-kaf2json
|
23
17
|
|
24
|
-
Please bare in mind that all components in OpeNER take KAF as an input and
|
25
|
-
output KAF by default.
|
18
|
+
Please bare in mind that all components in OpeNER take KAF as an input and output KAF by default.
|
26
19
|
|
27
20
|
### Command line interface
|
28
21
|
|
29
|
-
You should now be able to call the kaf2json as a regular shell
|
30
|
-
command: by its name. Once installed the gem normally sits in your path so you can call it directly from anywhere.
|
22
|
+
You should now be able to call the kaf2json as a regular shell command: by its name. Once installed the gem normally sits in your path so you can call it directly from anywhere.
|
31
23
|
|
32
24
|
This aplication reads a text from standard input in order to convert it to JSON.
|
33
25
|
|
@@ -53,26 +45,20 @@ You can launch a webservice by executing:
|
|
53
45
|
|
54
46
|
kaf2json-server
|
55
47
|
|
56
|
-
This will launch a mini webserver with the webservice. It defaults to port 9292,
|
57
|
-
so you can access it at <http://localhost:9292>.
|
48
|
+
This will launch a mini webserver with the webservice. It defaults to port 9292, so you can access it at <http://localhost:9292>.
|
58
49
|
|
59
|
-
To launch it on a different port provide the `-p [port-number]` option like
|
60
|
-
this:
|
50
|
+
To launch it on a different port provide the `-p [port-number]` option like this:
|
61
51
|
|
62
52
|
kaf2json-server -p 1234
|
63
53
|
|
64
54
|
It then launches at <http://localhost:1234>
|
65
55
|
|
66
|
-
Documentation on the Webservice is provided by surfing to the urls provided
|
67
|
-
above. For more information on how to launch a webservice run the command with
|
68
|
-
the ```-h``` option.
|
56
|
+
Documentation on the Webservice is provided by surfing to the urls provided above. For more information on how to launch a webservice run the command with the ```-h``` option.
|
69
57
|
|
70
58
|
|
71
59
|
### Daemon
|
72
60
|
|
73
|
-
Last but not least the kaf2json comes shipped with a daemon that
|
74
|
-
can read jobs (and write) jobs to and from Amazon SQS queues. For more
|
75
|
-
information type:
|
61
|
+
Last but not least the kaf2json comes shipped with a daemon that can read jobs (and write) jobs to and from Amazon SQS queues. For more information type:
|
76
62
|
|
77
63
|
kaf2json-daemon -h
|
78
64
|
|
@@ -80,11 +66,8 @@ information type:
|
|
80
66
|
Description of dependencies
|
81
67
|
---------------------------
|
82
68
|
|
83
|
-
This component runs best if you run it in an environment suited for OpeNER
|
84
|
-
|
85
|
-
installer)[https://github.com/opener-project/opener-installer] and (an
|
86
|
-
installation guide on the Opener
|
87
|
-
Website)[http://opener-project.github.io/getting-started/how-to/local-installation.html]
|
69
|
+
This component runs best if you run it in an environment suited for OpeNER components. You can find an installation guide and helper tools in the [OpeNER installer](https://github.com/opener-project/opener-installer) and an
|
70
|
+
[installation guide on the Opener Website](http://opener-project.github.io/getting-started/how-to/local-installation.html)
|
88
71
|
|
89
72
|
At least you need the following system setup:
|
90
73
|
|
@@ -105,29 +88,28 @@ Language Extension
|
|
105
88
|
The Core
|
106
89
|
--------
|
107
90
|
|
108
|
-
The component is a fat wrapper around the actual language technology core. You
|
109
|
-
can find the core technolies in the following repositories:
|
91
|
+
The component is a fat wrapper around the actual language technology core. You can find the core technolies in the following repositories:
|
110
92
|
|
111
93
|
* (link to) Related Core readmes
|
112
94
|
|
113
95
|
Where to go from here
|
114
96
|
---------------------
|
115
97
|
|
116
|
-
* Check
|
117
|
-
*
|
98
|
+
* [Check the project websitere](http://opener-project.github.io)
|
99
|
+
* [Checkout the webservice](http://opener.olery.com/kaf2json)
|
118
100
|
|
119
101
|
Report problem/Get help
|
120
102
|
-----------------------
|
121
103
|
|
122
104
|
If you encounter problems, please email support@opener-project.eu or leave an
|
123
|
-
issue
|
105
|
+
[issue tracker](https://github.com/opener-project/kaf2json/issues).
|
124
106
|
|
125
107
|
|
126
108
|
Contributing
|
127
109
|
------------
|
128
110
|
|
129
|
-
1. Fork it
|
111
|
+
1. Fork it <http://github.com/opener-project/kaf2json/fork>
|
130
112
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
131
113
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
132
114
|
4. Push to the branch (`git push origin my-new-feature`)
|
133
|
-
5. Create new Pull Request
|
115
|
+
5. Create new Pull Request
|
data/config/kaf2json.xsl
CHANGED
@@ -1,15 +1,24 @@
|
|
1
1
|
<?xml version="1.0"?>
|
2
2
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
3
3
|
|
4
|
+
<!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
5
|
+
KAF2JOSN
|
6
|
+
This module convert an xml kaf document into Jsonversion 1.2
|
7
|
+
|
8
|
+
date 23/05/2014
|
9
|
+
Author Andrea Marchetti
|
10
|
+
OpeNER Project
|
11
|
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
|
4
12
|
<xsl:output method="text" encoding="utf-8" omit-xml-declaration="yes"/>
|
5
13
|
|
6
|
-
<xsl:template match="/">{
|
7
|
-
"text" : "<xsl:apply-templates select="KAF/text/wf"
|
8
|
-
"language" : "<xsl:value-of
|
9
|
-
"terms" : {<xsl:apply-templates select="KAF/terms/term"
|
10
|
-
"sentiments":
|
11
|
-
"entities" : {<xsl:apply-templates select="KAF/entities/entity"
|
12
|
-
"opinions" : {<xsl:apply-templates select="KAF/opinions/opinion"
|
14
|
+
<xsl:template match="/">{
|
15
|
+
"text" : "<xsl:apply-templates select="KAF/text/wf" />",
|
16
|
+
"language" : "<xsl:value-of select="KAF/@xml:lang" />",
|
17
|
+
"terms" : {<xsl:apply-templates select="KAF/terms/term" />},
|
18
|
+
"sentiments": {<xsl:apply-templates select="KAF/terms/term/sentiment" />},
|
19
|
+
"entities" : {<xsl:apply-templates select="KAF/entities/entity" />},
|
20
|
+
"opinions" : {<xsl:apply-templates select="KAF/opinions/opinion" />},
|
21
|
+
"lp" : [<xsl:apply-templates select="KAF/kafHeader//lp" />]
|
13
22
|
}
|
14
23
|
</xsl:template>
|
15
24
|
|
@@ -18,6 +27,16 @@
|
|
18
27
|
</xsl:template>
|
19
28
|
|
20
29
|
<!-- Levels -->
|
30
|
+
<xsl:template match="lp">
|
31
|
+
{
|
32
|
+
"name" :"<xsl:value-of select="@name" />",
|
33
|
+
"timestamp":"<xsl:value-of select="@timestamp"/>",
|
34
|
+
"version" :"<xsl:value-of select="@version" />",
|
35
|
+
"layer" :"<xsl:value-of select="../@layer" />"
|
36
|
+
}<xsl:if test="position()!=last()"><xsl:text>,</xsl:text></xsl:if>
|
37
|
+
</xsl:template>
|
38
|
+
|
39
|
+
|
21
40
|
<xsl:template match="term">
|
22
41
|
<xsl:variable name="termId" select="@tid"/>
|
23
42
|
"<xsl:value-of select="$termId"/>":
|
@@ -26,19 +45,31 @@
|
|
26
45
|
"lemma" :"<xsl:value-of select="@lemma" />",
|
27
46
|
"text" :"<xsl:call-template name="termInside2" />",
|
28
47
|
"pos" :"<xsl:value-of select="@pos" />",
|
29
|
-
"morphofeat" :"<xsl:value-of select="@morphofeat" />"<xsl:if test="
|
30
|
-
"
|
31
|
-
"
|
48
|
+
"morphofeat" :"<xsl:value-of select="@morphofeat" />"<xsl:if test="sentiment">,
|
49
|
+
"sentiment" :<xsl:apply-templates select="sentiment" mode="inside" /> </xsl:if> <xsl:if test="//entity//target/@id=$termId">,
|
50
|
+
"entity" :"<xsl:value-of select="//entity[.//target/@id=$termId]/@eid"/>"</xsl:if> <xsl:if test="//opinion//target/@id=$termId">,
|
51
|
+
"opinion" :"<xsl:value-of select="//opinion[.//target/@id=$termId]/@oid"/>"</xsl:if>
|
32
52
|
}<xsl:if test="position()!=last()"><xsl:text>,</xsl:text></xsl:if>
|
33
53
|
</xsl:template>
|
34
54
|
|
55
|
+
|
35
56
|
<xsl:template match="sentiment">
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
57
|
+
"s<xsl:value-of select="position()"/>":
|
58
|
+
{
|
59
|
+
"lexicon" :"<xsl:value-of select="@resource" />",
|
60
|
+
<xsl:if test="@polarity">"polarity":"<xsl:value-of select="@polarity"/>",</xsl:if>
|
61
|
+
<xsl:if test="@sentiment_modifier">"sentiment_modifier":"<xsl:value-of select="@sentiment_modifier"/>",</xsl:if>
|
62
|
+
"termId" :"<xsl:value-of select="parent::term/@tid"/>",
|
63
|
+
"text" :"<xsl:call-template name="termInside" />"
|
64
|
+
}<xsl:if test="position()!=last()"><xsl:text>,</xsl:text></xsl:if>
|
65
|
+
</xsl:template>
|
66
|
+
|
67
|
+
<xsl:template match="sentiment" mode="inside">
|
68
|
+
{
|
69
|
+
"lexicon" :"<xsl:value-of select="@resource" />"<xsl:if test="@polarity">,
|
70
|
+
"polarity":"<xsl:value-of select="@polarity"/>"</xsl:if><xsl:if test="@sentiment_modifier">,
|
71
|
+
"sentiment_modifier":"<xsl:value-of select="@sentiment_modifier"/>"</xsl:if>
|
72
|
+
}
|
42
73
|
</xsl:template>
|
43
74
|
|
44
75
|
<xsl:template match="entity">
|
@@ -47,22 +78,32 @@
|
|
47
78
|
"type" :"<xsl:value-of select="@type" />",
|
48
79
|
"text" :"<xsl:call-template name="entityInside" />",
|
49
80
|
"reference":"<xsl:value-of select="externalReferences/externalRef/@reference" />",
|
50
|
-
"terms" :[<xsl:
|
81
|
+
"terms" :[<xsl:apply-templates select="references"/>]
|
51
82
|
}<xsl:if test="position()!=last()"><xsl:text>,</xsl:text></xsl:if>
|
52
83
|
</xsl:template>
|
53
84
|
|
85
|
+
<xsl:template match="references">
|
86
|
+
<xsl:call-template name="termList"/>
|
87
|
+
</xsl:template>
|
88
|
+
|
89
|
+
|
54
90
|
<xsl:template match="opinion">
|
55
91
|
"<xsl:value-of select="@oid"/>":
|
56
|
-
{
|
57
|
-
"holder" :""
|
58
|
-
"target" :""
|
59
|
-
"
|
60
|
-
"
|
61
|
-
"
|
62
|
-
"
|
92
|
+
{ <xsl:if test="opinion_holder" >
|
93
|
+
"holder" :[<xsl:apply-templates select="opinion_holder"/>],</xsl:if><xsl:if test="opinion_target" >
|
94
|
+
"target" :[<xsl:apply-templates select="opinion_target"/>],</xsl:if><xsl:if test="opinion_expression">
|
95
|
+
"expression":[<xsl:apply-templates select="opinion_expression"/>],
|
96
|
+
"polarity" :"<xsl:value-of select="opinion_expression/@polarity"/>",
|
97
|
+
"strength" :"<xsl:value-of select="opinion_expression/@strength"/>",</xsl:if>
|
98
|
+
"text" :"<xsl:call-template name="opinionInside" />"
|
63
99
|
}<xsl:if test="position()!=last()"><xsl:text>,</xsl:text></xsl:if>
|
64
100
|
</xsl:template>
|
65
101
|
|
102
|
+
|
103
|
+
<xsl:template match="opinion_expression|opinion_target|opinion_holder">
|
104
|
+
<xsl:call-template name="termList"/>
|
105
|
+
</xsl:template>
|
106
|
+
|
66
107
|
<!-- Routines -->
|
67
108
|
|
68
109
|
<xsl:template name="termInside">
|
@@ -92,15 +133,11 @@
|
|
92
133
|
</xsl:for-each>
|
93
134
|
</xsl:template>
|
94
135
|
|
95
|
-
<xsl:template name="entityTerms">
|
96
|
-
<xsl:for-each select="references/span/target">"<xsl:value-of select="@id"/>"<xsl:if test="position()!=last()"><xsl:text>,</xsl:text></xsl:if></xsl:for-each>
|
97
|
-
</xsl:template>
|
98
136
|
|
99
|
-
<xsl:template name="
|
100
|
-
<xsl:for-each select="
|
137
|
+
<xsl:template name="termList">
|
138
|
+
<xsl:for-each select="span/target">"<xsl:value-of select="@id"/>"<xsl:if test="position()!=last()"><xsl:text>,</xsl:text></xsl:if></xsl:for-each>
|
101
139
|
</xsl:template>
|
102
140
|
|
103
|
-
|
104
141
|
<xsl:template name="opinionInside">
|
105
142
|
<xsl:for-each select="opinion_expression/span/target">
|
106
143
|
<xsl:call-template name="term">
|
@@ -1,163 +1,303 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
3
|
+
<head>
|
4
|
+
<link type="text/css" rel="stylesheet" charset="UTF-8" href="markdown.css"/>
|
5
|
+
<title>KAF to JSON Webservice</title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<h1>KAF to JSON Web Service</h1>
|
9
|
+
|
10
|
+
<h2>Example Usage</h2>
|
11
|
+
|
12
|
+
<p>
|
13
|
+
<pre>kaf2json-server start</pre>
|
14
|
+
<pre>curl -d '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><linguisticProcessors layer="opinions"><lp timestamp="*" version="1.0" name="Basic opinion detector with Pos"/></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><opinions><opinion oid="o1"><opinion_target><!--hotel--><span><target id="t_6"/></span></opinion_target><opinion_expression polarity="positive" strength="2"><!--very nice--><span><target id="t_4"/><target id="t_5"/></span></opinion_expression></opinion></opinions></KAF>' http://localhost:9292 -XPOST</pre>
|
15
|
+
|
16
|
+
outputs:
|
17
|
+
|
18
|
+
<pre>
|
19
|
+
{
|
20
|
+
"text": "This is a very nice hotel in Amsterdam ",
|
21
|
+
"language": "en",
|
22
|
+
"terms": {
|
23
|
+
"t_1": {
|
24
|
+
"type": "close",
|
25
|
+
"lemma": "this",
|
26
|
+
"text": "This",
|
27
|
+
"pos": "D",
|
28
|
+
"morphofeat": "DT"
|
29
|
+
},
|
30
|
+
"t_2": {
|
31
|
+
"type": "open",
|
32
|
+
"lemma": "be",
|
33
|
+
"text": "is",
|
34
|
+
"pos": "V",
|
35
|
+
"morphofeat": "VBZ"
|
36
|
+
},
|
37
|
+
"t_3": {
|
38
|
+
"type": "close",
|
39
|
+
"lemma": "a",
|
40
|
+
"text": "a",
|
41
|
+
"pos": "D",
|
42
|
+
"morphofeat": "DT"
|
43
|
+
},
|
44
|
+
"t_4": {
|
45
|
+
"type": "open",
|
46
|
+
"lemma": "very",
|
47
|
+
"text": "very",
|
48
|
+
"pos": "A",
|
49
|
+
"morphofeat": "RB",
|
50
|
+
"polarity": ""
|
51
|
+
},
|
52
|
+
"t_5": {
|
53
|
+
"type": "open",
|
54
|
+
"lemma": "nice",
|
55
|
+
"text": "nice",
|
56
|
+
"pos": "G",
|
57
|
+
"morphofeat": "JJ",
|
58
|
+
"polarity": "positive"
|
59
|
+
},
|
60
|
+
"t_6": {
|
61
|
+
"type": "open",
|
62
|
+
"lemma": "hotel",
|
63
|
+
"text": "hotel",
|
64
|
+
"pos": "N",
|
65
|
+
"morphofeat": "NN"
|
66
|
+
},
|
67
|
+
"t_7": {
|
68
|
+
"type": "close",
|
69
|
+
"lemma": "in",
|
70
|
+
"text": "in",
|
71
|
+
"pos": "P",
|
72
|
+
"morphofeat": "IN"
|
73
|
+
},
|
74
|
+
"t_8": {
|
75
|
+
"type": "open",
|
76
|
+
"lemma": "Amsterdam",
|
77
|
+
"text": "Amsterdam",
|
78
|
+
"pos": "R",
|
79
|
+
"morphofeat": "NP",
|
80
|
+
"entity": "e15"
|
81
|
+
}
|
82
|
+
},
|
83
|
+
"sentiments": [
|
84
|
+
{
|
85
|
+
"lexicon": "VUA_olery_lexicon_en_lmf",
|
86
|
+
"polarity": "",
|
87
|
+
"termId": "t_4",
|
88
|
+
"text": "very"
|
89
|
+
},
|
90
|
+
{
|
91
|
+
"lexicon": "VUA_olery_lexicon_en_lmf",
|
92
|
+
"polarity": "positive",
|
93
|
+
"termId": "t_5",
|
94
|
+
"text": "nice"
|
95
|
+
}
|
96
|
+
],
|
97
|
+
"entities": {
|
98
|
+
"e15": {
|
99
|
+
"type": "location",
|
100
|
+
"text": "Amsterdam",
|
101
|
+
"reference": "",
|
102
|
+
"terms": [
|
103
|
+
"t_8"
|
104
|
+
]
|
105
|
+
}
|
106
|
+
},
|
107
|
+
"opinions": {
|
108
|
+
"o1": {
|
109
|
+
"holder": "",
|
110
|
+
"target": "",
|
111
|
+
"polarity": "positive",
|
112
|
+
"strength": "2",
|
113
|
+
"text": "very nice",
|
114
|
+
"terms": [
|
115
|
+
"t_4",
|
116
|
+
"t_5"
|
117
|
+
]
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}</pre>
|
121
|
+
</p>
|
122
|
+
|
123
|
+
<h2>Try the webservice</h2>
|
124
|
+
|
125
|
+
<p>* required</p>
|
126
|
+
<p>** When entering a value no response will be displayed in the browser.</p>
|
127
|
+
|
128
|
+
<form action="<%=url("/")%>" method="POST">
|
129
|
+
<div>
|
130
|
+
<label for="input"/>Type your text here*</label>
|
131
|
+
<br/>
|
132
|
+
|
133
|
+
<textarea name="input" id="text" rows="10" cols="50"/></textarea>
|
134
|
+
</div>
|
135
|
+
|
136
|
+
<% 10.times do |t| %>
|
137
|
+
<div>
|
138
|
+
<label for="callbacks">Callback URL <%=t+1%>(**)</label>
|
139
|
+
<br />
|
140
|
+
|
141
|
+
<input id="callbacks" type="text" name="callbacks[]" />
|
142
|
+
</div>
|
143
|
+
<% end %>
|
144
|
+
|
145
|
+
|
146
|
+
<div>
|
147
|
+
<label for="error_callback">Error Callback</label>
|
148
|
+
<br />
|
149
|
+
|
150
|
+
<input id="error_callback" type="text" name="error_callback" />
|
151
|
+
</div>
|
152
|
+
<input type="submit" value="Submit" />
|
153
|
+
</form>
|
154
|
+
|
155
|
+
<h2>Actions</h2>
|
156
|
+
|
157
|
+
<p>
|
158
|
+
<dl>
|
159
|
+
<dt>POST /</dt>
|
160
|
+
<dd>Convert the input KAF text. See arguments listing for more options.</dd>
|
161
|
+
<dt>GET /</dt>
|
162
|
+
<dd>Show this page</dd>
|
163
|
+
</dl>
|
164
|
+
</p>
|
165
|
+
|
166
|
+
<h2>Arguments</h2>
|
167
|
+
|
168
|
+
<p> The webservice takes the following arguments: </p>
|
169
|
+
<p>* required</p>
|
170
|
+
|
171
|
+
<dl>
|
172
|
+
<dt>text*</dt>
|
173
|
+
<dd>The input text in KAF format. Sample KAF input:</dd>
|
174
|
+
<pre>
|
175
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
176
|
+
<KAF xml:lang="en">
|
177
|
+
<kafHeader>
|
178
|
+
<linguisticProcessors layer="text">
|
179
|
+
<lp timestamp="2013-04-11T09:21:29CEST" version="1.0" name="Open-nlp sentence splitter"/>
|
180
|
+
<lp timestamp="2013-04-11T09:21:29CEST" version="1.0" name="Open-nlp tokenizer"/>
|
181
|
+
</linguisticProcessors>
|
182
|
+
<linguisticProcessors layer="opinions">
|
183
|
+
<lp timestamp="*" version="1.0" name="Basic opinion detector with Pos"/>
|
184
|
+
</linguisticProcessors>
|
185
|
+
<linguisticProcessor layer="terms">
|
186
|
+
<lp timestamp="2013-04-11T09:23:08CEST" version="1.0" name="Basic_polarity_tagger_with_pos"/>
|
187
|
+
</linguisticProcessor>
|
188
|
+
<linguisticProcessor layer="term">
|
189
|
+
<lp timestamp="2013-04-11T09:23:07CEST" version="1.0" name="TreeTagger_from_kaf"/>
|
190
|
+
</linguisticProcessor>
|
191
|
+
</kafHeader>
|
192
|
+
<text>
|
193
|
+
<wf wid="w_1" sent="s_1">This</wf>
|
194
|
+
<wf wid="w_2" sent="s_1">is</wf>
|
195
|
+
<wf wid="w_3" sent="s_1">a</wf>
|
196
|
+
<wf wid="w_4" sent="s_1">very</wf>
|
197
|
+
<wf wid="w_5" sent="s_1">nice</wf>
|
198
|
+
<wf wid="w_6" sent="s_1">hotel</wf>
|
199
|
+
<wf wid="w_7" sent="s_1">in</wf>
|
200
|
+
<wf wid="w_8" sent="s_1">Amsterdam</wf>
|
201
|
+
</text>
|
202
|
+
<terms>
|
203
|
+
<term tid="t_1" lemma="this" morphofeat="DT" type="close" pos="D">
|
204
|
+
<span>
|
205
|
+
<target id="w_1"/>
|
206
|
+
</span>
|
207
|
+
</term>
|
208
|
+
<term tid="t_2" lemma="be" morphofeat="VBZ" type="open" pos="V">
|
209
|
+
<span>
|
210
|
+
<target id="w_2"/>
|
211
|
+
</span>
|
212
|
+
</term>
|
213
|
+
<term tid="t_3" lemma="a" morphofeat="DT" type="close" pos="D">
|
214
|
+
<span>
|
215
|
+
<target id="w_3"/>
|
216
|
+
</span>
|
217
|
+
</term>
|
218
|
+
<term tid="t_4" lemma="very" morphofeat="RB" type="open" pos="A">
|
219
|
+
<span>
|
220
|
+
<target id="w_4"/>
|
221
|
+
</span>
|
222
|
+
<sentiment sentiment_modifier="intensifier" resource="VUA_olery_lexicon_en_lmf"/>
|
223
|
+
</term>
|
224
|
+
<term tid="t_5" lemma="nice" morphofeat="JJ" type="open" pos="G">
|
225
|
+
<span>
|
226
|
+
<target id="w_5"/>
|
227
|
+
</span>
|
228
|
+
<sentiment polarity="positive" resource="VUA_olery_lexicon_en_lmf"/>
|
229
|
+
</term>
|
230
|
+
<term tid="t_6" lemma="hotel" morphofeat="NN" type="open" pos="N">
|
231
|
+
<span>
|
232
|
+
<target id="w_6"/>
|
233
|
+
</span>
|
234
|
+
</term>
|
235
|
+
<term tid="t_7" lemma="in" morphofeat="IN" type="close" pos="P">
|
236
|
+
<span>
|
237
|
+
<target id="w_7"/>
|
238
|
+
</span>
|
239
|
+
</term>
|
240
|
+
<term tid="t_8" lemma="Amsterdam" morphofeat="NP" type="open" pos="R">
|
241
|
+
<span>
|
242
|
+
<target id="w_8"/>
|
243
|
+
</span>
|
244
|
+
</term>
|
245
|
+
</terms>
|
246
|
+
<entities>
|
247
|
+
<entity eid="e15" type="location">
|
248
|
+
<references>
|
249
|
+
<span>
|
250
|
+
<!--Amsterdam -->
|
251
|
+
<target id="t_8"/>
|
252
|
+
</span>
|
253
|
+
</references>
|
254
|
+
</entity>
|
255
|
+
</entities>
|
256
|
+
<opinions>
|
257
|
+
<opinion oid="o1">
|
258
|
+
<opinion_target>
|
259
|
+
<!--hotel-->
|
260
|
+
<span>
|
261
|
+
<target id="t_6"/>
|
262
|
+
</span>
|
263
|
+
</opinion_target>
|
264
|
+
<opinion_expression polarity="positive" strength="2">
|
265
|
+
<!--very nice-->
|
266
|
+
<span>
|
267
|
+
<target id="t_4"/>
|
268
|
+
<target id="t_5"/>
|
269
|
+
</span>
|
270
|
+
</opinion_expression>
|
271
|
+
</opinion>
|
272
|
+
</opinions>
|
273
|
+
</KAF>
|
274
|
+
</pre>
|
275
|
+
|
276
|
+
<dt>callbacks</dt>
|
277
|
+
<dd>
|
278
|
+
You can provide a list of callback urls. If you provide callback urls
|
279
|
+
the POS tagger will run as a background job and a callback
|
280
|
+
with the results will be performed (POST) to the first url in the callback
|
281
|
+
list. The other urls in callback list will be provided in the "callbacks"
|
282
|
+
argument.<br/><br/>
|
283
|
+
Using callback you can chain together several OpeNER webservices in
|
284
|
+
one call. The first, will call the second, which will call the third, etc.
|
285
|
+
See for more information the <a href="http://opener-project.github.io">
|
286
|
+
webservice documentation online</a>.
|
287
|
+
</dd>
|
288
|
+
<dt>error_callback</dt>
|
289
|
+
<dd>URL to notify if errors occur in the background process. The error
|
290
|
+
callback will do a POST with the error message in the 'error' field.</dd>
|
291
|
+
</dt>
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
</dl>
|
296
|
+
|
297
|
+
|
298
|
+
<p>
|
299
|
+
|
300
|
+
</p>
|
301
|
+
|
302
|
+
</body>
|
163
303
|
</html>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opener-kaf2json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- development@olery.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -167,26 +167,26 @@ dependencies:
|
|
167
167
|
description: Converts KAF input into JSON
|
168
168
|
email:
|
169
169
|
executables:
|
170
|
+
- kaf2json
|
170
171
|
- kaf2json-daemon
|
171
172
|
- kaf2json-server
|
172
|
-
- kaf2json
|
173
173
|
extensions: []
|
174
174
|
extra_rdoc_files: []
|
175
175
|
files:
|
176
|
+
- README.md
|
177
|
+
- bin/kaf2json
|
178
|
+
- bin/kaf2json-daemon
|
179
|
+
- bin/kaf2json-server
|
180
|
+
- config.ru
|
176
181
|
- config/kaf2json.xsl
|
182
|
+
- exec/kaf-to-json.rb
|
177
183
|
- lib/opener/kaf_to_json.rb
|
178
|
-
- lib/opener/kaf_to_json/version.rb
|
179
|
-
- lib/opener/kaf_to_json/server.rb
|
180
184
|
- lib/opener/kaf_to_json/public/markdown.css
|
185
|
+
- lib/opener/kaf_to_json/server.rb
|
186
|
+
- lib/opener/kaf_to_json/version.rb
|
181
187
|
- lib/opener/kaf_to_json/views/index.erb
|
182
188
|
- lib/opener/kaf_to_json/views/result.erb
|
183
|
-
- config.ru
|
184
189
|
- opener-kaf2json.gemspec
|
185
|
-
- README.md
|
186
|
-
- exec/kaf-to-json.rb
|
187
|
-
- bin/kaf2json-daemon
|
188
|
-
- bin/kaf2json-server
|
189
|
-
- bin/kaf2json
|
190
190
|
homepage: http://opener-project.github.com/
|
191
191
|
licenses: []
|
192
192
|
metadata: {}
|
@@ -206,9 +206,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
206
|
version: '0'
|
207
207
|
requirements: []
|
208
208
|
rubyforge_project:
|
209
|
-
rubygems_version: 2.
|
209
|
+
rubygems_version: 2.2.2
|
210
210
|
signing_key:
|
211
211
|
specification_version: 4
|
212
212
|
summary: Converts KAF input into JSON
|
213
213
|
test_files: []
|
214
|
-
has_rdoc: yard
|