wapiti 0.0.1 → 0.0.2

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/README.md CHANGED
@@ -79,7 +79,7 @@ Before saving your model you can use `compact` to reduce the model's size:
79
79
  By calling `#label` on a Model instance you can add labels to your sequence
80
80
  data:
81
81
 
82
- model = Waiti.load('m2.mod')
82
+ model = Wapiti.load('m2.mod')
83
83
  model.label('test.txt')
84
84
  => [[["Confidence NN B-NP", "B-NP"], ["in IN B-PP", "B-PP"] ... ]
85
85
 
@@ -1,6 +1,6 @@
1
1
  require 'mkmf'
2
2
 
3
- $CFLAGS << %q{ -std=c99 -O3 -Wall }
3
+ $CFLAGS << %q{ -std=c99 -O3 -Wall -ggdb }
4
4
 
5
5
  have_library('pthread')
6
6
  have_library('m')
@@ -873,11 +873,12 @@ static VALUE model_train(VALUE self, VALUE data) {
873
873
 
874
874
  rdr_loadpat(model->reader, file);
875
875
  fclose(file);
876
- qrk_lock(model->reader->obs, false);
877
876
  }
878
877
  else {
879
- rb_raise(cNativeError, "failed to train model: no pattern given");
878
+ // rb_raise(cNativeError, "failed to train model: no pattern given");
880
879
  }
880
+
881
+ qrk_lock(model->reader->obs, false);
881
882
 
882
883
 
883
884
  // Load the training data. When this is done we lock the quarks as we
@@ -67,13 +67,9 @@ void fatal(const char *msg, ...) {
67
67
  va_list args;
68
68
  va_start(args, msg);
69
69
 
70
- // VALUE message = rb_vsprintf(msg, args);
71
- VALUE message = rb_str_new2(msg);
70
+ rb_raise(cNativeError, msg, args);
72
71
 
73
- va_end(args);
74
-
75
- (void)rb_funcall(cLogger, rb_intern("fatal"), 1, message);
76
- rb_raise(cNativeError, StringValuePtr(message));
72
+ va_end(args);
77
73
  }
78
74
 
79
75
  /* pfatal:
@@ -90,12 +86,10 @@ void pfatal(const char *msg, ...) {
90
86
 
91
87
  // VALUE message = rb_vsprintf(msg, args);
92
88
  // rb_str_catf(message, ": <%s>", err);
93
- VALUE message = rb_str_new2(msg);
89
+ rb_raise(cNativeError, msg, args);
94
90
 
95
91
  va_end(args);
96
92
 
97
- (void)rb_funcall(cLogger, rb_intern("fatal"), 1, message);
98
- rb_raise(cNativeError, StringValuePtr(message));
99
93
  }
100
94
 
101
95
  /* warning:
@@ -8,9 +8,9 @@ module Wapiti
8
8
  config = Options.new(options, &block)
9
9
 
10
10
  # check configuration
11
- if config.pattern.empty?
12
- raise ConfigurationError, 'invalid options: no pattern specified'
13
- end
11
+ # if config.pattern.empty?
12
+ # raise ConfigurationError, 'invalid options: no pattern specified'
13
+ # end
14
14
 
15
15
  unless config.valid?
16
16
  raise ConfigurationError, "invalid options: #{ config.validate.join('; ') }"
@@ -1,3 +1,3 @@
1
1
  module Wapiti
2
- VERSION = '0.0.1'.freeze
2
+ VERSION = '0.0.2'.freeze
3
3
  end
@@ -110,6 +110,12 @@ module Wapiti
110
110
  # model.train([]).nlbl.should == 6
111
111
  end
112
112
 
113
+ context 'when called without a pattern' do
114
+ it 'fails because of wapiti' do
115
+ expect { Model.new.train(data).nlbl.should == 6 }.to raise_error(NativeError)
116
+ end
117
+ end
118
+
113
119
  end
114
120
 
115
121
  describe '#label' do
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.1
4
+ version: 0.0.2
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-08-30 00:00:00.000000000Z
12
+ date: 2011-09-01 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &2157117600 !ruby/object:Gem::Requirement
16
+ requirement: &2156429940 !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: *2157117600
24
+ version_requirements: *2156429940
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake-compiler
27
- requirement: &2157116700 !ruby/object:Gem::Requirement
27
+ requirement: &2156428740 !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: *2157116700
35
+ version_requirements: *2156428740
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: ZenTest
38
- requirement: &2157078940 !ruby/object:Gem::Requirement
38
+ requirement: &2156427300 !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: *2157078940
46
+ version_requirements: *2156427300
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &2157078120 !ruby/object:Gem::Requirement
49
+ requirement: &2156425920 !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: *2157078120
57
+ version_requirements: *2156425920
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: