nimono 0.2.1 → 0.3.0

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: 300fae415db9805bb8c58a11936386e452ef6c15
4
- data.tar.gz: 5e6495fc95595fb783a37edfa90cd2e5a21de767
3
+ metadata.gz: 1c3497504b7a81ce7e1bde7d0f81d430a7638f8e
4
+ data.tar.gz: 260e07f96cff960e60dc027217a0b326070c95df
5
5
  SHA512:
6
- metadata.gz: 9f87b4a3dcecf39008f7e3da2bf5ec6955e45cd9a8b52f7d096e645fcbbff8f8e7e8484b1f89739e499fc63ef24de1e876ddeb4a26eae3271ad53de92264e32c
7
- data.tar.gz: 40c96a110624688827425fd9d3fe5ad4d6105e139074d25c6dbd940f4b507cc7bcd2a723756eba66a7d0c4ef4f02cea4fa3d11981ac216b5c7047d1277b5e301
6
+ metadata.gz: df7f9defb15e3e400d37409ff8d2ed299b5aa11ff6a59f693804491caf834245baa35ecc5d74753ba6e2fbe7d4d015c555aaa75c8839f8abc128845123bba98e
7
+ data.tar.gz: fa50e032049107927efaa683ec21c893a898c87aace01998d8d8eac07f23de45e66f19f4d428fd2c8f75b90823f8eea9303e255599088984b4a24e6e28c0198a
data/README.md CHANGED
@@ -45,13 +45,12 @@ require 'nimono'
45
45
 
46
46
  nc = Nimono::Cabocha.new('-n1')
47
47
  nc.parse('太郎は花子が読んでいる本を次郎に渡した')
48
- nc.tokens.each do |t|
49
- cid = 0
50
- unless t.chunk.nil?
51
- puts "* #{cid} #{t.chunk.link}D #{t.chunk.head_pos}/#{t.chunk.func_pos} #{'%6f' % t.chunk.score}"
52
- cid += 1
48
+
49
+ nc.chunks.each_with_index do |chunk, cid|
50
+ puts "* #{cid} #{chunk.link}D #{chunk.head_pos}/#{chunk.func_pos} #{'%6f' % chunk.score}"
51
+ chunk.tokens.each do |token|
52
+ puts "#{token.surface}\t#{token.feature}\t#{token.ne}"
53
53
  end
54
- puts "#{t.surface}\t#{t.feature}\t#{t.ne}"
55
54
  end
56
55
 
57
56
  * 0 5D 0/1 -0.742128
@@ -74,7 +73,6 @@ end
74
73
  * 5 -1D 0/1 0.000000
75
74
  渡し 動詞,自立,*,*,五段・サ行,連用形,渡す,ワタシ,ワタシ O
76
75
  た 助動詞,*,*,*,特殊・タ,基本形,た,タ,タ O
77
-
78
76
  ```
79
77
 
80
78
  ## Contributing
@@ -85,4 +83,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/Takayo
85
83
  ## License
86
84
 
87
85
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
88
-
@@ -178,6 +178,7 @@ module Nimono
178
178
 
179
179
  # :features is a hash of elements of :feature_list separated by colons.
180
180
  attr_reader :features
181
+ attr_reader :tokens
181
182
 
182
183
  layout :link, :int,
183
184
  :head_pos, :size_t,
@@ -136,10 +136,14 @@ module Nimono
136
136
  @tokens.freeze
137
137
 
138
138
  @chunks = []
139
- @tokens.each do |token|
140
- @chunks << token.chunk unless token.chunk.nil?
139
+ @tokens.each {|token| @chunks << token.chunk unless token.chunk.nil?}
140
+ @chunks.each do |chunk|
141
+ tokens = []
142
+ chunk.token_size.times do |i|
143
+ tokens << @tokens[chunk.token_pos + i]
144
+ end
145
+ chunk.instance_variable_set(:@tokens, tokens)
141
146
  end
142
-
143
147
  @chunks.freeze
144
148
 
145
149
  self.to_s
@@ -1,4 +1,4 @@
1
1
  #-*- coding: utf-8 -*-
2
2
  module Nimono
3
- VERSION = "0.2.1"
3
+ VERSION = "0.3.0"
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.1
4
+ version: 0.3.0
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-11 00:00:00.000000000 Z
11
+ date: 2017-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement