wapiti 1.0.5 → 1.0.6
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 +7 -7
- data/lib/wapiti/dataset.rb +2 -2
- data/lib/wapiti/model.rb +4 -4
- data/lib/wapiti/sequence.rb +2 -2
- data/lib/wapiti/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 705ec52f8508c73225900b05bf330f96ea81a45c7c00d228433fd58e6cf8cd8e
|
4
|
+
data.tar.gz: 932633100b752db69c356a08a1a797a55933eb09bacb5ecaa67a391b35f976b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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-
|
145
|
+
Copyright 2011-2020 Sylvester Keil. All rights reserved.
|
146
146
|
|
147
147
|
Copyright 2009-2013 CNRS. All rights reserved.
|
148
148
|
|
data/lib/wapiti/dataset.rb
CHANGED
data/lib/wapiti/model.rb
CHANGED
@@ -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, &
|
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, &
|
71
|
+
native_train(tdat, ddat, &block)
|
72
72
|
else
|
73
73
|
native_train(tdat, ddat)
|
74
74
|
end
|
data/lib/wapiti/sequence.rb
CHANGED
data/lib/wapiti/version.rb
CHANGED
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.
|
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:
|
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
|
-
|
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.
|