opener-polarity-tagger 2.1.3 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -30
- data/bin/polarity-tagger-server +47 -3
- data/exec/polarity-tagger.rb +12 -2
- data/lib/opener/polarity_tagger/version.rb +1 -1
- data/opener-polarity-tagger.gemspec +0 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a41a8366638e7dcb419f2ff47267e273e02c5485
|
4
|
+
data.tar.gz: 5ea3c487d71544423708270222b49ef253d9371f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e74d5fdb704918ad2e255dc51ae022adef4c10551921a3b7851f0c3ae9daea5dfed95896ae95cd3660502faff5dbd5d9006c4c823bb27ac083ea6e5e14a7bc6
|
7
|
+
data.tar.gz: 563d7fe33c442f8062fdc6e5de4e15a73c1e8bc866563986d388d214361181a53a8263e7bb796e28447f749d286d389686b163796f364c6e96d293f1a82c1063
|
data/README.md
CHANGED
@@ -3,8 +3,7 @@ Introduction
|
|
3
3
|
|
4
4
|
This repository contains the code for the OpeNER polarity tagger. This tool tags words in a KAF file with polarity information, which basically is:
|
5
5
|
|
6
|
-
* Polarity information, which represents positive or negative facts in a certain domain. Good, cheap and clean can be positive words in a hotel domain, while
|
7
|
-
bad, expensive and dirty could be negative ones.
|
6
|
+
* Polarity information, which represents positive or negative facts in a certain domain. Good, cheap and clean can be positive words in a hotel domain, while bad, expensive and dirty could be negative ones.
|
8
7
|
* Sentiment modifiers, which modify the polarity of a surrounding polarity word. For instance very or no are sentiment modifiers
|
9
8
|
|
10
9
|
The polarity tagger supports the following languages:
|
@@ -18,11 +17,7 @@ The polarity tagger supports the following languages:
|
|
18
17
|
|
19
18
|
### Confused by some terminology?
|
20
19
|
|
21
|
-
This software is part of a larger collection of natural language processing
|
22
|
-
tools known as "the OpeNER project". You can find more information about the
|
23
|
-
project at [the OpeNER portal](http://opener-project.github.io). There you can
|
24
|
-
also find references to terms like KAF (an XML standard to represent linguistic
|
25
|
-
annotations in texts), component, cores, scenario's and pipelines.
|
20
|
+
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.
|
26
21
|
|
27
22
|
Quick Use Example
|
28
23
|
-----------------
|
@@ -31,16 +26,13 @@ Installing the polarity-tagger can be done by executing:
|
|
31
26
|
|
32
27
|
gem install opener-polarity-tagger
|
33
28
|
|
34
|
-
The polarity tagger uses python. So it is advised to run a virtualenv before
|
35
|
-
installing the gem.
|
29
|
+
The polarity tagger uses python. So it is advised to run a virtualenv before installing the gem.
|
36
30
|
|
37
|
-
Please bare in mind that all components in OpeNER take KAF as an input and
|
38
|
-
output KAF by default.
|
31
|
+
Please bare in mind that all components in OpeNER take KAF as an input and output KAF by default.
|
39
32
|
|
40
33
|
### Command line interface
|
41
34
|
|
42
|
-
You should now be able to call the polarity tagger as a regular shell
|
43
|
-
command: by its name. Once installed the gem normally sits in your path so you can call it directly from anywhere.
|
35
|
+
You should now be able to call the polarity tagger 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.
|
44
36
|
|
45
37
|
This aplication reads a text from standard input in order process it.
|
46
38
|
|
@@ -65,26 +57,20 @@ You can launch a webservice by executing:
|
|
65
57
|
|
66
58
|
polarity-tagger-server
|
67
59
|
|
68
|
-
This will launch a mini webserver with the webservice. It defaults to port 9292,
|
69
|
-
so you can access it at <http://localhost:9292>.
|
60
|
+
This will launch a mini webserver with the webservice. It defaults to port 9292, so you can access it at <http://localhost:9292>.
|
70
61
|
|
71
|
-
To launch it on a different port provide the `-p [port-number]` option like
|
72
|
-
this:
|
62
|
+
To launch it on a different port provide the `-p [port-number]` option like this:
|
73
63
|
|
74
64
|
polarity-tagger-server -p 1234
|
75
65
|
|
76
66
|
It then launches at <http://localhost:1234>
|
77
67
|
|
78
|
-
Documentation on the Webservice is provided by surfing to the urls provided
|
79
|
-
above. For more information on how to launch a webservice run the command with
|
80
|
-
the ```-h``` option.
|
68
|
+
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.
|
81
69
|
|
82
70
|
|
83
71
|
### Daemon
|
84
72
|
|
85
|
-
Last but not least the polarity tagger comes shipped with a daemon that
|
86
|
-
can read jobs (and write) jobs to and from Amazon SQS queues. For more
|
87
|
-
information type:
|
73
|
+
Last but not least the polarity tagger comes shipped with a daemon that can read jobs (and write) jobs to and from Amazon SQS queues. For more information type:
|
88
74
|
|
89
75
|
polarity-tagger-daemon -h
|
90
76
|
|
@@ -92,9 +78,7 @@ information type:
|
|
92
78
|
Description of dependencies
|
93
79
|
---------------------------
|
94
80
|
|
95
|
-
This component runs best if you run it in an environment suited for OpeNER
|
96
|
-
components. You can find an installation guide and helper tools in the [OpeNER installer](https://github.com/opener-project/opener-installer) and an
|
97
|
-
[installation guide on the Opener Website](http://opener-project.github.io/getting-started/how-to/local-installation.html)
|
81
|
+
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 [installation guide on the Opener Website](http://opener-project.github.io/getting-started/how-to/local-installation.html)
|
98
82
|
|
99
83
|
At least you need the following system setup:
|
100
84
|
|
@@ -117,8 +101,7 @@ Language Extension
|
|
117
101
|
The Core
|
118
102
|
--------
|
119
103
|
|
120
|
-
The component is a fat wrapper around the actual language technology core. You
|
121
|
-
can find the core technolies in the ```core/``` folder.
|
104
|
+
The component is a fat wrapper around the actual language technology core. You can find the core technolies in the ``\`core/``` folder.
|
122
105
|
|
123
106
|
Where to go from here
|
124
107
|
---------------------
|
@@ -129,8 +112,8 @@ Where to go from here
|
|
129
112
|
Report problem/Get help
|
130
113
|
-----------------------
|
131
114
|
|
132
|
-
If you encounter problems, please email <support@opener-project.eu> or leave an
|
133
|
-
|
115
|
+
If you encounter problems, please email <support@opener-project.eu> or leave an issue in the
|
116
|
+
[issue tracker](https://github.com/opener-project/polarity-tagger/issues).
|
134
117
|
|
135
118
|
|
136
119
|
Contributing
|
data/bin/polarity-tagger-server
CHANGED
@@ -1,8 +1,52 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'puma/cli'
|
4
|
+
require 'optparse'
|
5
|
+
require 'opener/core/resource_switcher'
|
4
6
|
|
5
|
-
|
7
|
+
# Puma sadly does not provide a system that allows us to cleanly inject custom
|
8
|
+
# options into their CLI. At the same time Puma doesn't provide an easy system
|
9
|
+
# of starting it *without* using the `Puma::CLI` class.
|
10
|
+
#
|
11
|
+
# To work around these problems we create our own parser and ignore any invalid
|
12
|
+
# option errors it throws up. This parser is used to handle options for the
|
13
|
+
# resource switcher.
|
6
14
|
|
7
|
-
|
8
|
-
|
15
|
+
rack_config = File.expand_path('../../config.ru', __FILE__)
|
16
|
+
switcher = Opener::Core::ResourceSwitcher.new
|
17
|
+
switcher_opts = {}
|
18
|
+
show_help = false
|
19
|
+
|
20
|
+
parser = OptionParser.new do |opts|
|
21
|
+
opts.banner = "Usage: #{File.basename($0)} [OPTIONS]"
|
22
|
+
|
23
|
+
opts.separator "\nOptions:\n"
|
24
|
+
|
25
|
+
# Don't abort in this block as we otherwise can't show Puma's help message.
|
26
|
+
opts.on('-h', '--help', 'Shows this help message') do
|
27
|
+
show_help = true
|
28
|
+
|
29
|
+
puts parser
|
30
|
+
end
|
31
|
+
|
32
|
+
switcher.bind(opts, switcher_opts)
|
33
|
+
|
34
|
+
opts.separator "\nPuma Usage:\n\n"
|
35
|
+
end
|
36
|
+
|
37
|
+
begin
|
38
|
+
# Parse destructively so that Puma doesn't break on our custom options.
|
39
|
+
parser.parse!(ARGV)
|
40
|
+
rescue OptionParser::InvalidOption
|
41
|
+
# Catch errors generated by Puma options and ignore them.
|
42
|
+
end
|
43
|
+
|
44
|
+
# Trigger the Puma help message since we overwrite this option and parse
|
45
|
+
# destructively.
|
46
|
+
if show_help
|
47
|
+
ARGV << '--help'
|
48
|
+
end
|
49
|
+
|
50
|
+
switcher.install(switcher_opts)
|
51
|
+
|
52
|
+
Puma::CLI.new([rack_config] + ARGV).run
|
data/exec/polarity-tagger.rb
CHANGED
@@ -1,9 +1,19 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'opener/daemons'
|
4
|
+
require 'opener/core/resource_switcher'
|
5
|
+
|
4
6
|
require_relative '../lib/opener/polarity_tagger'
|
5
7
|
|
6
|
-
|
8
|
+
switcher = Opener::Core::ResourceSwitcher.new
|
9
|
+
switcher_opts = {}
|
10
|
+
|
11
|
+
parser = Opener::Daemons::OptParser.new do |opts|
|
12
|
+
switcher.bind(opts, switcher_opts)
|
13
|
+
end
|
14
|
+
|
15
|
+
options = parser.parse!(ARGV)
|
7
16
|
daemon = Opener::Daemons::Daemon.new(Opener::PolarityTagger, options)
|
8
17
|
|
9
|
-
|
18
|
+
switcher.install(switcher_opts)
|
19
|
+
daemon.start
|