Class: Igo::ViterbiNode
- Inherits:
-
Object
- Object
- Igo::ViterbiNode
- Defined in:
- lib/igo/dictionary.rb
Overview
Viterbiアルゴリズムで使用されるノードクラス
Instance Attribute Summary collapse
-
#cost ⇒ Object
Returns the value of attribute cost.
-
#is_space ⇒ Object
Returns the value of attribute is_space.
-
#left_id ⇒ Object
Returns the value of attribute left_id.
-
#length ⇒ Object
Returns the value of attribute length.
-
#prev ⇒ Object
Returns the value of attribute prev.
-
#right_id ⇒ Object
Returns the value of attribute right_id.
-
#start ⇒ Object
Returns the value of attribute start.
-
#word_id ⇒ Object
Returns the value of attribute word_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(word_id, start, length, left_id, right_id, is_space) ⇒ ViterbiNode
constructor
A new instance of ViterbiNode.
Constructor Details
#initialize(word_id, start, length, left_id, right_id, is_space) ⇒ ViterbiNode
Returns a new instance of ViterbiNode.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/igo/dictionary.rb', line 10 def initialize(word_id, start, length, left_id, right_id, is_space) @cost = 0 # 始点からノードまでの総コスト @prev = nil # コスト最小の前方のノードへのリンク @word_id = word_id # 単語ID @start = start # 入力テキスト内での形態素の開始位置 @length = length # 形態素の表層形の長さ(文字数) @left_id = left_id # 左文脈ID @right_id = right_id # 右文脈ID @is_space = is_space # 形態素の文字種(文字カテゴリ)が空白かどうか end |
Instance Attribute Details
#cost ⇒ Object
Returns the value of attribute cost.
9 10 11 |
# File 'lib/igo/dictionary.rb', line 9 def cost @cost end |
#is_space ⇒ Object
Returns the value of attribute is_space.
9 10 11 |
# File 'lib/igo/dictionary.rb', line 9 def is_space @is_space end |
#left_id ⇒ Object
Returns the value of attribute left_id.
9 10 11 |
# File 'lib/igo/dictionary.rb', line 9 def left_id @left_id end |
#length ⇒ Object
Returns the value of attribute length.
9 10 11 |
# File 'lib/igo/dictionary.rb', line 9 def length @length end |
#prev ⇒ Object
Returns the value of attribute prev.
9 10 11 |
# File 'lib/igo/dictionary.rb', line 9 def prev @prev end |
#right_id ⇒ Object
Returns the value of attribute right_id.
9 10 11 |
# File 'lib/igo/dictionary.rb', line 9 def right_id @right_id end |
#start ⇒ Object
Returns the value of attribute start.
9 10 11 |
# File 'lib/igo/dictionary.rb', line 9 def start @start end |
#word_id ⇒ Object
Returns the value of attribute word_id.
9 10 11 |
# File 'lib/igo/dictionary.rb', line 9 def word_id @word_id end |
Class Method Details
.make_BOSEOS ⇒ Object
21 22 23 |
# File 'lib/igo/dictionary.rb', line 21 def self.make_BOSEOS return ViterbiNode.new(0, 0, 0, 0, 0, false) end |