mecab-light 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/ext/mecab/light.c +24 -7
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 905b46000c4f3aa2da1252ee10f01f5cd44cfc6a
4
- data.tar.gz: ffde14f8a056e8dfa9dde57900ca6e08fc6da0ad
3
+ metadata.gz: fd0c56af90db21074dfcde684800b72136d1f25e
4
+ data.tar.gz: 8b138d9551a7e24f396728545e665262d3f321fa
5
5
  SHA512:
6
- metadata.gz: 1cf53d9d1d3e27cd74531190423193cba4ddae9ed334ae3b61250ab92038eeab789b671ee64d32f47034bcb77d2acfc0072a0adec109b17a19ac8ce5f6b9d686
7
- data.tar.gz: 902dc3c3a94f117f8bb548300b6c4c151fa8d9d3dae6698f37a320a56b13c92f3b40f4a19fad02cec65018208223b048943ffd6b93575bec0a7555f315bfdd03
6
+ metadata.gz: dab8363385620a185a1e6ec1a17b35c69f9db912abc6ce704e5234d1dd7a56ae8b602f09b3cbc24fcd59db1803a130d3ad0ead5662985ac5313a5407ebdc6328
7
+ data.tar.gz: 15ae8b7e124c519139d49f6dad5814d8128eaee462c7d42ab82f55d33b20c4edcb481fa10e87ade2bba78c2f5741125f379ed61873986b2eed5a6ffb29b727e6
@@ -4,7 +4,7 @@
4
4
 
5
5
  #define MECAB_LIGHT_MAJOR_VERSION 1
6
6
  #define MECAB_LIGHT_MINOR_VERSION 0
7
- #define MECAB_LIGHT_PATCH_VERSION 0
7
+ #define MECAB_LIGHT_PATCH_VERSION 1
8
8
 
9
9
  typedef struct {
10
10
  mecab_model_t* ptr;
@@ -40,6 +40,7 @@ static void
40
40
  model_free(Model* model)
41
41
  {
42
42
  mecab_model_destroy(model->ptr);
43
+ free(model);
43
44
  }
44
45
 
45
46
  static VALUE
@@ -53,6 +54,7 @@ static void
53
54
  tagger_free(Tagger* tagger)
54
55
  {
55
56
  mecab_destroy(tagger->ptr);
57
+ free(tagger);
56
58
  }
57
59
 
58
60
  static VALUE
@@ -66,6 +68,7 @@ static void
66
68
  lattice_free(Lattice* lattice)
67
69
  {
68
70
  mecab_lattice_destroy(lattice->ptr);
71
+ free(lattice);
69
72
  }
70
73
 
71
74
  static VALUE
@@ -75,6 +78,18 @@ lattice_alloc(VALUE klass)
75
78
  return Data_Wrap_Struct(klass, 0, lattice_free, lattice);
76
79
  }
77
80
 
81
+ static void
82
+ node_free(Node* node)
83
+ {
84
+ free(node);
85
+ }
86
+
87
+ static void
88
+ result_free(Result* result)
89
+ {
90
+ free(result);
91
+ }
92
+
78
93
  static VALUE
79
94
  rb_model_initialize(VALUE self, VALUE arg)
80
95
  {
@@ -129,7 +144,7 @@ rb_tagger_parse(VALUE self, VALUE arg)
129
144
  rb_raise(rb_eTypeError, "The argument should be String or MeCab::Light::Lattice");
130
145
  }
131
146
  rb_cResult = rb_define_class_under(name_space(), "Result", rb_cObject);
132
- return Data_Wrap_Struct(rb_cResult, 0, 0, result);
147
+ return Data_Wrap_Struct(rb_cResult, 0, result_free, result);
133
148
  }
134
149
 
135
150
  static VALUE
@@ -166,16 +181,18 @@ rb_result_each(VALUE self)
166
181
  {
167
182
  Result* result;
168
183
  Node* node;
184
+ mecab_node_t* m_node;
169
185
  VALUE rb_cNode;
170
186
 
171
187
  RETURN_SIZED_ENUMERATOR(self, 0, 0, result_enum_length);
172
188
  Data_Get_Struct(self, Result, result);
173
- node = ALLOC(Node);
174
- node->ptr = result->bos_node->next;
175
- node->enc = result->enc;
189
+ m_node = result->bos_node->next;
176
190
  rb_cNode = rb_define_class_under(name_space(), "Node", rb_cObject);
177
- for (; node->ptr->next; node->ptr = node->ptr->next) {
178
- rb_yield(Data_Wrap_Struct(rb_cNode, 0, 0, node));
191
+ for (; m_node->next; m_node = m_node->next) {
192
+ node = ALLOC(Node);
193
+ node->ptr = m_node;
194
+ node->enc = result->enc;
195
+ rb_yield(Data_Wrap_Struct(rb_cNode, 0, node_free, node));
179
196
  }
180
197
  return self;
181
198
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mecab-light
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hajime Wakahara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-26 00:00:00.000000000 Z
11
+ date: 2014-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake