opener-kaf2json 1.1.0-java → 1.1.1-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/kaf2json.xsl +32 -8
- data/lib/opener/kaf_to_json/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 586646679121ccd4d2180500b7638a6a8f1e0d0d
|
4
|
+
data.tar.gz: 024f2d20e458dfc884152014fc42ed1f3b4ff9be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28a9e7055ad249a64e9596cce02263c2714d0008c5f38f5383cb11ea1f405f2076338a203ea8e86d39f75f92eca61bc8cae7acf5f56132e4cc8008dd075f698e
|
7
|
+
data.tar.gz: 5d46f27fc2d8451d4a3e3171b91af971a7aa26744a5d187e4240f94c4bb34437cea0a43153865e87f1794fca48698ab5bce76874c51e0b3c2a8957c589314c24
|
data/config/kaf2json.xsl
CHANGED
@@ -3,27 +3,39 @@
|
|
3
3
|
|
4
4
|
<!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
5
5
|
KAF2JOSN
|
6
|
-
This module convert an xml kaf document into
|
6
|
+
This module convert an xml kaf document into Json version 1.2
|
7
7
|
|
8
|
-
date 23/05/2014
|
9
8
|
Author Andrea Marchetti
|
10
9
|
OpeNER Project
|
10
|
+
|
11
|
+
19/06/2014
|
12
|
+
- sentiments,entities,opinions are inserted into json only if there are into kaf
|
13
|
+
- fixed double quote
|
14
|
+
|
15
|
+
23/05/2014
|
16
|
+
This new version fixes some bugs on opinions and
|
17
|
+
makes some enhancements on sentiments
|
11
18
|
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
|
19
|
+
|
12
20
|
<xsl:output method="text" encoding="utf-8" omit-xml-declaration="yes"/>
|
13
21
|
|
14
22
|
<xsl:template match="/">{
|
15
23
|
"text" : "<xsl:apply-templates select="KAF/text/wf" />",
|
16
24
|
"language" : "<xsl:value-of select="KAF/@xml:lang" />",
|
17
25
|
"terms" : {<xsl:apply-templates select="KAF/terms/term" />},
|
18
|
-
"sentiments": {<xsl:apply-templates select="KAF/terms/term/sentiment"
|
19
|
-
"entities"
|
20
|
-
"opinions"
|
26
|
+
<xsl:if test="KAF/terms/term/sentiment">"sentiments" : {<xsl:apply-templates select="KAF/terms/term/sentiment"/>},</xsl:if>
|
27
|
+
<xsl:if test="KAF/entities/entity" >"entities" : {<xsl:apply-templates select="KAF/entities/entity" />},</xsl:if>
|
28
|
+
<xsl:if test="KAF/opinions/opinion" >"opinions" : {<xsl:apply-templates select="KAF/opinions/opinion" />},</xsl:if>
|
29
|
+
<!-- xsl:if test="KAF/coreferences/coref" >"coreferences": {<xsl:apply-templates select="KAF/coreferences/coref" />},</xsl:if -->
|
21
30
|
"lp" : [<xsl:apply-templates select="KAF/kafHeader//lp" />]
|
22
31
|
}
|
23
32
|
</xsl:template>
|
24
33
|
|
25
34
|
<xsl:template match="wf">
|
26
|
-
<xsl:
|
35
|
+
<xsl:choose>
|
36
|
+
<xsl:when test=".='"'"><xsl:text>\"</xsl:text></xsl:when>
|
37
|
+
<xsl:otherwise><xsl:value-of select="."/><xsl:text> </xsl:text></xsl:otherwise>
|
38
|
+
</xsl:choose>
|
27
39
|
</xsl:template>
|
28
40
|
|
29
41
|
<!-- Levels -->
|
@@ -37,12 +49,13 @@ OpeNER Project
|
|
37
49
|
</xsl:template>
|
38
50
|
|
39
51
|
|
52
|
+
|
40
53
|
<xsl:template match="term">
|
41
54
|
<xsl:variable name="termId" select="@tid"/>
|
42
55
|
"<xsl:value-of select="$termId"/>":
|
43
56
|
{
|
44
57
|
"type" :"<xsl:value-of select="@type" />",
|
45
|
-
"lemma" :"<xsl:value-of select="@lemma"
|
58
|
+
"lemma" :"<xsl:choose><xsl:when test="@lemma='"'">\"</xsl:when><xsl:otherwise><xsl:value-of select="@lemma"/></xsl:otherwise></xsl:choose>",
|
46
59
|
"text" :"<xsl:call-template name="termInside2" />",
|
47
60
|
"pos" :"<xsl:value-of select="@pos" />",
|
48
61
|
"morphofeat" :"<xsl:value-of select="@morphofeat" />"<xsl:if test="sentiment">,
|
@@ -78,6 +91,7 @@ OpeNER Project
|
|
78
91
|
"type" :"<xsl:value-of select="@type" />",
|
79
92
|
"text" :"<xsl:call-template name="entityInside" />",
|
80
93
|
"reference":"<xsl:value-of select="externalReferences/externalRef/@reference" />",
|
94
|
+
"resource" :"<xsl:value-of select="externalReferences/externalRef/@resource" />",
|
81
95
|
"terms" :[<xsl:apply-templates select="references"/>]
|
82
96
|
}<xsl:if test="position()!=last()"><xsl:text>,</xsl:text></xsl:if>
|
83
97
|
</xsl:template>
|
@@ -99,6 +113,11 @@ OpeNER Project
|
|
99
113
|
}<xsl:if test="position()!=last()"><xsl:text>,</xsl:text></xsl:if>
|
100
114
|
</xsl:template>
|
101
115
|
|
116
|
+
<xsl:template match="coref">
|
117
|
+
"<xsl:value-of select="@coid"/>":
|
118
|
+
{
|
119
|
+
}<xsl:if test="position()!=last()"><xsl:text>,</xsl:text></xsl:if>
|
120
|
+
</xsl:template>
|
102
121
|
|
103
122
|
<xsl:template match="opinion_expression|opinion_target|opinion_holder">
|
104
123
|
<xsl:call-template name="termList"/>
|
@@ -159,6 +178,11 @@ OpeNER Project
|
|
159
178
|
|
160
179
|
<xsl:template name="word">
|
161
180
|
<xsl:param name="id"/>
|
162
|
-
<xsl:
|
181
|
+
<xsl:variable name="word" select="//wf[@wid=$id]"/>
|
182
|
+
<xsl:choose>
|
183
|
+
<xsl:when test="$word='"'"><xsl:text>\"</xsl:text></xsl:when>
|
184
|
+
<xsl:otherwise><xsl:value-of select="$word"/></xsl:otherwise>
|
185
|
+
</xsl:choose>
|
163
186
|
</xsl:template>
|
187
|
+
|
164
188
|
</xsl:stylesheet>
|
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.1.
|
4
|
+
version: 1.1.1
|
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-06-
|
11
|
+
date: 2014-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|