Sha256: b76213d927ac5ce709ed0134e8a05431b85fc3d5f00234758a8a5da4128d087f

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require_relative '../wclasses/all_word_classes'
require_relative 'lexicon'

module Zenlish
  module Lex
    module EmptyLexiconFactory
      def create_empty_lexicon()
        lexicon = Lexicon.new

        add_word_classes(lexicon)
        add_punctuation(lexicon)
        lexicon
      end

      private

      def add_word_classes(aLexicon)
        aLexicon.add_terminal(WClasses::Adjective.new.freeze)
        aLexicon.add_terminal(WClasses::Cardinal.new.freeze)
        aLexicon.add_terminal(WClasses::CommonNoun.new.freeze)
        aLexicon.add_terminal(WClasses::ComparativeParticle.new.freeze)
        aLexicon.add_terminal(WClasses::DefiniteArticle.new.freeze)
        aLexicon.add_terminal(WClasses::DemonstrativeDeterminer.new.freeze)
        aLexicon.add_terminal(WClasses::IndefinitePronoun.new.freeze)
        aLexicon.add_terminal(WClasses::IrregularVerb.new.freeze)
        aLexicon.add_terminal(WClasses::ProperNoun.new.freeze)
      end

      def add_punctuation(aLexicon)
        aLexicon.add_terminal(Rley::Syntax::Terminal.new('Period'))
      end
    end # module
  end # module
end # module

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zenlish-0.1.01 lib/zenlish/lex/empty_lexicon_factory.rb