Class: Okura::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/okura.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(word) ⇒ Node

Returns a new instance of Node.



86
87
88
89
90
# File 'lib/okura.rb', line 86

def initialize word
  @word=word
  @nearest_prev=nil
  @total_cost=nil
end

Instance Attribute Details

#nearest_prevObject

Returns the value of attribute nearest_prev.



92
93
94
# File 'lib/okura.rb', line 92

def nearest_prev
  @nearest_prev
end

#total_costObject

Returns the value of attribute total_cost.



93
94
95
# File 'lib/okura.rb', line 93

def total_cost
  @total_cost
end

#wordObject (readonly)

Returns the value of attribute word.



91
92
93
# File 'lib/okura.rb', line 91

def word
  @word
end

Class Method Details

.mk_bos_eosObject



100
101
102
103
104
105
# File 'lib/okura.rb', line 100

def self.mk_bos_eos
  f=Features::BOS_EOS
  node=Node.new Word.new('BOS/EOS',f,f,0)
  def node.length; 1; end
  node
end

Instance Method Details

#lengthObject



94
95
96
# File 'lib/okura.rb', line 94

def length
  word.surface.length
end

#to_sObject



97
98
99
# File 'lib/okura.rb', line 97

def to_s
  "Node(#{word},#{total_cost})"
end