lib/zenlish/lex/lexicon.rb in zenlish-0.2.01 vs lib/zenlish/lex/lexicon.rb in zenlish-0.2.02

- old
+ new

@@ -3,10 +3,12 @@ # A lexicon is a collection of lexical entries. # Every entry is associated with one one more lexemes. class Lexicon # @return [Array<Lex::LexicalEntry>] entries in the lexicon attr_reader :entries + + # @return [Hash{String => Lex::LexicalEntry}] the lexical entry for the given lemma. attr_reader :lemma2entry # The list of terminal symbols. Examples of terminal symbols: # - word classes, # - punctuation signs,... @@ -21,10 +23,11 @@ end # @param aLemma[String] retrieve the lexeme form the given "head word". # @param aWordClass [WordClasses::WordClass, NilClass] the word class of # the lexeme. + # @return [Lex::Lexeme] def get_lexeme(aLemma, aWordClass = nil) if aWordClass lexeme = nil candidate = nil @@ -49,14 +52,16 @@ raise exc end end end + # @param aTerminal [Rley::Syntax::Terminal] def add_terminal(aTerminal) terminals << aTerminal name2terminal[aTerminal.name] = aTerminal end + # @param anEntry [Lex::LexicalEntry] def add_entry(anEntry) entries << anEntry lemma = anEntry.lemma update_mapping(lemma2entry, lemma, anEntry)