opener-pos-tagger 3.0.0 → 3.1.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: 265d6d03c32e0facbfe14fb9e40b00ef400318a3
4
- data.tar.gz: 744bf220b17323b4167286118d13c138d05a2cf3
3
+ metadata.gz: cf7095e2c9fcbfcebc368ca29ee3b6f42871cbf6
4
+ data.tar.gz: f1718afc6b69c8f1cb7be1b22971fe0e00033a51
5
5
  SHA512:
6
- metadata.gz: 611d76b145ce73e77738a7fa27d4bcffeba2663a079c72762793c7d6aa7fb0b2c19bf2b57b0b3fc9bdfabc01cb9fc05a49b75c4434dfeac0ca25868ca292b993
7
- data.tar.gz: 55e715455ea8bfd992c576ee71ab334bbff12d6499796eaadc9b98d8211a1dfb99a10559be8a438a41a4e91f1d81c1ff3cecdb495748d7a240e9dac8a3018712
6
+ metadata.gz: fb0bd215b41e2556e6c51e8058d4cdb20a93b1bd339159f12cee7598d77915f23b898559581ec10fa024cc18e9a774d714a956d24998ed8a0a8fb2638a53ea59
7
+ data.tar.gz: 4a7ae07742a19e592dc69ffb9651a9e33f0f628b34b7f3f65914aee47290c6aa6f1b037e7471c6b7bfd735f3e0788aec11c486796968923e3c7daa77ee4a7068
data/bin/pos-tagger CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  require_relative '../lib/opener/pos_tagger'
4
4
 
5
- cli = Opener::POSTagger::CLI.new(:args => ARGV)
5
+ cli = Opener::POSTagger::CLI.new
6
6
 
7
- cli.run(STDIN.tty? ? nil : STDIN.read)
7
+ cli.run
@@ -2,7 +2,7 @@ require 'opener/pos_taggers/base'
2
2
  require 'opener/pos_taggers/en'
3
3
  require 'nokogiri'
4
4
  require 'open3'
5
- require 'optparse'
5
+ require 'slop'
6
6
 
7
7
  require_relative 'pos_tagger/version'
8
8
  require_relative 'pos_tagger/cli'
@@ -1,72 +1,57 @@
1
- require 'optparse'
2
-
3
1
  module Opener
4
2
  class POSTagger
5
3
  ##
6
- # CLI wrapper around {Opener::POSTagger} using OptionParser.
4
+ # CLI wrapper around {Opener::POSTagger} using Slop.
7
5
  #
8
- # @!attribute [r] options
9
- # @return [Hash]
10
- # @!attribute [r] option_parser
11
- # @return [OptionParser]
6
+ # @!attribute [r] parser
7
+ # @return [Slop]
12
8
  #
13
9
  class CLI
14
- attr_reader :options, :option_parser
10
+ attr_reader :parser
11
+
12
+ def initialize
13
+ @parser = configure_slop
14
+ end
15
15
 
16
16
  ##
17
- # @param [Hash] options
17
+ # @param [Array] argv
18
18
  #
19
- def initialize(options = {})
20
- @options = DEFAULT_OPTIONS.merge(options)
19
+ def run(argv = ARGV)
20
+ parser.parse(argv)
21
+ end
21
22
 
22
- @option_parser = ::OptionParser.new do |opts|
23
- opts.program_name = 'pos-tagger'
24
- opts.summary_indent = ' '
23
+ ##
24
+ # @return [Slop]
25
+ #
26
+ def configure_slop
27
+ return Slop.new(:strict => false, :indent => 2, :help => true) do
28
+ banner 'Usage: pos-tagger [OPTIONS]'
25
29
 
26
- opts.on('-h', '--help', 'Shows this help message') do
27
- show_help
28
- end
30
+ separator <<-EOF.chomp
29
31
 
30
- opts.on('-v', '--version', 'Shows the current version') do
31
- show_version
32
- end
32
+ About:
33
33
 
34
- opts.separator <<-EOF
34
+ POS tagger component with support for various languages such as Dutch and
35
+ English. This component reads input from STDIN.
35
36
 
36
- Examples:
37
+ Example:
37
38
 
