Class: Kotoshu::Algorithms::Lookup::CompoundForm

Inherits:
Object
  • Object
show all
Defined in:
lib/kotoshu/algorithms/lookup.rb

Overview

CompoundForm is a hypothesis of how some word could be split into several AffixForms (word parts with their own stems and possible affixes).

Typically, only first part is allowed to have prefix, and only last part is allowed to have suffix, but there are languages where middle parts can have affixes too, specified by special flags.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parts) ⇒ CompoundForm

Returns a new instance of CompoundForm.



153
154
155
# File 'lib/kotoshu/algorithms/lookup.rb', line 153

def initialize(parts)
  @parts = parts
end

Instance Attribute Details

#partsArray<AffixForm> (readonly)

Returns Parts of the compound word.

Returns:

  • (Array<AffixForm>)

    Parts of the compound word



151
152
153
# File 'lib/kotoshu/algorithms/lookup.rb', line 151

def parts
  @parts
end

Instance Method Details

#to_sString Also known as: inspect

String representation.

Returns:

  • (String)


160
161
162
# File 'lib/kotoshu/algorithms/lookup.rb', line 160

def to_s
  "CompoundForm(#{@parts.map(&:to_s).join(' + ')})"
end