zenlish 0.2.02 → 0.2.06

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +455 -0
  3. data/CHANGELOG.md +58 -1
  4. data/Gemfile +5 -3
  5. data/README.md +27 -0
  6. data/Rakefile +5 -3
  7. data/lib/zenlish/feature/boolean_domain.rb +9 -3
  8. data/lib/zenlish/feature/boolean_value.rb +3 -2
  9. data/lib/zenlish/feature/enumeration_domain.rb +8 -1
  10. data/lib/zenlish/feature/feature.rb +9 -7
  11. data/lib/zenlish/feature/feature_def.rb +10 -6
  12. data/lib/zenlish/feature/feature_domain.rb +9 -3
  13. data/lib/zenlish/feature/feature_struct.rb +3 -1
  14. data/lib/zenlish/feature/feature_struct_def.rb +5 -1
  15. data/lib/zenlish/feature/feature_struct_def_bearer.rb +6 -4
  16. data/lib/zenlish/feature/feature_value.rb +4 -2
  17. data/lib/zenlish/feature/identifier_domain.rb +5 -3
  18. data/lib/zenlish/feature/identifier_value.rb +3 -2
  19. data/lib/zenlish/feature/symbol_value.rb +3 -1
  20. data/lib/zenlish/inflect/atomic_o_expression.rb +2 -1
  21. data/lib/zenlish/inflect/composite_o_expression.rb +3 -1
  22. data/lib/zenlish/inflect/concatenation.rb +3 -2
  23. data/lib/zenlish/inflect/equals_literal.rb +7 -1
  24. data/lib/zenlish/inflect/feature_heading.rb +11 -5
  25. data/lib/zenlish/inflect/formal_argument.rb +3 -1
  26. data/lib/zenlish/inflect/function_call.rb +4 -1
  27. data/lib/zenlish/inflect/heading.rb +5 -0
  28. data/lib/zenlish/inflect/inflection_rule.rb +2 -0
  29. data/lib/zenlish/inflect/inflection_table.rb +29 -4
  30. data/lib/zenlish/inflect/inflection_table_builder.rb +27 -20
  31. data/lib/zenlish/inflect/input_asis.rb +3 -0
  32. data/lib/zenlish/inflect/input_expression.rb +4 -2
  33. data/lib/zenlish/inflect/literal_asis.rb +4 -1
  34. data/lib/zenlish/inflect/matches_pattern.rb +2 -0
  35. data/lib/zenlish/inflect/membership.rb +2 -0
  36. data/lib/zenlish/inflect/method_heading.rb +7 -6
  37. data/lib/zenlish/inflect/not_equals_literal.rb +2 -0
  38. data/lib/zenlish/inflect/nullary_input_expression.rb +3 -1
  39. data/lib/zenlish/inflect/output_expression.rb +2 -0
  40. data/lib/zenlish/inflect/substitution.rb +3 -1
  41. data/lib/zenlish/inflect/unary_input_expression.rb +4 -1
  42. data/lib/zenlish/inflect/unconditionally_true.rb +4 -2
  43. data/lib/zenlish/lang/dictionary.rb +35 -29
  44. data/lib/zenlish/lang/lemmatizer.rb +40 -0
  45. data/lib/zenlish/lang/zenlish_grammar.rb +9 -6
  46. data/lib/zenlish/lex/empty_lexicon_factory.rb +4 -3
  47. data/lib/zenlish/lex/lexeme.rb +9 -2
  48. data/lib/zenlish/lex/lexical_entry.rb +6 -4
  49. data/lib/zenlish/lex/lexicon.rb +10 -8
  50. data/lib/zenlish/lex/literal.rb +3 -1
  51. data/lib/zenlish/lexer/lexer.rb +144 -0
  52. data/lib/zenlish/trie/base_trie_node.rb +27 -0
  53. data/lib/zenlish/trie/trie.rb +132 -0
  54. data/lib/zenlish/trie/trie_node.rb +21 -0
  55. data/lib/zenlish/trie/trie_root.rb +10 -0
  56. data/lib/zenlish/version.rb +3 -1
  57. data/lib/zenlish/wclasses/adjective.rb +5 -2
  58. data/lib/zenlish/wclasses/adverb.rb +3 -1
  59. data/lib/zenlish/wclasses/adverb_maybe.rb +3 -1
  60. data/lib/zenlish/wclasses/adverb_not.rb +2 -0
  61. data/lib/zenlish/wclasses/all_word_classes.rb +4 -2
  62. data/lib/zenlish/wclasses/article.rb +2 -0
  63. data/lib/zenlish/wclasses/auxiliary.rb +5 -2
  64. data/lib/zenlish/wclasses/auxiliary_be.rb +34 -1
  65. data/lib/zenlish/wclasses/auxiliary_do.rb +31 -0
  66. data/lib/zenlish/wclasses/cardinal.rb +3 -1
  67. data/lib/zenlish/wclasses/common_noun.rb +2 -0
  68. data/lib/zenlish/wclasses/comparative_particle.rb +5 -3
  69. data/lib/zenlish/wclasses/conjunction.rb +2 -0
  70. data/lib/zenlish/wclasses/conjunctive_pronoun.rb +2 -0
  71. data/lib/zenlish/wclasses/coordinator.rb +4 -2
  72. data/lib/zenlish/wclasses/definite_article.rb +2 -0
  73. data/lib/zenlish/wclasses/degree_adverb.rb +2 -0
  74. data/lib/zenlish/wclasses/demonstrative_determiner.rb +40 -1
  75. data/lib/zenlish/wclasses/demonstrative_pronoun.rb +2 -0
  76. data/lib/zenlish/wclasses/determiner.rb +3 -1
  77. data/lib/zenlish/wclasses/distributive_determiner.rb +2 -0
  78. data/lib/zenlish/wclasses/existential_there.rb +2 -0
  79. data/lib/zenlish/wclasses/fronting_quantifier.rb +3 -1
  80. data/lib/zenlish/wclasses/indefinite_article.rb +2 -0
  81. data/lib/zenlish/wclasses/indefinite_pronoun.rb +3 -1
  82. data/lib/zenlish/wclasses/irregular_linking_verb.rb +3 -1
  83. data/lib/zenlish/wclasses/irregular_verb.rb +14 -22
  84. data/lib/zenlish/wclasses/irregular_verb_be.rb +41 -1
  85. data/lib/zenlish/wclasses/irregular_verb_can.rb +35 -0
  86. data/lib/zenlish/wclasses/irregular_verb_do.rb +38 -1
  87. data/lib/zenlish/wclasses/irregular_verb_extension.rb +8 -6
  88. data/lib/zenlish/wclasses/irregular_verb_have.rb +38 -1
  89. data/lib/zenlish/wclasses/irregular_verb_know.rb +3 -1
  90. data/lib/zenlish/wclasses/irregular_verb_say.rb +3 -1
  91. data/lib/zenlish/wclasses/irregular_verb_think.rb +3 -1
  92. data/lib/zenlish/wclasses/lexical_verb.rb +3 -4
  93. data/lib/zenlish/wclasses/linking_adverb.rb +2 -0
  94. data/lib/zenlish/wclasses/modal_verb_can.rb +27 -0
  95. data/lib/zenlish/wclasses/noun.rb +4 -2
  96. data/lib/zenlish/wclasses/numeral.rb +2 -0
  97. data/lib/zenlish/wclasses/personal_pronoun.rb +70 -1
  98. data/lib/zenlish/wclasses/possessive_determiner.rb +60 -0
  99. data/lib/zenlish/wclasses/preposition.rb +3 -1
  100. data/lib/zenlish/wclasses/preposition_of.rb +2 -0
  101. data/lib/zenlish/wclasses/preposition_than.rb +2 -0
  102. data/lib/zenlish/wclasses/pronoun.rb +3 -1
  103. data/lib/zenlish/wclasses/proper_noun.rb +10 -8
  104. data/lib/zenlish/wclasses/quantifier.rb +3 -1
  105. data/lib/zenlish/wclasses/regular_verb.rb +13 -18
  106. data/lib/zenlish/wclasses/regular_verb_want.rb +4 -2
  107. data/lib/zenlish/wclasses/relative_pronoun.rb +4 -2
  108. data/lib/zenlish/wclasses/subordinating_conjunction.rb +7 -5
  109. data/lib/zenlish/wclasses/verb.rb +16 -8
  110. data/lib/zenlish/wclasses/word_class.rb +11 -3
  111. data/spec/spec_helper.rb +3 -1
  112. data/spec/zenlish/feature/boolean_domain_spec.rb +6 -1
  113. data/spec/zenlish/feature/boolean_value_spec.rb +1 -1
  114. data/spec/zenlish/feature/enumeration_domain_spec.rb +9 -5
  115. data/spec/zenlish/feature/feature_spec.rb +3 -3
  116. data/spec/zenlish/feature/feature_struct_def_bearer_spec.rb +10 -8
  117. data/spec/zenlish/feature/feature_struct_def_spec.rb +3 -2
  118. data/spec/zenlish/feature/identifier_domain_spec.rb +3 -3
  119. data/spec/zenlish/feature/identifier_value_spec.rb +4 -4
  120. data/spec/zenlish/feature/symbol_value_spec.rb +3 -3
  121. data/spec/zenlish/inflect/concatenation_spec.rb +7 -7
  122. data/spec/zenlish/inflect/feature_heading_spec.rb +23 -3
  123. data/spec/zenlish/inflect/formal_argument_spec.rb +2 -2
  124. data/spec/zenlish/inflect/function_call_spec.rb +4 -4
  125. data/spec/zenlish/inflect/inflection_rule_spec.rb +9 -5
  126. data/spec/zenlish/inflect/inflection_table_builder_spec.rb +26 -21
  127. data/spec/zenlish/inflect/inflection_table_spec.rb +39 -22
  128. data/spec/zenlish/inflect/input_asis_spec.rb +2 -6
  129. data/spec/zenlish/inflect/literal_asis_spec.rb +3 -3
  130. data/spec/zenlish/inflect/matches_pattern_spec.rb +1 -1
  131. data/spec/zenlish/inflect/membership_spec.rb +2 -2
  132. data/spec/zenlish/inflect/method_heading_spec.rb +7 -1
  133. data/spec/zenlish/inflect/substitution_spec.rb +1 -1
  134. data/spec/zenlish/inflect/unconditionally_true_spec.rb +2 -2
  135. data/spec/zenlish/lang/dictionary_spec.rb +51 -16
  136. data/spec/zenlish/lang/lemmatizer_spec.rb +43 -0
  137. data/spec/zenlish/lang/zenlish_grammar_spec.rb +2 -2
  138. data/spec/zenlish/lex/lexeme_spec.rb +16 -11
  139. data/spec/zenlish/lex/lexical_entry_spec.rb +1 -2
  140. data/spec/zenlish/lex/lexicon_spec.rb +9 -8
  141. data/spec/zenlish/lex/literal_spec.rb +2 -2
  142. data/spec/zenlish/lexer/lexer_spec.rb +52 -0
  143. data/spec/zenlish/parser/lesson1_spec.rb +2 -2
  144. data/spec/zenlish/parser/lesson2_spec.rb +31 -36
  145. data/spec/zenlish/parser/lesson3_spec.rb +98 -138
  146. data/spec/zenlish/parser/zparser_spec.rb +2 -1
  147. data/spec/zenlish/support/minimal_lexicon.rb +2 -0
  148. data/spec/zenlish/support/var2word.rb +27 -18
  149. data/spec/zenlish/trie/base_trie_node_spec.rb +33 -0
  150. data/spec/zenlish/trie/trie_spec.rb +108 -0
  151. data/spec/zenlish/wclasses/common_noun_spec.rb +19 -7
  152. data/spec/zenlish/wclasses/demonstrative_determiner_spec.rb +47 -0
  153. data/spec/zenlish/wclasses/irregular_verb_can_spec.rb +60 -0
  154. data/spec/zenlish/wclasses/irregular_verb_spec.rb +14 -4
  155. data/spec/zenlish/wclasses/lexical_verb_spec.rb +9 -2
  156. data/spec/zenlish/wclasses/modal_verb_can_spec.rb +50 -0
  157. data/spec/zenlish/wclasses/personal_pronoun_spec.rb +66 -0
  158. data/spec/zenlish/wclasses/possessive_determiner_spec.rb +69 -0
  159. data/spec/zenlish/wclasses/regular_verb_spec.rb +35 -15
  160. data/spec/zenlish/wclasses/regular_verb_want_spec.rb +30 -0
  161. data/spec/zenlish/wclasses/verb_spec.rb +9 -2
  162. data/spec/zenlish_spec.rb +3 -1
  163. data/zenlish.gemspec +17 -14
  164. metadata +37 -10
  165. data/lib/zenlish/wclasses/modal_verb_could.rb +0 -9
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'irregular_verb'
2
4
 
