Sha256: f172c69f1274b15fe651d39e0cf2b2847b593bfdb49457832e57f547c15045d1

Contents?: true

Size: 1.39 KB

Versions: 1

Compression:

Stored size: 1.39 KB

Contents

require_relative 'word_class'
require_relative '../inflect/inflection_table_builder'

module Zenlish
  module WClasses
    # Abstract class. In traditional grammar, the verb is often defined
    # notionally as a 'doing' word (i.e. a word that describes the action
    # in a clause).
    class Verb < WordClass
      def initialize
        super()
        @paradigms = {}
        init_feature_defs
        init_paradigms
      end

      # As all verbs inflect, or change form, to reflect changes in tense,
      # person, number, and voice, they are, by definition, variable.
      def invariable?
        false
      end

      protected

      def add_paradigm(anInflectionTable)
        @paradigms[anInflectionTable.name] = anInflectionTable
      end

      private

      def init_feature_defs
        # Create standard feature definitions for lexical verbs.
        feature_def_dsl {
          feature_def 'NUMBER' => enumeration(:singular, :plural)
          feature_def 'PERSON' => enumeration(:first, :second, :third)
          feature_def 'TIME' => enumeration(:present, :progressive, :past_simple, :past_participle)
          feature_def 'PARADIGM' => [identifier, 'Regular_inflection'] # 2nd item is default value
        }
      end

      def init_paradigms
        raise NotImplementedError, "Method #{__callee__} must implemented for #{self.class}."
      end
    end # class
  end # module
end # module

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zenlish-0.2.04 lib/zenlish/wclasses/verb.rb