opener-property-tagger 2.1.1 → 2.2.0

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: 01266e13df09e19768ca16aba60a5dde22334d38
4
- data.tar.gz: 73fa035f1949b9a45efdd28cbe2fa51edf41a418
3
+ metadata.gz: f201757321597f1b138fad992d4e5a2df4487130
4
+ data.tar.gz: 94ffa11cd6417f680ad910c586a63546bca2ccca
5
5
  SHA512:
6
- metadata.gz: c0317a20e5d4aca38d4cdfde47a9911143b024bdab221c00714f81079231093cdf627866744a18a73ab38f278fc8bea451195ba9f7ac928ac19763a5e63c1c38
7
- data.tar.gz: c83585d02d72f38cc6f3ebf2386ad6c399772b1e4e094595b1a7b3d3ab3f6918ea53894f4b5dfa6f932053d11b1398ef8e2503e412808e21a367e299cacbd7d3
6
+ metadata.gz: c81059508ccb04d2eccf5061f8005dde9579558260b70eb1ca30d5476926a251a617a67f46c5d81e1e31abcd9e9a5ac45aae6972a0e29d78699c6129c3c92688
7
+ data.tar.gz: a15dad65f9291d2ea34a0969f3b885b6656818b20dbecefa9a9dddc42dd9e81c3ff64d6fca9512f8238b88595d64fcbab915d13c9fa0bd532d5324e5fa1a401b
data/README.md CHANGED
@@ -1,45 +1,33 @@
1
1
  Property Tagger
2
2
  ---------------
3
3
 
4
- This module implements a tagger for hotel properties for Dutch, English, French, Italian, Spanish and German. It detects aspect words,
5
- for instance words related with "room", "cleanliness", "staff" or "breakfast" and links them with the correct aspect class.
6
- The input for this module has to be a valid KAF file with at lest the term layer, as the lemmas will be used for detecting the hotel properties. The output is also
7
- a KAF valid file extended with the property layer. This module works for all the languages within the OpeNER project (en,de,nl,fr,es,it) and the language is read from
8
- the input KAF file, from the lang attribute of the KAF element (make sure your preprocessors set properly this value or you might use the resources for a wrong language)
4
+ This module implements a tagger for hotel properties for Dutch, English, French, Italian, Spanish and German. It detects aspect words, for instance words related with "room", "cleanliness", "staff" or "breakfast" and links them with the correct aspect class. The input for this module has to be a valid KAF file with at lest the term layer, as the lemmas will be used for detecting the hotel properties. The output is also a KAF valid file extended with the property layer. This module works for all the languages within the OpeNER project (en,de,nl,fr,es,it) and the language is read from the input KAF file, from the lang attribute of the KAF element (make sure your preprocessors set properly this value or you might use the resources for a wrong language)
9
5
 
10
6
  ### Confused by some terminology?
11
7
 
