wapiti 0.0.4 → 0.0.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.
- data/HISTORY.md +13 -0
- data/README.md +1 -1
- data/ext/wapiti/native.c +8 -1
- data/ext/wapiti/native.h +4 -0
- data/lib/wapiti/version.rb +1 -1
- data/spec/wapiti/model_spec.rb +4 -2
- metadata +11 -10
data/HISTORY.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
0.0.5 / 2011-09-06
|
2
|
+
==================
|
3
|
+
* Added UTF-8 encoding to native result strings for Ruby 1.9
|
4
|
+
|
5
|
+
0.0.3 / 2011-09-02
|
6
|
+
==================
|
7
|
+
* Added support for output scores
|
8
|
+
* Improved n-best output
|
9
|
+
* Added statistics
|
10
|
+
|
11
|
+
0.0.2 / 2011-09-01
|
12
|
+
==================
|
13
|
+
* Initial release
|
data/README.md
CHANGED
@@ -14,7 +14,7 @@ Wapiti is written in C and Ruby and requires a compiler with C99
|
|
14
14
|
support (e.g., gcc); on GNU/Linux systems it will be fairly easy to install
|
15
15
|
all necessary packages through your distribution; on Mac OS X you can either
|
16
16
|
install Xcode or
|
17
|
-
|
17
|
+
[osx-gcc-installer](https://github.com/kennethreitz/osx-gcc-installer);
|
18
18
|
on Windows you may want to install RubyInstaller's
|
19
19
|
[DevKit](https://github.com/oneclick/rubyinstaller/wiki/development-kit).
|
20
20
|
|
data/ext/wapiti/native.c
CHANGED
@@ -991,7 +991,14 @@ static VALUE decode_sequence(VALUE self, mdl_t *model, raw_t *raw) {
|
|
991
991
|
tokens = rb_ary_new();
|
992
992
|
|
993
993
|
if (!model->opt->label) {
|
994
|
-
|
994
|
+
VALUE token = rb_str_new2(raw->lines[t]);
|
995
|
+
|
996
|
+
#ifdef HAVE_RUBY_ENCODING_H
|
997
|
+
int enc = rb_enc_find_index("UTF-8");
|
998
|
+
rb_enc_associate_index(token, enc);
|
999
|
+
#endif
|
1000
|
+
|
1001
|
+
rb_ary_push(tokens, token);
|
995
1002
|
}
|
996
1003
|
|
997
1004
|
for (n = 0; n < N; ++n) {
|
data/ext/wapiti/native.h
CHANGED
data/lib/wapiti/version.rb
CHANGED
data/spec/wapiti/model_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
1
3
|
module Wapiti
|
2
4
|
describe 'Model' do
|
3
5
|
|
@@ -128,14 +130,14 @@ module Wapiti
|
|
128
130
|
let(:model) { Model.load(File.expand_path('../../fixtures/ch.mod', __FILE__)) }
|
129
131
|
|
130
132
|
context 'when passed an array of arrays' do
|
131
|
-
let(:input) { [['
|
133
|
+
let(:input) { [['Héllo NN B-VP', ', , O', 'world NN B-NP', '! ! O']] }
|
132
134
|
|
133
135
|
it 'returns an array of token-label pairs' do
|
134
136
|
labels = model.label(input)
|
135
137
|
labels[0].map(&:first).should == input[0]
|
136
138
|
labels[0].map(&:last).should == %w{ B-NP O B-NP O }
|
137
139
|
end
|
138
|
-
|
140
|
+
|
139
141
|
it 'yields each token/label pair to the supplied block' do
|
140
142
|
labels = model.label(input) do |token, label|
|
141
143
|
[token.downcase, label.downcase]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wapiti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-09-
|
12
|
+
date: 2011-09-06 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &2156563060 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0.9'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2156563060
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake-compiler
|
27
|
-
requirement: &
|
27
|
+
requirement: &2156559320 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0.7'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2156559320
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: ZenTest
|
38
|
-
requirement: &
|
38
|
+
requirement: &2156553240 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '4.6'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2156553240
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &2156552400 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '2.6'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2156552400
|
58
58
|
description: This gem provides a Ruby API for Conditional Random Fields (CRF). It
|
59
59
|
is implemented as a C exstension and based on the wicked fast "wapiti" package.
|
60
60
|
email:
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- .gitignore
|
71
71
|
- .rspec
|
72
72
|
- Gemfile
|
73
|
+
- HISTORY.md
|
73
74
|
- LICENSE
|
74
75
|
- README.md
|
75
76
|
- Rakefile
|