zenlish 0.2.05 → 0.2.07
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +228 -0
- data/CHANGELOG.md +19 -0
- data/Gemfile +5 -3
- data/LICENSE.txt +1 -1
- data/Rakefile +5 -3
- data/lib/zenlish/feature/boolean_domain.rb +6 -4
- data/lib/zenlish/feature/boolean_value.rb +3 -2
- data/lib/zenlish/feature/enumeration_domain.rb +5 -2
- data/lib/zenlish/feature/feature.rb +9 -7
- data/lib/zenlish/feature/feature_def.rb +9 -6
- data/lib/zenlish/feature/feature_domain.rb +4 -2
- data/lib/zenlish/feature/feature_struct.rb +3 -1
- data/lib/zenlish/feature/feature_struct_def.rb +5 -3
- data/lib/zenlish/feature/feature_struct_def_bearer.rb +6 -4
- data/lib/zenlish/feature/feature_value.rb +4 -2
- data/lib/zenlish/feature/identifier_domain.rb +5 -3
- data/lib/zenlish/feature/identifier_value.rb +3 -2
- data/lib/zenlish/feature/symbol_value.rb +3 -1
- data/lib/zenlish/inflect/atomic_o_expression.rb +2 -1
- data/lib/zenlish/inflect/composite_o_expression.rb +3 -1
- data/lib/zenlish/inflect/concatenation.rb +3 -2
- data/lib/zenlish/inflect/equals_literal.rb +3 -1
- data/lib/zenlish/inflect/feature_heading.rb +2 -5
- data/lib/zenlish/inflect/formal_argument.rb +3 -1
- data/lib/zenlish/inflect/function_call.rb +4 -1
- data/lib/zenlish/inflect/heading.rb +2 -0
- data/lib/zenlish/inflect/inflection_rule.rb +2 -0
- data/lib/zenlish/inflect/inflection_table.rb +6 -4
- data/lib/zenlish/inflect/inflection_table_builder.rb +21 -18
- data/lib/zenlish/inflect/input_asis.rb +3 -0
- data/lib/zenlish/inflect/input_expression.rb +4 -2
- data/lib/zenlish/inflect/literal_asis.rb +4 -1
- data/lib/zenlish/inflect/matches_pattern.rb +2 -0
- data/lib/zenlish/inflect/membership.rb +2 -0
- data/lib/zenlish/inflect/method_heading.rb +3 -6
- data/lib/zenlish/inflect/not_equals_literal.rb +2 -0
- data/lib/zenlish/inflect/nullary_input_expression.rb +3 -1
- data/lib/zenlish/inflect/output_expression.rb +6 -0
- data/lib/zenlish/inflect/substitution.rb +3 -1
- data/lib/zenlish/inflect/unary_input_expression.rb +4 -1
- data/lib/zenlish/inflect/unconditionally_true.rb +4 -2
- data/lib/zenlish/lang/dictionary.rb +19 -16
- data/lib/zenlish/lang/lemmatizer.rb +40 -0
- data/lib/zenlish/lang/zenlish_grammar.rb +6 -4
- data/lib/zenlish/lex/empty_lexicon_factory.rb +3 -2
- data/lib/zenlish/lex/lexeme.rb +6 -4
- data/lib/zenlish/lex/lexical_entry.rb +6 -4
- data/lib/zenlish/lex/lexicon.rb +4 -3
- data/lib/zenlish/lex/literal.rb +3 -1
- data/lib/zenlish/lexer/lexer.rb +144 -0
- data/lib/zenlish/trie/base_trie_node.rb +27 -0
- data/lib/zenlish/trie/trie.rb +132 -0
- data/lib/zenlish/trie/trie_node.rb +21 -0
- data/lib/zenlish/trie/trie_root.rb +10 -0
- data/lib/zenlish/version.rb +3 -1
- data/lib/zenlish/wclasses/adjective.rb +4 -2
- data/lib/zenlish/wclasses/adverb.rb +3 -1
- data/lib/zenlish/wclasses/adverb_maybe.rb +3 -1
- data/lib/zenlish/wclasses/adverb_not.rb +2 -0
- data/lib/zenlish/wclasses/all_word_classes.rb +3 -1
- data/lib/zenlish/wclasses/article.rb +2 -0
- data/lib/zenlish/wclasses/auxiliary.rb +2 -0
- data/lib/zenlish/wclasses/auxiliary_be.rb +7 -6
- data/lib/zenlish/wclasses/auxiliary_do.rb +6 -5
- data/lib/zenlish/wclasses/cardinal.rb +3 -1
- data/lib/zenlish/wclasses/common_noun.rb +2 -0
- data/lib/zenlish/wclasses/comparative_particle.rb +5 -3
- data/lib/zenlish/wclasses/conjunction.rb +2 -0
- data/lib/zenlish/wclasses/conjunctive_pronoun.rb +2 -0
- data/lib/zenlish/wclasses/coordinator.rb +4 -2
- data/lib/zenlish/wclasses/definite_article.rb +2 -0
- data/lib/zenlish/wclasses/degree_adverb.rb +2 -0
- data/lib/zenlish/wclasses/demonstrative_determiner.rb +6 -4
- data/lib/zenlish/wclasses/demonstrative_pronoun.rb +2 -0
- data/lib/zenlish/wclasses/determiner.rb +3 -1
- data/lib/zenlish/wclasses/distributive_determiner.rb +2 -0
- data/lib/zenlish/wclasses/existential_there.rb +2 -0
- data/lib/zenlish/wclasses/fronting_quantifier.rb +3 -1
- data/lib/zenlish/wclasses/indefinite_article.rb +2 -0
- data/lib/zenlish/wclasses/indefinite_pronoun.rb +3 -1
- data/lib/zenlish/wclasses/irregular_linking_verb.rb +3 -1
- data/lib/zenlish/wclasses/irregular_verb.rb +13 -15
- data/lib/zenlish/wclasses/irregular_verb_be.rb +8 -7
- data/lib/zenlish/wclasses/irregular_verb_can.rb +8 -7
- data/lib/zenlish/wclasses/irregular_verb_do.rb +7 -6
- data/lib/zenlish/wclasses/irregular_verb_extension.rb +8 -7
- data/lib/zenlish/wclasses/irregular_verb_have.rb +12 -11
- data/lib/zenlish/wclasses/irregular_verb_know.rb +3 -1
- data/lib/zenlish/wclasses/irregular_verb_say.rb +3 -1
- data/lib/zenlish/wclasses/irregular_verb_think.rb +3 -1
- data/lib/zenlish/wclasses/lexical_verb.rb +3 -4
- data/lib/zenlish/wclasses/linking_adverb.rb +2 -0
- data/lib/zenlish/wclasses/modal_verb_can.rb +7 -5
- data/lib/zenlish/wclasses/noun.rb +4 -2
- data/lib/zenlish/wclasses/numeral.rb +2 -0
- data/lib/zenlish/wclasses/personal_pronoun.rb +8 -6
- data/lib/zenlish/wclasses/possessive_determiner.rb +13 -12
- data/lib/zenlish/wclasses/preposition.rb +3 -1
- data/lib/zenlish/wclasses/preposition_of.rb +2 -0
- data/lib/zenlish/wclasses/preposition_than.rb +2 -0
- data/lib/zenlish/wclasses/pronoun.rb +3 -1
- data/lib/zenlish/wclasses/proper_noun.rb +10 -8
- data/lib/zenlish/wclasses/quantifier.rb +3 -1
- data/lib/zenlish/wclasses/regular_verb.rb +9 -9
- data/lib/zenlish/wclasses/regular_verb_want.rb +4 -2
- data/lib/zenlish/wclasses/relative_pronoun.rb +4 -2
- data/lib/zenlish/wclasses/subordinating_conjunction.rb +7 -5
- data/lib/zenlish/wclasses/verb.rb +5 -3
- data/lib/zenlish/wclasses/word_class.rb +7 -5
- data/lib/zenlish.rb +3 -3
- data/spec/spec_helper.rb +3 -1
- data/spec/zenlish/feature/boolean_domain_spec.rb +16 -16
- data/spec/zenlish/feature/boolean_value_spec.rb +7 -6
- data/spec/zenlish/feature/enumeration_domain_spec.rb +21 -21
- data/spec/zenlish/feature/feature_def_spec.rb +15 -14
- data/spec/zenlish/feature/feature_spec.rb +17 -17
- data/spec/zenlish/feature/feature_struct_def_bearer_spec.rb +23 -21
- data/spec/zenlish/feature/feature_struct_def_spec.rb +26 -25
- data/spec/zenlish/feature/identifier_domain_spec.rb +15 -15
- data/spec/zenlish/feature/identifier_value_spec.rb +10 -9
- data/spec/zenlish/feature/symbol_value_spec.rb +9 -8
- data/spec/zenlish/inflect/concatenation_spec.rb +14 -14
- data/spec/zenlish/inflect/equals_literal_spec.rb +17 -16
- data/spec/zenlish/inflect/feature_heading_spec.rb +22 -21
- data/spec/zenlish/inflect/formal_argument_spec.rb +7 -7
- data/spec/zenlish/inflect/function_call_spec.rb +11 -12
- data/spec/zenlish/inflect/inflection_rule_spec.rb +28 -24
- data/spec/zenlish/inflect/inflection_table_builder_spec.rb +62 -57
- data/spec/zenlish/inflect/inflection_table_spec.rb +49 -46
- data/spec/zenlish/inflect/input_asis_spec.rb +12 -15
- data/spec/zenlish/inflect/literal_asis_spec.rb +10 -10
- data/spec/zenlish/inflect/matches_pattern_spec.rb +16 -15
- data/spec/zenlish/inflect/membership_spec.rb +17 -16
- data/spec/zenlish/inflect/method_heading_spec.rb +15 -14
- data/spec/zenlish/inflect/not_equals_literal_spec.rb +17 -16
- data/spec/zenlish/inflect/substitution_spec.rb +10 -11
- data/spec/zenlish/inflect/unconditionally_true_spec.rb +8 -6
- data/spec/zenlish/lang/dictionary_spec.rb +28 -31
- data/spec/zenlish/lang/lemmatizer_spec.rb +43 -0
- data/spec/zenlish/lang/zenlish_grammar_spec.rb +5 -5
- data/spec/zenlish/lex/empty_lexicon_factory_spec.rb +8 -8
- data/spec/zenlish/lex/lexeme_spec.rb +27 -28
- data/spec/zenlish/lex/lexical_entry_spec.rb +15 -15
- data/spec/zenlish/lex/lexicon_spec.rb +52 -50
- data/spec/zenlish/lex/literal_spec.rb +8 -8
- data/spec/zenlish/lexer/lexer_spec.rb +52 -0
- data/spec/zenlish/parser/lesson1_spec.rb +81 -81
- data/spec/zenlish/parser/lesson2_spec.rb +133 -138
- data/spec/zenlish/parser/lesson3_spec.rb +186 -226
- data/spec/zenlish/parser/zparser_spec.rb +8 -7
- data/spec/zenlish/support/minimal_lexicon.rb +2 -0
- data/spec/zenlish/support/var2word.rb +16 -9
- data/spec/zenlish/trie/base_trie_node_spec.rb +33 -0
- data/spec/zenlish/trie/trie_spec.rb +108 -0
- data/spec/zenlish/wclasses/common_noun_spec.rb +15 -19
- data/spec/zenlish/wclasses/demonstrative_determiner_spec.rb +12 -12
- data/spec/zenlish/wclasses/irregular_verb_can_spec.rb +18 -18
- data/spec/zenlish/wclasses/irregular_verb_extension_spec.rb +10 -10
- data/spec/zenlish/wclasses/irregular_verb_spec.rb +28 -28
- data/spec/zenlish/wclasses/lexical_verb_spec.rb +9 -9
- data/spec/zenlish/wclasses/modal_verb_can_spec.rb +12 -12
- data/spec/zenlish/wclasses/noun_spec.rb +7 -7
- data/spec/zenlish/wclasses/personal_pronoun_spec.rb +20 -23
- data/spec/zenlish/wclasses/possessive_determiner_spec.rb +28 -31
- data/spec/zenlish/wclasses/preposition_spec.rb +5 -5
- data/spec/zenlish/wclasses/proper_noun_spec.rb +3 -3
- data/spec/zenlish/wclasses/regular_verb_spec.rb +30 -30
- data/spec/zenlish/wclasses/regular_verb_want_spec.rb +30 -0
- data/spec/zenlish/wclasses/verb_spec.rb +9 -9
- data/spec/zenlish_spec.rb +4 -2
- data/zenlish.gemspec +18 -14
- metadata +49 -16
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'lexical_verb'
|
2
4
|
require_relative 'irregular_verb_extension'
|
3
5
|
|
@@ -7,24 +9,20 @@ module Zenlish
|
|
7
9
|
# @return [Array<String>] [the past simple form, past participle form].
|
8
10
|
attr_writer :forms
|
9
11
|
|
10
|
-
def initialize
|
11
|
-
super()
|
12
|
-
end
|
13
|
-
|
14
12
|
# The mix-in module used to extend the lexeme
|
15
13
|
# @return [Module, NilClass]
|
16
14
|
def extension
|
17
15
|
IrregularVerbExtension
|
18
|
-
end
|
16
|
+
end
|
19
17
|
|
20
18
|
private
|
21
|
-
|
19
|
+
|
22
20
|
def init_feature_defs
|
23
21
|
super
|
24
22
|
# Create standard feature definitions for irregular verbs.
|
25
|
-
feature_def_dsl
|
23
|
+
feature_def_dsl do
|
26
24
|
feature_def 'PARADIGM' => [identifier, 'Irregular_inflection'] # 2nd item is default value
|
27
|
-
|
25
|
+
end
|
28
26
|
end
|
29
27
|
|
30
28
|
def init_paradigms
|
@@ -37,17 +35,17 @@ module Zenlish
|
|
37
35
|
# PERSON NUMBER TIME base_form
|
38
36
|
rule([not_equal(:third), equals(:singular), equals(:present), dont_care], col('base_form'))
|
39
37
|
rule([equals(:third), equals(:singular), equals(:present), matches(/[^aeiouy]y$/)], sub(col('base_form'), /y$/, 'ies'))
|
40
|
-
rule([equals(:third), equals(:singular), equals(:present), matches(/(?:[osxz]|ch|sh)$/)], concat(col('base_form'), 'es'))
|
38
|
+
rule([equals(:third), equals(:singular), equals(:present), matches(/(?:[osxz]|ch|sh)$/)], concat(col('base_form'), 'es'))
|
41
39
|
rule([equals(:third), equals(:singular), equals(:present), dont_care], concat(col('base_form'), 's'))
|
42
|
-
rule([dont_care, equals(:plural), equals(:present), dont_care], col('base_form'))
|
43
|
-
rule([dont_care, dont_care, equals(:progressive), matches(/ie$/)], sub(col('base_form'), /ie$/, 'ying'))
|
44
|
-
rule([dont_care, dont_care, equals(:progressive), matches(/[^eoy]e$/)], sub(col('base_form'), /e$/, 'ing'))
|
40
|
+
rule([dont_care, equals(:plural), equals(:present), dont_care], col('base_form'))
|
41
|
+
rule([dont_care, dont_care, equals(:progressive), matches(/ie$/)], sub(col('base_form'), /ie$/, 'ying'))
|
42
|
+
rule([dont_care, dont_care, equals(:progressive), matches(/[^eoy]e$/)], sub(col('base_form'), /e$/, 'ing'))
|
45
43
|
rule([dont_care, dont_care, equals(:progressive), dont_care], concat(col('base_form'), 'ing'))
|
46
|
-
rule([dont_care, dont_care, equals(:past_simple), dont_care], func('past_simple'))
|
44
|
+
rule([dont_care, dont_care, equals(:past_simple), dont_care], func('past_simple'))
|
47
45
|
rule([dont_care, dont_care, equals(:past_participle), dont_care], func('past_participle'))
|
48
46
|
end
|
49
47
|
add_paradigm(table)
|
50
|
-
end
|
48
|
+
end
|
51
49
|
end # class
|
52
50
|
end # module
|
53
|
-
end # module
|
51
|
+
end # module
|
@@ -1,12 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'irregular_verb'
|
2
4
|
|
3
5
|
module Zenlish
|
4
6
|
module WClasses
|
5
7
|
# The `be` verb used as a lexical verb (as opposed auxiliary verb).
|
6
8
|
class IrregularVerbBe < IrregularVerb
|
7
|
-
|
8
|
-
super()
|
9
|
-
end
|
9
|
+
# rubocop: disable Layout/SpaceInsideArrayLiteralBrackets
|
10
10
|
|
11
11
|
# The mix-in module used to extend the lexeme
|
12
12
|
# @return [Module, NilClass]
|
@@ -18,10 +18,10 @@ module Zenlish
|
|
18
18
|
|
19
19
|
def init_feature_defs
|
20
20
|
super
|
21
|
-
# Create standard feature
|
22
|
-
feature_def_dsl
|
21
|
+
# Create standard feature definitiofor irregular verbs.
|
22
|
+
feature_def_dsl do
|
23
23
|
feature_def 'PARADIGM' => [identifier, 'Verb_be_inflection'] # 2nd item is default value
|
24
|
-
|
24
|
+
end
|
25
25
|
end
|
26
26
|
|
27
27
|
def init_paradigms
|
@@ -43,6 +43,7 @@ module Zenlish
|
|
43
43
|
end
|
44
44
|
add_paradigm(table)
|
45
45
|
end
|
46
|
+
# rubocop: enable Layout/SpaceInsideArrayLiteralBrackets
|
46
47
|
end # class
|
47
48
|
end # module
|
48
|
-
end # module
|
49
|
+
end # module
|
@@ -1,22 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'irregular_verb'
|
2
4
|
|
3
5
|
module Zenlish
|
4
6
|
module WClasses
|
5
7
|
# Irregular verb can
|
6
8
|
class IrregularVerbCan < IrregularVerb
|
7
|
-
|
8
|
-
super()
|
9
|
-
end
|
9
|
+
# rubocop: disable Layout/SpaceInsideArrayLiteralBrackets
|
10
10
|
|
11
11
|
private
|
12
12
|
|
13
13
|
def init_feature_defs
|
14
14
|
super
|
15
15
|
# Create standard feature definitions for modal verb can.
|
16
|
-
feature_def_dsl
|
16
|
+
feature_def_dsl do
|
17
17
|
feature_def 'TIME' => enumeration(:present, :past_simple)
|
18
18
|
feature_def 'PARADIGM' => [identifier, 'Verb_can_inflection'] # 2nd item is default value
|
19
|
-
|
19
|
+
end
|
20
20
|
end
|
21
21
|
|
22
22
|
def init_paradigms
|
@@ -28,7 +28,8 @@ module Zenlish
|
|
28
28
|
rule([equals(:past_simple) ], literal('could'))
|
29
29
|
end
|
30
30
|
add_paradigm(table)
|
31
|
-
end
|
31
|
+
end
|
32
|
+
# rubocop: enable Layout/SpaceInsideArrayLiteralBrackets
|
32
33
|
end # class
|
33
34
|
end # module
|
34
|
-
end # module
|
35
|
+
end # module
|
@@ -1,12 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'irregular_verb'
|
2
4
|
|
3
5
|
module Zenlish
|
4
6
|
module WClasses
|
5
7
|
# The `do` verb used as a lexical verb (as opposed auxiliary verb).
|
6
8
|
class IrregularVerbDo < IrregularVerb
|
7
|
-
|
8
|
-
super()
|
9
|
-
end
|
9
|
+
# rubocop: disable Layout/SpaceInsideArrayLiteralBrackets
|
10
10
|
|
11
11
|
# The mix-in module used to extend the lexeme
|
12
12
|
# @return [Module, NilClass]
|
@@ -19,9 +19,9 @@ module Zenlish
|
|
19
19
|
def init_feature_defs
|
20
20
|
super
|
21
21
|
# Create standard feature definitions for irregular verbs.
|
22
|
-
feature_def_dsl
|
22
|
+
feature_def_dsl do
|
23
23
|
feature_def 'PARADIGM' => [identifier, 'Verb_do_inflection'] # 2nd item is default value
|
24
|
-
|
24
|
+
end
|
25
25
|
end
|
26
26
|
|
27
27
|
def init_paradigms
|
@@ -40,6 +40,7 @@ module Zenlish
|
|
40
40
|
end
|
41
41
|
add_paradigm(table)
|
42
42
|
end
|
43
|
+
# rubocop: enable Layout/SpaceInsideArrayLiteralBrackets
|
43
44
|
end # class
|
44
45
|
end # module
|
45
|
-
end # module
|
46
|
+
end # module
|
@@ -1,5 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'lexical_verb'
|
2
|
-
require_relative 'irregular_verb_extension'
|
3
4
|
|
4
5
|
module Zenlish
|
5
6
|
module WClasses
|
@@ -10,10 +11,10 @@ module Zenlish
|
|
10
11
|
def init_extension(host)
|
11
12
|
host.instance_variable_set(:@forms, [])
|
12
13
|
end
|
13
|
-
|
14
|
+
|
14
15
|
# @param theForm [Hash{Symbol => String}]
|
15
16
|
def forms(theForms)
|
16
|
-
valid_symbols = [
|
17
|
+
valid_symbols = %i[past_simple past_participle]
|
17
18
|
actual_symbols = theForms.keys
|
18
19
|
actual_symbols.each do |symb|
|
19
20
|
raise StandardError, "Invalid verb form #{symb}" unless valid_symbols.include?(symb)
|
@@ -26,14 +27,14 @@ module Zenlish
|
|
26
27
|
@forms[0] = theForms[valid_symbols[0]]
|
27
28
|
@forms[1] = theForms[valid_symbols[1]]
|
28
29
|
end
|
29
|
-
|
30
|
+
|
30
31
|
def past_simple
|
31
32
|
@forms.first
|
32
33
|
end
|
33
|
-
|
34
|
+
|
34
35
|
def past_participle
|
35
36
|
@forms.last
|
36
|
-
end
|
37
|
+
end
|
37
38
|
end # class
|
38
39
|
end # module
|
39
|
-
end # module
|
40
|
+
end # module
|
@@ -1,27 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'irregular_verb'
|
2
4
|
|
3
5
|
module Zenlish
|
4
6
|
module WClasses
|
5
7
|
# The `have` verb used as a lexical verb (as opposed auxiliary verb).
|
6
8
|
class IrregularVerbHave < IrregularVerb
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
|
9
|
+
# rubocop: disable Layout/SpaceInsideArrayLiteralBrackets
|
10
|
+
|
11
11
|
# The mix-in module used to extend the lexeme
|
12
12
|
# @return [Module, NilClass]
|
13
13
|
def extension
|
14
14
|
nil
|
15
|
-
end
|
15
|
+
end
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
19
|
def init_feature_defs
|
20
20
|
super
|
21
21
|
# Create standard feature definitions for irregular verbs.
|
22
|
-
feature_def_dsl
|
22
|
+
feature_def_dsl do
|
23
23
|
feature_def 'PARADIGM' => [identifier, 'Verb_have_inflection'] # 2nd item is default value
|
24
|
-
|
24
|
+
end
|
25
25
|
end
|
26
26
|
|
27
27
|
def init_paradigms
|
@@ -31,15 +31,16 @@ module Zenlish
|
|
31
31
|
feature_heading 'NUMBER'
|
32
32
|
feature_heading 'TIME'
|
33
33
|
# PERSON NUMBER TIME
|
34
|
-
rule([not_equal(:third), equals(:singular), equals(:present)
|
34
|
+
rule([not_equal(:third), equals(:singular), equals(:present) ], literal('have'))
|
35
35
|
rule([equals(:third), equals(:singular), equals(:present) ], literal('has'))
|
36
36
|
rule([dont_care, equals(:plural), equals(:present) ], literal('have'))
|
37
37
|
rule([dont_care, dont_care, equals(:progressive) ], literal('having'))
|
38
|
-
rule([dont_care, dont_care, equals(:past_simple) ], literal('had'))
|
38
|
+
rule([dont_care, dont_care, equals(:past_simple) ], literal('had'))
|
39
39
|
rule([dont_care, dont_care, equals(:past_participle)], literal('had'))
|
40
40
|
end
|
41
41
|
add_paradigm(table)
|
42
|
-
end
|
42
|
+
end
|
43
|
+
# rubocop: enable Layout/SpaceInsideArrayLiteralBrackets
|
43
44
|
end # class
|
44
45
|
end # module
|
45
|
-
end # module
|
46
|
+
end # module
|
@@ -1,24 +1,25 @@
|
|
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
|
7
|
-
|
8
|
-
super()
|
9
|
-
end
|
9
|
+
# Comment requested by Rubocop
|
10
10
|
|
11
11
|
private
|
12
12
|
|
13
13
|
def init_feature_defs
|
14
14
|
super
|
15
15
|
# Create standard feature definitions for modal verb can.
|
16
|
-
feature_def_dsl
|
16
|
+
feature_def_dsl do
|
17
17
|
feature_def 'TIME' => enumeration(:present, :past_simple)
|
18
18
|
feature_def 'PARADIGM' => [identifier, 'Verb_can_inflection'] # 2nd item is default value
|
19
|
-
|
19
|
+
end
|
20
20
|
end
|
21
21
|
|
22
|
+
# rubocop: disable Layout/SpaceInsideArrayLiteralBrackets
|
22
23
|
def init_paradigms
|
23
24
|
builder = Inflect::InflectionTableBuilder.new
|
24
25
|
table = builder.build('Verb_can_inflection') do
|
@@ -29,6 +30,7 @@ module Zenlish
|
|
29
30
|
end
|
30
31
|
add_paradigm(table)
|
31
32
|
end
|
33
|
+
# rubocop: enable Layout/SpaceInsideArrayLiteralBrackets
|
32
34
|
end # class
|
33
35
|
end # module
|
34
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 'pronoun'
|
2
4
|
require_relative '../inflect/inflection_table_builder'
|
3
5
|
|
@@ -23,13 +25,13 @@ module Zenlish
|
|
23
25
|
|
24
26
|
def init_feature_defs
|
25
27
|
# Create standard feature definitions for irregular verbs.
|
26
|
-
feature_def_dsl
|
28
|
+
feature_def_dsl do
|
27
29
|
feature_def 'NUMBER' => enumeration(:singular, :plural)
|
28
30
|
feature_def 'PERSON' => enumeration(:first, :second, :third)
|
29
31
|
feature_def 'GENDER' => enumeration(:feminine, :masculine, :neuter)
|
30
32
|
feature_def 'CASE' => enumeration(:subject, :object)
|
31
33
|
feature_def 'PARADIGM' => [identifier, 'ppn_1st_paradigm'] # 2nd item is default value
|
32
|
-
|
34
|
+
end
|
33
35
|
end
|
34
36
|
|
35
37
|
def init_paradigms
|
@@ -57,14 +59,14 @@ module Zenlish
|
|
57
59
|
rule([equals(:second), dont_care, not_equal(:neuter), dont_care], func('base_form'))
|
58
60
|
end
|
59
61
|
add_paradigm(table)
|
60
|
-
|
62
|
+
|
61
63
|
table = builder.build('ppn_3rd_paradigm') do
|
62
64
|
feature_heading 'PERSON'
|
63
65
|
feature_heading 'NUMBER'
|
64
66
|
feature_heading 'GENDER'
|
65
67
|
feature_heading 'CASE'
|
66
68
|
# PERSON NUMBER GENDER CASE
|
67
|
-
rule([equals(:third), equals(:singular), equals(:neuter), dont_care], func('base_form'))
|
69
|
+
rule([equals(:third), equals(:singular), equals(:neuter), dont_care], func('base_form'))
|
68
70
|
rule([equals(:third), equals(:singular), equals(:feminine), equals(:subject)], literal('she'))
|
69
71
|
rule([equals(:third), equals(:singular), equals(:masculine), equals(:subject)], literal('he'))
|
70
72
|
rule([equals(:third), equals(:plural), dont_care, equals(:subject)], literal('they'))
|
@@ -72,8 +74,8 @@ module Zenlish
|
|
72
74
|
rule([equals(:third), equals(:singular), equals(:masculine), equals(:object)], literal('him'))
|
73
75
|
rule([equals(:third), equals(:plural), dont_care, equals(:object)], literal('them'))
|
74
76
|
end
|
75
|
-
add_paradigm(table)
|
77
|
+
add_paradigm(table)
|
76
78
|
end
|
77
79
|
end # class
|
78
80
|
end # module
|
79
|
-
end # module
|
81
|
+
end # module
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'determiner'
|
2
4
|
require_relative '../inflect/inflection_table_builder'
|
3
5
|
|
@@ -11,7 +13,7 @@ module Zenlish
|
|
11
13
|
super()
|
12
14
|
init_feature_defs
|
13
15
|
init_paradigms
|
14
|
-
end
|
16
|
+
end
|
15
17
|
|
16
18
|
# @return [FalseClass] Indicates that demonstrative determiners inflects.
|
17
19
|
def invariable?
|
@@ -22,12 +24,12 @@ module Zenlish
|
|
22
24
|
|
23
25
|
def init_feature_defs
|
24
26
|
# Create standard feature definitions for irregular verbs.
|
25
|
-
feature_def_dsl
|
27
|
+
feature_def_dsl do
|
26
28
|
feature_def 'NUMBER' => enumeration(:singular, :plural)
|
27
29
|
feature_def 'PERSON' => enumeration(:first, :second, :third)
|
28
30
|
feature_def 'GENDER' => enumeration(:feminine, :masculine, :neuter)
|
29
31
|
feature_def 'PARADIGM' => [identifier, 'possdet_1st_paradigm'] # 2nd item is default value
|
30
|
-
|
32
|
+
end
|
31
33
|
end
|
32
34
|
|
33
35
|
def init_paradigms
|
@@ -37,7 +39,7 @@ module Zenlish
|
|
37
39
|
feature_heading 'PERSON'
|
38
40
|
feature_heading 'NUMBER'
|
39
41
|
feature_heading 'GENDER'
|
40
|
-
# PERSON NUMBER GENDER
|
42
|
+
# PERSON NUMBER GENDER
|
41
43
|
rule([equals(:first), equals(:singular), not_equal(:neuter)], func('base_form'))
|
42
44
|
rule([equals(:first), equals(:plural), not_equal(:neuter)], literal('our'))
|
43
45
|
end
|
@@ -47,24 +49,23 @@ module Zenlish
|
|
47
49
|
feature_heading 'PERSON'
|
48
50
|
feature_heading 'NUMBER'
|
49
51
|
feature_heading 'GENDER'
|
50
|
-
# PERSON NUMBER GENDER
|
51
|
-
rule([equals(:second), dont_care, not_equal(:neuter)],
|
52
|
-
|
52
|
+
# PERSON NUMBER GENDER
|
53
|
+
rule([equals(:second), dont_care, not_equal(:neuter)], func('base_form'))
|
53
54
|
end
|
54
55
|
add_paradigm(table)
|
55
|
-
|
56
|
+
|
56
57
|
table = builder.build('possdet_3rd_paradigm') do
|
57
58
|
feature_heading 'PERSON'
|
58
59
|
feature_heading 'NUMBER'
|
59
60
|
feature_heading 'GENDER'
|
60
|
-
# PERSON NUMBER GENDER
|
61
|
+
# PERSON NUMBER GENDER
|
61
62
|
rule([equals(:third), equals(:singular), equals(:neuter)], func('base_form'))
|
62
63
|
rule([equals(:third), equals(:singular), equals(:feminine)], literal('her'))
|
63
64
|
rule([equals(:third), equals(:singular), equals(:masculine)], literal('his'))
|
64
|
-
rule([equals(:third), equals(:plural), dont_care], literal('their'))
|
65
|
+
rule([equals(:third), equals(:plural), dont_care], literal('their'))
|
65
66
|
end
|
66
|
-
add_paradigm(table)
|
67
|
-
end
|
67
|
+
add_paradigm(table)
|
68
|
+
end
|
68
69
|
end # class
|
69
70
|
end # module
|
70
71
|
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
|
9
|
+
class Quantifier < Determiner
|
8
10
|
end # class
|
9
11
|
end # module
|
10
12
|
end # module
|
@@ -1,11 +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
|
-
|
7
|
-
super
|
8
|
-
end
|
8
|
+
# Requested by Rubocop
|
9
9
|
|
10
10
|
private
|
11
11
|
|
@@ -19,18 +19,18 @@ module Zenlish
|
|
19
19
|
# PERSON NUMBER TIME base_form
|
20
20
|
rule([not_equal(:third), equals(:singular), equals(:present), dont_care], col('base_form'))
|
21
21
|
rule([equals(:third), equals(:singular), equals(:present), matches(/[^aeiouy]y$/)], sub(col('base_form'), /y$/, 'ies'))
|
22
|
-
rule([equals(:third), equals(:singular), equals(:present), matches(/(?:[osxz]|ch|sh)$/)], concat(col('base_form'), 'es'))
|
22
|
+
rule([equals(:third), equals(:singular), equals(:present), matches(/(?:[osxz]|ch|sh)$/)], concat(col('base_form'), 'es'))
|
23
23
|
rule([equals(:third), equals(:singular), equals(:present), dont_care], concat(col('base_form'), 's'))
|
24
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'))
|
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
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'))
|
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'))
|
30
30
|
rule([dont_care, dont_care, in?(:past_simple, :past_participle), dont_care], concat(col('base_form'), 'ed'))
|
31
31
|
end
|
32
32
|
add_paradigm(table)
|
33
33
|
end
|
34
34
|
end # class
|
35
35
|
end # module
|
36
|
-
end # module
|
36
|
+
end # module
|