12
- This software is part of a larger collection of natural language processing
13
- tools known as "the OpeNER project". You can find more information about the
14
- project at the [OpeNER portal](http://opener-project.github.io). There you can
15
- also find references to terms like KAF (an XML standard to represent linguistic
16
- 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.
17
9
 
18
10
  Quick Use Example
19
11
  -----------------
20
12
 
21
- Keep in mind that this component uses PYTHON so it's advised to make sure you
22
- have a virtualenv activated before installing.
13
+ Keep in mind that this component uses PYTHON so it's advised to make sure you have a virtualenv activated before installing.
23
14
 
24
15
  Installing the property-tagger can be done by executing:
25
16
 
26
17
  gem install opener-property-tagger
27
18
 
28
- Please bare in mind that all components in OpeNER take KAF as an input and
29
- output KAF by default.
19
+ Please keep in mind that all components in OpeNER take KAF as an input and output KAF by default.
30
20
 
31
21
 
32
22
  ### Command line interface
33
23
 
34
- You should now be able to call the property tagger as a regular shell
35
- command: by its name. Once installed the gem normally sits in your path so you can call it directly from anywhere.
24
+ You should now be able to call the property 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.
36
25
 
37
26
  This application reads a text from standard input in order process it.
38
27
 
39
28
  cat some_kind_of_kaf_file.kaf | property-tagger --resource-path /path/to/lexicons/
40
29
 
41
- The property tagger will search in the resource-path for files named
42
- ```{language_code}.txt```, for example ```en.txt```.
30
+ The property tagger will search in the resource-path for files named ```{language_code}.txt```, for example ```en.txt```.
43
31
 
44
32
  An excerpt of a potential output would than be:
45
33
 
@@ -84,26 +72,20 @@ You can launch a webservice by executing:
84
72
 
85
73
  property-tagger-server --resource-path /path/to/resources
86
74
 
87
- This will launch a mini webserver with the webservice. It defaults to port 9292,
88
- so you can access it at <http://localhost:9292>.
75
+ This will launch a mini webserver with the webservice. It defaults to port 9292, so you can access it at <http://localhost:9292>.
89
76
 
90
- To launch it on a different port provide the `-p [port-number]` option like
91
- this:
77
+ To launch it on a different port provide the `-p [port-number]` option like this:
92
78
 
93
79
  property-tagger-server -p 1234
94
80
 
95
81
  It then launches at <http://localhost:1234>
96
82
 
97
- Documentation on the Webservice is provided by surfing to the urls provided
98
- above. For more information on how to launch a webservice run the command with
99
- the ```-h``` option.
83
+ 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.
100
84
 
101
85
 
102
86
  ### Daemon
103
87
 
104
- Last but not least the property tagger comes shipped with a daemon that
105
- can read jobs (and write) jobs to and from Amazon SQS queues. For more
106
- information type:
88
+ Last but not least the property tagger comes shipped with a daemon that can read jobs (and write) jobs to and from Amazon SQS queues. For more information type:
107
89
 
108
90
  property-tagger-daemon -h
109
91
 
@@ -111,9 +93,7 @@ information type:
111
93
  Description of dependencies
112
94
  ---------------------------
113
95
 
114
- This component runs best if you run it in an environment suited for OpeNER
115
- components. You can find an installation guide and helper tools in the [OpeNER installer](https://github.com/opener-project/opener-installer) and an
116
- [installation guide on the Opener Website](http://opener-project.github.io/getting-started/how-to/local-installation.html)
96
+ 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)
117
97
 
118
98
  At least you need the following system setup:
119
99
 
@@ -139,14 +119,12 @@ The lexicons in the resource path must be stored in a file and follow this forma
139
119
  surfing verb facilities
140
120
 
141
121
 
142
- So, one aspect per line, with 3 fields separated by a tabulator, the first one is the word or span of words (in this case use whitespaces), then the part
143
- of speech (which actually it is not use, you can include a dummy label) and finally the aspect class associated with the word.
122
+ So, one aspect per line, with 3 fields separated by a tabulator, the first one is the word or span of words (in this case use whitespaces), then the part of speech (which actually it is not use, you can include a dummy label) and finally the aspect class associated with the word.
144
123
 
145
124
  The Core
146
125
  --------
147
126
 
148
- The component is a fat wrapper around the actual language technology core. You
149
- can find the core technolies (python) in the ```/core``` directory.
127
+ The component is a fat wrapper around the actual language technology core. You can find the core technolies (python) in the ```/core``` directory.
150
128
 
151
129
  Where to go from here
152
130
  ---------------------
@@ -157,8 +135,8 @@ Where to go from here
157
135
  Report problem/Get help
158
136
  -----------------------
159
137
 
160
- If you encounter problems, please email <support@opener-project.eu> or leave an
161
- issue in the [issue tracker](https://github.com/opener-project/property-tagger/issues).
138
+ If you encounter problems, please email <support@opener-project.eu> or leave an issue in the
139
+ [issue tracker](https://github.com/opener-project/property-tagger/issues).
162
140
 
163
141
  Contributing
164
142
  ------------
@@ -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
- rack_config = File.expand_path('../../config.ru', __FILE__)
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
- cli = Puma::CLI.new([rack_config] + ARGV)
8
- cli.run
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/config.ru CHANGED
@@ -1,4 +1,4 @@
1
- require File.expand_path('../lib/opener/property_tagger/hotel', __FILE__)
1
+ require File.expand_path('../lib/opener/property_tagger', __FILE__)
2
2
  require File.expand_path('../lib/opener/property_tagger/server', __FILE__)
3
3
 
4
4
  run Opener::PropertyTagger::Server
@@ -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/property_tagger'
5
7
 
6
- options = Opener::Daemons::OptParser.parse!(ARGV)
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::PropertyTagger, options)
8
17
 
9
- daemon.start
18
+ switcher.install(switcher_opts)
19
+ daemon.start
@@ -1,5 +1,5 @@
1
1
  module Opener
2
2
  class PropertyTagger
3
- VERSION = '2.1.1'
3
+ VERSION = '2.2.0'
4
4
  end # PropertyTagger
5
5
  end # Opener
@@ -12,7 +12,6 @@ Gem::Specification.new do |gem|
12
12
  gem.required_ruby_version = '>= 1.9.2'
13
13
 
14
14
  gem.files = Dir.glob([
15
- 'core/site-packages/pre_build/**/*',
16
15
  'core/data/**/*',
17
16
  'core/*',
18
17
  'ext/**/*',
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opener-property-tagger
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - development@olery.com