Class: Chawan::Analyzers::ChasenAnalyzer

Inherits:
AbstractAnalyzer show all
Defined in:
lib/chawan/analyzers/chasen_analyzer.rb

Direct Known Subclasses

MecabAnalyzer

Constant Summary collapse

Format =

“%mt%yt%Mt%U(%P-)t%t%n” # default format

"%m\t%P:\t%y\t\n"
Fields =
%w{ 見出し 品詞 読み }

Instance Attribute Summary

Attributes inherited from AbstractAnalyzer

#options

Instance Method Summary collapse

Methods inherited from AbstractAnalyzer

#initialize

Constructor Details

This class inherits a constructor from Chawan::Analyzers::AbstractAnalyzer

Instance Method Details

#parse(text) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/chawan/analyzers/chasen_analyzer.rb', line 9

def parse(text)
  lines = execute(text).split(/\n/)
  lines.pop == "EOS" or              # "EOS"
    raise CannotAnalyze
  nodes = lines.map{|line| instantiate(line, self.class::Fields)}
  return Nodes.new(nodes)
end