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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af051722a959ec00c10c52a501dbd384a73b8e8e
4
- data.tar.gz: 08a3c059f5e3e62ace4388782ae1d4f4775f3e15
3
+ metadata.gz: 586646679121ccd4d2180500b7638a6a8f1e0d0d
4
+ data.tar.gz: 024f2d20e458dfc884152014fc42ed1f3b4ff9be
5
5
  SHA512:
6
- metadata.gz: fcf28a2436734e40e355dfad7c0fb0ea20b0bd0a7b8269e3b21c2ed115f11f908e845156b6eee174792e4c88573f25f63821f60f93f102394c2f6ede8c2dc611
7
- data.tar.gz: c6445c969cec5ee6aa679d21968d1c92fb2bcba57a93e1a6fbee8cc660b97efae3d9429aafdefe627d03a548f9e372258a21454a3b03ccea897883c6a46e1be7
6
+ metadata.gz: 28a9e7055ad249a64e9596cce02263c2714d0008c5f38f5383cb11ea1f405f2076338a203ea8e86d39f75f92eca61bc8cae7acf5f56132e4cc8008dd075f698e
7
+ data.tar.gz: 5d46f27fc2d8451d4a3e3171b91af971a7aa26744a5d187e4240f94c4bb34437cea0a43153865e87f1794fca48698ab5bce76874c51e0b3c2a8957c589314c24
@@ -3,27 +3,39 @@
3
3
 
4
4
  <!--+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5
5
  KAF2JOSN
6
- This module convert an xml kaf document into Jsonversion 1.2
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" : {<xsl:apply-templates select="KAF/entities/entity" />},
20
- "opinions" : {<xsl:apply-templates select="KAF/opinions/opinion" />},
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:value-of select="."/><xsl:text> </xsl:text>
35
+ <xsl:choose>
36
+ <xsl:when test=".='&quot;'"><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='&quot;'">\"</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:value-of select="//wf[@wid=$id]"/>
181
+ <xsl:variable name="word" select="//wf[@wid=$id]"/>
182
+ <xsl:choose>
183
+ <xsl:when test="$word='&quot;'"><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>
@@ -1,5 +1,5 @@
1
1
  module Opener
2
2
  class KafToJson
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
4
4
  end
5
5
  end
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.0
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-19 00:00:00.000000000 Z
11
+ date: 2014-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder