wapiti 1.0.5 → 1.0.6

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
  SHA256:
3
- metadata.gz: d1b615815731e51a90b7043b7ad91c97f0386bf99435c78f18ab23cf9df212cc
4
- data.tar.gz: ee11a7e6f76f382847f721f8388b9c7f314e46a90ab391b463aa7e60ef641d41
3
+ metadata.gz: 705ec52f8508c73225900b05bf330f96ea81a45c7c00d228433fd58e6cf8cd8e
4
+ data.tar.gz: 932633100b752db69c356a08a1a797a55933eb09bacb5ecaa67a391b35f976b6
5
5
  SHA512:
6
- metadata.gz: a7852d9566407e93c9d66a641dd8551e3d4666449b9aad01ef434f822c78955d887911e59adb0418751ec4183d1ffa32504ec525fe3b16dbf05018c650c143c2
7
- data.tar.gz: '0762885a4ef9265917756d983932da613ebb2cf32c9f18db76afcdac933ae710fe457ba8b431bdf537b986c9c54f7a9908b605627a72e000dd59f6f9cebab034'
6
+ metadata.gz: 2473b6ab76b965e7f9332556e743d3f0165b1251bc5c5aaee09ca0fe5682aecbcfca1ada54450da717106825a5b83bb3f02622d52d5b5c7e261a583fa803f9f9
7
+ data.tar.gz: 59b2d00d9646525061feceab127fb880f8c0924521150e3fbf4c622092abc0e2a4466430a1778b288b56482a6355c3c7d1987e39fbf389f245c019b7ffd3a476
data/README.md CHANGED
@@ -24,7 +24,7 @@ Quickstart
24
24
  ### Creating a Model
25
25
 
26
26
  You can run the following examples starting the ruby interpreter (irb or pry) inside spec/fixtures directory.
27
-
27
+
28
28
  Using a pattern and training data stored in a file:
29
29
 
30
30
  require 'wapiti'
@@ -40,15 +40,15 @@ this class supports the default text format used by Wapiti as well as
40
40
  additional formats (such as YAML or XML) and an API, to make it easier
41
41
  to manage data sets used for input and training.
42
42
 
43
- options = {threads:3, pattern: 'chpattern.txt'}
44
-
43
+ options = {threads:3, pattern: 'chpattern.txt'}
44
+
45
45
  data_text = Wapiti::Dataset.open('chtrain.txt',tagged:true)
46
46
  model2= Wapiti.train(data_text,options)
47
47
  model2.labels
48
48
  => ["B-ADJP", "B-ADVP", "B-CONJP" ...]
49
49
 
50
- options = {threads:3, pattern: 'chpattern_only_tag.txt'}
51
-
50
+ options = {threads:3, pattern: 'chpattern_only_tag.txt'}
51
+
52
52
  data_xml = Wapiti::Dataset.open('chtrain.xml')
53
53
  #=> #<Wapiti::Dataset sequences={823}>
54
54
  model3 = Wapiti.train(data_xml, options)
@@ -104,7 +104,7 @@ argument to the passed-in block.
104
104
  # => Dataset where each token will include a score
105
105
  output_with_score.first.map(&:score)
106
106
  # => [5.950832716249245, 8.870883529621942, ...]
107
-
107
+
108
108
  ### Statistics
109
109
 
110
110
  By setting the *:check* option you can tell Wapiti to keep statistics during
@@ -142,7 +142,7 @@ example, fix the bug and submit a pull request.
142
142
 
143
143
  License
144
144
  -------
145
- Copyright 2011-2018 Sylvester Keil. All rights reserved.
145
+ Copyright 2011-2020 Sylvester Keil. All rights reserved.
146
146
 
147
147
  Copyright 2009-2013 CNRS. All rights reserved.
148
148
 
@@ -56,9 +56,9 @@ module Wapiti
56
56
  @sequences = sequences
57
57
  end
58
58
 
59
- def each
59
+ def each(&block)
60
60
  if block_given?
61
- sequences.each(&Proc.new)
61
+ sequences.each(&block)
62
62
  self
63
63
  else
64
64
  to_enum
@@ -30,7 +30,7 @@ module Wapiti
30
30
 
31
31
  alias native_label label
32
32
 
33
- def label(input, opts = nil)
33
+ def label(input, opts = nil, &block)
34
34
  unless opts.nil?
35
35
  original_options = options.attributes(opts.keys)
36
36
  options.update!(opts)
@@ -39,7 +39,7 @@ module Wapiti
39
39
  input = input.to_a(tagged: options.check) if input.is_a?(Dataset)
40
40
 
41
41
  if block_given?
42
- output = native_label(input, &Proc.new)
42
+ output = native_label(input, &block)
43
43
  else
44
44
  output = native_label(input)
45
45
  end
@@ -61,14 +61,14 @@ module Wapiti
61
61
 
62
62
  alias native_train train
63
63
 
64
- def train(tdat, ddat = nil, opts = nil)
64
+ def train(tdat, ddat = nil, opts = nil, &block)
65
65
  options.update!(opts) unless opts.nil?
66
66
 
67
67
  tdat = tdat.to_a(tagged: true) if tdat.is_a?(Dataset)
68
68
  ddat = ddat.to_a(tagged: true) if ddat.is_a?(Dataset)
69
69
 
70
70
  if block_given?
71
- native_train(tdat, ddat, &Proc.new)
71
+ native_train(tdat, ddat, &block)
72
72
  else
73
73
  native_train(tdat, ddat)
74
74
  end
@@ -50,9 +50,9 @@ module Wapiti
50
50
  tokens.map(&:label).uniq
51
51
  end
52
52
 
53
- def each
53
+ def each(&block)
54
54
  if block_given?
55
- tokens.each(&Proc.new)
55
+ tokens.each(&block)
56
56
  self
57
57
  else
58
58
  to_enum
@@ -1,3 +1,3 @@
1
1
  module Wapiti
2
- VERSION = '1.0.5'.freeze
2
+ VERSION = '1.0.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wapiti
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvester Keil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-13 00:00:00.000000000 Z
11
+ date: 2020-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -107,8 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  - !ruby/object:Gem::Version
108
108
  version: '0'
109
109
  requirements: []
110
- rubyforge_project:
111
- rubygems_version: 2.7.4
110
+ rubygems_version: 3.1.2
112
111
  signing_key:
113
112
  specification_version: 4
114
113
  summary: Wicked fast Conditional Random Fields for Ruby.