Class: LLT::Morphologizer
- Inherits:
-
Object
- Object
- LLT::Morphologizer
- Includes:
- Core::Serviceable, Helpers::Constantize, Helpers::Normalizer, Helpers::Pluralize, Helpers::PrimitiveCache
- Defined in:
- lib/llt/morphologizer.rb,
lib/llt/morphologizer/version.rb,
lib/llt/morphologizer/lookup_statement.rb,
lib/llt/morphologizer/stem_lookup_statement_builder.rb
Overview
Analyzes a token string morphologically.
Looks up stems in a given db-dictionary and builds LLT::Form objects with the help of the LLT::FormBuilder.
Defined Under Namespace
Classes: LookupStatement, StemLookupStatementBuilder
Constant Summary collapse
- VERSION =
"0.0.1"
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Morphologizer
constructor
A new instance of Morphologizer.
-
#morphologize(word, add_to: nil) ⇒ Array<LLT::Form>
Takes a string and analyzes it morphologically.
Constructor Details
#initialize(options = {}) ⇒ Morphologizer
Returns a new instance of Morphologizer.
33 34 35 36 |
# File 'lib/llt/morphologizer.rb', line 33 def initialize( = {}) super enable_cache if [:cache] end |
Instance Method Details
#morphologize(word, add_to: nil) ⇒ Array<LLT::Form>
Takes a string and analyzes it morphologically
45 46 47 48 49 |
# File 'lib/llt/morphologizer.rb', line 45 def morphologize(word, add_to: nil) forms = cached(word) { compute(word) } add_to << forms if add_to.respond_to?(:<<) forms end |