zenlish 0.2.06 → 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 +48 -275
- data/CHANGELOG.md +8 -0
- data/LICENSE.txt +1 -1
- data/lib/zenlish/feature/feature_struct_def.rb +0 -2
- data/lib/zenlish/inflect/output_expression.rb +4 -0
- data/lib/zenlish/version.rb +1 -1
- data/lib/zenlish/wclasses/irregular_verb_extension.rb +0 -1
- data/lib/zenlish.rb +3 -3
- data/spec/zenlish/feature/boolean_domain_spec.rb +14 -14
- data/spec/zenlish/feature/boolean_value_spec.rb +6 -5
- data/spec/zenlish/feature/enumeration_domain_spec.rb +16 -16
- data/spec/zenlish/feature/feature_def_spec.rb +15 -14
- data/spec/zenlish/feature/feature_spec.rb +16 -16
- data/spec/zenlish/feature/feature_struct_def_bearer_spec.rb +16 -16
- data/spec/zenlish/feature/feature_struct_def_spec.rb +23 -23
- data/spec/zenlish/feature/identifier_domain_spec.rb +12 -12
- data/spec/zenlish/feature/identifier_value_spec.rb +6 -5
- data/spec/zenlish/feature/symbol_value_spec.rb +6 -5
- data/spec/zenlish/inflect/concatenation_spec.rb +8 -8
- data/spec/zenlish/inflect/equals_literal_spec.rb +17 -16
- data/spec/zenlish/inflect/feature_heading_spec.rb +14 -13
- data/spec/zenlish/inflect/formal_argument_spec.rb +5 -5
- data/spec/zenlish/inflect/function_call_spec.rb +8 -9
- data/spec/zenlish/inflect/inflection_rule_spec.rb +20 -20
- data/spec/zenlish/inflect/inflection_table_builder_spec.rb +37 -37
- data/spec/zenlish/inflect/inflection_table_spec.rb +33 -32
- data/spec/zenlish/inflect/input_asis_spec.rb +10 -9
- data/spec/zenlish/inflect/literal_asis_spec.rb +7 -7
- data/spec/zenlish/inflect/matches_pattern_spec.rb +15 -14
- data/spec/zenlish/inflect/membership_spec.rb +16 -15
- data/spec/zenlish/inflect/method_heading_spec.rb +12 -11
- data/spec/zenlish/inflect/not_equals_literal_spec.rb +17 -16
- data/spec/zenlish/inflect/substitution_spec.rb +9 -10
- data/spec/zenlish/inflect/unconditionally_true_spec.rb +7 -5
- data/spec/zenlish/lang/dictionary_spec.rb +17 -19
- data/spec/zenlish/lang/lemmatizer_spec.rb +23 -23
- data/spec/zenlish/lang/zenlish_grammar_spec.rb +3 -3
- data/spec/zenlish/lex/empty_lexicon_factory_spec.rb +8 -8
- data/spec/zenlish/lex/lexeme_spec.rb +18 -18
- data/spec/zenlish/lex/lexical_entry_spec.rb +14 -13
- data/spec/zenlish/lex/lexicon_spec.rb +44 -43
- data/spec/zenlish/lex/literal_spec.rb +6 -6
- data/spec/zenlish/lexer/lexer_spec.rb +10 -10
- data/spec/zenlish/parser/lesson1_spec.rb +79 -79
- data/spec/zenlish/parser/lesson2_spec.rb +102 -102
- data/spec/zenlish/parser/lesson3_spec.rb +89 -89
- data/spec/zenlish/parser/zparser_spec.rb +6 -6
- data/spec/zenlish/support/var2word.rb +0 -2
- data/spec/zenlish/trie/base_trie_node_spec.rb +11 -11
- data/spec/zenlish/trie/trie_spec.rb +46 -46
- data/spec/zenlish/wclasses/common_noun_spec.rb +9 -9
- data/spec/zenlish/wclasses/demonstrative_determiner_spec.rb +11 -11
- data/spec/zenlish/wclasses/irregular_verb_can_spec.rb +10 -10
- data/spec/zenlish/wclasses/irregular_verb_extension_spec.rb +10 -10
- data/spec/zenlish/wclasses/irregular_verb_spec.rb +19 -19
- data/spec/zenlish/wclasses/lexical_verb_spec.rb +7 -7
- data/spec/zenlish/wclasses/modal_verb_can_spec.rb +9 -9
- data/spec/zenlish/wclasses/noun_spec.rb +7 -7
- data/spec/zenlish/wclasses/personal_pronoun_spec.rb +15 -15
- data/spec/zenlish/wclasses/possessive_determiner_spec.rb +15 -15
- 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 +12 -12
- data/spec/zenlish/wclasses/regular_verb_want_spec.rb +7 -7
- data/spec/zenlish/wclasses/verb_spec.rb +9 -9
- data/spec/zenlish_spec.rb +1 -1
- data/zenlish.gemspec +6 -5
- metadata +32 -16
@@ -9,174 +9,174 @@ module Zenlish
|
|
9
9
|
describe ZParser do
|
10
10
|
include Var2Word
|
11
11
|
|
12
|
-
subject {
|
12
|
+
subject(:parser) { described_class.new }
|
13
13
|
|
14
14
|
context 'Parsing lesson 2:' do
|
15
|
-
it '
|
15
|
+
it 'parses sample sentences from lesson 2-A' do
|
16
16
|
# Sentence 2-01a: "This thing is like two of the other things."
|
17
17
|
literals = [this, thing, is, like, two, of, the, other, things, dot]
|
18
|
-
expect {
|
18
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
19
19
|
|
20
20
|
# Sentence 2-01b: "One of these things is not like the other things."
|
21
21
|
literals = [one, of, these, things, is, not_, like, the, other, things, dot]
|
22
|
-
expect {
|
22
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
23
23
|
|
24
24
|
# Sentence 2-02a: "Lisa has something."
|
25
25
|
literals = [lisa, has, something, dot]
|
26
|
-
expect {
|
26
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
27
27
|
|
28
28
|
# Sentence 2-02b: "Tony has another thing."
|
29
29
|
literals = [tony, has, another, thing, dot]
|
30
|
-
expect {
|
30
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
31
31
|
|
32
32
|
# Sentence 2-02c: "Lisa does not have the same kind of thing as Tony has."
|
33
33
|
literals = [lisa, does_aux, not_, have, the, same, kind, of, thing, as, tony, has, dot]
|
34
34
|
# Ambiguous parse
|
35
|
-
expect {
|
35
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
36
36
|
|
37
37
|
# Sentence 2-03a: "Lisa is touching part of this thing."
|
38
38
|
literals = [lisa, is_aux, touching, part, of, this, thing, dot]
|
39
39
|
# Ambiguous parse
|
40
|
-
expect {
|
40
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
41
41
|
|
42
42
|
# Sentence 2-03b: "Tony is touching the other part."
|
43
43
|
literals = [tony, is_aux, touching, the, other, part, dot]
|
44
|
-
expect {
|
44
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
45
45
|
|
46
46
|
# Sentence 2-Ax: "What Tony has is like what Lisa has."
|
47
47
|
literals = [what, tony, has, is, like, what, lisa, has, dot]
|
48
|
-
expect {
|
48
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
49
49
|
end
|
50
50
|
|
51
|
-
it '
|
51
|
+
it 'parses sample sentences from lesson 2-B' do
|
52
52
|
# Sentence 2-04a: "Lisa does something."
|
53
53
|
literals = [lisa, does, something, dot]
|
54
|
-
expect {
|
54
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
55
55
|
|
56
56
|
# Sentence 2-04b: "Lisa does something with this thing."
|
57
57
|
literals = [lisa, does, something, with, this, thing, dot]
|
58
58
|
# Ambiguous parse
|
59
|
-
expect {
|
59
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
60
60
|
|
61
61
|
# Sentence 2-04c: "Lisa does something to Tony."
|
62
62
|
literals = [lisa, does, something, to, tony, dot]
|
63
63
|
# Ambiguous parse
|
64
|
-
expect {
|
64
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
65
65
|
|
66
66
|
# Sentence 2-04d: "Lisa does something to Tony with this thing."
|
67
67
|
literals = [lisa, does, something, to, tony, with, this, thing, dot]
|
68
68
|
# Ambiguous parse
|
69
|
-
expect {
|
69
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
70
70
|
|
71
71
|
# Sentence 2-05a: "Something happens."
|
72
72
|
literals = [something, happens, dot]
|
73
|
-
expect {
|
73
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
74
74
|
|
75
75
|
# Sentence 2-05b: "Something happens to Lisa."
|
76
76
|
literals = [something, happens, to, lisa, dot]
|
77
|
-
expect {
|
77
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
78
78
|
|
79
79
|
# Sentence 2-06a: "Tony does something."
|
80
80
|
literals = [tony, does, something, dot]
|
81
|
-
expect {
|
81
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
82
82
|
|
83
83
|
# Sentence 2-06b: "Something happens to Lisa because of this."
|
84
84
|
literals = [something, happens, to, lisa, because, of, this_as_pronoun, dot]
|
85
|
-
expect {
|
85
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
86
86
|
|
87
87
|
# Sentence 2-06c: "Something happens to Lisa because Tony does this."
|
88
88
|
literals = [something, happens, to, lisa, because, tony, does, this_as_pronoun, dot]
|
89
|
-
expect {
|
89
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
90
90
|
|
91
91
|
# Sentence 2-06: "Something happens to this living thing."
|
92
92
|
literals = [something, happens, to, this, living, thing, dot]
|
93
|
-
expect {
|
93
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
94
94
|
end
|
95
95
|
|
96
|
-
it '
|
96
|
+
it 'parses sample sentences from lesson 2-C' do
|
97
97
|
# Sentence 2-07a: "Lisa thinks Tony is inside this thing."
|
98
98
|
literals = [lisa, thinks, tony, is, inside, this, thing, dot]
|
99
99
|
# Ambiguous parse
|
100
|
-
expect {
|
100
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
101
101
|
|
102
102
|
# Sentence 2-07b: "Lisa thinks something about Tony."
|
103
103
|
literals = [lisa, thinks, something, about, tony, dot]
|
104
104
|
# Ambiguous parse
|
105
|
-
expect {
|
105
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
106
106
|
|
107
107
|
# Sentence 2-08a: "Tony knows Lisa is inside this thing, because Tony sees Lisa inside."
|
108
108
|
literals = [tony, knows, lisa, is, inside, this, thing, comma,
|
109
109
|
because, tony, sees, lisa, inside, dot]
|
110
110
|
# Ambiguous parse
|
111
|
-
expect {
|
111
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
112
112
|
|
113
113
|
# Sentence 2-08b: "Tony knows something about Lisa."
|
114
114
|
literals = [tony, knows, something, about, lisa, dot]
|
115
115
|
# Ambiguous parse
|
116
|
-
expect {
|
116
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
117
117
|
|
118
118
|
# Sentence 2-09a: "Tony wants this thing."
|
119
119
|
literals = [tony, wants, this, thing, dot]
|
120
|
-
expect {
|
120
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
121
121
|
|
122
122
|
# Sentence 2-09b: "Tony wants to have this thing."
|
123
123
|
literals = [tony, wants, to, have, this, thing, dot]
|
124
124
|
# Ambiguous parse
|
125
|
-
expect {
|
125
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
126
126
|
|
127
127
|
# Sentence 2-10a: "Tony wants to do something."
|
128
128
|
literals = [tony, wants, to, do_, something, dot]
|
129
129
|
# Ambiguous parse
|
130
|
-
expect {
|
130
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
131
131
|
|
132
132
|
# Sentence 2-10b: "Lisa wants to do the same thing."
|
133
133
|
literals = [lisa, wants, to, do_, the, same, thing, dot]
|
134
134
|
# Ambiguous parse
|
135
|
-
expect {
|
135
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
136
136
|
|
137
137
|
# Sentence 2-10c: "Tony can do this."
|
138
138
|
literals = [tony, can, do_, this_as_pronoun, dot]
|
139
|
-
expect {
|
139
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
140
140
|
|
141
141
|
# Sentence 2-10d: "This is not something Lisa can do."
|
142
142
|
literals = [this_as_pronoun, is, not_, something, lisa, can, do_, dot]
|
143
|
-
expect {
|
143
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
144
144
|
|
145
145
|
# Sentence 2-10e: "Lisa cannot do this."
|
146
146
|
literals = [lisa, can, not_, do_, this_as_pronoun, dot]
|
147
|
-
expect {
|
147
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
148
148
|
end
|
149
149
|
|
150
|
-
it '
|
150
|
+
it 'parses sample sentences from lesson 2-D' do
|
151
151
|
# Sentence 2-11a: "This person does something bad."
|
152
152
|
literals = [this, person, does, something, bad, dot]
|
153
153
|
# Ambiguous parse
|
154
|
-
expect {
|
154
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
155
155
|
|
156
156
|
# Sentence 2-11b: "This person does something bad for Tony."
|
157
157
|
literals = [this, person, does, something, bad, for_, tony, dot]
|
158
158
|
# Ambiguous parse
|
159
|
-
expect {
|
159
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
160
160
|
|
161
161
|
# Sentence 2-12a: "Tony does something good."
|
162
162
|
literals = [tony, does, something, good, dot]
|
163
|
-
expect {
|
163
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
164
164
|
|
165
165
|
# Sentence 2-12b: "Tony does something good for Lisa."
|
166
166
|
literals = [tony, does, something, good, for_, lisa, dot]
|
167
|
-
expect {
|
167
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
168
168
|
|
169
169
|
# Sentence 2-13a: "Tony feels something."
|
170
170
|
literals = [tony, feels, something, dot]
|
171
|
-
expect {
|
171
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
172
172
|
|
173
173
|
# Sentence 2-13b: "This does not feel good for Tony."
|
174
174
|
literals = [this_as_pronoun, does_aux, not_, feel, good, for_, tony, dot]
|
175
|
-
expect {
|
175
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
176
176
|
|
177
177
|
# Sentence 2-13b: "This feels bad for Tony."
|
178
178
|
literals = [this_as_pronoun, feels, bad, for_, tony, dot]
|
179
|
-
expect {
|
179
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
180
180
|
|
181
181
|
# Sentence 2-Dx: "Lisa thinks about something bad happening to this
|
182
182
|
# living thing. Thinking about this feels bad for Lisa."
|
@@ -184,196 +184,196 @@ module Zenlish
|
|
184
184
|
living, thing, dot]
|
185
185
|
# thinking, about, this_as_pronoun, feels, bad,
|
186
186
|
# for_, lisa, dot]
|
187
|
-
expect {
|
187
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
188
188
|
end
|
189
189
|
|
190
|
-
it '
|
190
|
+
it 'parses sample sentences from lesson 2-E' do
|
191
191
|
# Sentence 2-14a: "Lisa says something at this time."
|
192
192
|
literals = [lisa, says, something, at, this, time, dot]
|
193
193
|
# Ambiguous parse
|
194
|
-
expect {
|
194
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
195
195
|
|
196
196
|
# Sentence 2-14b: "Tony is not in this place at this time."
|
197
197
|
literals = [tony, is, not_, in_, this, place, at, this, time, dot]
|
198
|
-
expect {
|
198
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
199
199
|
|
200
200
|
# Sentence 2-15a: "At one time, Tony does something to this thing."
|
201
201
|
literals = [at, one, time, comma, tony, does, something, to, this, thing, dot]
|
202
|
-
expect {
|
202
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
203
203
|
|
204
204
|
# Sentence 2-15b: "At another time, Lisa says something."
|
205
205
|
literals = [at, another, time, comma, lisa, says, something, dot]
|
206
|
-
expect {
|
206
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
207
207
|
|
208
208
|
# Sentence 2-15c: "Tony does something to this thing before Lisa says something."
|
209
209
|
literals = [tony, does, something, to, this, thing, before, lisa, says, something, dot]
|
210
|
-
expect {
|
210
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
211
211
|
|
212
212
|
# Sentence 2-16a: "Lisa does something for a long time."
|
213
213
|
literals = [lisa, does, something, for_, a_as_art, long, time, dot]
|
214
|
-
expect {
|
214
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
215
215
|
|
216
216
|
# Sentence 2-17a: "Tony does something for a short time."
|
217
217
|
literals = [tony, does, something, for_, a_as_art, short, time, dot]
|
218
|
-
expect {
|
218
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
219
219
|
|
220
220
|
# Sentence 2-17a: "Tony does not do this for a long time."
|
221
221
|
literals = [tony, does_aux, not_, do_, this_as_pronoun, for_, a_as_art, long, time, dot]
|
222
|
-
expect {
|
222
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
223
223
|
|
224
224
|
# Sentence 2-18a: "Lisa sees something move."
|
225
225
|
literals = [lisa, sees, something, move, dot]
|
226
|
-
expect {
|
226
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
227
227
|
|
228
228
|
# Sentence 2-18a: "Lisa moves near to this thing."
|
229
229
|
literals = [lisa, moves, near_to, this, thing, dot]
|
230
|
-
expect {
|
230
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
231
231
|
|
232
232
|
# Sentence 2-E-Xa: "A short time before, Tony was far from Lisa."
|
233
233
|
# Case of a time adverbial adjunct that is put in front position.
|
234
234
|
literals = [a_as_art, short, time, before_adverb, comma, tony, was, far, from, lisa, dot]
|
235
|
-
expect {
|
235
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
236
236
|
|
237
237
|
# Sentence 2-E-Xa: "At this time, Tony is near to Lisa"
|
238
238
|
literals = [at, this, time, comma, tony, is, near_to, lisa, dot]
|
239
|
-
expect {
|
239
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
240
240
|
|
241
241
|
# Sentence 2-E-Xa: "Tony is near to Lisa because Tony moved"
|
242
242
|
# Case of a time adverbial adjunct that is put in front position.
|
243
243
|
literals = [tony, is, near_to, lisa, because, tony, moved, dot]
|
244
|
-
expect {
|
244
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
245
245
|
end
|
246
246
|
|
247
|
-
it '
|
247
|
+
it 'parses sample sentences from lesson 2-F' do
|
248
248
|
# Sentence 2-19a: 'Tony says: "I did X.".'
|
249
249
|
literals = [tony, says, colon, quote, i_pronoun, did, x_as_noun, dot, quote, dot]
|
250
|
-
expect {
|
250
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
251
251
|
|
252
252
|
# Sentence 2-19a definiendum: 'Tony says: "I did X.".'
|
253
253
|
literals = [tony, says, colon, quote, i_pronoun, did, x_as_noun, dot, quote, dot]
|
254
|
-
expect {
|
254
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
255
255
|
|
256
256
|
# Sentence 2-19a definiens: 'Tony says something about Tony. Tony says: Tony did X.'
|
257
257
|
literals = [tony, says, something, about, tony, dot,
|
258
258
|
tony, says, colon, tony, did, x_as_noun, dot]
|
259
|
-
expect {
|
259
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
260
260
|
|
261
261
|
# Sentence 2-19a: 'Tony says: "I see Lisa.".'
|
262
262
|
literals = [tony, says, colon, quote, i_pronoun, see, lisa, dot, quote, dot]
|
263
|
-
expect {
|
263
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
264
264
|
|
265
265
|
# Sentence 2-19b definiendum: 'Lisa says: "X happened to me.".'
|
266
266
|
literals = [lisa, says, colon, quote, x_as_noun, happened, to, me, dot, quote, dot]
|
267
|
-
expect {
|
267
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
268
268
|
|
269
269
|
# Sentence 2-19b definiens: 'Lisa says something about Lisa. Lisa says: X happened to Lisa.'
|
270
270
|
literals = [lisa, says, something, about, lisa, dot,
|
271
271
|
lisa, says, colon, x_as_noun, happened, to, lisa, dot]
|
272
|
-
expect {
|
272
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
273
273
|
|
274
274
|
# Sentence 2-19c: 'Lisa says: "Tony sees me."'
|
275
275
|
literals = [lisa, says, colon, quote, tony, sees, me, dot, quote, dot]
|
276
|
-
expect {
|
276
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
277
277
|
|
278
278
|
# Sentence 2-20a definiendum: 'Tony says to Lisa: "I can see you.".'
|
279
279
|
literals = [tony, says, to, lisa, colon, quote, i_pronoun, can, see, you, dot, quote, dot]
|
280
|
-
expect {
|
280
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
281
281
|
|
282
282
|
# Sentence 2-20a definiens: 'Tony says something about Lisa.
|
283
283
|
# Tony says this to Lisa. Tony says: Tony can see Lisa.'
|
284
284
|
literals = [tony, says, something, about, lisa, dot,
|
285
285
|
tony, says, this_as_pronoun, to, lisa, dot,
|
286
286
|
tony, says, colon, tony, can, see, lisa, dot]
|
287
|
-
expect {
|
287
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
288
288
|
|
289
289
|
# Sentence 2-20b: "I know you have something good."
|
290
290
|
literals = [i_pronoun, know, you, have, something, good, dot]
|
291
|
-
expect {
|
291
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
292
292
|
|
293
293
|
# Sentence 2-20c: "I want you to do something good for me."
|
294
294
|
literals = [i_pronoun, want, you, to, do_, something, good, for_, me, dot]
|
295
|
-
expect {
|
295
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
296
296
|
|
297
297
|
# Sentence 2-21a definiendum: 'Tony says: "X happens here.".'
|
298
298
|
literals = [tony, says, colon, quote, x_as_noun, happens, here, dot, quote, dot]
|
299
|
-
expect {
|
299
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
300
300
|
|
301
301
|
# Sentence 2-21a definiens: "Tony is in a place. Tony says: X happens in this place."
|
302
302
|
literals = [tony, is, in_, a_as_art, place, dot,
|
303
303
|
tony, says, colon, x_as_noun, happens, in_, this, place, dot]
|
304
|
-
expect {
|
304
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
305
305
|
|
306
306
|
# Sentence 2-21b: "Many people were here at one time."
|
307
307
|
literals = [many, people, were, here, at, one, time, dot]
|
308
|
-
expect {
|
308
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
309
309
|
|
310
310
|
# Sentence 2-22a definiendum: 'Lisa says: "X happens now.".'
|
311
311
|
literals = [lisa, says, colon, quote, x_as_noun, happens, now, dot, quote, dot]
|
312
|
-
expect {
|
312
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
313
313
|
|
314
314
|
# Sentence 2-22a definiens: 'Lisa says something at a time.
|
315
315
|
# Lisa says: X happens at this same time.'
|
316
316
|
literals = [lisa, says, something, at, a_as_art, time, dot,
|
317
317
|
lisa, says, colon, x_as_noun, happens, at, this, time, dot]
|
318
|
-
expect {
|
318
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
319
319
|
|
320
320
|
# Sentence 2-22b: "There are not many people here now."
|
321
321
|
literals = [there, are, not_, many, people, here, now, dot]
|
322
|
-
expect {
|
322
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
323
323
|
|
324
324
|
# Sentence 2-Fa: "Lisa says to Tony: "I can see many living things here."."
|
325
325
|
literals = [lisa, says, to, tony, colon, quote, i_pronoun,
|
326
326
|
can, see, many, living, things, here, dot, quote, dot]
|
327
|
-
expect {
|
327
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
328
328
|
end
|
329
329
|
|
330
|
-
it '
|
330
|
+
it 'parses sample sentences from lesson 2-G' do
|
331
331
|
# Sentence 2-23a definiendum: 'Someone does X.'
|
332
332
|
literals = [someone, does, x_as_noun, dot]
|
333
|
-
expect {
|
333
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
334
334
|
|
335
335
|
# Sentence 2-23a definiens: 'Something does X. This something can
|
336
336
|
# think like people think. This something can be one person.'
|
337
337
|
literals = [something, does, x_as_noun, dot,
|
338
338
|
this, something, can, think, like, people, think, dot,
|
339
339
|
this, something, can, be_, a_as_art, person, dot]
|
340
|
-
expect {
|
340
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
341
341
|
|
342
342
|
# Sentence 2-23b: Someone said something to Tony.
|
343
343
|
literals = [someone, said, something, to, tony, dot]
|
344
|
-
expect {
|
344
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
345
345
|
|
346
346
|
# Sentence 2-23c definiendum: 'J knows who did K.'
|
347
347
|
literals = [j_, knows, who, did, k_, dot]
|
348
|
-
expect {
|
348
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
349
349
|
|
350
350
|
# Sentence 2-23c definiens: J thinks about someone.
|
351
351
|
# J knows this someone did K.
|
352
352
|
literals = [j_, thinks, about, someone, dot,
|
353
353
|
j_, knows, this, someone, did, k_, dot]
|
354
|
-
expect {
|
354
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
355
355
|
|
356
356
|
# Sentence 2-23d: Tony knows who said something.
|
357
357
|
literals = [tony, knows, who, said, something, dot]
|
358
|
-
expect {
|
358
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
359
359
|
|
360
360
|
# Sentence 2-24a definiendum: 'J happens after K happens.'
|
361
361
|
literals = [j_, happens, after_, k_, happens, dot]
|
362
|
-
expect {
|
362
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
363
363
|
|
364
364
|
# Sentence 2-24a definiens: K happens before J happens.
|
365
365
|
literals = [k_, happens, before, j_, happens, dot]
|
366
|
-
expect {
|
366
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
367
367
|
|
368
368
|
# Sentence 2-24b: After you do something for a long time,
|
369
369
|
# you can know much more about this.
|
370
370
|
literals = [after_, you, do_, something, for_, a_as_art, long, time,
|
371
371
|
comma, you, can, know, much, more_as_adverb, about, this_as_pronoun, dot]
|
372
|
-
expect {
|
372
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
373
373
|
|
374
374
|
# Sentence 2-25a definiendum: 'X is true for some time.'
|
375
375
|
literals = [x_as_noun, is, true_, for_, some, time, dot]
|
376
|
-
expect {
|
376
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
377
377
|
|
378
378
|
# Sentence 2-25a definiens: X is true at a time.
|
379
379
|
# Some parts of this one time happen before other parts.
|
@@ -383,17 +383,17 @@ module Zenlish
|
|
383
383
|
some, parts, of, this, one, time, happen, before_adverb, other, parts, dot,
|
384
384
|
some, parts, of, this, one, time, happen, after_adverb, other, parts, dot,
|
385
385
|
x_as_noun, is, true_, at, all, parts, of, this, one, time, dot]
|
386
|
-
expect {
|
386
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
387
387
|
|
388
388
|
# Sentence 2-25b: After I moved for some time,
|
389
389
|
# I was near the other side of this place.
|
390
390
|
literals = [after_, i_pronoun, moved, for_, some, time,
|
391
391
|
comma, i_pronoun, was, near, the, other, side, of, this, place, dot]
|
392
|
-
expect {
|
392
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
393
393
|
|
394
394
|
# Sentence 2-26a definiendum: 'X happens in a moment.'
|
395
395
|
literals = [x_as_noun, happens, in_, a_as_art, moment, dot]
|
396
|
-
expect {
|
396
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
397
397
|
|
398
398
|
# Sentence 2-26a definiens: X happens for one very short time.
|
399
399
|
# There are not parts of this very short time when one part
|
@@ -401,13 +401,13 @@ module Zenlish
|
|
401
401
|
literals = [x_as_noun, happens, for_, one, very, short, time, dot,
|
402
402
|
there, are, not_, parts, of, this, very, short, time, when_,
|
403
403
|
one, part, happens, before_adverb, other, part, dot]
|
404
|
-
expect {
|
404
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
405
405
|
|
406
406
|
# Sentence 2-26b: In a moment, I knew something here was not good.
|
407
407
|
# 'here' is adverb that modifies the 'knew' verb
|
408
408
|
literals = [in_, a_as_art, moment, comma, i_pronoun, knew, something,
|
409
409
|
here, was, not_, good, dot]
|
410
|
-
expect {
|
410
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
411
411
|
|
412
412
|
# Sentence 2-Gx: Tony is inside this thing for some time.
|
413
413
|
# Lisa says: "I want to know who is inside this thing.".
|
@@ -419,13 +419,13 @@ module Zenlish
|
|
419
419
|
because, of, this_as_pronoun, comma, tony, says, colon,
|
420
420
|
quote, i_pronoun, am, inside, dot, quote, dot,
|
421
421
|
tony, says, this_as_pronoun, after_, tony, hears, lisa, dot]
|
422
|
-
expect {
|
422
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
423
423
|
end
|
424
424
|
|
425
|
-
it '
|
425
|
+
it 'parses sample sentences from lesson 2-H' do
|
426
426
|
# Sentence 2-27a definiendum: 'X is the body of this person.'
|
427
427
|
literals = [x_as_noun, is, the, body, of, this, person, dot]
|
428
|
-
expect {
|
428
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
429
429
|
|
430
430
|
# Sentence 2-27b "Parts of this person can touch other things.
|
431
431
|
# Parts of this person can touch other parts inside this person.
|
@@ -436,11 +436,11 @@ module Zenlish
|
|
436
436
|
this, person, dot,
|
437
437
|
x_as_noun, is, all, of, these, parts, of, this, person, dot,
|
438
438
|
one, part, of, the, body, of, this, person, felt, very, bad, dot]
|
439
|
-
expect {
|
439
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
440
440
|
|
441
441
|
# Sentence 2-28a definiendum "X dies."
|
442
442
|
literals = [x_as_noun, dies, dot]
|
443
|
-
expect {
|
443
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
444
444
|
|
445
445
|
# Sentence 2-28b definiens "Something happens to X in a moment.
|
446
446
|
# X is alive before this moment. X is not alive after this moment.
|
@@ -451,11 +451,11 @@ module Zenlish
|
|
451
451
|
x_as_noun, is, not_, alive, after_adverb, this, moment, dot,
|
452
452
|
after_, this, person, lived, for_, a_as_art, long, time, comma,
|
453
453
|
this, person, died, dot]
|
454
|
-
expect {
|
454
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
455
455
|
|
456
456
|
# Sentence 2-29a definiendum "You think maybe X is true."
|
457
457
|
literals = [you, think, maybe, x_as_noun, is, true_, dot]
|
458
|
-
expect {
|
458
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
459
459
|
|
460
460
|
# Sentence 2-29b definiens "You think something like X
|
461
461
|
# can be true. You do not know X is true.
|
@@ -464,24 +464,24 @@ module Zenlish
|
|
464
464
|
literals = [you, do_aux, not_, know, x_as_noun, is, true_, dot,
|
465
465
|
you, do_aux, not_, know, x_as_noun, is, not_, true_, dot,
|
466
466
|
maybe, some, people, far_from, here_as_noun, can, see, me, dot]
|
467
|
-
expect {
|
467
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
468
468
|
|
469
469
|
# Sentence 2-30a definiendum "J is below K."
|
470
470
|
literals = [j_, is, below, k_, dot]
|
471
|
-
expect {
|
471
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
472
472
|
|
473
473
|
# Sentence 2-30b definiens "K is above J.
|
474
474
|
# [I am touching this thing below me.]
|
475
475
|
literals = [j_, is, below, k_, dot,
|
476
476
|
i_pronoun, am, touching, this, thing, below, me, dot]
|
477
|
-
expect {
|
477
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
478
478
|
|
479
479
|
# Sentence 2-H extra "Someone sees this thing.
|
480
480
|
# The body of this thing is not moving.
|
481
481
|
# Maybe this thing is dead."
|
482
482
|
literals = [someone, sees, thing, dot,
|
483
483
|
the, body, of, this, thing, is_aux, not_, moving, dot]
|
484
|
-
expect {
|
484
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
485
485
|
end
|
486
486
|
=begin
|
487
487
|
TODO
|