zenlish 0.2.04 → 0.2.05
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/README.md +27 -0
- data/lib/zenlish/feature/boolean_domain.rb +4 -0
- data/lib/zenlish/feature/enumeration_domain.rb +4 -0
- data/lib/zenlish/feature/feature_def.rb +1 -0
- data/lib/zenlish/feature/feature_domain.rb +5 -1
- data/lib/zenlish/inflect/equals_literal.rb +6 -2
- data/lib/zenlish/inflect/feature_heading.rb +10 -1
- data/lib/zenlish/inflect/heading.rb +3 -0
- data/lib/zenlish/inflect/inflection_table.rb +25 -2
- data/lib/zenlish/inflect/method_heading.rb +4 -0
- data/lib/zenlish/lang/dictionary.rb +18 -14
- data/lib/zenlish/lang/zenlish_grammar.rb +1 -1
- data/lib/zenlish/lex/empty_lexicon_factory.rb +1 -1
- data/lib/zenlish/lex/lexeme.rb +5 -0
- data/lib/zenlish/version.rb +1 -1
- data/lib/zenlish/wclasses/adjective.rb +2 -1
- data/lib/zenlish/wclasses/demonstrative_determiner.rb +38 -1
- data/lib/zenlish/wclasses/irregular_verb.rb +3 -2
- data/lib/zenlish/wclasses/personal_pronoun.rb +67 -0
- data/lib/zenlish/wclasses/possessive_determiner.rb +59 -0
- data/lib/zenlish/wclasses/regular_verb.rb +3 -2
- data/lib/zenlish/wclasses/verb.rb +0 -6
- data/lib/zenlish/wclasses/word_class.rb +6 -0
- data/spec/zenlish/feature/boolean_domain_spec.rb +6 -1
- data/spec/zenlish/feature/enumeration_domain_spec.rb +5 -1
- data/spec/zenlish/inflect/feature_heading_spec.rb +22 -2
- data/spec/zenlish/inflect/inflection_table_spec.rb +32 -17
- data/spec/zenlish/inflect/method_heading_spec.rb +6 -0
- data/spec/zenlish/lang/dictionary_spec.rb +7 -7
- data/spec/zenlish/lex/lexeme_spec.rb +7 -1
- data/spec/zenlish/support/var2word.rb +9 -9
- data/spec/zenlish/wclasses/common_noun_spec.rb +21 -5
- data/spec/zenlish/wclasses/demonstrative_determiner_spec.rb +47 -0
- data/spec/zenlish/wclasses/irregular_verb_can_spec.rb +10 -0
- data/spec/zenlish/wclasses/irregular_verb_spec.rb +10 -0
- data/spec/zenlish/wclasses/personal_pronoun_spec.rb +69 -0
- data/spec/zenlish/wclasses/possessive_determiner_spec.rb +72 -0
- data/spec/zenlish/wclasses/regular_verb_spec.rb +21 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faced8ff57142b76d300ba5457b0ca153eaf6b7db6ee2fa004317acfff7b9f5e
|
4
|
+
data.tar.gz: 8b63ee393b6bcbe181584c6689496f6c07142b6a8fe0aaf85a6ef7885328c418
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 243b0b5254cb4d770f050c938d73fa4231dc2abfbb33ca2f5bb4098539be075d193899a93cd94f12132634889dbd9d507092047458710a2fb5a7e57e9efb97a0
|
7
|
+
data.tar.gz: 75ac3aa5d919f4fd3f5e6a15eac52258b3e3696fae018e2e50819c146bb1b39cfa41240dc0efac1ed69211693e0802868c2d855edde7ea3ef0872e88ed32007a
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,25 @@
|
|
1
1
|
# CHANGELOG
|
2
|
+
## [0.2.05] - 2020-02-16
|
3
|
+
Zenlish can now inflect all the lexemes in its lexicon.
|
4
|
+
|
5
|
+
### Changed
|
6
|
+
- File `README.md` added demo example showing the inflection capabilities of Zenlish
|
7
|
+
- Method `Lex::Lexeme#all_inflections` added.
|
8
|
+
- Method `Inflect::InflectionTable#all_inflections` added.
|
9
|
+
- Class `WClass::DemonstrativeDeterminer`: added specific inflection tables.
|
10
|
+
- Class `WClass::PersonalPronoun`: added specific inflection tables.
|
11
|
+
- Class `WClass::PossessiveDeterminer`: added specific inflection tables.
|
12
|
+
- Method `Feature::BooleanDomain#to_a` added.
|
13
|
+
- Method `Feature::EnumerationDomain#to_a` added.
|
14
|
+
- Method `WClasses::WordClass#add_paradigm` added.
|
15
|
+
|
16
|
+
### Fixed
|
17
|
+
- Inflection table of `WClasses::IrregularVerb`
|
18
|
+
- Inflection table of `WClasses::RegularVerb`
|
19
|
+
|
20
|
+
### Removed
|
21
|
+
- Method `WClasses::Verb#add_paradigm` removed.
|
22
|
+
|
2
23
|
## [0.2.04] - 2020-02-09
|
3
24
|
Zenlish can now inflect all the verbs in its lexicon.
|
4
25
|
|
data/README.md
CHANGED
@@ -101,6 +101,33 @@ end
|
|
101
101
|
# Rley::Syntax::Terminal
|
102
102
|
```
|
103
103
|
|
104
|
+
Demo of lexeme inflections
|
105
|
+
|
106
|
+
```ruby
|
107
|
+
# Demo inflection (aka declension, conjugation)
|
108
|
+
require 'zenlish'
|
109
|
+
|
110
|
+
# The Zenlish dictionary is more than a list of words...
|
111
|
+
dict = Zenlish::Lang::Dictionary
|
112
|
+
|
113
|
+
# What are the spellings of a given common noun?
|
114
|
+
noun_body = dict.get_lexeme('body')
|
115
|
+
p noun_body.all_inflections # => ["body", "bodies"]
|
116
|
+
|
117
|
+
# What are the word forms of a personal pronoun (3rd person)?
|
118
|
+
p_3rd_pn = dict.get_lexeme('it')
|
119
|
+
p p_3rd_pn.all_inflections # => ["she", "her", "he", "him", "it", "they", "them"]
|
120
|
+
|
121
|
+
# What are the distinct forms of a regular verb?
|
122
|
+
vb_touch = dict.get_lexeme('touch')
|
123
|
+
p vb_touch.all_inflections # => ["touch", "touching", "touched", "touches"]
|
124
|
+
|
125
|
+
# What are the forms of the (highly) irregular verb be?
|
126
|
+
vb_be = dict.get_lexeme('be', Zenlish::WClasses::IrregularVerbBe)
|
127
|
+
p vb_be.all_inflections # => ["am", "being", "was", "been", "are", "were", "is"]
|
128
|
+
```
|
129
|
+
|
130
|
+
|
104
131
|
More to come...
|
105
132
|
|
106
133
|
## Principles behind the Zenlish language
|
@@ -2,7 +2,11 @@ module Zenlish
|
|
2
2
|
module Feature
|
3
3
|
class FeatureDomain
|
4
4
|
def include?(aValue)
|
5
|
-
raise NotImplementedError,
|
5
|
+
raise NotImplementedError, "Implement #{__callee__} method in subclass(es)."
|
6
|
+
end
|
7
|
+
|
8
|
+
def to_a
|
9
|
+
raise NotImplementedError, "Implement #{__callee__} method in subclass(es)."
|
6
10
|
end
|
7
11
|
end # class
|
8
12
|
end # module
|
@@ -15,9 +15,13 @@ module Zenlish
|
|
15
15
|
hd = headings[argument.index]
|
16
16
|
feat_def = hd.evaluate_for(lexeme)
|
17
17
|
feat_def.domain.include?(literal)
|
18
|
-
else
|
18
|
+
else
|
19
19
|
val = actuals[argument.index]
|
20
|
-
val
|
20
|
+
if val.kind_of?(Feature::FeatureDef)
|
21
|
+
val.domain.include?(literal)
|
22
|
+
else
|
23
|
+
val == literal
|
24
|
+
end
|
21
25
|
end
|
22
26
|
end
|
23
27
|
end # class
|
@@ -7,10 +7,19 @@ module Zenlish
|
|
7
7
|
def initialize(aLabel)
|
8
8
|
super(aLabel)
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def evaluate_for(aFeatureBearer)
|
12
12
|
aFeatureBearer[label]
|
13
13
|
end
|
14
|
+
|
15
|
+
def all_matches(aFeatureBearer)
|
16
|
+
feat = aFeatureBearer[label]
|
17
|
+
if feat.kind_of?(Feature::FeatureDef)
|
18
|
+
feat.domain.to_a
|
19
|
+
else
|
20
|
+
[feat]
|
21
|
+
end
|
22
|
+
end
|
14
23
|
end # class
|
15
24
|
end # module
|
16
25
|
end # module
|
@@ -37,8 +37,8 @@ module Zenlish
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
# Hit policy: first
|
40
|
-
matching_rule = rules.find do |rule|
|
41
|
-
rule.success?(headings, aLexeme, actuals)
|
40
|
+
matching_rule = rules.find do |rule|
|
41
|
+
rule.success?(headings, aLexeme, actuals)
|
42
42
|
end
|
43
43
|
unless matching_rule
|
44
44
|
err_msg = "No rule in table covers case: lexeme #{aLexeme}, actuals: #{p actuals}."
|
@@ -46,6 +46,29 @@ module Zenlish
|
|
46
46
|
end
|
47
47
|
matching_rule.apply(headings, aLexeme, actuals)
|
48
48
|
end
|
49
|
+
|
50
|
+
def all_inflections(aLexeme)
|
51
|
+
constraints = Array.new(headings.size) { |_i| nil }
|
52
|
+
heading_matches = []
|
53
|
+
headings.each_with_index do |hd, idx|
|
54
|
+
heading_matches << hd.all_matches(aLexeme)
|
55
|
+
end
|
56
|
+
w_forms = nil
|
57
|
+
if constraints.size == 1
|
58
|
+
all_combos = heading_matches
|
59
|
+
w_forms = all_combos.first.map do |item|
|
60
|
+
inflect(aLexeme, [item])
|
61
|
+
end
|
62
|
+
else
|
63
|
+
vector_1 = heading_matches.shift
|
64
|
+
all_combos = vector_1.product(*heading_matches)
|
65
|
+
w_forms = all_combos.map do |combination|
|
66
|
+
inflect(aLexeme, combination)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
w_forms.uniq
|
71
|
+
end
|
49
72
|
end # class
|
50
73
|
end # module
|
51
74
|
end # module
|
@@ -11,7 +11,7 @@ unless defined?(Zenlish::Lang::Dictionary)
|
|
11
11
|
Dictionary = sandbox.create_empty_lexicon
|
12
12
|
self.extend(Feature::FeatureStructDefBearer)
|
13
13
|
|
14
|
-
# @param aLemma [String] is the canonical form, dictionary form,
|
14
|
+
# @param aLemma [String] is the canonical form, dictionary form,
|
15
15
|
# or citation form of a headword.
|
16
16
|
# @param aWClassName [String] the name of a word class.
|
17
17
|
def self.add_entry(aLemma, aWClassName, aFeatureHash = nil, &aBlock)
|
@@ -65,9 +65,9 @@ unless defined?(Zenlish::Lang::Dictionary)
|
|
65
65
|
end
|
66
66
|
add_entry('contain', 'RegularVerb')
|
67
67
|
add_entry('container', 'CommonNoun')
|
68
|
-
add_entry('damage', 'RegularVerb')
|
68
|
+
add_entry('damage', 'RegularVerb')
|
69
69
|
add_entry('die', 'RegularVerb')
|
70
|
-
add_entry('difficult', 'Adjective')
|
70
|
+
add_entry('difficult', 'Adjective')
|
71
71
|
add_entry('different', 'Adjective')
|
72
72
|
add_entry('do', 'AuxiliaryDo')
|
73
73
|
add_entry('do', 'IrregularVerbDo')
|
@@ -92,12 +92,15 @@ unless defined?(Zenlish::Lang::Dictionary)
|
|
92
92
|
# example: ...from here (works as a pronoun of a place)
|
93
93
|
add_entry('here', 'CommonNoun', {'NUMBER' => enumeration(:singular),
|
94
94
|
'PARADIGM' => [identifier, 'Singular_only']})
|
95
|
-
add_entry('I', 'PersonalPronoun')
|
95
|
+
add_entry('I', 'PersonalPronoun', { 'PERSON' => enumeration(:first),
|
96
|
+
'GENDER' => enumeration(:feminine, :masculine) })
|
96
97
|
add_entry('if', 'SubordinatingConjunction')
|
97
98
|
add_entry('in', 'Preposition')
|
98
99
|
add_entry('inside', 'Preposition')
|
99
|
-
add_entry('it', 'PersonalPronoun')
|
100
|
-
|
100
|
+
add_entry('it', 'PersonalPronoun', { 'PERSON' => enumeration(:third),
|
101
|
+
'PARADIGM' => [identifier, 'ppn_3rd_paradigm']})
|
102
|
+
add_entry('its', 'PossessiveDeterminer', { 'PERSON' => enumeration(:third),
|
103
|
+
'PARADIGM' => [identifier, 'possdet_3rd_paradigm']})
|
101
104
|
add_entry('kind', 'CommonNoun')
|
102
105
|
add_entry('know', 'IrregularVerbKnow') do
|
103
106
|
forms past_simple: 'knew', past_participle: 'known'
|
@@ -112,13 +115,13 @@ unless defined?(Zenlish::Lang::Dictionary)
|
|
112
115
|
end
|
113
116
|
add_entry('many', 'Quantifier')
|
114
117
|
add_entry('maybe', 'AdverbMaybe')
|
115
|
-
add_entry('me', 'PersonalPronoun')
|
116
118
|
add_entry('moment', 'CommonNoun')
|
117
119
|
add_entry('more', 'Adjective')
|
118
120
|
add_entry('more', 'Adverb')
|
119
121
|
add_entry('move', 'RegularVerb')
|
120
122
|
add_entry('much', 'Adverb')
|
121
|
-
add_entry('my', 'PossessiveDeterminer')
|
123
|
+
add_entry('my', 'PossessiveDeterminer',{ 'PERSON' => enumeration(:first),
|
124
|
+
'GENDER' => enumeration(:feminine, :masculine)})
|
122
125
|
add_entry('near', 'Preposition')
|
123
126
|
add_entry('near to', 'Preposition')
|
124
127
|
add_entry('now', 'Adverb')
|
@@ -133,7 +136,7 @@ unless defined?(Zenlish::Lang::Dictionary)
|
|
133
136
|
add_entry('or', 'Coordinator')
|
134
137
|
add_entry('other', 'Adjective')
|
135
138
|
add_entry('part', 'CommonNoun')
|
136
|
-
add_entry('people', 'CommonNoun', {'NUMBER' => enumeration(:plural),
|
139
|
+
add_entry('people', 'CommonNoun', {'NUMBER' => enumeration(:plural),
|
137
140
|
'PARADIGM' => [identifier, 'Plural_only']})
|
138
141
|
add_entry('person', 'CommonNoun', {'NUMBER' => enumeration(:singular),
|
139
142
|
'PARADIGM' => [identifier, 'Singular_only']})
|
@@ -157,11 +160,8 @@ unless defined?(Zenlish::Lang::Dictionary)
|
|
157
160
|
add_entry('than', 'PrepositionThan')
|
158
161
|
add_entry('that', 'RelativePronoun')
|
159
162
|
add_entry('the', 'DefiniteArticle')
|
160
|
-
add_entry('them', 'PersonalPronoun')
|
161
163
|
add_entry('then', 'LinkingAdverb')
|
162
|
-
add_entry('their', 'PossessiveDeterminer')
|
163
164
|
add_entry('there', 'ExistentialThere')
|
164
|
-
add_entry('they', 'PersonalPronoun')
|
165
165
|
add_entry('thing', 'CommonNoun')
|
166
166
|
add_entry('think', 'IrregularVerbThink') do
|
167
167
|
forms past_simple: 'thought', past_participle: 'thought'
|
@@ -186,8 +186,12 @@ unless defined?(Zenlish::Lang::Dictionary)
|
|
186
186
|
add_entry('who', 'RelativePronoun')
|
187
187
|
add_entry('with', 'Preposition')
|
188
188
|
add_entry('word', 'CommonNoun')
|
189
|
-
add_entry('you', 'PersonalPronoun')
|
190
|
-
|
189
|
+
add_entry('you', 'PersonalPronoun', { 'PERSON' => enumeration(:second),
|
190
|
+
'GENDER' => enumeration(:feminine, :masculine),
|
191
|
+
'PARADIGM' => [identifier, 'ppn_2nd_paradigm']})
|
192
|
+
add_entry('your', 'PossessiveDeterminer', { 'PERSON' => enumeration(:second),
|
193
|
+
'GENDER' => enumeration(:feminine, :masculine),
|
194
|
+
'PARADIGM' => [identifier, 'possdet_2nd_paradigm']})
|
191
195
|
|
192
196
|
# Punctuation signs...
|
193
197
|
add_entry(':', 'Colon')
|
@@ -238,7 +238,7 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
238
238
|
rule 'lexical_verb' => 'IrregularVerbKnow'
|
239
239
|
rule 'lexical_verb' => 'IrregularVerbSay'
|
240
240
|
rule 'lexical_verb' => 'IrregularVerbThink'
|
241
|
-
|
241
|
+
|
242
242
|
|
243
243
|
rule 'linking_verb' => 'IrregularLinkingVerb'
|
244
244
|
|
@@ -41,7 +41,7 @@ module Zenlish
|
|
41
41
|
add_wclass(aLexicon, WClasses::IrregularLinkingVerb)
|
42
42
|
add_wclass(aLexicon, WClasses::IrregularVerb)
|
43
43
|
add_wclass(aLexicon, WClasses::IrregularVerbBe)
|
44
|
-
add_wclass(aLexicon, WClasses::IrregularVerbCan)
|
44
|
+
add_wclass(aLexicon, WClasses::IrregularVerbCan)
|
45
45
|
add_wclass(aLexicon, WClasses::IrregularVerbDo)
|
46
46
|
add_wclass(aLexicon, WClasses::IrregularVerbHave)
|
47
47
|
add_wclass(aLexicon, WClasses::IrregularVerbKnow)
|
data/lib/zenlish/lex/lexeme.rb
CHANGED
data/lib/zenlish/version.rb
CHANGED
@@ -6,7 +6,8 @@ module Zenlish
|
|
6
6
|
class Adjective < WordClass
|
7
7
|
# @return [FalseClass] Indicates that an adjective may inflect.
|
8
8
|
def invariable?
|
9
|
-
false
|
9
|
+
# TODO: set to false once we introduce the degrees (basic, comparative, superlative)
|
10
|
+
true
|
10
11
|
end
|
11
12
|
end # class
|
12
13
|
end # module
|
@@ -1,9 +1,46 @@
|
|
1
1
|
require_relative 'determiner'
|
2
|
+
require_relative '../inflect/inflection_table_builder'
|
2
3
|
|
3
4
|
module Zenlish
|
4
5
|
module WClasses
|
5
|
-
#
|
6
|
+
# In grammar, a demonstrative is a determiner or a pronoun
|
7
|
+
# that points to a particular noun or to the noun it replaces (the antecedent).
|
6
8
|
class DemonstrativeDeterminer < Determiner
|
9
|
+
def initialize
|
10
|
+
super()
|
11
|
+
init_feature_defs
|
12
|
+
init_paradigms
|
13
|
+
end
|
14
|
+
|
15
|
+
# @return [FalseClass] Indicates that demonstrative determiners inflects.
|
16
|
+
def invariable?
|
17
|
+
false
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def init_feature_defs
|
23
|
+
# Create standard feature definitions for irregular verbs.
|
24
|
+
feature_def_dsl {
|
25
|
+
feature_def 'NUMBER' => enumeration(:singular, :plural)
|
26
|
+
feature_def 'DISTANCE' => enumeration(:near, :far)
|
27
|
+
feature_def 'PARADIGM' => [identifier, 'Demonstrative_det_paradigm'] # 2nd item is default value
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def init_paradigms
|
32
|
+
builder = Inflect::InflectionTableBuilder.new
|
33
|
+
table = builder.build('Demonstrative_det_paradigm') do
|
34
|
+
feature_heading 'NUMBER'
|
35
|
+
feature_heading 'DISTANCE'
|
36
|
+
# NUMBER DISTANCE
|
37
|
+
rule([equals(:singular), equals(:near)], func('base_form'))
|
38
|
+
rule([equals(:singular), equals(:far)], literal('that'))
|
39
|
+
rule([equals(:plural), equals(:near)], literal('these'))
|
40
|
+
rule([equals(:plural), equals(:far), ], literal('those'))
|
41
|
+
end
|
42
|
+
add_paradigm(table)
|
43
|
+
end
|
7
44
|
end # class
|
8
45
|
end # module
|
9
46
|
end # module
|
@@ -35,10 +35,11 @@ module Zenlish
|
|
35
35
|
feature_heading 'TIME'
|
36
36
|
method_heading 'base_form'
|
37
37
|
# PERSON NUMBER TIME base_form
|
38
|
-
rule([not_equal(:third),
|
38
|
+
rule([not_equal(:third), equals(:singular), equals(:present), dont_care], col('base_form'))
|
39
39
|
rule([equals(:third), equals(:singular), equals(:present), matches(/[^aeiouy]y$/)], sub(col('base_form'), /y$/, 'ies'))
|
40
40
|
rule([equals(:third), equals(:singular), equals(:present), matches(/(?:[osxz]|ch|sh)$/)], concat(col('base_form'), 'es'))
|
41
|
-
rule([equals(:third), equals(:singular), equals(:present), dont_care], concat(col('base_form'), 's'))
|
41
|
+
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'))
|
42
43
|
rule([dont_care, dont_care, equals(:progressive), matches(/ie$/)], sub(col('base_form'), /ie$/, 'ying'))
|
43
44
|
rule([dont_care, dont_care, equals(:progressive), matches(/[^eoy]e$/)], sub(col('base_form'), /e$/, 'ing'))
|
44
45
|
rule([dont_care, dont_care, equals(:progressive), dont_care], concat(col('base_form'), 'ing'))
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative 'pronoun'
|
2
|
+
require_relative '../inflect/inflection_table_builder'
|
2
3
|
|
3
4
|
module Zenlish
|
4
5
|
module WClasses
|
@@ -7,6 +8,72 @@ module Zenlish
|
|
7
8
|
# Subject forms: I, you, he/she/it, we, you, they
|
8
9
|
# Object forms: Me, you, him, her, it, us, you, them
|
9
10
|
class PersonalPronoun < Pronoun
|
11
|
+
def initialize
|
12
|
+
super()
|
13
|
+
init_feature_defs
|
14
|
+
init_paradigms
|
15
|
+
end
|
16
|
+
|
17
|
+
# @return [FalseClass] Indicates that demonstrative determiners inflects.
|
18
|
+
def invariable?
|
19
|
+
false
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def init_feature_defs
|
25
|
+
# Create standard feature definitions for irregular verbs.
|
26
|
+
feature_def_dsl {
|
27
|
+
feature_def 'NUMBER' => enumeration(:singular, :plural)
|
28
|
+
feature_def 'PERSON' => enumeration(:first, :second, :third)
|
29
|
+
feature_def 'GENDER' => enumeration(:feminine, :masculine, :neuter)
|
30
|
+
feature_def 'CASE' => enumeration(:subject, :object)
|
31
|
+
feature_def 'PARADIGM' => [identifier, 'ppn_1st_paradigm'] # 2nd item is default value
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
def init_paradigms
|
36
|
+
# Conventional base forms in Zenlish are: I, you, it
|
37
|
+
builder = Inflect::InflectionTableBuilder.new
|
38
|
+
table = builder.build('ppn_1st_paradigm') do
|
39
|
+
feature_heading 'PERSON'
|
40
|
+
feature_heading 'NUMBER'
|
41
|
+
feature_heading 'GENDER'
|
42
|
+
feature_heading 'CASE'
|
43
|
+
# PERSON NUMBER GENDER CASE
|
44
|
+
rule([equals(:first), equals(:singular), not_equal(:neuter), equals(:subject)], func('base_form'))
|
45
|
+
rule([equals(:first), equals(:plural), not_equal(:neuter), equals(:subject)], literal('we'))
|
46
|
+
rule([equals(:first), equals(:singular), not_equal(:neuter), equals(:object)], literal('me'))
|
47
|
+
rule([equals(:first), equals(:plural), not_equal(:neuter), equals(:object)], literal('us'))
|
48
|
+
end
|
49
|
+
add_paradigm(table)
|
50
|
+
|
51
|
+
table = builder.build('ppn_2nd_paradigm') do
|
52
|
+
feature_heading 'PERSON'
|
53
|
+
feature_heading 'NUMBER'
|
54
|
+
feature_heading 'GENDER'
|
55
|
+
feature_heading 'CASE'
|
56
|
+
# PERSON NUMBER GENDER CASE
|
57
|
+
rule([equals(:second), dont_care, not_equal(:neuter), dont_care], func('base_form'))
|
58
|
+
end
|
59
|
+
add_paradigm(table)
|
60
|
+
|
61
|
+
table = builder.build('ppn_3rd_paradigm') do
|
62
|
+
feature_heading 'PERSON'
|
63
|
+
feature_heading 'NUMBER'
|
64
|
+
feature_heading 'GENDER'
|
65
|
+
feature_heading 'CASE'
|
66
|
+
# PERSON NUMBER GENDER CASE
|
67
|
+
rule([equals(:third), equals(:singular), equals(:neuter), dont_care], func('base_form'))
|
68
|
+
rule([equals(:third), equals(:singular), equals(:feminine), equals(:subject)], literal('she'))
|
69
|
+
rule([equals(:third), equals(:singular), equals(:masculine), equals(:subject)], literal('he'))
|
70
|
+
rule([equals(:third), equals(:plural), dont_care, equals(:subject)], literal('they'))
|
71
|
+
rule([equals(:third), equals(:singular), equals(:feminine), equals(:object)], literal('her'))
|
72
|
+
rule([equals(:third), equals(:singular), equals(:masculine), equals(:object)], literal('him'))
|
73
|
+
rule([equals(:third), equals(:plural), dont_care, equals(:object)], literal('them'))
|
74
|
+
end
|
75
|
+
add_paradigm(table)
|
76
|
+
end
|
10
77
|
end # class
|
11
78
|
end # module
|
12
79
|
end # module
|