lib/zenlish/lex/lexicon.rb in zenlish-0.1.23 vs lib/zenlish/lex/lexicon.rb in zenlish-0.1.24

- old
+ new

@@ -17,10 +17,11 @@ @lemma2entry = {} @terminals = [] @name2terminal = {} end + # @param aLemma[String] retrieve the lexeme form the given "head word". def get_lexeme(aLemma, aWordClass = nil) if aWordClass lexeme = nil candidate = nil @@ -36,10 +37,15 @@ lexeme = candidate if candidate.wclass.kind_of?(aWordClass) end lexeme else - lemma2entry.fetch(aLemma).lexemes.first + begin + lemma2entry.fetch(aLemma).lexemes.first + rescue NoMethodError => exc + $stderr.puts "Multiple lexemes for #{aLemma}" + raise exc + end end end def add_terminal(aTerminal) terminals << aTerminal