38
- cat example.kaf | #{opts.program_name}
39
+ cat some_file.kaf | pos-tagger
39
40
  EOF
40
- end
41
- end
42
-
43
- ##
44
- # @param [String] input
45
- #
46
- def run(input)
47
- option_parser.parse!(options[:args])
48
-
49
- tagger = POSTagger.new(options)
50
-
51
- stdout = tagger.run(input)
52
41
 
53
- puts stdout
54
- end
42
+ separator "\nOptions:\n"
55
43
 
56
- private
44
+ on :v, :version, 'Shows the current version' do
45
+ abort "pos-tagger v#{VERSION} on #{RUBY_DESCRIPTION}"
46
+ end
57
47
 
58
- ##
59
- # Shows the help message and exits the program.
60
- #
61
- def show_help
62
- abort option_parser.to_s
63
- end
48
+ run do |opts, args|
49
+ tagger = POSTagger.new(:args => args)
50
+ input = STDIN.tty? ? nil : STDIN.read
64
51
 
65
- ##
66
- # Shows the version and exits the program.
67
- #
68
- def show_version
69
- abort "#{option_parser.program_name} v#{VERSION} on #{RUBY_DESCRIPTION}"
52
+ puts tagger.run(input)
53
+ end
54
+ end
70
55
  end
71
56
  end # CLI
72
57
  end # POSTagger
@@ -1,5 +1,5 @@
1
1
  module Opener
2
2
  class POSTagger
3
- VERSION = '3.0.0'
3
+ VERSION = '3.1.0'
4
4
  end
5
5
  end
@@ -26,14 +26,15 @@ Gem::Specification.new do |gem|
26
26
  gem.add_dependency 'opener-pos-tagger-base', ['~> 2.0', '>= 2.1.0']
27
27
  gem.add_dependency 'opener-pos-tagger-en-es', ['~> 2.0', '>= 2.0.2']
28
28
 
29
- gem.add_dependency 'nokogiri'
30
29
  gem.add_dependency 'opener-webservice', '~> 2.0'
31
30
  gem.add_dependency 'opener-daemons', '~> 2.1'
32
31
  gem.add_dependency 'opener-core', '~> 2.0'
33
32
 
33
+ gem.add_dependency 'nokogiri'
34
+ gem.add_dependency 'slop', '~> 3.5'
35
+
34
36
  gem.add_development_dependency 'rspec'
35
37
  gem.add_development_dependency 'cucumber'
36
38
  gem.add_development_dependency 'pry'
37
39
  gem.add_development_dependency 'rake'
38
40
  end
39
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opener-pos-tagger
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - development@olery.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-24 00:00:00.000000000 Z
11
+ date: 2014-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opener-pos-tagger-base
@@ -50,20 +50,6 @@ dependencies:
50
50
  version: 2.0.2
51
51
  prerelease: false
52
52
  type: :runtime
53
- - !ruby/object:Gem::Dependency
54
- name: nokogiri
55
- version_requirements: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - '>='
58
- - !ruby/object:Gem::Version
59
- version: '0'
60
- requirement: !ruby/object:Gem::Requirement
61
- requirements:
62
- - - '>='
63
- - !ruby/object:Gem::Version
64
- version: '0'
65
- prerelease: false
66
- type: :runtime
67
53
  - !ruby/object:Gem::Dependency
68
54
  name: opener-webservice
69
55
  version_requirements: !ruby/object:Gem::Requirement
@@ -106,6 +92,34 @@ dependencies:
106
92
  version: '2.0'
107
93
  prerelease: false
108
94
  type: :runtime
95
+ - !ruby/object:Gem::Dependency
96
+ name: nokogiri
97
+ version_requirements: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ requirement: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ prerelease: false
108
+ type: :runtime
109
+ - !ruby/object:Gem::Dependency
110
+ name: slop
111
+ version_requirements: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ~>
114
+ - !ruby/object:Gem::Version
115
+ version: '3.5'
116
+ requirement: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ~>
119
+ - !ruby/object:Gem::Version
120
+ version: '3.5'
121
+ prerelease: false
122
+ type: :runtime
109
123
  - !ruby/object:Gem::Dependency
110
124
  name: rspec
111
125
  version_requirements: !ruby/object:Gem::Requirement