Module: Zenlish::Lang

Extended by:
Feature::FeatureStructDefBearer
Defined in:
lib/zenlish/lang/dictionary.rb

Constant Summary collapse

Dictionary =
sandbox.create_empty_lexicon

Class Method Summary collapse

Methods included from Feature::FeatureStructDefBearer

[], boolean, enumeration, feature_def, feature_def_dsl, identifier, init_struct_def, struct

Class Method Details

.add_entry(aLemma, aWClassName, aFeatureHash = nil, &aBlock) ⇒ Object

Parameters:

  • aLemma (String)

    is the canonical form, dictionary form, or citation form of a headword.

  • aWClassName (String)

    the name of a word class.

Raises:

  • (StandardError)


17
18
19
20
21
22
23
24
25
# File 'lib/zenlish/lang/dictionary.rb', line 17

def self.add_entry(aLemma, aWClassName, aFeatureHash = nil, &aBlock)
  entry = Zenlish::Lex::LexicalEntry.new(aLemma)
  wclass = Dictionary.name2terminal[aWClassName]
  raise StandardError, "Undefined word class for '#{aLemma}'" unless wclass
  lexeme = Zenlish::Lex::Lexeme.new(wclass, entry, aFeatureHash)
  lexeme.instance_exec(&aBlock) if block_given?
  lexeme.freeze
  Dictionary.add_entry(entry.freeze)
end