zenlish 0.2.02 → 0.2.06
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +455 -0
- data/CHANGELOG.md +58 -1
- data/Gemfile +5 -3
- data/README.md +27 -0
- data/Rakefile +5 -3
- data/lib/zenlish/feature/boolean_domain.rb +9 -3
- data/lib/zenlish/feature/boolean_value.rb +3 -2
- data/lib/zenlish/feature/enumeration_domain.rb +8 -1
- data/lib/zenlish/feature/feature.rb +9 -7
- data/lib/zenlish/feature/feature_def.rb +10 -6
- data/lib/zenlish/feature/feature_domain.rb +9 -3
- data/lib/zenlish/feature/feature_struct.rb +3 -1
- data/lib/zenlish/feature/feature_struct_def.rb +5 -1
- 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 +7 -1
- data/lib/zenlish/inflect/feature_heading.rb +11 -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 +5 -0
- data/lib/zenlish/inflect/inflection_rule.rb +2 -0
- data/lib/zenlish/inflect/inflection_table.rb +29 -4
- data/lib/zenlish/inflect/inflection_table_builder.rb +27 -20
- 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 +7 -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 +2 -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 +35 -29
- data/lib/zenlish/lang/lemmatizer.rb +40 -0
- data/lib/zenlish/lang/zenlish_grammar.rb +9 -6
- data/lib/zenlish/lex/empty_lexicon_factory.rb +4 -3
- data/lib/zenlish/lex/lexeme.rb +9 -2
- data/lib/zenlish/lex/lexical_entry.rb +6 -4
- data/lib/zenlish/lex/lexicon.rb +10 -8
- 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 +5 -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 +4 -2
- data/lib/zenlish/wclasses/article.rb +2 -0
- data/lib/zenlish/wclasses/auxiliary.rb +5 -2
- data/lib/zenlish/wclasses/auxiliary_be.rb +34 -1
- data/lib/zenlish/wclasses/auxiliary_do.rb +31 -0
- 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 +40 -1
- 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 +14 -22
- data/lib/zenlish/wclasses/irregular_verb_be.rb +41 -1
- data/lib/zenlish/wclasses/irregular_verb_can.rb +35 -0
- data/lib/zenlish/wclasses/irregular_verb_do.rb +38 -1
- data/lib/zenlish/wclasses/irregular_verb_extension.rb +8 -6
- data/lib/zenlish/wclasses/irregular_verb_have.rb +38 -1
- 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 +27 -0
- data/lib/zenlish/wclasses/noun.rb +4 -2
- data/lib/zenlish/wclasses/numeral.rb +2 -0
- data/lib/zenlish/wclasses/personal_pronoun.rb +70 -1
- data/lib/zenlish/wclasses/possessive_determiner.rb +60 -0
- 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 +13 -18
- 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 +16 -8
- data/lib/zenlish/wclasses/word_class.rb +11 -3
- data/spec/spec_helper.rb +3 -1
- data/spec/zenlish/feature/boolean_domain_spec.rb +6 -1
- data/spec/zenlish/feature/boolean_value_spec.rb +1 -1
- data/spec/zenlish/feature/enumeration_domain_spec.rb +9 -5
- data/spec/zenlish/feature/feature_spec.rb +3 -3
- data/spec/zenlish/feature/feature_struct_def_bearer_spec.rb +10 -8
- data/spec/zenlish/feature/feature_struct_def_spec.rb +3 -2
- data/spec/zenlish/feature/identifier_domain_spec.rb +3 -3
- data/spec/zenlish/feature/identifier_value_spec.rb +4 -4
- data/spec/zenlish/feature/symbol_value_spec.rb +3 -3
- data/spec/zenlish/inflect/concatenation_spec.rb +7 -7
- data/spec/zenlish/inflect/feature_heading_spec.rb +23 -3
- data/spec/zenlish/inflect/formal_argument_spec.rb +2 -2
- data/spec/zenlish/inflect/function_call_spec.rb +4 -4
- data/spec/zenlish/inflect/inflection_rule_spec.rb +9 -5
- data/spec/zenlish/inflect/inflection_table_builder_spec.rb +26 -21
- data/spec/zenlish/inflect/inflection_table_spec.rb +39 -22
- data/spec/zenlish/inflect/input_asis_spec.rb +2 -6
- data/spec/zenlish/inflect/literal_asis_spec.rb +3 -3
- data/spec/zenlish/inflect/matches_pattern_spec.rb +1 -1
- data/spec/zenlish/inflect/membership_spec.rb +2 -2
- data/spec/zenlish/inflect/method_heading_spec.rb +7 -1
- data/spec/zenlish/inflect/substitution_spec.rb +1 -1
- data/spec/zenlish/inflect/unconditionally_true_spec.rb +2 -2
- data/spec/zenlish/lang/dictionary_spec.rb +51 -16
- data/spec/zenlish/lang/lemmatizer_spec.rb +43 -0
- data/spec/zenlish/lang/zenlish_grammar_spec.rb +2 -2
- data/spec/zenlish/lex/lexeme_spec.rb +16 -11
- data/spec/zenlish/lex/lexical_entry_spec.rb +1 -2
- data/spec/zenlish/lex/lexicon_spec.rb +9 -8
- data/spec/zenlish/lex/literal_spec.rb +2 -2
- data/spec/zenlish/lexer/lexer_spec.rb +52 -0
- data/spec/zenlish/parser/lesson1_spec.rb +2 -2
- data/spec/zenlish/parser/lesson2_spec.rb +31 -36
- data/spec/zenlish/parser/lesson3_spec.rb +98 -138
- data/spec/zenlish/parser/zparser_spec.rb +2 -1
- data/spec/zenlish/support/minimal_lexicon.rb +2 -0
- data/spec/zenlish/support/var2word.rb +27 -18
- 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 +19 -7
- data/spec/zenlish/wclasses/demonstrative_determiner_spec.rb +47 -0
- data/spec/zenlish/wclasses/irregular_verb_can_spec.rb +60 -0
- data/spec/zenlish/wclasses/irregular_verb_spec.rb +14 -4
- data/spec/zenlish/wclasses/lexical_verb_spec.rb +9 -2
- data/spec/zenlish/wclasses/modal_verb_can_spec.rb +50 -0
- data/spec/zenlish/wclasses/personal_pronoun_spec.rb +66 -0
- data/spec/zenlish/wclasses/possessive_determiner_spec.rb +69 -0
- data/spec/zenlish/wclasses/regular_verb_spec.rb +35 -15
- data/spec/zenlish/wclasses/regular_verb_want_spec.rb +30 -0
- data/spec/zenlish/wclasses/verb_spec.rb +9 -2
- data/spec/zenlish_spec.rb +3 -1
- data/zenlish.gemspec +17 -14
- metadata +37 -10
- data/lib/zenlish/wclasses/modal_verb_could.rb +0 -9
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require_relative '../../spec_helper' # Use the RSpec framework
|
3
4
|
require_relative '../support/var2word'
|
4
5
|
require_relative '../../../lib/zenlish/parser/zparser' # Load the class under test
|
@@ -21,8 +22,7 @@ module Zenlish
|
|
21
22
|
# [Tony has something that Lisa wants.]'
|
22
23
|
literals = [j_, happens, to, something, dot,
|
23
24
|
this, same, thing, does, k_, dot,
|
24
|
-
tony, has, something, that, lisa, wants, dot
|
25
|
-
]
|
25
|
+
tony, has, something, that, lisa, wants, dot]
|
26
26
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
27
27
|
|
28
28
|
# Sentence 3-02a definiendum: 'J is true, and K is true.'
|
@@ -34,8 +34,7 @@ module Zenlish
|
|
34
34
|
# [Lisa sees Tony, and Tony sees Lisa.]'
|
35
35
|
literals = [these, two, things, are, true_, colon, j_, is, true_, dot,
|
36
36
|
k_, is, true_, dot,
|
37
|
-
lisa, sees, tony, comma, and_, tony, sees, lisa, dot
|
38
|
-
]
|
37
|
+
lisa, sees, tony, comma, and_, tony, sees, lisa, dot]
|
39
38
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
40
39
|
|
41
40
|
# Sentence 3-02c definiendum: 'J and K do X.'
|
@@ -51,8 +50,7 @@ module Zenlish
|
|
51
50
|
j_, is, one_as_adj, that, does, this_as_pronoun, dot,
|
52
51
|
k_, is, another, that, does, this_as_pronoun, dot,
|
53
52
|
tony, and_, lisa, want, to, see, me, dot,
|
54
|
-
i_pronoun, see, tony, and_, lisa, dot
|
55
|
-
]
|
53
|
+
i_pronoun, see, tony, and_, lisa, dot]
|
56
54
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
57
55
|
|
58
56
|
# Sentence 3-03a definiendum: 'J is true, or K is true.'
|
@@ -62,9 +60,8 @@ module Zenlish
|
|
62
60
|
# Sentence 3-03b definiens: 'If J is not true, then K is true.
|
63
61
|
# [Tony saw me, or Lisa heard me.]
|
64
62
|
literals = [if_, j_, is, not_, true_, comma,
|
65
|
-
|
66
|
-
tony, saw, me, comma, or_, lisa, heard, me, dot
|
67
|
-
]
|
63
|
+
then_, k_, is, true_, dot,
|
64
|
+
tony, saw, me, comma, or_, lisa, heard, me, dot]
|
68
65
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
69
66
|
|
70
67
|
# Sentence 3-03c definiendum: 'J or K does this.'
|
@@ -79,8 +76,7 @@ module Zenlish
|
|
79
76
|
# Sentence 3-03e: '[Lisa or Tony said something.]
|
80
77
|
# [This belongs to Tony or Lisa.]'
|
81
78
|
literals = [lisa, or_, tony, said, something, dot,
|
82
|
-
this_as_pronoun, belongs, to, tony, or_, lisa, dot
|
83
|
-
]
|
79
|
+
this_as_pronoun, belongs, to, tony, or_, lisa, dot]
|
84
80
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
85
81
|
|
86
82
|
# Sentence 3-04a definiendum: 'It does something.'
|
@@ -90,41 +86,35 @@ module Zenlish
|
|
90
86
|
# Sentence 3-04b definiens: 'This thing does something.'
|
91
87
|
# [I touched this thing, and it moved.]
|
92
88
|
literals = [this, thing, does, something, dot,
|
93
|
-
i_pronoun, touched, this, thing, comma, and_, it_, moved, dot
|
94
|
-
]
|
89
|
+
i_pronoun, touched, this, thing, comma, and_, it_, moved, dot]
|
95
90
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
96
91
|
|
97
92
|
# Sentence 3-04c definiendum: 'They do something.'
|
98
|
-
literals = [they, does, something, dot
|
99
|
-
]
|
93
|
+
literals = [they, does, something, dot]
|
100
94
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
101
95
|
|
102
96
|
# Sentence 3-04d definiens: 'These things or people do something.'
|
103
97
|
# [Something happens to them.] = Something happens to these things or people.
|
104
|
-
literals = [
|
98
|
+
literals = [these, things, or_, people, do_, something, dot,
|
105
99
|
something, happens, to, them, dot,
|
106
|
-
something, happens, to, these, things, or_, people, dot
|
107
|
-
]
|
100
|
+
something, happens, to, these, things, or_, people, dot]
|
108
101
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
109
102
|
end
|
110
103
|
|
111
104
|
it 'should parse sample sentences from lesson 3-B' do
|
112
105
|
# Sentence 3-05a definiendum: 'This is its X.'
|
113
|
-
literals = [this_as_pronoun, is, its, x_as_noun, dot
|
114
|
-
]
|
106
|
+
literals = [this_as_pronoun, is, its, x_as_noun, dot]
|
115
107
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
116
108
|
|
117
109
|
# Sentence 3-05b definiens: 'This X belongs to it.
|
118
110
|
# [I saw this thing and touched some of its parts.]
|
119
111
|
# [These things are their things.] = These things belong to them.
|
120
112
|
literals = [this, x_as_noun, belongs, to, it_, dot,
|
121
|
-
i_pronoun, saw, this, thing, and_, touched, some, of, its, parts, dot
|
122
|
-
]
|
113
|
+
i_pronoun, saw, this, thing, and_, touched, some, of, its, parts, dot]
|
123
114
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
124
115
|
|
125
116
|
# Sentence 3-05c definiendum: 'These things are their things.'
|
126
|
-
literals = [these, things, are, their, things, dot
|
127
|
-
]
|
117
|
+
literals = [these, things, are, their, things, dot]
|
128
118
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
129
119
|
|
130
120
|
# Sentence 3-05d definiens: 'These things belong to them.
|
@@ -138,20 +128,17 @@ module Zenlish
|
|
138
128
|
# Sentence 3-06b definien: 'This X belongs to you.
|
139
129
|
# [You feel something touching your body.]
|
140
130
|
literals = [this, x_as_noun, belongs, to, you, dot,
|
141
|
-
you, feel, something, touching, your, body, dot
|
142
|
-
]
|
131
|
+
you, feel, something, touching, your, body, dot]
|
143
132
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
144
133
|
|
145
134
|
# Sentence 3-07a definiendum: 'This is my X.'
|
146
|
-
literals = [this_as_pronoun, is, my, x_as_noun, dot
|
147
|
-
]
|
135
|
+
literals = [this_as_pronoun, is, my, x_as_noun, dot]
|
148
136
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
149
137
|
|
150
138
|
# Sentence 3-07b definiens: 'This X belongs to me.
|
151
139
|
# [I do not want you to touch my body.]
|
152
140
|
literals = [this, x_as_noun, belongs, to, me, dot,
|
153
|
-
i_pronoun, do_aux, not_, want, to, touch, my, body, dot
|
154
|
-
]
|
141
|
+
i_pronoun, do_aux, not_, want, to, touch, my, body, dot]
|
155
142
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
156
143
|
|
157
144
|
# Sentence 3-08a definiendum: 'There is an X here.'
|
@@ -165,8 +152,7 @@ module Zenlish
|
|
165
152
|
literals = [x_as_noun, is, some, kind, of, thing, dot,
|
166
153
|
there, is, one, of, this, kind, of, thing, here, dot,
|
167
154
|
this_as_pronoun, is, not_, one_as_adj, that, you, said, something,
|
168
|
-
|
169
|
-
]
|
155
|
+
about, a_as_art, short, time, before_as_adj, now_as_noun, dot]
|
170
156
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
171
157
|
|
172
158
|
# Sentence 3-Bxa 'Lisa sees a living thing that is very big.
|
@@ -174,7 +160,7 @@ module Zenlish
|
|
174
160
|
literals = [
|
175
161
|
lisa, sees, a_as_art, living, thing, that, is, very, big, dot,
|
176
162
|
lisa, says, colon, quote, i_pronoun, see, one, living, thing, dot,
|
177
|
-
|
163
|
+
its, body, is, bigger, than, my, body, dot, quote, dot
|
178
164
|
]
|
179
165
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
180
166
|
end
|
@@ -190,12 +176,11 @@ module Zenlish
|
|
190
176
|
# [I saw two people here before, and now I do not see the people.]
|
191
177
|
literals = [something, happens, to, x_as_noun, dot,
|
192
178
|
this_as_pronoun, is, the, same, x_as_noun, that, someone, said, something, about,
|
193
|
-
|
194
|
-
|
195
|
-
|
179
|
+
a_as_art, short, time, before_as_adj, comma,
|
180
|
+
or_, there, is, not_, another, thing, that, is, the, same, kind,
|
181
|
+
as, x_as_noun, dot,
|
196
182
|
i_pronoun, saw, two, people, here, before_adverb, comma,
|
197
|
-
|
198
|
-
]
|
183
|
+
and_, now, i_pronoun, do_aux, not_, see, the, people, dot]
|
199
184
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
200
185
|
|
201
186
|
# Sentence 3-10a definiendum: 'X is an animal.'
|
@@ -205,11 +190,10 @@ module Zenlish
|
|
205
190
|
# Sentence 3-10b definiens: There are many kinds of living things
|
206
191
|
# that can feel and can move when they want. X is one of these.
|
207
192
|
# [The animal moved when someone touched its body.]
|
208
|
-
literals = [
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
]
|
193
|
+
literals = [there, are, many, kinds, of, living, things,
|
194
|
+
that, can, feel, and_, can, move, when_, they, want, dot,
|
195
|
+
x_as_noun, is, one, of, these_as_pronoun, dot,
|
196
|
+
the, animal, moved, when_, someone, touched, its, body, dot]
|
213
197
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
214
198
|
|
215
199
|
# Sentence 3-11a definiendum: 'J causes K to happen.'
|
@@ -219,10 +203,9 @@ module Zenlish
|
|
219
203
|
# Sentence 3-11b definiens: K happens because J happens
|
220
204
|
# or because J does something.
|
221
205
|
# [Someone bad caused these people to die.]
|
222
|
-
literals = [
|
206
|
+
literals = [k_, happens, because, j_, happens,
|
223
207
|
or_, because, j_, does, something, dot,
|
224
|
-
something, bad, caused, these, people, to, die, dot
|
225
|
-
]
|
208
|
+
something, bad, caused, these, people, to, die, dot]
|
226
209
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
227
210
|
|
228
211
|
# Sentence 3-12a definiendum: 'J is true, but K is not true.'
|
@@ -234,21 +217,19 @@ module Zenlish
|
|
234
217
|
# they think K is true because of this.
|
235
218
|
# You want them to know K is not true, and you say this.
|
236
219
|
# [I hear Tony, but I do not see Tony.]
|
237
|
-
literals = [
|
238
|
-
|
220
|
+
literals = [maybe, when_, some, people, hear, j_, is, true_, comma,
|
221
|
+
they, think, k_, is, true_, because, of, this_as_pronoun, dot,
|
239
222
|
you, want, them, to, know, k_, is, not_, true_, comma,
|
240
223
|
and_, you, say, this_as_pronoun, dot,
|
241
|
-
i_pronoun, hear, tony, comma, but, i_pronoun, do_aux, not_, see, lisa, dot
|
242
|
-
]
|
224
|
+
i_pronoun, hear, tony, comma, but, i_pronoun, do_aux, not_, see, lisa, dot]
|
243
225
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
244
226
|
|
245
227
|
# Sentence 3-C Xtra Lisa says: "I can hear an animal, but I do not see it."
|
246
228
|
# Tony says: "I can see the animal that you hear.".
|
247
|
-
literals = [
|
248
|
-
|
229
|
+
literals = [lisa, says, colon, quote, i_pronoun, can, hear, an,
|
230
|
+
animal, comma, but, i_pronoun, do_aux, not_, see, it_, dot, quote,
|
249
231
|
dot, tony, says, colon, quote, i_pronoun, can, see, the, animal,
|
250
|
-
|
251
|
-
]
|
232
|
+
that, you, hear, dot, quote, dot]
|
252
233
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
253
234
|
end
|
254
235
|
|
@@ -260,12 +241,11 @@ module Zenlish
|
|
260
241
|
# Sentence 3-13b definiens: You do something with this thing
|
261
242
|
# because you think this can cause something to happen that you want.
|
262
243
|
# [I used something big to cause people far from here to see me.]
|
263
|
-
literals = [
|
244
|
+
literals = [you, do_, something, with, this, thing, because, you,
|
264
245
|
think, this_as_pronoun, can, cause, something, to, happen,
|
265
246
|
that, you, want, dot,
|
266
247
|
i_pronoun, used, something, big, to, cause, people, far, from,
|
267
|
-
here_as_noun, to, see, me, dot
|
268
|
-
]
|
248
|
+
here_as_noun, to, see, me, dot]
|
269
249
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
270
250
|
|
271
251
|
# Sentence 3-14a definiendum: 'You know X about each of these things.'
|
@@ -278,12 +258,11 @@ module Zenlish
|
|
278
258
|
# [Each person here said something to me.]
|
279
259
|
# because you think this can cause something to happen that you want.
|
280
260
|
# [I used something big to cause people far from here to see me.]
|
281
|
-
literals = [
|
261
|
+
literals = [there, are, two, or_, more, things, dot,
|
282
262
|
you, think, about, all, these, things, like, this_as_pronoun, colon,
|
283
|
-
|
284
|
-
|
285
|
-
each_, person, here, said, something, to, me, dot
|
286
|
-
]
|
263
|
+
if_, something, is, one, of, these, things, comma,
|
264
|
+
then_, you, know, x_as_noun, about, it_, dot,
|
265
|
+
each_, person, here, said, something, to, me, dot]
|
287
266
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
288
267
|
|
289
268
|
# Sentence 3-15a definiendum: 'Someplace an X exists.'
|
@@ -293,7 +272,7 @@ module Zenlish
|
|
293
272
|
# Sentence 3-15b definiens: Someplace there is an X,
|
294
273
|
# or someplace an X is alive.
|
295
274
|
# [This kind of thing did not exist before this time.]
|
296
|
-
literals = [
|
275
|
+
literals = [someplace, there, is, an, x_as_noun, comma,
|
297
276
|
or_, someplace, an, x_as_noun, is, alive, dot,
|
298
277
|
this, kind, of, thing, did, not_, exist, before, this, time, dot]
|
299
278
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
@@ -306,12 +285,11 @@ module Zenlish
|
|
306
285
|
# After this happened, K is something true you can know about J.
|
307
286
|
# But before this happened, K was not true.
|
308
287
|
# [These two animals were small before, but they became big.]
|
309
|
-
literals = [
|
288
|
+
literals = [something, happened, to, j_, for_, some, time, dot,
|
310
289
|
after_, this_as_pronoun, happened, comma, k_, is, something, true_,
|
311
|
-
|
290
|
+
you, can, know, about, j_, dot,
|
312
291
|
these, two, animals, were, small, before_adverb, comma,
|
313
|
-
but, they, became, big, dot
|
314
|
-
]
|
292
|
+
but, they, became, big, dot]
|
315
293
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
316
294
|
|
317
295
|
# Sentence 3-Dx: There are some animals here.
|
@@ -319,10 +297,9 @@ module Zenlish
|
|
319
297
|
# After a long time, each of these animals became big.
|
320
298
|
literals = [there, are, some, animal, here, dot,
|
321
299
|
each_, of, these, animals, was, small, when_, it_,
|
322
|
-
|
300
|
+
existed, a_as_art, short, time, dot,
|
323
301
|
after_, a_as_art, long, time, comma, each_, of, these, animals,
|
324
|
-
|
325
|
-
]
|
302
|
+
became, big, dot]
|
326
303
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
327
304
|
end
|
328
305
|
|
@@ -333,10 +310,9 @@ module Zenlish
|
|
333
310
|
|
334
311
|
# Sentence 3-17b definiens: These things are not the same.
|
335
312
|
# [I want this kind of thing, but you want something different.]
|
336
|
-
literals = [
|
313
|
+
literals = [these, things, are, not_, the, same_as_pronoun, dot,
|
337
314
|
i_pronoun, want, this, kind, of, thing, comma,
|
338
|
-
but, you, want, something, different, dot
|
339
|
-
]
|
315
|
+
but, you, want, something, different, dot]
|
340
316
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
341
317
|
|
342
318
|
# Sentence 3-18a definiendum: 'J made K.'
|
@@ -349,14 +325,13 @@ module Zenlish
|
|
349
325
|
# K is this thing that now exists because of this.
|
350
326
|
# [I used many small things to make this big thing.]
|
351
327
|
# [J made K happen.] = J caused K to happen.
|
352
|
-
literals = [
|
328
|
+
literals = [j_, did, something, to, some, things, and_,
|
353
329
|
caused, them, to, become, parts, of, one, different, kind, of,
|
354
330
|
thing, that, was, not_, here, before_adverb, dot,
|
355
331
|
k_, is, this, thing, that, now, exists, because, of, this_as_pronoun, dot,
|
356
332
|
i_pronoun, used, many, small, things, to, make, this, big, thing, dot,
|
357
333
|
j_, made, k_, happen, dot,
|
358
|
-
j_, caused, k_, to, happen, dot
|
359
|
-
]
|
334
|
+
j_, caused, k_, to, happen, dot]
|
360
335
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
361
336
|
|
362
337
|
# Sentence 3-19a definiendum: 'J contains K.'
|
@@ -366,10 +341,9 @@ module Zenlish
|
|
366
341
|
# Sentence 3-19b definiens: K is inside J.
|
367
342
|
# [I made something to contain all these small things.]
|
368
343
|
# [Your body contains many parts.]
|
369
|
-
literals = [
|
344
|
+
literals = [k_, is, inside, j_, dot,
|
370
345
|
i_pronoun, made, something, to, contain, all, these, small, things, dot,
|
371
|
-
your, body, contains, many, parts, dot
|
372
|
-
]
|
346
|
+
your, body, contains, many, parts, dot]
|
373
347
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
374
348
|
|
375
349
|
# Sentence 3-20a definiendum: 'X is a container.'
|
@@ -379,17 +353,15 @@ module Zenlish
|
|
379
353
|
# Sentence 3-20b definiens: X is something that people make because
|
380
354
|
# they want to use it to contain other things.
|
381
355
|
# [There are two things inside this container.]
|
382
|
-
literals = [
|
356
|
+
literals = [x_as_noun, is, something, that, people, make, because,
|
383
357
|
they, want, to, use, it_, to, contain, other, things, dot,
|
384
|
-
there, are, two, things, inside, this, container, dot
|
385
|
-
]
|
358
|
+
there, are, two, things, inside, this, container, dot]
|
386
359
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
387
360
|
|
388
361
|
# Sentence 3-Extra: Someone made these containers.
|
389
362
|
# Each contains a different kind of animal.
|
390
363
|
literals = [someone, made, these, containers, dot,
|
391
|
-
each_as_pronoun, contains, a_as_art, different, kind, of, animal, dot
|
392
|
-
]
|
364
|
+
each_as_pronoun, contains, a_as_art, different, kind, of, animal, dot]
|
393
365
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
394
366
|
end
|
395
367
|
|
@@ -401,11 +373,10 @@ module Zenlish
|
|
401
373
|
# Sentence 3-21b definiens: Because you want X to happen,
|
402
374
|
# you do things that you think can cause X to happen.
|
403
375
|
# [I tried to do something good.]
|
404
|
-
literals = [
|
405
|
-
you,
|
376
|
+
literals = [because, you, want, x_as_noun, to, happen, comma,
|
377
|
+
you, do_, things, that, you, think, can, cause, x_as_noun,
|
406
378
|
to, happen, dot,
|
407
|
-
i_pronoun, tried, to, do_, something, good, dot
|
408
|
-
]
|
379
|
+
i_pronoun, tried, to, do_, something, good, dot]
|
409
380
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
410
381
|
|
411
382
|
# Sentence 3-22a definiendum: 'X changed.'
|
@@ -415,12 +386,11 @@ module Zenlish
|
|
415
386
|
# Sentence 3-22b definiens: Something happened to X.
|
416
387
|
# Because of this, X is not the same as before.
|
417
388
|
# [After this kind of animal is alive for some time, its body changes.]
|
418
|
-
literals = [
|
389
|
+
literals = [something, happened, to, x_as_noun, dot,
|
419
390
|
because, of, this_as_pronoun, comma, x_as_noun, is, not_, the, same_as_pronoun,
|
420
391
|
as, before_adverb, dot,
|
421
392
|
after_, this, kind, of, animal, is, alive, for_, some, time, comma,
|
422
|
-
|
423
|
-
]
|
393
|
+
its, body, changes, dot]
|
424
394
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
425
395
|
|
426
396
|
# Sentence 3-22c definiendum: 'J changed K.'
|
@@ -430,10 +400,9 @@ module Zenlish
|
|
430
400
|
# Sentence 3-22d definiens: J caused K to change.
|
431
401
|
# Because of this, X is not the same as before.
|
432
402
|
# [When these people did something bad, it changed what I thought about them.]
|
433
|
-
literals = [
|
403
|
+
literals = [j_, caused, k_, to, change_, dot,
|
434
404
|
when_, these, people, did, something, bad, comma,
|
435
|
-
it_, changed, what, i_pronoun, thought, about, them, dot
|
436
|
-
]
|
405
|
+
it_, changed, what, i_pronoun, thought, about, them, dot]
|
437
406
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
438
407
|
|
439
408
|
# Sentence 3-23a definiendum: 'You see the surface of X.'
|
@@ -446,11 +415,10 @@ module Zenlish
|
|
446
415
|
# [When I touched this thing, I could feel parts of it moving below its surface.]
|
447
416
|
# comment: `where` word was implicitly defined in section 1-25.
|
448
417
|
# `could` verb was implicitly defined in section 2-10.
|
449
|
-
literals = [
|
418
|
+
literals = [i_pronoun, can, see, the, surface, of, this, thing, comma,
|
450
419
|
but, i_pronoun, can, not_, see, what, is, inside, dot,
|
451
420
|
when_, i_pronoun, touched, this, thing, comma, i_pronoun, could,
|
452
|
-
|
453
|
-
]
|
421
|
+
feel, parts, of, it_, moving, below, its, surface, dot]
|
454
422
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
455
423
|
|
456
424
|
# Sentence 3-23c definiendum: 'J is on the surface of K.'
|
@@ -458,14 +426,13 @@ module Zenlish
|
|
458
426
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
459
427
|
|
460
428
|
# Sentence 3-23d definiens: J is touching the surface of K.
|
461
|
-
literals = [
|
429
|
+
literals = [j_, is, touching, the, surface, of, k_, dot]
|
462
430
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
463
431
|
|
464
432
|
# Sentence 3-F xtra: Tony wants to know what is inside this container.
|
465
433
|
# Tony tries to touch things inside the container.
|
466
|
-
literals = [
|
467
|
-
tony, tries, to, touch, things, inside, the, container, dot
|
468
|
-
]
|
434
|
+
literals = [tony, wants, to, know, what, is, inside, this, container, dot,
|
435
|
+
tony, tries, to, touch, things, inside, the, container, dot]
|
469
436
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
470
437
|
end
|
471
438
|
|
@@ -483,16 +450,15 @@ module Zenlish
|
|
483
450
|
# [I chose this big one.]'
|
484
451
|
literals = [there, are, two, or_, more, things, you, can, do_, dot,
|
485
452
|
if_, you, do_, one, of, these_as_pronoun, comma,
|
486
|
-
|
453
|
+
you, can, not_, do_, another_as_pronoun, dot,
|
487
454
|
you, think, about, these_as_pronoun, and_,
|
488
|
-
|
455
|
+
what, you, want, to, do_, dot,
|
489
456
|
there, is, one, moment, when_, you, know, what, one, of, these_as_pronoun,
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
]
|
457
|
+
you, want, more_as_adverb, comma, and_,
|
458
|
+
after_adverb, this, moment, comma, you, try_, for_, some, time,
|
459
|
+
to, do_, this, one_as_pronoun, dot,
|
460
|
+
you, can, choose, to, have, one, of, these, things, dot,
|
461
|
+
i_pronoun, chose, this, big, one_as_pronoun, dot]
|
496
462
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
497
463
|
|
498
464
|
# Sentence 3-25a definiendum: 'X is in a place between J and K.'
|
@@ -503,8 +469,7 @@ module Zenlish
|
|
503
469
|
# J is on one side of X, and K is on the other side of X.
|
504
470
|
literals = [x_as_noun, is, in_, a_as_art, place, dot,
|
505
471
|
j_, is, on, one, side, of, x_as_noun, comma, and_,
|
506
|
-
k_, is, on, the, other, side, of, x_as_noun, dot
|
507
|
-
]
|
472
|
+
k_, is, on, the, other, side, of, x_as_noun, dot]
|
508
473
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
509
474
|
|
510
475
|
# Sentence 3-25c definiendum: 'X happens at a time between J and K.'
|
@@ -522,8 +487,7 @@ module Zenlish
|
|
522
487
|
|
523
488
|
# Sentence 3-25f definiens: X is more than J but not more than K.
|
524
489
|
literals = [x_as_noun, is, more, than, j_,
|
525
|
-
but, not_, more, than, k_, dot
|
526
|
-
]
|
490
|
+
but, not_, more, than, k_, dot]
|
527
491
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
528
492
|
|
529
493
|
# Sentence 3-26a definiendum: 'X moved here from this other place.'
|
@@ -536,8 +500,7 @@ module Zenlish
|
|
536
500
|
literals = [x_as_noun, was, in_, this, other, place, before,
|
537
501
|
it_, moved, for_, some, time, dot,
|
538
502
|
because, x_as_noun, moved, comma, it_, is, here, after_,
|
539
|
-
this_as_pronoun, comma, and_, it_, is, not_, in_, this, other, place, dot
|
540
|
-
]
|
503
|
+
this_as_pronoun, comma, and_, it_, is, not_, in_, this, other, place, dot]
|
541
504
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
542
505
|
|
543
506
|
# Sentence 3-27a definiendum: 'X is a machine.'
|
@@ -552,54 +515,51 @@ module Zenlish
|
|
552
515
|
# [I used a machine to cause these big things to move.].'
|
553
516
|
literals = [x_as_noun, is, something, people, make, dot,
|
554
517
|
when_, people, make, some, things, like, x_as_noun, comma,
|
555
|
-
|
518
|
+
they, use, many, parts, to, make, these, things, dot,
|
556
519
|
some, parts, of, x_as_noun, move, dot,
|
557
520
|
some, parts, can, cause, other, parts, to, move, dot,
|
558
521
|
people, make, things, like, this_as_pronoun, because, these, things, do_,
|
559
|
-
|
522
|
+
something, that, people, want, dot,
|
560
523
|
these, things, can, do_, more_as_adverb, than, people, can, do_,
|
561
|
-
|
524
|
+
and_, more_as_adverb, than, people, want, to, do_, dot,
|
562
525
|
i_pronoun, used, a_as_art, machine, to, cause, these, big, things,
|
563
|
-
|
564
|
-
]
|
526
|
+
to, move, dot]
|
565
527
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
566
528
|
|
567
529
|
# Sentence 3-G xtra: Tony wants to make something using a machine.
|
568
530
|
# Tony is between two different machines.
|
569
531
|
# Tony says: "I can choose to use one of these machines."
|
570
|
-
literals = [
|
532
|
+
literals = [tony, wants, to, make, something, using, a_as_art,
|
571
533
|
machine, dot,
|
572
534
|
tony, is, between, two, different, machines, dot,
|
573
535
|
tony, says, colon, quote, i_pronoun, can, choose, to, use,
|
574
|
-
|
575
|
-
]
|
536
|
+
one, of, these, machines, dot, quote, dot]
|
576
537
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
577
538
|
end
|
578
|
-
|
539
|
+
|
579
540
|
it 'should parse sample sentences from lesson 3-H' do
|
580
541
|
# Sentence 3-28a definiendum: 'J damaged K.'
|
581
542
|
literals = [j_, damaged, k_, dot]
|
582
543
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
583
|
-
|
584
|
-
# Sentence 3-28b definiens: 'J did something to K that was bad for K
|
585
|
-
# and it changed K like this: Before this happened,
|
586
|
-
# some parts of K were good more than now.
|
544
|
+
|
545
|
+
# Sentence 3-28b definiens: 'J did something to K that was bad for K
|
546
|
+
# and it changed K like this: Before this happened,
|
547
|
+
# some parts of K were good more than now.
|
587
548
|
# Before this happened, K could do some things more than it can now.
|
588
549
|
# [You cannot move now because something damaged part of your body.]'
|
589
|
-
literals = [j_, did, something, to, k_, that, was, bad, for_, k_,
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
]
|
550
|
+
literals = [j_, did, something, to, k_, that, was, bad, for_, k_,
|
551
|
+
and_, it_, changed, k_, like, this_as_pronoun, colon,
|
552
|
+
before, this_as_pronoun, happened, comma, some, parts, of, k_, were,
|
553
|
+
good, more, than, now_as_noun, dot,
|
554
|
+
before, this_as_pronoun, happened, comma, k_, could, do_, some,
|
555
|
+
things, more, than, it_, can_irregular, now, dot,
|
556
|
+
you, can, not_, move, now, because, something, damaged,
|
557
|
+
part, of, your, body, dot]
|
598
558
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
599
559
|
|
600
560
|
# Sentence 3-29a definiendum: 'Doing X is difficult.'
|
601
561
|
# literals = [doing, x_as_noun, is, difficult, dot]
|
602
|
-
# expect { subject.to_pforest(literals) }.not_to raise_error
|
562
|
+
# expect { subject.to_pforest(literals) }.not_to raise_error
|
603
563
|
end
|
604
564
|
=begin
|
605
565
|
3-29. difficult.
|