Class: Zenlish::Lex::Lexeme
- Inherits:
-
Object
- Object
- Zenlish::Lex::Lexeme
- Includes:
- Feature::FeatureStructDefBearer
- Defined in:
- lib/zenlish/lex/lexeme.rb
Overview
A word in the abstract sense; an individual, distinct item of a lexicon that belongs to a word class and of which a number of actual word forms may exist. For instance, the word forms: 'hide', 'hides', 'hid', 'hidden' relate to the lexeme for verb 'hide'. Also called 'dictionary word'.
Instance Attribute Summary collapse
-
#wclass ⇒ Zenlish::WClasses::WordClass
readonly
The word class to which the lexeme belongs.
Instance Method Summary collapse
-
#entry ⇒ Zenlish::Lex::LexicalEntry
Link to its dictionary entry (headword).
-
#inflect(constraints) ⇒ String
Inflect the lexeme according the default paradigm of the word class.
-
#initialize(aWClass, anEntry, aFeatureHash = nil) ⇒ Lexeme
constructor
A new instance of Lexeme.
-
#lemma ⇒ String
(also: #base_form)
The base (dictionary) form.
-
#paradigm ⇒ Inflect::InflectionTable
Return the inflection paradigm for the lexeme.
Methods included from Feature::FeatureStructDefBearer
#[], #boolean, #enumeration, #feature_def, #feature_def_dsl, #identifier, #init_struct_def, #struct
Constructor Details
#initialize(aWClass, anEntry, aFeatureHash = nil) ⇒ Lexeme
Returns a new instance of Lexeme.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/zenlish/lex/lexeme.rb', line 17 def initialize(aWClass, anEntry, aFeatureHash = nil) @wclass = aWClass @entry = anEntry.object_id anEntry.add_lexeme(self) if aWClass.kind_of?(WClasses::WordClass) unless wclass.extension.nil? self.extend(wclass.extension) init_extension(self) end p_struct = aWClass.kind_of?(WClasses::WordClass) ? aWClass.struct : nil overriding_struct_defs = aFeatureHash.nil? ? {} : aFeatureHash init_struct_def(p_struct, overriding_struct_defs) end end |
Instance Attribute Details
#wclass ⇒ Zenlish::WClasses::WordClass (readonly)
Returns the word class to which the lexeme belongs.
12 13 14 |
# File 'lib/zenlish/lex/lexeme.rb', line 12 def wclass @wclass end |
Instance Method Details
#entry ⇒ Zenlish::Lex::LexicalEntry
Returns Link to its dictionary entry (headword).
33 34 35 |
# File 'lib/zenlish/lex/lexeme.rb', line 33 def entry ObjectSpace._id2ref(@entry) end |
#inflect(constraints) ⇒ String
Inflect the lexeme according the default paradigm of the word class.
40 41 42 43 |
# File 'lib/zenlish/lex/lexeme.rb', line 40 def inflect(constraints) table = paradigm table.inflect(self, constraints) end |
#lemma ⇒ String Also known as: base_form
Returns the base (dictionary) form.
46 47 48 |
# File 'lib/zenlish/lex/lexeme.rb', line 46 def lemma entry.lemma end |
#paradigm ⇒ Inflect::InflectionTable
Return the inflection paradigm for the lexeme.
52 53 54 55 |
# File 'lib/zenlish/lex/lexeme.rb', line 52 def paradigm paradigm_feat_def = self['PARADIGM'] wclass.paradigms[paradigm_feat_def.default.val] end |