3
5
  module Zenlish
@@ -6,4 +8,4 @@ module Zenlish
6
8
  class IrregularVerbKnow < IrregularVerb
7
9
  end # class
8
10
  end # module
9
- end # module
11
+ end # module
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'irregular_verb'
2
4
 
3
5
  module Zenlish
@@ -6,4 +8,4 @@ module Zenlish
6
8
  class IrregularVerbSay < IrregularVerb
7
9
  end # class
8
10
  end # module
9
- end # module
11
+ end # module
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'irregular_verb'
2
4
 
3
5
  module Zenlish
@@ -6,4 +8,4 @@ module Zenlish
6
8
  class IrregularVerbThink < IrregularVerb
7
9
  end # class
8
10
  end # module
9
- end # module
11
+ end # module
@@ -1,11 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'verb'
2
4
 
3
5
  module Zenlish
4
6
  module WClasses
5
7
  class LexicalVerb < Verb
6
- def initialize
7
- super
8
- end
9
8
  end # class
10
9
  end # module
11
- end # module
10
+ end # module
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'adverb'
2
4
 
3
5
  module Zenlish
@@ -1,9 +1,36 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'auxiliary'
2
4
 
3
5
  module Zenlish
4
6
  module WClasses
5
7
  # The modal verb `can`
