anystyle-parser 0.4.4 → 0.4.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98fa1a2861bc3fd5953accb104cdf3bf3d3c7a8d
4
- data.tar.gz: 691f25e7ade807451098edde34ae8628f299286d
3
+ metadata.gz: bc18ecd238c51394c2a34f8ec45c9ece02eaaeeb
4
+ data.tar.gz: 7e26461b65683e798ca4a6e166d1691d6ff2db7a
5
5
  SHA512:
6
- metadata.gz: 95dc3700ea6a51ffac3059ab14c87098072342adbd108afd8aaa5bcf980fe627da7d279c801ce38f948b45db258a44e180c08021b671368f0270c39db148f31e
7
- data.tar.gz: 81b0e2bce8ad581bddb9215882ff67d1d1cab38498d523411b64eed0115803b5fc465621849b128619d15315d1573b56245afaff19dc4c072a0bb8ca4595b012
6
+ metadata.gz: a6afa20d3b20068d49d773c90677a8a4f815e05b86e9cf50c0bf32489a8e51c7b51d7358389ad6bca3d628c81f4d30ab4ab8e7406bef73bc07de26c77d427ac6
7
+ data.tar.gz: 6ecaaa31b450b68fdcc5fd04b5d34dbca250604408163a482e783cf6d70061fba9a0cd56220fbb5ebcb8a66befd6cc320385970f4d58bcf0555de622024c9591
data/HISTORY.md CHANGED
@@ -1,5 +1,5 @@
1
- 0.4.4 / 2014-03-10
2
- ==================
1
+ 0.4.4 & 0.4.5 / 2014-03-10
2
+ ==========================
3
3
  * Mitigate potential vulnerability: open files only if string not tainted
4
4
 
5
5
  0.4.3 / 2014-03-09
@@ -63,9 +63,7 @@ module Anystyle
63
63
 
64
64
  # Returns an array of label/segment pairs for each line in the passed-in string.
65
65
  def label(input, labelled = false)
66
- string = input_to_s(input)
67
-
68
- model.label(prepare(string, labelled)).map! do |sequence|
66
+ model.label(prepare(input, labelled)).map! do |sequence|
69
67
  sequence.inject([]) do |ts, (token, label)|
70
68
  token, label = token[/^\S+/], label.to_sym
71
69
  if (prev = ts[-1]) && prev[0] == label
@@ -139,14 +137,12 @@ module Anystyle
139
137
  end
140
138
 
141
139
  def train(input = options[:training_data], truncate = true)
142
- string = input_to_s(input)
143
-
144
140
  if truncate
145
141
  @model = Wapiti::Model.new(options.reject { |k,_| k == :model })
146
142
  end
147
143
 
148
- unless string.nil? || string.empty?
149
- @model.train(prepare(string, true))
144
+ unless input.nil? || input.empty?
145
+ @model.train(prepare(input, true))
150
146
  end
151
147
 
152
148
  @model.path = options[:model]
@@ -161,9 +157,8 @@ module Anystyle
161
157
  end
162
158
 
163
159
  def test(input)
164
- string = input_to_s(input)
165
160
  model.options.check!
166
- model.label(prepare(string, true))
161
+ model.label(prepare(input, true))
167
162
  end
168
163
 
169
164
  def normalize(hash)
@@ -1,5 +1,5 @@
1
1
  module Anystyle
2
2
  module Parser
3
- VERSION = '0.4.4'.freeze
3
+ VERSION = '0.4.5'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anystyle-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvester Keil