opener-tree-tagger 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +150 -0
- data/bin/opener-tree-tagger-daemon +7 -0
- data/bin/opener-tree-tagger-server +11 -0
- data/bin/tree-tagger +7 -0
- data/config.ru +5 -0
- data/core/dutch.map.treetagger.kaf.csv +40 -0
- data/core/english.map.treetagger.kaf.csv +36 -0
- data/core/french.map.treetagger.kaf.csv +33 -0
- data/core/german.map.treetagger.kaf.csv +52 -0
- data/core/italian.map.treetagger.kaf.csv +38 -0
- data/core/site-packages/pre_build/VUKafParserPy-1.0-py2.7.egg-info/PKG-INFO +10 -0
- data/core/site-packages/pre_build/VUKafParserPy-1.0-py2.7.egg-info/SOURCES.txt +7 -0
- data/core/site-packages/pre_build/VUKafParserPy-1.0-py2.7.egg-info/dependency_links.txt +1 -0
- data/core/site-packages/pre_build/VUKafParserPy-1.0-py2.7.egg-info/installed-files.txt +11 -0
- data/core/site-packages/pre_build/VUKafParserPy-1.0-py2.7.egg-info/top_level.txt +1 -0
- data/core/site-packages/pre_build/VUKafParserPy/KafDataObjectsMod.py +165 -0
- data/core/site-packages/pre_build/VUKafParserPy/KafDataObjectsMod.pyc +0 -0
- data/core/site-packages/pre_build/VUKafParserPy/KafParserMod.py +439 -0
- data/core/site-packages/pre_build/VUKafParserPy/KafParserMod.pyc +0 -0
- data/core/site-packages/pre_build/VUKafParserPy/__init__.py +7 -0
- data/core/site-packages/pre_build/VUKafParserPy/__init__.pyc +0 -0
- data/core/spanish.map.treetagger.kaf.csv +75 -0
- data/core/token_matcher.py +82 -0
- data/core/tt_from_kaf_to_kaf.py +215 -0
- data/exec/tree-tagger.rb +9 -0
- data/ext/hack/Rakefile +13 -0
- data/ext/hack/support.rb +38 -0
- data/lib/opener/tree_tagger.rb +69 -0
- data/lib/opener/tree_tagger/cli.rb +69 -0
- data/lib/opener/tree_tagger/public/markdown.css +284 -0
- data/lib/opener/tree_tagger/server.rb +16 -0
- data/lib/opener/tree_tagger/version.rb +5 -0
- data/lib/opener/tree_tagger/views/index.erb +96 -0
- data/lib/opener/tree_tagger/views/result.erb +15 -0
- data/opener-tree-tagger.gemspec +35 -0
- data/pre_build_requirements.txt +1 -0
- metadata +197 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b28b43d43758b577a224654b1d13a904544c3472
|
4
|
+
data.tar.gz: 6c0359925f27fe733a72425a97da3ff730441453
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 10ccf8aa51f752587c42768839270368ef6448192157570e15d65f8291a41a4ecd93bef059cda82a4ec70771177af5b8609dc98e3234b5c8f4e1230e8eb4759b
|
7
|
+
data.tar.gz: e8b74d458942a42ef391a4ab4533641a7de37c24a4aebb7634df0a5b09dace5a6adb3f122b6034d9624f768129b9c5db3078652c68ce3d7f757aac53f306c67f
|
data/README.md
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
[![Build Status](https://drone.io/github.com/opener-project/VU-tree-tagger_kernel/status.png)](https://drone.io/github.com/opener-project/VU-tree-tagger_kernel/latest)
|
2
|
+
|
3
|
+
Introduction
|
4
|
+
------------
|
5
|
+
|
6
|
+
This module implements a wrapper to process text with the PoS tagger TreeTagger. TreeTagger is a tool that assigns the lemmas and part-of-speech information to an input text.
|
7
|
+
This module takes KAF as input, with the token layer created (for instance by one of our tokenizer modules) and outputs KAF with a new term layer. It is important to note
|
8
|
+
that the token layer in the input is not modified in the output, so the program takes care of performing the correct matching between the term and the token layer.
|
9
|
+
|
10
|
+
By default this module works for text in English, Dutch and German, but can be easily extended to other languages. The language of the input KAF text has to be specified through
|
11
|
+
the attribute xml:lang in the main KAF element.
|
12
|
+
|
13
|
+
### Confused by some terminology?
|
14
|
+
|
15
|
+
This software is part of a larger collection of natural language processing
|
16
|
+
tools known as "the OpeNER project". You can find more information about the
|
17
|
+
project at (the OpeNER portal)[http://opener-project.github.io]. There you can
|
18
|
+
also find references to terms like KAF (an XML standard to represent linguistic
|
19
|
+
annotations in texts), component, cores, scenario's and pipelines.
|
20
|
+
|
21
|
+
Quick Use Example
|
22
|
+
-----------------
|
23
|
+
|
24
|
+
Installing the tree-tagger can be done by executing:
|
25
|
+
|
26
|
+
gem install opener-tree-tagger
|
27
|
+
|
28
|
+
Also make sure you have tree-tagger and the proper language files installed AND
|
29
|
+
that you set the path to the tree-tagger in the TREE_TAGGER_PATH environment
|
30
|
+
variable.
|
31
|
+
|
32
|
+
Besides that, make sure you install lxml. You can probably achieve this by
|
33
|
+
typing
|
34
|
+
|
35
|
+
pip install lxml
|
36
|
+
|
37
|
+
If that doesn't work, please check the (installation guide on the OpeNER
|
38
|
+
portal)[http://opener-project.github.io/getting-started/how-to/local-installation.html].
|
39
|
+
|
40
|
+
Please bare in mind that all components in OpeNER take KAF as an input and
|
41
|
+
output KAF by default.
|
42
|
+
|
43
|
+
### Command line interface
|
44
|
+
|
45
|
+
You should now be able to call the tree-tagger as a regular shell
|
46
|
+
command: by its name. Once installed the gem normalyl sits in your path so you can call it directly from anywhere.
|
47
|
+
|
48
|
+
This aplication reads a text from standard input in order to identify the language.
|
49
|
+
|
50
|
+
cat some_kind_of_kaf_file.kaf | tree-tagger
|
51
|
+
|
52
|
+
|
53
|
+
This will output KAF xml.
|
54
|
+
|
55
|
+
### Webservices
|
56
|
+
|
57
|
+
You can launch a language identification webservice by executing:
|
58
|
+
|
59
|
+
tree-tagger-server
|
60
|
+
|
61
|
+
This will launch a mini webserver with the webservice. It defaults to port 9292,
|
62
|
+
so you can access it at <http://localhost:9292>.
|
63
|
+
|
64
|
+
To launch it on a different port provide the `-p [port-number]` option like
|
65
|
+
this:
|
66
|
+
|
67
|
+
tree-tagger-server -p 1234
|
68
|
+
|
69
|
+
It then launches at <http://localhost:1234>
|
70
|
+
|
71
|
+
Documentation on the Webservice is provided by surfing to the urls provided
|
72
|
+
above. For more information on how to launch a webservice run the command with
|
73
|
+
the ```-h``` option.
|
74
|
+
|
75
|
+
|
76
|
+
### Daemon
|
77
|
+
|
78
|
+
Last but not least the tree-tagger comes shipped with a daemon that
|
79
|
+
can read jobs (and write) jobs to and from Amazon SQS queues. For more
|
80
|
+
information type:
|
81
|
+
|
82
|
+
tree-tagger-daemon -h
|
83
|
+
|
84
|
+
|
85
|
+
Description of dependencies
|
86
|
+
---------------------------
|
87
|
+
|
88
|
+
This component runs best if you run it in an environment suited for OpeNER
|
89
|
+
components. You can find an installation guide and helper tools in the (OpeNER
|
90
|
+
installer)[https://github.com/opener-project/opener-installer] and (an
|
91
|
+
installation guide on the Opener
|
92
|
+
Website)[http://opener-project.github.io/getting-started/how-to/local-installation.html]
|
93
|
+
|
94
|
+
At least you need the following system setup:
|
95
|
+
|
96
|
+
### Depenencies for normal use:
|
97
|
+
|
98
|
+
* Ruby (Tested on MRI and JRuby) 1.9.3
|
99
|
+
* Python 2.6
|
100
|
+
* LXML installed
|
101
|
+
* This module has a dependency on the following external module: TreeTagger (http://www.ims.uni-stuttgart.de/projekte/corplex/TreeTagger/) More information is further down in this document.
|
102
|
+
* Tree tagger installed and it's path know in TREE_TAGGER_PATH environment
|
103
|
+
variable.
|
104
|
+
|
105
|
+
If TreeTagger is not installed in your machine
|
106
|
+
you can download it from http://www.ims.uni-stuttgart.de/projekte/corplex/TreeTagger/ and follow the installation instructions. To indicate to our scripts where
|
107
|
+
TreeTagger is located, you have to set an environment variable with the
|
108
|
+
location:
|
109
|
+
|
110
|
+
```shell
|
111
|
+
export TREE_TAGGER_PATH=/usr/local/TreeTagger/
|
112
|
+
```
|
113
|
+
|
114
|
+
It is advised you add the path to the tree tagger in your bash or zsh profile by
|
115
|
+
adding it to ```~/.bash_profile``` or ```~/.zshrc```
|
116
|
+
|
117
|
+
Language Extension
|
118
|
+
------------------
|
119
|
+
|
120
|
+
The tree-tagger depends on the availability of Tree Tagger models. Check
|
121
|
+
out the tree tagger website for more languages. Also you'll have to update the
|
122
|
+
py files in the core directory.
|
123
|
+
|
124
|
+
The Core
|
125
|
+
--------
|
126
|
+
|
127
|
+
The component is a fat wrapper around the actual language technology core. You
|
128
|
+
can find the core technolies in the core directory of this repository.
|
129
|
+
|
130
|
+
Where to go from here
|
131
|
+
---------------------
|
132
|
+
|
133
|
+
* Check (the project websitere)[http://opener-project.github.io]
|
134
|
+
* (Checkout the webservice)[http://opener.olery.com/tree-tagger]
|
135
|
+
|
136
|
+
Report problem/Get help
|
137
|
+
-----------------------
|
138
|
+
|
139
|
+
If you encounter problems, please email support@opener-project.eu or leave an
|
140
|
+
issue in the (issue tracker)[https://github.com/opener-project/tree-tagger/issues].
|
141
|
+
|
142
|
+
|
143
|
+
Contributing
|
144
|
+
------------
|
145
|
+
|
146
|
+
1. Fork it ( http://github.com/opener-project/tree-tagger/fork )
|
147
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
148
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
149
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
150
|
+
5. Create new Pull Request
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rack'
|
4
|
+
|
5
|
+
# Without calling `Rack::Server#options` manually the CLI arguments will never
|
6
|
+
# be passed, thus the application can't be specified as a constructor argument.
|
7
|
+
server = Rack::Server.new
|
8
|
+
server.options[:config] = File.expand_path('../../config.ru', __FILE__)
|
9
|
+
|
10
|
+
server.start
|
11
|
+
|
data/bin/tree-tagger
ADDED
data/config.ru
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
adj G adjective
|
2
|
+
adj*kop G truncated adjective
|
3
|
+
adjabbr G abbreviated adjective
|
4
|
+
adv A adverb
|
5
|
+
advabbr A abbreviated adverb
|
6
|
+
conjcoord C coordinating conjunction
|
7
|
+
conjsubo C subordinating conjunction
|
8
|
+
det__art D article
|
9
|
+
det__demo D attributively used demonstrative pronoun
|
10
|
+
det__indef D attributively used indefinite pronoun
|
11
|
+
det__poss D attributively used possessive pronoun
|
12
|
+
det__quest D attributively used question pronoun
|
13
|
+
det__rel D attributively used relative pronoun
|
14
|
+
int O interjection
|
15
|
+
noun*kop N truncated noun
|
16
|
+
nounabbr N abbreviated noun
|
17
|
+
nounpl N plural noun
|
18
|
+
nounprop R proper name
|
19
|
+
nounsg N singular noun
|
20
|
+
num__card O cardinal number
|
21
|
+
num__ord O ordinal number
|
22
|
+
partte O particle "te"
|
23
|
+
prep P preposition
|
24
|
+
prepabbr P abbreviated preposition
|
25
|
+
pronadv Q pronomial adverb
|
26
|
+
prondemo Q demonstrative pronoun (used substitutively)
|
27
|
+
pronindef Q indefined pronoun
|
28
|
+
pronpers Q personal pronoun
|
29
|
+
pronposs Q possessive pronoun
|
30
|
+
pronquest Q question pronoun
|
31
|
+
pronrefl Q reflexive pronoun
|
32
|
+
pronrel Q relative pronoun
|
33
|
+
punc O (non-sentential) punctuation
|
34
|
+
verbinf V infinitival verb
|
35
|
+
verbpapa V past participle verb
|
36
|
+
verbpastpl V plural past tense verb
|
37
|
+
verbpastsg V singular past tense verb
|
38
|
+
verbpresp V present participle verb
|
39
|
+
verbprespl V plural present tense verb
|
40
|
+
verbpressg V singular present tense verb
|
@@ -0,0 +1,36 @@
|
|
1
|
+
CC C coordinating conjunttion
|
2
|
+
CD O cardinal number
|
3
|
+
DT D determiner
|
4
|
+
EX O Existential there
|
5
|
+
FW O Foreign word
|
6
|
+
IN P Preposition or subordinating
|
7
|
+
JJ G Adjective
|
8
|
+
JJR G Adjective comparative
|
9
|
+
JJS G Adjective superlative
|
10
|
+
LS O List item marker
|
11
|
+
MD V Modal
|
12
|
+
NN N Noun singular
|
13
|
+
NNS N Noun plural
|
14
|
+
NP R Proper noun, singular
|
15
|
+
NPS R Proper noun, plural
|
16
|
+
PDT D Predeterminer
|
17
|
+
POS O Possesive ending
|
18
|
+
PP Q Personal pronoun
|
19
|
+
PP$ Q Posssisve pronoun
|
20
|
+
RB A Adverb
|
21
|
+
RBR A Adverb comparative
|
22
|
+
RBS A Adverb superlative
|
23
|
+
RP O Particle
|
24
|
+
SYM O Symbol
|
25
|
+
TO O to
|
26
|
+
UH O Interjection
|
27
|
+
VB V Verb, base form
|
28
|
+
VBD V Verb, past tense form
|
29
|
+
VBG V Verb, gerund or present participle
|
30
|
+
VBN V Verb, past participle
|
31
|
+
VBP V Verb, non 3rd person singular present
|
32
|
+
VBZ V Verb, 3rd person singular present
|
33
|
+
WDT D Wh-determiner
|
34
|
+
WP Q Wh-pronoun
|
35
|
+
WP$ Q Possesive wh-pronoun
|
36
|
+
WRB A Wh-adverb
|
@@ -0,0 +1,33 @@
|
|
1
|
+
ABR O abreviation
|
2
|
+
ADJ G adjective
|
3
|
+
ADV A adverb
|
4
|
+
DET:ART D article
|
5
|
+
DET:POS Q possessive pronoun (ma, ta, ...)
|
6
|
+
INT O interjection
|
7
|
+
KON C conjunction
|
8
|
+
NAM R proper name
|
9
|
+
NOM N noun
|
10
|
+
NUM O numeral
|
11
|
+
PRO Q pronoun
|
12
|
+
PRO:DEM Q demonstrative pronoun
|
13
|
+
PRO:IND Q indefinite pronoun
|
14
|
+
PRO:PER Q personal pronoun
|
15
|
+
PRO:POS Q possessive pronoun (mien, tien, ...)
|
16
|
+
PRO:REL Q relative pronoun
|
17
|
+
PRP O preposition
|
18
|
+
PRP:det O preposition plus article (au,du,aux,des)
|
19
|
+
PUN O punctuation
|
20
|
+
PUN:cit O punctuation citation
|
21
|
+
SENT O sentence tag
|
22
|
+
SYM O symbol
|
23
|
+
VER:cond V verb conditional
|
24
|
+
VER:futu V verb futur
|
25
|
+
VER:impe V verb imperative
|
26
|
+
VER:impf V verb imperfect
|
27
|
+
VER:infi V verb infinitive
|
28
|
+
VER:pper V verb past participle
|
29
|
+
VER:ppre V verb present participle
|
30
|
+
VER:pres V verb present
|
31
|
+
VER:simp V verb simple past
|
32
|
+
VER:subi V verb subjunctive imperfect
|
33
|
+
VER:subp V verb subjunctive presentc
|
@@ -0,0 +1,52 @@
|
|
1
|
+
ADJA G ("Attributives Adjektiv"),
|
2
|
+
ADJD G ("Adverbiales oder pr�dikatives Adjektiv"),
|
3
|
+
ADV A ("Adverb"),
|
4
|
+
APPR P ("Pr�position; Zirkumposition links"),
|
5
|
+
APPRART P ("Pr�position mit Artikel"),
|
6
|
+
APPO P ("Postposition"),
|
7
|
+
APZR P ("Zirkumposition rechts"),
|
8
|
+
ART D ("Bestimmer oder unbestimmer Artikel"),
|
9
|
+
CARD O ("Kardinalzahl"),
|
10
|
+
FM O ("Fremdsprachichles Material"),
|
11
|
+
ITJ O ("Interjektion"),
|
12
|
+
KOUI C ("unterordnende Konjunktion mit zu und Infinitiv"),
|
13
|
+
KOUS C ("unterordnende Konjunktion mit Satz"),
|
14
|
+
KON C ("nebenordnende Konjunktion"),
|
15
|
+
KOKOM C ("Vergleichskonjunktion"),
|
16
|
+
NN N ("normales Nomen"),
|
17
|
+
NE R ("Eigennamen"),
|
18
|
+
PDS Q ("substituierendes Demonstrativpronomen"),
|
19
|
+
PDAT Q ("attribuierendes Demonstrativpronomen"),
|
20
|
+
PIS Q ("substituierendes Indefinitpronomen"),
|
21
|
+
PIAT Q ("attribuierendes Indefinitpronomen ohne Determiner"),
|
22
|
+
PIDAT Q ("attribuierendes Indefinitpronomen mit Determiner"),
|
23
|
+
PPER Q ("irreflexives Personalpronomen"),
|
24
|
+
PPOSS Q ("substituierendes Possessivpronomen"),
|
25
|
+
PPOSAT Q ("attribuierendes Possessivpronomen"),
|
26
|
+
PRELS Q ("substituierendes Relativpronomen"),
|
27
|
+
PRELAT Q ("attribuierendes Relativpronomen"),
|
28
|
+
PRF Q ("reflexives Personalpronomen"),
|
29
|
+
PWS Q ("substituierendes Interrogativpronomen"),
|
30
|
+
PWAT Q ("attribuierendes Interrogativpronomen"),
|
31
|
+
PWAV Q ("adverbiales Interrogativ- oder Relativpronomen"),
|
32
|
+
PAV Q ("Pronominaladverb"),
|
33
|
+
PTKZU O ("zu vor Infinitiv"),
|
34
|
+
PTKNEG O ("Negationspartike"),
|
35
|
+
PTKVZ V ("abgetrennter Verbzusatz"),
|
36
|
+
PTKANT O ("Antwortpartikel"),
|
37
|
+
PTKA O ("Partikel bei Adjektiv oder Adverb"),
|
38
|
+
TRUNC N ("Kompositions-Erstglied"),
|
39
|
+
VVFIN V ("finites Verb, voll"),
|
40
|
+
VVIMP V ("Imperativ, voll"),
|
41
|
+
VVINF V ("Infinitiv"),
|
42
|
+
VVIZU V ("Infinitiv mit zu"),
|
43
|
+
VVPP V ("Partizip Perfekt"),
|
44
|
+
VAFIN V ("finites Verb, aux"),
|
45
|
+
VAIMP V ("Imperativ, aux"),
|
46
|
+
VAINF V ("Infinitiv, aux"),
|
47
|
+
VAPP V ("Partizip Perfekt"),
|
48
|
+
VMFIN V ("finites Verb, modal"),
|
49
|
+
VMINF V ("Infinitiv, modal"),
|
50
|
+
VMPP V ("Partizip Perfekt, modal"),
|
51
|
+
XY O ("Nichtwort, Sonderzeichen"),
|
52
|
+
UNDEFINED O ("Nicht definiert, zb. Satzzeichen");
|
@@ -0,0 +1,38 @@
|
|
1
|
+
ABR O abbreviation
|
2
|
+
ADJ G adjective
|
3
|
+
ADV A adverb
|
4
|
+
CON C conjunction
|
5
|
+
DET:def D definite article
|
6
|
+
DET:indef D indefinite article
|
7
|
+
FW O foreign word
|
8
|
+
INT O interjection
|
9
|
+
LS O list symbol
|
10
|
+
NOM N noun
|
11
|
+
NPR R name
|
12
|
+
NUM O numeral
|
13
|
+
PON O punctuation
|
14
|
+
PRE O preposition
|
15
|
+
PRE:det O preposition+article
|
16
|
+
PRO Q pronoun
|
17
|
+
PRO:demo Q demonstrative pronoun
|
18
|
+
PRO:indef Q indefinite pronoun
|
19
|
+
PRO:inter Q interrogative pronoun
|
20
|
+
PRO:pers Q personal pronoun
|
21
|
+
PRO:poss Q possessive pronoun
|
22
|
+
PRO:refl Q reflexive pronoun
|
23
|
+
PRO:rela Q relative pronoun
|
24
|
+
SENT O sentence marker
|
25
|
+
SYM O symbol
|
26
|
+
VER:cimp V verb conjunctive imperfect
|
27
|
+
VER:cond V verb conditional
|
28
|
+
VER:cpre V verb conjunctive present
|
29
|
+
VER:futu V verb future tense
|
30
|
+
VER:geru V verb gerund
|
31
|
+
VER:impe V verb imperative
|
32
|
+
VER:impf V verb imperfect
|
33
|
+
VER:infi V verb infinitive
|
34
|
+
VER:pper V verb participle perfect
|
35
|
+
VER:ppre V verb participle present
|
36
|
+
VER:pres V verb present
|
37
|
+
VER:refl:infi V verb reflexive infinitive
|
38
|
+
VER:remo V verb simple past
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
../VUKafParserPy/KafParserMod.py
|
2
|
+
../VUKafParserPy/__init__.py
|
3
|
+
../VUKafParserPy/KafDataObjectsMod.py
|
4
|
+
../VUKafParserPy/KafParserMod.pyc
|
5
|
+
../VUKafParserPy/__init__.pyc
|
6
|
+
../VUKafParserPy/KafDataObjectsMod.pyc
|
7
|
+
./
|
8
|
+
top_level.txt
|
9
|
+
SOURCES.txt
|
10
|
+
PKG-INFO
|
11
|
+
dependency_links.txt
|
@@ -0,0 +1 @@
|
|
1
|
+
VUKafParserPy
|
@@ -0,0 +1,165 @@
|
|
1
|
+
class KafTermSentiment:
|
2
|
+
def __init__(self):
|
3
|
+
self.resource=None
|
4
|
+
self.polarity=None
|
5
|
+
self.strength=None
|
6
|
+
self.subjectivity=None
|
7
|
+
|
8
|
+
def simpleInit(self,r,p,st,su,sm=None):
|
9
|
+
self.resource=r
|
10
|
+
self.polarity=p
|
11
|
+
self.strength=st
|
12
|
+
self.subjectivity=su
|
13
|
+
self.sentiment_modifier = sm
|
14
|
+
|
15
|
+
def getPolarity(self):
|
16
|
+
return self.polarity
|
17
|
+
|
18
|
+
def getSentimentModifier(self):
|
19
|
+
return self.sentiment_modifier
|
20
|
+
|
21
|
+
|
22
|
+
class KafToken:
|
23
|
+
def __init__(self,wid, value, sent=None, para=None):
|
24
|
+
self.token_id = wid
|
25
|
+
self.value = value
|
26
|
+
self.sent = sent
|
27
|
+
self.para = para
|
28
|
+
|
29
|
+
|
30
|
+
class KafOpinionExpression:
|
31
|
+
def __init__(self,polarity,strength,targets):
|
32
|
+
self.polarity = polarity
|
33
|
+
self.strength = strength
|
34
|
+
self.targets = targets
|
35
|
+
|
36
|
+
def __str__(self):
|
37
|
+
return 'Op_exp==> pol:'+self.polarity+' Str:'+self.strength+' ids:'+'-'.join(self.targets)
|
38
|
+
|
39
|
+
class KafOpinion:
|
40
|
+
def __init__(self,id,holders, targets, opi_exp):
|
41
|
+
self.id = id
|
42
|
+
self.holders = holders
|
43
|
+
self.targets = targets
|
44
|
+
self.opi_exp = opi_exp
|
45
|
+
|
46
|
+
def __str__(self):
|
47
|
+
c='Opinion id'+self.id+'\n'
|
48
|
+
c+=' Holders: '+'-'.join(self.holders)+'\n'
|
49
|
+
c+=' Targets: '+'-'.join(self.targets)+'\n'
|
50
|
+
c+=str(self.opi_exp)
|
51
|
+
return c
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
class KafSingleProperty:
|
56
|
+
def __init__(self,id,type,targets):
|
57
|
+
self.id = id
|
58
|
+
self.type = type
|
59
|
+
self.targets = targets
|
60
|
+
|
61
|
+
|
62
|
+
def get_id(self):
|
63
|
+
return self.id
|
64
|
+
|
65
|
+
def get_type(self):
|
66
|
+
return self.type
|
67
|
+
|
68
|
+
def get_span(self):
|
69
|
+
return self.targets
|
70
|
+
|
71
|
+
def __str__(self):
|
72
|
+
return 'Id: '+self.id+' Type: '+self.type+' ids:'+' '.join(self.targets)
|
73
|
+
|
74
|
+
|
75
|
+
class KafSingleEntity:
|
76
|
+
def __init__(self,id,type,targets):
|
77
|
+
self.id = id
|
78
|
+
self.type = type
|
79
|
+
self.targets = targets
|
80
|
+
|
81
|
+
def get_id(self):
|
82
|
+
return self.id
|
83
|
+
|
84
|
+
def get_type(self):
|
85
|
+
return self.type
|
86
|
+
|
87
|
+
def get_span(self):
|
88
|
+
return self.targets
|
89
|
+
|
90
|
+
def __str__(self):
|
91
|
+
return 'Id: '+self.id+' Type: '+self.type+' ids:'+' '.join(self.targets)
|
92
|
+
|
93
|
+
class KafTerm:
|
94
|
+
def __init__(self):
|
95
|
+
self.tid = None
|
96
|
+
self.lemma = None
|
97
|
+
self.pos = None
|
98
|
+
self.morphofeat = None
|
99
|
+
self.sentiment = None
|
100
|
+
self.list_span_id = []
|
101
|
+
|
102
|
+
def get_morphofeat(self):
|
103
|
+
return self.morphofeat
|
104
|
+
|
105
|
+
def set_list_span_id(self, L):
|
106
|
+
self.list_span_id = L
|
107
|
+
|
108
|
+
def get_list_span(self):
|
109
|
+
return self.list_span_id
|
110
|
+
|
111
|
+
def get_polarity(self):
|
112
|
+
if self.sentiment != None:
|
113
|
+
return self.sentiment.getPolarity()
|
114
|
+
else:
|
115
|
+
return None
|
116
|
+
|
117
|
+
def get_sentiment_modifier(self):
|
118
|
+
if self.sentiment != None:
|
119
|
+
return self.sentiment.getSentimentModifier()
|
120
|
+
else:
|
121
|
+
return None
|
122
|
+
|
123
|
+
|
124
|
+
def setSentiment(self,my_sent):
|
125
|
+
self.sentiment = my_sent
|
126
|
+
|
127
|
+
def getSentiment(self):
|
128
|
+
return self.sentiment
|
129
|
+
|
130
|
+
def getLemma(self):
|
131
|
+
return self.lemma
|
132
|
+
|
133
|
+
def setLemma(self,lemma):
|
134
|
+
self.lemma = lemma
|
135
|
+
|
136
|
+
def getPos(self):
|
137
|
+
return self.pos
|
138
|
+
|
139
|
+
def setPos(self,pos):
|
140
|
+
self.pos = pos
|
141
|
+
|
142
|
+
def getId(self):
|
143
|
+
return self.tid
|
144
|
+
|
145
|
+
def setId(self,id):
|
146
|
+
self.tid = id
|
147
|
+
|
148
|
+
def getShortPos(self):
|
149
|
+
if self.pos==None:
|
150
|
+
return None
|
151
|
+
auxpos=self.pos.lower()[0]
|
152
|
+
if auxpos == 'g': auxpos='a'
|
153
|
+
elif auxpos == 'a': auxpos='r'
|
154
|
+
return auxpos
|
155
|
+
|
156
|
+
def __str__(self):
|
157
|
+
if self.tid and self.lemma and self.pos:
|
158
|
+
return self.tid+'\n\t'+self.lemma.encode('utf-8')+'\n\t'+self.pos
|
159
|
+
else:
|
160
|
+
return 'None'
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|