6
8
  class ModalVerbCan < Auxiliary
9
+ # Comment requested by Rubocop
10
+
11
+ private
12
+
13
+ def init_feature_defs
14
+ super
15
+ # Create standard feature definitions for modal verb can.
16
+ feature_def_dsl do
17
+ feature_def 'TIME' => enumeration(:present, :past_simple)
18
+ feature_def 'PARADIGM' => [identifier, 'Verb_can_inflection'] # 2nd item is default value
19
+ end
20
+ end
21
+
22
+ # rubocop: disable Layout/SpaceInsideArrayLiteralBrackets
23
+ def init_paradigms
24
+ builder = Inflect::InflectionTableBuilder.new
25
+ table = builder.build('Verb_can_inflection') do
26
+ feature_heading 'TIME'
27
+ # TIME
28
+ rule([equals(:present) ], literal('can'))
29
+ rule([equals(:past_simple) ], literal('could'))
30
+ end
31
+ add_paradigm(table)
32
+ end
33
+ # rubocop: enable Layout/SpaceInsideArrayLiteralBrackets
7
34
  end # class
8
35
  end # module
9
36
  end # module
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'word_class'
2
4
 
3
5
  module Zenlish
@@ -21,11 +23,11 @@ module Zenlish
21
23
 
22
24
  def init_feature_defs
