Class: Zenlish::Lex::LexicalEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/zenlish/lex/lexical_entry.rb

Overview

TODO: document

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(theLemma, aLexeme = nil) ⇒ LexicalEntry

Returns a new instance of LexicalEntry.

Parameters:

  • theLemma (String)

    lemma (= citation form), a word form used conventionnaly to represent a lexeme.

  • aLexeme (Lexeme, NilClass) (defaults to: nil)

    the lexeme to link with lexical entry.



14
15
16
17
18
# File 'lib/zenlish/lex/lexical_entry.rb', line 14

def initialize(theLemma, aLexeme = nil)
  @lemma = theLemma.dup
  @lexemes = []
  add_lexeme(aLexeme)
end

Instance Attribute Details

#lemmaString (readonly)

Returns the lemma (dictionary) form of a word.

Returns:

  • (String)

    the lemma (dictionary) form of a word.



6
7
8
# File 'lib/zenlish/lex/lexical_entry.rb', line 6

def lemma
  @lemma
end

#lexemesArray<Lexeme, Rley::Syntax::Terminal> (readonly)

Returns:

  • (Array<Lexeme, Rley::Syntax::Terminal>)


9
10
11
# File 'lib/zenlish/lex/lexical_entry.rb', line 9

def lexemes
  @lexemes
end

Instance Method Details

#add_lexeme(aLexeme) ⇒ Object

Parameters:

  • aLexeme (Lexeme, NilClass)

    the lexeme to link with lexical entry.



21
22
23
# File 'lib/zenlish/lex/lexical_entry.rb', line 21

def add_lexeme(aLexeme)
  lexemes << aLexeme if aLexeme
end