lib/zenlish/lang/dictionary.rb in zenlish-0.2.05 vs lib/zenlish/lang/dictionary.rb in zenlish-0.2.06

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + unless defined?(Zenlish::Lang::Dictionary) require_relative '../feature/feature_struct_def_bearer' module Zenlish module Lang require_relative '../lex/empty_lexicon_factory' @@ -7,19 +9,20 @@ require_relative '../lex/lexeme' sandbox = Object.new sandbox.extend(Zenlish::Lex::EmptyLexiconFactory) Dictionary = sandbox.create_empty_lexicon - self.extend(Feature::FeatureStructDefBearer) + extend(Feature::FeatureStructDefBearer) # @param aLemma [String] is the canonical form, dictionary form, # or citation form of a headword. # @param aWClassName [String] the name of a word class. 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 @@ -88,21 +91,21 @@ add_entry('hear', 'IrregularLinkingVerb') do forms past_simple: 'heard', past_participle: 'heard' end add_entry('here', 'Adverb') # example: ...from here (works as a pronoun of a place) - add_entry('here', 'CommonNoun', {'NUMBER' => enumeration(:singular), - 'PARADIGM' => [identifier, 'Singular_only']}) + add_entry('here', 'CommonNoun', { 'NUMBER' => enumeration(:singular), + 'PARADIGM' => [identifier, 'Singular_only'] }) add_entry('I', 'PersonalPronoun', { 'PERSON' => enumeration(:first), 'GENDER' => enumeration(:feminine, :masculine) }) add_entry('if', 'SubordinatingConjunction') add_entry('in', 'Preposition') add_entry('inside', 'Preposition') add_entry('it', 'PersonalPronoun', { 'PERSON' => enumeration(:third), - 'PARADIGM' => [identifier, 'ppn_3rd_paradigm']}) + 'PARADIGM' => [identifier, 'ppn_3rd_paradigm'] }) add_entry('its', 'PossessiveDeterminer', { 'PERSON' => enumeration(:third), - 'PARADIGM' => [identifier, 'possdet_3rd_paradigm']}) + 'PARADIGM' => [identifier, 'possdet_3rd_paradigm'] }) add_entry('kind', 'CommonNoun') add_entry('know', 'IrregularVerbKnow') do forms past_simple: 'knew', past_participle: 'known' end add_entry('like', 'Preposition') @@ -118,30 +121,30 @@ add_entry('moment', 'CommonNoun') add_entry('more', 'Adjective') add_entry('more', 'Adverb') add_entry('move', 'RegularVerb') add_entry('much', 'Adverb') - add_entry('my', 'PossessiveDeterminer',{ 'PERSON' => enumeration(:first), - 'GENDER' => enumeration(:feminine, :masculine)}) + add_entry('my', 'PossessiveDeterminer', { 'PERSON' => enumeration(:first), + 'GENDER' => enumeration(:feminine, :masculine) }) add_entry('near', 'Preposition') add_entry('near to', 'Preposition') add_entry('now', 'Adverb') - add_entry('now', 'CommonNoun', {'NUMBER' => enumeration(:singular), - 'PARADIGM' => [identifier, 'Singular_only']}) + add_entry('now', 'CommonNoun', { 'NUMBER' => enumeration(:singular), + 'PARADIGM' => [identifier, 'Singular_only'] }) add_entry('not', 'AdverbNot') add_entry('of', 'PrepositionOf') add_entry('on', 'Preposition') add_entry('one', 'Adjective') add_entry('one', 'Cardinal') add_entry('one', 'IndefinitePronoun') add_entry('or', 'Coordinator') add_entry('other', 'Adjective') add_entry('part', 'CommonNoun') - add_entry('people', 'CommonNoun', {'NUMBER' => enumeration(:plural), - 'PARADIGM' => [identifier, 'Plural_only']}) - add_entry('person', 'CommonNoun', {'NUMBER' => enumeration(:singular), - 'PARADIGM' => [identifier, 'Singular_only']}) + add_entry('people', 'CommonNoun', { 'NUMBER' => enumeration(:plural), + 'PARADIGM' => [identifier, 'Plural_only'] }) + add_entry('person', 'CommonNoun', { 'NUMBER' => enumeration(:singular), + 'PARADIGM' => [identifier, 'Singular_only'] }) add_entry('place', 'CommonNoun') add_entry('same', 'Adjective') add_entry('same', 'Pronoun') add_entry('say', 'IrregularVerbSay') do forms past_simple: 'said', past_participle: 'said' @@ -186,18 +189,18 @@ add_entry('who', 'RelativePronoun') add_entry('with', 'Preposition') add_entry('word', 'CommonNoun') add_entry('you', 'PersonalPronoun', { 'PERSON' => enumeration(:second), 'GENDER' => enumeration(:feminine, :masculine), - 'PARADIGM' => [identifier, 'ppn_2nd_paradigm']}) + 'PARADIGM' => [identifier, 'ppn_2nd_paradigm'] }) add_entry('your', 'PossessiveDeterminer', { 'PERSON' => enumeration(:second), 'GENDER' => enumeration(:feminine, :masculine), - 'PARADIGM' => [identifier, 'possdet_2nd_paradigm']}) + 'PARADIGM' => [identifier, 'possdet_2nd_paradigm'] }) # Punctuation signs... add_entry(':', 'Colon') add_entry(',', 'Comma') add_entry('.', 'Period') add_entry('"', 'Quote') end # module end # module -end # defined? \ No newline at end of file +end # defined?