23
25
  # Create standard feature definitions for nouns.
24
- feature_def_dsl {
26
+ feature_def_dsl do
25
27
  feature_def 'NUMBER' => enumeration(:singular, :plural)
26
28
  feature_def 'COUNTABILITY' => enumeration(:count, :non_count)
27
29
  feature_def 'PARADIGM' => [identifier, 'Common_form'] # 2nd item is default value
28
- }
30
+ end
29
31
  end
30
32
  end # class
31
33
  end # module
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'determiner'
2
4
 
3
5
  module Zenlish
@@ -1,4 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'pronoun'
4
+ require_relative '../inflect/inflection_table_builder'
2
5
 
3
6
  module Zenlish
4
7
  module WClasses
@@ -7,6 +10,72 @@ module Zenlish
7
10
  # Subject forms: I, you, he/she/it, we, you, they
8
11
  # Object forms: Me, you, him, her, it, us, you, them
9
12
  class PersonalPronoun < Pronoun
13
+ def initialize
14
+ super()
15
+ init_feature_defs
16
+ init_paradigms
17
+ end
18
+
19
+ # @return [FalseClass] Indicates that demonstrative determiners inflects.
20
+ def invariable?
21
+ false
22
+ end
23
+
24
+ private
25
+
26
+ def init_feature_defs
27
+ # Create standard feature definitions for irregular verbs.
28
+ feature_def_dsl do
29
+ feature_def 'NUMBER' => enumeration(:singular, :plural)
30
+ feature_def 'PERSON' => enumeration(:first, :second, :third)
31
+ feature_def 'GENDER' => enumeration(:feminine, :masculine, :neuter)
32
+ feature_def 'CASE' => enumeration(:subject, :object)
33
+ feature_def 'PARADIGM' => [identifier, 'ppn_1st_paradigm'] # 2nd item is default value
34
+ end
35
+ end
36
+
37
+ def init_paradigms
38
+ # Conventional base forms in Zenlish are: I, you, it
39
+ builder = Inflect::InflectionTableBuilder.new
40
+ table = builder.build('ppn_1st_paradigm') do
41
+ feature_heading 'PERSON'
42
+ feature_heading 'NUMBER'
43
+ feature_heading 'GENDER'
44
+ feature_heading 'CASE'
45
+ # PERSON NUMBER GENDER CASE
46
+ rule([equals(:first), equals(:singular), not_equal(:neuter), equals(:subject)], func('base_form'))
47
+ rule([equals(:first), equals(:plural), not_equal(:neuter), equals(:subject)], literal('we'))
48
+ rule([equals(:first), equals(:singular), not_equal(:neuter), equals(:object)], literal('me'))
49
+ rule([equals(:first), equals(:plural), not_equal(:neuter), equals(:object)], literal('us'))
50
+ end
51
+ add_paradigm(table)
52
+
53
+ table = builder.build('ppn_2nd_paradigm') do
54
+ feature_heading 'PERSON'
55
+ feature_heading 'NUMBER'
56
+ feature_heading 'GENDER'
57
+ feature_heading 'CASE'
58
+ # PERSON NUMBER GENDER CASE
59
+ rule([equals(:second), dont_care, not_equal(:neuter), dont_care], func('base_form'))
60
+ end
61
+ add_paradigm(table)
62
+
63
+ table = builder.build('ppn_3rd_paradigm') do
64
+ feature_heading 'PERSON'
65
+ feature_heading 'NUMBER'
66
+ feature_heading 'GENDER'
67
+ feature_heading 'CASE'
68
+ # PERSON NUMBER GENDER CASE
69
+ rule([equals(:third), equals(:singular), equals(:neuter), dont_care], func('base_form'))
70
+ rule([equals(:third), equals(:singular), equals(:feminine), equals(:subject)], literal('she'))
71
+ rule([equals(:third), equals(:singular), equals(:masculine), equals(:subject)], literal('he'))
72
+ rule([equals(:third), equals(:plural), dont_care, equals(:subject)], literal('they'))
73
+ rule([equals(:third), equals(:singular), equals(:feminine), equals(:object)], literal('her'))
74
+ rule([equals(:third), equals(:singular), equals(:masculine), equals(:object)], literal('him'))
75
+ rule([equals(:third), equals(:plural), dont_care, equals(:object)], literal('them'))
76
+ end
77
+ add_paradigm(table)
78
+ end
10
79
  end # class
