Class: ViterbiNode
- Inherits:
-
Object
- Object
- 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.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/igo/dictionary.rb', line 8 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.
7 8 9 |
# File 'lib/igo/dictionary.rb', line 7 def cost @cost end |
#is_space ⇒ Object
Returns the value of attribute is_space.
7 8 9 |
# File 'lib/igo/dictionary.rb', line 7 def is_space @is_space end |
#left_id ⇒ Object
Returns the value of attribute left_id.
7 8 9 |
# File 'lib/igo/dictionary.rb', line 7 def left_id @left_id end |
#length ⇒ Object
Returns the value of attribute length.
7 8 9 |
# File 'lib/igo/dictionary.rb', line 7 def length @length end |
#prev ⇒ Object
Returns the value of attribute prev.
7 8 9 |
# File 'lib/igo/dictionary.rb', line 7 def prev @prev end |
#right_id ⇒ Object
Returns the value of attribute right_id.
7 8 9 |
# File 'lib/igo/dictionary.rb', line 7 def right_id @right_id end |
#start ⇒ Object
Returns the value of attribute start.
7 8 9 |
# File 'lib/igo/dictionary.rb', line 7 def start @start end |
#word_id ⇒ Object
Returns the value of attribute word_id.
7 8 9 |
# File 'lib/igo/dictionary.rb', line 7 def word_id @word_id end |
Class Method Details
.make_BOSEOS ⇒ Object
19 20 21 |
# File 'lib/igo/dictionary.rb', line 19 def self.make_BOSEOS return ViterbiNode.new(0, 0, 0, 0, 0, false) end |