Class: SFST::CompactTransducer

Inherits:
CompactTransducerMachine show all
Defined in:
lib/sfst.rb

Overview

A compact transducer.

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ CompactTransducer

Returns a new instance of CompactTransducer.



80
81
82
# File 'lib/sfst.rb', line 80

def initialize(file)
  @fst = CompactTransducerMachine.new(file)
end

Instance Method Details

#accepted_analysis?(string) ⇒ Boolean

Checks if the string string is accepted for analysis.

Returns:

  • (Boolean)


85
86
87
# File 'lib/sfst.rb', line 85

def accepted_analysis?(string)
  @fst._analyze(string)
end

#analyze(form) ⇒ Object Also known as: analyse

Analyses a string string. Returns an array of analysed strings if the string is accepted or an empty array if not.



91
92
93
94
95
# File 'lib/sfst.rb', line 91

def analyze(form)
  x = []
  @fst._analyze(form) { |a| x << a }
  x
end