11
80
  end # module
12
- end # module
81
+ end # module
@@ -1,4 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'determiner'
4
+ require_relative '../inflect/inflection_table_builder'
2
5
 
3
6
  module Zenlish
4
7
  module WClasses
@@ -6,6 +9,63 @@ module Zenlish
6
9
  # that is used to modify nouns to denote possession my, your, her, his, its.
7
10
  # they aren't used with other determiners like the, a/an, or this.
8
11
  class PossessiveDeterminer < Determiner
12
+ def initialize
13
+ super()
14
+ init_feature_defs
15
+ init_paradigms
16
+ end
17
+
18
+ # @return [FalseClass] Indicates that demonstrative determiners inflects.
19
+ def invariable?
20
+ false
21
+ end
22
+
23
+ private
24
+
25
+ def init_feature_defs
26
+ # Create standard feature definitions for irregular verbs.
27
+ feature_def_dsl do
28
+ feature_def 'NUMBER' => enumeration(:singular, :plural)
29
+ feature_def 'PERSON' => enumeration(:first, :second, :third)
30
+ feature_def 'GENDER' => enumeration(:feminine, :masculine, :neuter)
31
+ feature_def 'PARADIGM' => [identifier, 'possdet_1st_paradigm'] # 2nd item is default value
32
+ end
33
+ end
34
+
35
+ def init_paradigms
36
+ # Conventional base forms in Zenlish are: my, your, its
37
+ builder = Inflect::InflectionTableBuilder.new
38
+ table = builder.build('possdet_1st_paradigm') do
39
+ feature_heading 'PERSON'
40
+ feature_heading 'NUMBER'
41
+ feature_heading 'GENDER'
42
+ # PERSON NUMBER GENDER
43
+ rule([equals(:first), equals(:singular), not_equal(:neuter)], func('base_form'))
44
+ rule([equals(:first), equals(:plural), not_equal(:neuter)], literal('our'))
45
+ end
46
+ add_paradigm(table)
47
+
48
+ table = builder.build('possdet_2nd_paradigm') do
49
+ feature_heading 'PERSON'
50
+ feature_heading 'NUMBER'
51
+ feature_heading 'GENDER'
52
+ # PERSON NUMBER GENDER
53
+ rule([equals(:second), dont_care, not_equal(:neuter)], func('base_form'))
54
+ end
55
+ add_paradigm(table)
56
+
57
+ table = builder.build('possdet_3rd_paradigm') do
58
+ feature_heading 'PERSON'
59
+ feature_heading 'NUMBER'
60
+ feature_heading 'GENDER'
61
+ # PERSON NUMBER GENDER
62
+ rule([equals(:third), equals(:singular), equals(:neuter)], func('base_form'))
63
+ rule([equals(:third), equals(:singular), equals(:feminine)], literal('her'))
64
+ rule([equals(:third), equals(:singular), equals(:masculine)], literal('his'))
65
+ rule([equals(:third), equals(:plural), dont_care], literal('their'))
66
+ end
67
+ add_paradigm(table)
68
+ end
9
69
  end # class
