nimono 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 58d9d79c7656b5846c27046eddb5ba4c7e68712c
4
- data.tar.gz: d043f1239881c0c687b749f795f49990dd6e2215
3
+ metadata.gz: 300fae415db9805bb8c58a11936386e452ef6c15
4
+ data.tar.gz: 5e6495fc95595fb783a37edfa90cd2e5a21de767
5
5
  SHA512:
6
- metadata.gz: e77c4822207063e4f9ae6f69df5588446e069b3ee72e31af3825a20ce79645614544fe30e775fe0f3f40b27954af3941d2d7ed086ba0042b32da754f0a395109
7
- data.tar.gz: 28edbeb9938781c6ac5202010aff30c7cf6729fee65bdc473f633696742ce61aa614070ed94f6fc7af6dc334027fca04ebd4549231da19402087e83705c4747a
6
+ metadata.gz: 9f87b4a3dcecf39008f7e3da2bf5ec6955e45cd9a8b52f7d096e645fcbbff8f8e7e8484b1f89739e499fc63ef24de1e876ddeb4a26eae3271ad53de92264e32c
7
+ data.tar.gz: 40c96a110624688827425fd9d3fe5ad4d6105e139074d25c6dbd940f4b507cc7bcd2a723756eba66a7d0c4ef4f02cea4fa3d11981ac216b5c7047d1277b5e301
@@ -8,7 +8,7 @@ module Nimono
8
8
  # `Cabocha` is a class providing an interface to the CaboCha library.
9
9
  # In this class the arguments supported by CaboCha can be used in almost
10
10
  # the same way.
11
- class Cabocha
11
+ class Cabocha < FFI::AutoPointer
12
12
  include Nimono::OptionParse
13
13
  include Nimono::CabochaLib
14
14
 
@@ -22,6 +22,10 @@ module Nimono
22
22
  # @return [Array] Array of Token
23
23
  attr_reader :tokens
24
24
 
25
+ def self.release(ptr)
26
+ self.class.cabocha_destroy(ptr)
27
+ end
28
+
25
29
  # Initializes the CaboCha with the given 'options'.
26
30
  # options is given as a string (CaboCha command line arguments) or
27
31
  # as a Ruby-style hash.
@@ -92,6 +96,8 @@ module Nimono
92
96
  @libpath = self.class.cabocha_library
93
97
 
94
98
  @parser = self.class.cabocha_new2(opt_str)
99
+ super @parser
100
+
95
101
  if @parser.address == 0x0
96
102
  raise CabochaError.new("Could not initialize CaboCha with options: '#{opt_str}'")
97
103
  end
@@ -130,12 +136,10 @@ module Nimono
130
136
  @tokens.freeze
131
137
 
132
138
  @chunks = []
133
- self.class.cabocha_tree_chunk_size(@tree).times do |i|
134
- @chunks << Nimono::Chunk.new(self.class.cabocha_tree_chunk(@tree, i))
135
- # chunk = Nimono::Chunk.new(self.class.cabocha_tree_chunk(@tree, i))
136
- # chunk.instance_variable_set(:@tokens, @tokens[chunk.token_pos..(chunk.token_pos + chunk.token_size - 1)])
137
- # @chunks << chunk
139
+ @tokens.each do |token|
140
+ @chunks << token.chunk unless token.chunk.nil?
138
141
  end
142
+
139
143
  @chunks.freeze
140
144
 
141
145
  self.to_s
@@ -1,4 +1,4 @@
1
1
  #-*- coding: utf-8 -*-
2
2
  module Nimono
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nimono
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takayoshi Yamazaki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-06 00:00:00.000000000 Z
11
+ date: 2017-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement