Sha256: 36136e1a536673b0ae2df16f69b95b91e1c8d8d02e8a7862a2bd950a38f85c6d

Contents?: true

Size: 1.53 KB

Versions: 1

Compression:

Stored size: 1.53 KB

Contents

require_relative 'determiner'
require_relative '../inflect/inflection_table_builder'

module Zenlish
  module WClasses
    # In grammar, a demonstrative is a determiner or a pronoun
    # that points to a particular noun or to the noun it replaces (the antecedent).
    class DemonstrativeDeterminer < Determiner
      def initialize
        super()
        init_feature_defs
        init_paradigms
      end    

      # @return [FalseClass] Indicates that demonstrative determiners inflects.
      def invariable?
        false
      end

      private

      def init_feature_defs
        # Create standard feature definitions for irregular verbs.
        feature_def_dsl {
          feature_def 'NUMBER' => enumeration(:singular, :plural)
          feature_def 'DISTANCE' => enumeration(:near, :far)
          feature_def 'PARADIGM' => [identifier, 'Demonstrative_det_paradigm'] # 2nd item is default value
        }
      end

      def init_paradigms
        builder = Inflect::InflectionTableBuilder.new
        table = builder.build('Demonstrative_det_paradigm') do
          feature_heading 'NUMBER'
          feature_heading 'DISTANCE'
          #     NUMBER             DISTANCE
          rule([equals(:singular), equals(:near)],  func('base_form'))
          rule([equals(:singular), equals(:far)],   literal('that'))
          rule([equals(:plural),   equals(:near)],  literal('these'))
          rule([equals(:plural),   equals(:far), ], literal('those'))
        end
        add_paradigm(table)
      end
    end # class
  end # module
end # module

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zenlish-0.2.05 lib/zenlish/wclasses/demonstrative_determiner.rb