10
70
  end # module
11
71
  end # module
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'word_class'
2
4
 
3
5
  module Zenlish
4
6
  module WClasses
5
7
  # TODO: document
6
- class Preposition < WordClass
8
+ class Preposition < WordClass
7
9
  end # class
8
10
  end # module
9
11
  end # module
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'preposition'
2
4
 
3
5
  module Zenlish
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'preposition'
2
4
 
3
5
  module Zenlish
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'word_class'
2
4
 
3
5
  module Zenlish
4
6
  module WClasses
5
7
  # TODO: document
6
- class Pronoun < WordClass
8
+ class Pronoun < WordClass
7
9
  end # class
8
10
  end # module
9
11
  end # module
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'noun'
2
4
 
3
5
  module Zenlish
@@ -8,14 +10,14 @@ module Zenlish
8
10
  def initialize
9
11
  super()
10
12
  init_feature_defs
11
- end
12
-
13
+ end
14
+
13
15
  def init_feature_defs
14
16
  # Override standard feature definitions for proper nouns.
15
- feature_def_dsl {
16
- feature_def 'NUMBER' => enumeration(:singular)
17
- }
18
- end
17
+ feature_def_dsl do
18
+ feature_def 'NUMBER' => enumeration(:singular)
19
+ end
20
+ end
19
21
  end # class
20
- end # module
21
- end # module
22
+ end # module
23
+ end # module
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'determiner'
2
4
 
3
5
  module Zenlish
4
6
  module WClasses
5
7
  # Quantifiers are used to indicate the number or quantity of the noun under consideration.
6
8
  # enough, few, little, many, more, most, much, none, several, some
7
- class Quantifier < Determiner
9
+ class Quantifier < Determiner
8
10
  end # class
9
11
  end # module
10
12
  end # module
@@ -1,13 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'lexical_verb'
2
4
 
3
5
  module Zenlish
4
6
  module WClasses
5
7
  class RegularVerb < LexicalVerb
