Class: Okura::Serializer::WordDic::Naive
- Inherits:
-
Object
- Object
- Okura::Serializer::WordDic::Naive
- Defined in:
- lib/okura/serializer.rb
Instance Method Summary collapse
Instance Method Details
#compile(features_l, features_r, inputs, encoding, output) ⇒ Object
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/okura/serializer.rb', line 154 def compile(features_l,features_r,inputs,encoding,output) dic=Okura::WordDic::Naive.new Okura::Serializer::WordDic.each_input(inputs,encoding){|input| parser=Okura::Parser::Word.new(input) parser.each{|surface,lid,rid,cost| word=Okura::Word.new( surface, features_l.from_id(lid), features_r.from_id(rid), cost ) dic.define word } } Marshal.dump(dic,output) end |
#load(io) ⇒ Object
170 171 172 |
# File 'lib/okura/serializer.rb', line 170 def load(io) Marshal.load(io) end |