Class: Lingo::Language::Lexical
- Defined in:
- lib/lingo/language/lexical.rb
Overview
– Die Klasse Lexical, abgeleitet von der Klasse WordForm, stellt den Container für eine Grundform eines Wortes bereit, welches mit der Wortklasse versehen ist.
Wird z.B. aus dem Wörterbuch eine Grundform gelesen, so wird dies in Form eines Lexical-Objektes zurückgegeben, z.B. Lexical.new(‘Rennen’, ‘S’) -> (rennen/s) ++
Instance Attribute Summary
Attributes inherited from WordForm
#attr, #form, #gender, #head, #src, #token
Instance Method Summary collapse
Methods inherited from WordForm
#eql?, #hash, #identified?, #initialize, #inspect, #to_a, #unknown?, #word_token?
Constructor Details
This class inherits a constructor from Lingo::Language::WordForm
Instance Method Details
#<=>(other) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/lingo/language/lexical.rb', line 45 def <=>(other) return 1 unless other.is_a?(self.class) a1, a2 = attr, other.attr return form <=> other.form if a1 == a2 a1.empty? ? 1 : a2.empty? ? -1 : begin i1, i2 = LA_SORTORDER.values_at(a1, a2) i1 ? i2 ? i1 <=> i2 : -1 : i2 ? 1 : a1 <=> a2 end end |
#attr?(attr) ⇒ Boolean
41 42 43 |
# File 'lib/lingo/language/lexical.rb', line 41 def attr?(attr) self.attr.start_with?(attr) end |
#to_s ⇒ Object
61 62 63 |
# File 'lib/lingo/language/lexical.rb', line 61 def to_s "(#{super})" end |
#to_str ⇒ Object
57 58 59 |
# File 'lib/lingo/language/lexical.rb', line 57 def to_str to_a.join('#') end |