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
- #all_inflections ⇒ Object
-
#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.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/zenlish/lex/lexeme.rb', line 19 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? 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.
14 15 16 |
# File 'lib/zenlish/lex/lexeme.rb', line 14 def wclass @wclass end |
Instance Method Details
#all_inflections ⇒ Object
47 48 49 50 |
# File 'lib/zenlish/lex/lexeme.rb', line 47 def all_inflections table = paradigm table.all_inflections(self) end |
#entry ⇒ Zenlish::Lex::LexicalEntry
Returns Link to its dictionary entry (headword).
35 36 37 |
# File 'lib/zenlish/lex/lexeme.rb', line 35 def entry ObjectSpace._id2ref(@entry) end |
#inflect(constraints) ⇒ String
Inflect the lexeme according the default paradigm of the word class.
42 43 44 45 |
# File 'lib/zenlish/lex/lexeme.rb', line 42 def inflect(constraints) table = paradigm table.inflect(self, constraints) end |
#lemma ⇒ String Also known as: base_form
Returns the base (dictionary) form.
53 54 55 |
# File 'lib/zenlish/lex/lexeme.rb', line 53 def lemma entry.lemma end |
#paradigm ⇒ Inflect::InflectionTable
Return the inflection paradigm for the lexeme.
59 60 61 62 |
# File 'lib/zenlish/lex/lexeme.rb', line 59 def paradigm paradigm_feat_def = self['PARADIGM'] wclass.paradigms[paradigm_feat_def.default.val] end |