6
- def initialize
7
- super
8
- @paradigms = {}
9
- init_paradigms
10
- end
8
+ # Requested by Rubocop
11
9
 
12
10
  private
13
11
 
@@ -19,23 +17,20 @@ module Zenlish
19
17
  feature_heading 'TIME'
20
18
  method_heading 'base_form'
21
19
  # PERSON NUMBER TIME base_form
22
- rule([not_equal(:third), dont_care, equals(:present), dont_care], col('base_form'))
20
+ rule([not_equal(:third), equals(:singular), equals(:present), dont_care], col('base_form'))
23
21
  rule([equals(:third), equals(:singular), equals(:present), matches(/[^aeiouy]y$/)], sub(col('base_form'), /y$/, 'ies'))
24
- rule([equals(:third), equals(:singular), equals(:present), matches(/(?:[osxz]|ch|sh)$/)], concat(col('base_form'), 'es'))
25
- rule([equals(:third), equals(:singular), equals(:present), dont_care], concat(col('base_form'), 's'))
26
- rule([dont_care, dont_care, equals(:progressive), matches(/ie$/)], sub(col('base_form'), /ie$/, 'ying'))
27
- rule([dont_care, dont_care, equals(:progressive), matches(/[^e]e$/)], sub(col('base_form'), /e$/, 'ing'))
28
- rule([dont_care, dont_care, equals(:progressive), dont_care], concat(col('base_form'), 'ing'))
29
- rule([dont_care, dont_care, in?(:past_simple, :past_participle), matches(/e$/)], concat(col('base_form'), 'd'))
30
- rule([dont_care, dont_care, in?(:past_simple, :past_participle), matches(/[^aeiouy]y$/)], sub(col('base_form'), /y$/, 'ied'))
22
+ rule([equals(:third), equals(:singular), equals(:present), matches(/(?:[osxz]|ch|sh)$/)], concat(col('base_form'), 'es'))
23
+ rule([equals(:third), equals(:singular), equals(:present), dont_care], concat(col('base_form'), 's'))
24
+ rule([dont_care, equals(:plural), equals(:present), dont_care], col('base_form'))
25
+ rule([dont_care, dont_care, equals(:progressive), matches(/ie$/)], sub(col('base_form'), /ie$/, 'ying'))
26
+ rule([dont_care, dont_care, equals(:progressive), matches(/[^eoy]e$/)], sub(col('base_form'), /e$/, 'ing'))
27
+ rule([dont_care, dont_care, equals(:progressive), dont_care], concat(col('base_form'), 'ing'))
28
+ rule([dont_care, dont_care, in?(:past_simple, :past_participle), matches(/e$/)], concat(col('base_form'), 'd'))
29
+ rule([dont_care, dont_care, in?(:past_simple, :past_participle), matches(/[^aeiouy]y$/)], sub(col('base_form'), /y$/, 'ied'))
31
30
  rule([dont_care, dont_care, in?(:past_simple, :past_participle), dont_care], concat(col('base_form'), 'ed'))
32
31
  end
33
32
  add_paradigm(table)
34
33
  end
35
-
36
- def add_paradigm(anInflectionTable)
37
- @paradigms[anInflectionTable.name] = anInflectionTable
38
- end
39
34
  end # class
40
35
  end # module
41
- end # module
36
+ end # module
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'regular_verb'
2
4
 
3
5
  module Zenlish
4
6
  module WClasses
5
7
  # The `want` verb like `need` allow the construct:
6
8
  # want + to + infinitive or progressive.
7
- class RegularVerbWant < IrregularVerb
9
+ class RegularVerbWant < RegularVerb
8
10
  end # class
9
11
  end # module
10
- end # module
12
+ end # module
@@ -1,12 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'pronoun'
2
4
 
3
5
  module Zenlish
4
6
  module WClasses
5
7
  # A relative pronoun refers to a noun that has already been mentionned,
6
- # and gives more information about that noun: who, whom, whose
8
+ # and gives more information about that noun: who, whom, whose
7
9
  # (for people) and which, what, that for things (and animals).
8
10
  # A relative pronoun introduces a relative clause.
9
11
  class RelativePronoun < Pronoun
10
12
  end # class
11
13
  end # module
12
- end # module
14
+ end # module