zenlish 0.1.15 → 0.1.16
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/CHANGELOG.md +8 -0
- data/README.md +5 -4
- data/lib/zenlish/lang/dictionary.rb +4 -1
- data/lib/zenlish/lang/zenlish_grammar.rb +190 -127
- data/lib/zenlish/lex/empty_lexicon_factory.rb +1 -1
- data/lib/zenlish/parser/zparser.rb +31 -2
- data/lib/zenlish/version.rb +1 -1
- data/lib/zenlish/wclasses/all_word_classes.rb +2 -2
- data/lib/zenlish/wclasses/existential_there.rb +9 -0
- data/spec/zenlish/parser/zparser_spec.rb +238 -165
- data/zenlish.gemspec +1 -1
- metadata +5 -6
- data/lib/zenlish/wclasses/adverb_there.rb +0 -9
- data/lib/zenlish/wclasses/test_hierarchy.rb +0 -3
@@ -49,6 +49,7 @@ module Zenlish
|
|
49
49
|
def before ; Lex::Literal.new('before', get_lexeme('before', WClasses::SubordinatingConjunction), 0) ; end
|
50
50
|
literal2var('big', 'big')
|
51
51
|
literal2var('big', 'bigger')
|
52
|
+
literal2var('body', 'body')
|
52
53
|
literal2var('can', 'can')
|
53
54
|
def did ; Lex::Literal.new('did', get_lexeme('do', WClasses::IrregularVerbDo), 0) ; end
|
54
55
|
def do_ ; Lex::Literal.new('do', get_lexeme('do', WClasses::IrregularVerbDo), 0) ; end
|
@@ -100,7 +101,8 @@ module Zenlish
|
|
100
101
|
literal2var('now', 'now')
|
101
102
|
literal2var('of', 'of')
|
102
103
|
literal2var('on', 'on')
|
103
|
-
|
104
|
+
def one ; Lex::Literal.new('one', get_lexeme('one', WClasses::Cardinal), 0) ; end
|
105
|
+
def one_as_pronoun ; Lex::Literal.new('one', get_lexeme('one', WClasses::IndefinitePronoun), 0) ; end
|
104
106
|
literal2var('other', 'other')
|
105
107
|
literal2var('part', 'part')
|
106
108
|
literal2var('part', 'parts')
|
@@ -126,6 +128,7 @@ module Zenlish
|
|
126
128
|
literal2var('thing', 'thing')
|
127
129
|
literal2var('thing', 'things')
|
128
130
|
literal2var('think', 'think')
|
131
|
+
literal2var('think', 'thinking')
|
129
132
|
literal2var('think', 'thinks')
|
130
133
|
def these ; Lex::Literal.new('these', get_lexeme('this', WClasses::DemonstrativeDeterminer), 0) ; end
|
131
134
|
def these_as_pronoun ; Lex::Literal.new('these', get_lexeme('this', WClasses::DemonstrativePronoun), 0) ; end
|
@@ -137,7 +140,8 @@ module Zenlish
|
|
137
140
|
literal2var('Tony', 'Tony')
|
138
141
|
literal2var('touch', 'touching')
|
139
142
|
literal2var('true', 'true', '_')
|
140
|
-
|
143
|
+
def two ; Lex::Literal.new('two', get_lexeme('two', WClasses::Cardinal), 0) ; end
|
144
|
+
def two_as_pronoun ; Lex::Literal.new('two', get_lexeme('two', WClasses::IndefinitePronoun), 0) ; end
|
141
145
|
literal2var('very', 'very')
|
142
146
|
literal2var('want', 'want')
|
143
147
|
literal2var('want', 'wants')
|
@@ -170,659 +174,701 @@ module Zenlish
|
|
170
174
|
end
|
171
175
|
end
|
172
176
|
|
177
|
+
context 'Producing parse tree or forest:' do
|
178
|
+
it 'should produce trees (for non ambiguous input)' do
|
179
|
+
# OK, non-ambiguous sentence: "Lisa sees Tony."
|
180
|
+
literals = [lisa, sees, tony, dot]
|
181
|
+
result_type = Rley::PTree::ParseTree
|
182
|
+
expect(subject.to_ptree(literals)).to be_kind_of(result_type)
|
183
|
+
end
|
184
|
+
|
185
|
+
it 'should produce forest' do
|
186
|
+
# Sentence: "Lisa sees Tony."
|
187
|
+
literals = [lisa, sees, tony, dot]
|
188
|
+
result_type = Rley::SPPF::ParseForest
|
189
|
+
expect(subject.to_pforest(literals)).to be_kind_of(result_type)
|
190
|
+
end
|
191
|
+
end # context
|
192
|
+
|
173
193
|
context 'Parsing lessons:' do
|
174
194
|
it 'should parse sample sentences from lesson 1-A' do
|
175
195
|
# Sentence 1-01: "Tony sees Lisa."
|
176
196
|
# in absence of a tokenizer, we create a sequence of literals by hand...
|
177
197
|
# prox_tony = ZProxy.new(tony)
|
178
198
|
literals = [tony, sees, lisa, dot]
|
179
|
-
expect { subject.
|
199
|
+
expect { subject.to_ptree(literals) }.not_to raise_error
|
180
200
|
|
181
201
|
# Sentence 1-02a: "Tony sees something."
|
182
202
|
sentence_literals = [tony, sees, something, dot]
|
183
|
-
expect { subject.
|
203
|
+
expect { subject.to_ptree(sentence_literals) }.not_to raise_error
|
184
204
|
|
185
205
|
# Sentence 1-02b: "Lisa sees something."
|
186
206
|
sentence_literals = [lisa, sees, something, dot]
|
187
|
-
expect { subject.
|
207
|
+
expect { subject.to_ptree(sentence_literals) }.not_to raise_error
|
188
208
|
|
189
209
|
# Sentence 1-03: "Tony sees this thing."
|
190
210
|
sentence_literals = [tony, sees, this, thing, dot]
|
191
|
-
expect { subject.
|
211
|
+
expect { subject.to_ptree(sentence_literals) }.not_to raise_error
|
192
212
|
|
193
213
|
# Sentence 1-04: "Lisa sees the other thing."
|
194
214
|
sentence_literals = [lisa, sees, the, other, thing, dot]
|
195
|
-
expect { subject.
|
215
|
+
expect { subject.to_ptree(sentence_literals) }.not_to raise_error
|
196
216
|
end
|
197
217
|
|
198
218
|
it 'should parse sample sentences from lesson 1-B' do
|
199
219
|
# Sentence 1-05a: "Lisa sees the same thing."
|
200
220
|
literals = [lisa, sees, the, same, thing, dot]
|
201
|
-
expect { subject.
|
221
|
+
expect { subject.to_ptree(literals) }.not_to raise_error
|
202
222
|
|
203
223
|
# Sentence 1-05b: "Lisa sees the same thing as Tony sees."
|
204
224
|
literals = [lisa, sees, the, same, thing, as, tony, sees, dot]
|
205
225
|
# same is an adjective of equality comparison
|
206
226
|
# as is part of same ... as combination
|
207
227
|
# it introduces a comparative clause
|
208
|
-
expect { subject.
|
228
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
209
229
|
|
210
230
|
# Sentence 1-06: "Tony sees one thing."
|
211
231
|
literals = [tony, sees, one, thing, dot]
|
212
|
-
expect { subject.
|
232
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
213
233
|
|
214
234
|
# Sentence 1-07: "Lisa sees two things."
|
215
235
|
literals = [lisa, sees, two, things, dot]
|
216
|
-
expect { subject.
|
236
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
217
237
|
|
218
238
|
# Sentence 1-08a: "Tony sees one person."
|
219
239
|
literals = [tony, sees, one, person, dot]
|
220
|
-
expect { subject.
|
240
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
221
241
|
|
222
242
|
# Sentence 1-08b: "Lisa sees two people."
|
223
243
|
literals = [lisa, sees, two, people, dot]
|
224
|
-
expect { subject.
|
244
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
225
245
|
|
226
246
|
# Sentence 1-05b: "Tony sees the same person as Lisa sees."
|
227
247
|
literals = [tony, sees, the, same, person, as, lisa, sees, dot]
|
228
248
|
# same is an adjective of equality comparison
|
229
249
|
# as is part of same ... as combination
|
230
250
|
# it introduces a comparative clause
|
231
|
-
expect { subject.
|
251
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
232
252
|
end
|
233
253
|
|
234
254
|
it 'should parse sample sentences from lesson 1-C' do
|
235
255
|
# Sentence 1-09a: "Tony sees many things."
|
236
256
|
literals = [tony, sees, many, things, dot]
|
237
|
-
expect { subject.
|
257
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
238
258
|
|
239
259
|
# Sentence 1-09b: "Lisa sees many people."
|
240
260
|
literals = [lisa, sees, many, people, dot]
|
241
|
-
expect { subject.
|
261
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
242
262
|
|
243
263
|
# Sentence 1-10: "Tony is inside this thing."
|
244
264
|
literals = [tony, is, inside, this, thing, dot]
|
245
|
-
expect { subject.
|
265
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
246
266
|
|
247
267
|
# Sentence 1-11: "Lisa is not inside this thing."
|
248
268
|
literals = [lisa, is, not_, inside, this, thing, dot]
|
249
|
-
expect { subject.
|
269
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
250
270
|
|
251
271
|
# Sentence: "Lisa does not see people inside the other thing."
|
252
272
|
literals = [lisa, does_aux, not_, see, people, inside, the, other, thing, dot]
|
253
|
-
|
273
|
+
# Ambiguous parse...
|
274
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
254
275
|
end
|
255
276
|
|
256
277
|
it 'should parse sample sentences from lesson 1-D' do
|
257
278
|
# Sentence 1-12a: "Some of these people are inside this thing."
|
258
279
|
literals = [some, of, these, people, are, inside, this, thing, dot]
|
259
|
-
expect { subject.
|
280
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
260
281
|
|
261
282
|
# Sentence 1-12b: "Some of these people are not inside this thing."
|
262
283
|
literals = [some, of, these, people, are, not_, inside, this, thing, dot]
|
263
|
-
expect { subject.
|
284
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
264
285
|
|
265
286
|
# Sentence 1-13: "All of these people are inside this thing."
|
266
287
|
literals = [all, of, these, people, are, not_, inside, this, thing, dot]
|
267
|
-
expect { subject.
|
288
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
268
289
|
|
269
290
|
# Sentence 1-14a: "There are two people inside one of these things."
|
270
291
|
literals = [there, are, two, people, inside, one, of, these, things, dot]
|
271
|
-
expect { subject.
|
292
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
272
293
|
|
273
294
|
# Sentence 1-14b: "There are not people inside the other thing."
|
274
295
|
literals = [there, are, not_, people, inside, the, other, thing, dot]
|
275
|
-
expect { subject.
|
296
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
276
297
|
|
277
298
|
# Sentence 1-15a: "There are many people inside this thing."
|
278
299
|
literals = [there, are, many, people, inside, this, thing, dot]
|
279
|
-
expect { subject.
|
300
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
280
301
|
|
281
302
|
# Sentence 1-15b: "There are more people inside this thing."
|
282
303
|
literals = [there, are, more, people, inside, this, thing, dot]
|
283
|
-
expect { subject.
|
284
|
-
|
285
|
-
# Sentence 1-15c: "There are more people inside the other thing
|
286
|
-
|
287
|
-
|
304
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
305
|
+
|
306
|
+
# Sentence 1-15c: "There are more people inside the other thing
|
307
|
+
# than there are inside this thing."
|
308
|
+
literals = [there, are, more, people, inside, the, other, thing,
|
309
|
+
than, there, are, inside, this, thing, dot]
|
310
|
+
# Ambiguous parse
|
311
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
288
312
|
end
|
289
313
|
|
290
314
|
it 'should parse sample sentences from lesson 1-E' do
|
291
315
|
# Sentence 1-16a: "Two of these things are alive."
|
292
316
|
literals = [two, of, these, things, are, alive, dot]
|
293
|
-
expect { subject.
|
317
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
294
318
|
|
295
319
|
# Sentence 1-16b: "One of these things is not alive."
|
296
320
|
literals = [one, of, these, things, is, not_, alive, dot]
|
297
|
-
expect { subject.
|
321
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
298
322
|
|
299
323
|
# Sentence 1-17a: "Tony sees some living things."
|
300
324
|
literals = [tony, sees, some, living, things, dot]
|
301
|
-
expect { subject.
|
325
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
302
326
|
|
303
327
|
# Sentence 1-17b: "Two of these things are big."
|
304
328
|
literals = [two, of, these, things, are, big, dot]
|
305
|
-
expect { subject.
|
329
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
306
330
|
|
307
331
|
# Sentence 1-17c: "One of these things is not big."
|
308
332
|
literals = [one, of, these, things, is, not_, big, dot]
|
309
|
-
expect { subject.
|
333
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
310
334
|
|
311
335
|
# Sentence 1-18a: "Tony sees some living things."
|
312
336
|
literals = [tony, sees, some, living, things, dot]
|
313
|
-
expect { subject.
|
337
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
314
338
|
|
315
339
|
# Sentence 1-18b: "One of these is big."
|
316
|
-
literals = [one, of,
|
317
|
-
expect { subject.
|
340
|
+
literals = [one, of, these_as_pronoun, is, big, dot]
|
341
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
318
342
|
|
319
343
|
# Sentence 1-18c: "Two of these are small."
|
320
|
-
literals = [two, of,
|
321
|
-
expect { subject.
|
344
|
+
literals = [two, of, these_as_pronoun, are, small, dot]
|
345
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
322
346
|
|
323
347
|
# Sentence 1-19a: "Tony sees one living thing."
|
324
348
|
literals = [tony, sees, one, living, thing, dot]
|
325
|
-
expect { subject.
|
349
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
326
350
|
|
327
351
|
# Sentence 1-19b: "This one is very big."
|
328
352
|
literals = [this_one, is, very, big, dot]
|
329
|
-
expect { subject.
|
353
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
330
354
|
|
331
355
|
# Sentence: "This thing is bigger than the other thing."
|
332
356
|
literals = [this, thing, is, bigger, than, the, other, thing, dot]
|
333
|
-
expect { subject.
|
357
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
334
358
|
|
335
359
|
# Sentence: "This thing is smaller than the other thing."
|
336
360
|
literals = [this, thing, is, smaller, than, the, other, thing, dot]
|
337
|
-
expect { subject.
|
361
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
338
362
|
end
|
339
363
|
|
340
364
|
it 'should parse sample sentences from lesson 1-F' do
|
341
365
|
# Sentence 1-20a: "Tony sees some living things."
|
342
366
|
literals = [tony, sees, some, living, things, dot]
|
343
|
-
expect { subject.
|
367
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
344
368
|
|
345
369
|
# Sentence 1-20b: "Two of these are the same kind of living thing."
|
346
370
|
literals = [these_as_pronoun, are, the, same, kind, of, living, thing, dot]
|
347
|
-
expect { subject.
|
371
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
348
372
|
|
349
373
|
# Sentence 1-20c: "One of these is not the same kind as the other two."
|
350
|
-
literals = [one, of,
|
351
|
-
|
374
|
+
literals = [one, of, these_as_pronoun, is, not_, the, same, kind,
|
375
|
+
as, the, other, two_as_pronoun, dot]
|
376
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
352
377
|
|
353
378
|
# Sentence 1-21a: "There is one person inside this thing."
|
354
379
|
literals = [there, is, one, person, inside, this, thing, dot]
|
355
|
-
expect { subject.
|
380
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
356
381
|
|
357
382
|
# Sentence 1-21b: "If Tony is not inside this thing, then another person is inside."
|
358
383
|
literals = [if_, tony, is, not_, inside, this, thing, comma, then_,
|
359
384
|
another, person, is, inside, dot]
|
360
|
-
|
385
|
+
# Ambiguous parse
|
386
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
361
387
|
|
362
388
|
# Sentence 1-22a: "Tony is touching something."
|
363
389
|
literals = [tony, is_aux, touching, something, dot]
|
364
|
-
expect { subject.
|
390
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
365
391
|
|
366
392
|
# Sentence 1-22b: "Lisa is touching Tony."
|
367
393
|
literals = [lisa, is_aux, touching, tony, dot]
|
368
|
-
expect { subject.
|
394
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
369
395
|
|
370
396
|
# Sentence 1-23a: "Tony is far from Lisa."
|
371
397
|
literals = [tony, is, far, from, lisa, dot]
|
372
|
-
expect { subject.
|
398
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
373
399
|
|
374
400
|
# Sentence 1-23b: "Lisa is far from Tony."
|
375
401
|
literals = [lisa, is, far, from, tony, dot]
|
376
|
-
expect { subject.
|
402
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
377
403
|
|
378
404
|
# Sentence 1-23c: "Tony is not far from Lisa."
|
379
405
|
literals = [tony, is, far, from, lisa, dot]
|
380
|
-
expect { subject.
|
406
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
381
407
|
|
382
408
|
# Sentence 1-24: "Tony is near to Lisa."
|
383
409
|
literals = [tony, is, near_to, lisa, dot]
|
384
|
-
expect { subject.
|
410
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
385
411
|
end
|
386
412
|
|
387
413
|
it 'should parse sample sentences from lesson 1-G' do
|
388
414
|
# Sentence 1-25a: "Lisa is in this place."
|
389
415
|
literals = [lisa, is, in_, this, place, dot]
|
390
|
-
expect { subject.
|
416
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
391
417
|
|
392
418
|
# Sentence 1-25b: "There are two other things in this place."
|
393
419
|
literals = [there, are, two, other, things, in_, this, place, dot]
|
394
|
-
expect { subject.
|
420
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
395
421
|
|
396
422
|
# Sentence 1-25c: "Lisa is in the same place as these two other things."
|
397
423
|
literals = [lisa, is, in_, the, same, place, as, these, two, other, things, dot]
|
398
|
-
expect { subject.
|
424
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
399
425
|
|
400
426
|
# Sentence 1-25d: "Tony is not in this place."
|
401
427
|
literals = [tony, is, not_, in_, this, place, dot]
|
402
|
-
expect { subject.
|
428
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
403
429
|
|
404
430
|
# Sentence 1-25e: "Tony is in another place."
|
405
431
|
literals = [tony, is, in_, another, place, dot]
|
406
|
-
expect { subject.
|
432
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
407
433
|
|
408
434
|
# Sentence 1-26a: "Lisa is inside this thing."
|
409
435
|
literals = [lisa, is, inside, this, thing, dot]
|
410
|
-
expect { subject.
|
436
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
411
437
|
|
412
438
|
# Sentence 1-26b: "Tony is above this thing."
|
413
439
|
literals = [tony, is, above, this, thing, dot]
|
414
|
-
expect { subject.
|
440
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
415
441
|
|
416
442
|
# Sentence 1-26c: "Tony is above lisa."
|
417
443
|
literals = [tony, is, above, lisa, dot]
|
418
|
-
expect { subject.
|
444
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
419
445
|
|
420
446
|
# Sentence 1-27a: "Tony is on one side of this thing."
|
421
447
|
literals = [tony, is, on, one, side, of, this, thing, dot]
|
422
|
-
expect { subject.
|
448
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
423
449
|
|
424
450
|
# Sentence 1-27b: "Lisa is on the other side."
|
425
451
|
literals = [lisa, is, on, the, other, side, dot]
|
426
|
-
expect { subject.
|
452
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
427
453
|
|
428
454
|
# Sentence 1-27c: "Tony is touching one side of this thing."
|
429
455
|
literals = [tony, is_aux, touching, one, side, of, this, thing, dot]
|
430
|
-
|
456
|
+
# Ambiguous parse
|
457
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
431
458
|
end
|
432
459
|
|
433
460
|
it 'should parse sample sentences from lesson 1-H' do
|
434
461
|
# Sentence 1-28: "Tony hears something."
|
435
462
|
literals = [tony, hears, something, dot]
|
436
|
-
expect { subject.
|
463
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
437
464
|
|
438
465
|
# Sentence 1-29a: "Tony says something."
|
439
466
|
literals = [tony, says, something, dot]
|
440
|
-
expect { subject.
|
467
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
441
468
|
|
442
469
|
# Sentence 1-29b: "Tony says something to Lisa."
|
443
470
|
literals = [tony, says, something, to, lisa, dot]
|
444
|
-
|
471
|
+
# Ambiguous parse
|
472
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
445
473
|
|
446
474
|
# Sentence 1-29c: "Tony says something about this living thing."
|
447
475
|
literals = [tony, says, something, about, this, living, thing, dot]
|
448
|
-
expect { subject.
|
476
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
449
477
|
|
450
478
|
# Sentence 1-29d: 'Tony says: "This living thing is small."'
|
451
479
|
literals = [tony, says, colon, quote, this, living, thing, is, small, dot, quote, dot]
|
452
|
-
expect { subject.
|
480
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
453
481
|
|
454
482
|
# Sentence 1-30a: "Tony says some words."
|
455
483
|
literals = [tony, says, some, words, dot]
|
456
|
-
expect { subject.
|
484
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
457
485
|
|
458
486
|
# Sentence 1-30b: "Lisa says more words."
|
459
487
|
literals = [lisa, says, more, words, dot]
|
460
|
-
expect { subject.
|
488
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
461
489
|
|
462
490
|
# Sentence 1-31a: 'Tony says: "There are two people inside this thing."'
|
463
491
|
literals = [tony, says, colon, quote, there, are, two, people, inside,
|
464
492
|
this, thing, dot, quote, dot]
|
465
|
-
expect { subject.
|
493
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
466
494
|
|
467
495
|
# Sentence 1-31b: 'Lisa says: "There is one person inside this thing."'
|
468
496
|
literals = [lisa, says, colon, quote, there, is, one, person, inside,
|
469
497
|
this, thing, dot, quote, dot]
|
470
|
-
expect { subject.
|
498
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
471
499
|
|
472
500
|
# Sentence 1-31c: "What Tony says is not true."
|
473
501
|
literals = [what, tony, says, is, not_, true_, dot]
|
474
|
-
expect { subject.
|
502
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
475
503
|
|
476
504
|
# Sentence 1-31d: "What Lisa says is true."
|
477
505
|
literals = [what, lisa, says, is, true_, dot]
|
478
|
-
expect { subject.
|
506
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
479
507
|
end
|
480
508
|
|
481
509
|
it 'should parse sample sentences from lesson 2-A' do
|
482
510
|
# Sentence 2-01a: "This thing is like two of the other things."
|
483
511
|
literals = [this, thing, is, like, two, of, the, other, things, dot]
|
484
|
-
expect { subject.
|
512
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
485
513
|
|
486
514
|
# Sentence 2-01b: "One of these things is not like the other things."
|
487
515
|
literals = [one, of, these, things, is, not_, like, the, other, things, dot]
|
488
|
-
expect { subject.
|
516
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
489
517
|
|
490
518
|
# Sentence 2-02a: "Lisa has something."
|
491
519
|
literals = [lisa, has, something, dot]
|
492
|
-
expect { subject.
|
520
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
493
521
|
|
494
522
|
# Sentence 2-02b: "Tony has another thing."
|
495
523
|
literals = [tony, has, another, thing, dot]
|
496
|
-
expect { subject.
|
524
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
497
525
|
|
498
526
|
# Sentence 2-02c: "Lisa does not have the same kind of thing as Tony has."
|
499
527
|
literals = [lisa, does_aux, not_, have, the, same, kind, of, thing, as, tony, has, dot]
|
500
|
-
|
528
|
+
# Ambiguous parse
|
529
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
501
530
|
|
502
531
|
# Sentence 2-03a: "Lisa is touching part of this thing."
|
503
532
|
literals = [lisa, is_aux, touching, part, of, this, thing, dot]
|
504
|
-
|
533
|
+
# Ambiguous parse
|
534
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
505
535
|
|
506
536
|
# Sentence 2-03b: "Tony is touching the other part."
|
507
537
|
literals = [tony, is_aux, touching, the, other, part, dot]
|
508
|
-
expect { subject.
|
538
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
509
539
|
|
510
540
|
# Sentence 2-Ax: "What Tony has is like what Lisa has."
|
511
541
|
literals = [what, tony, has, is, like, what, lisa, has, dot]
|
512
|
-
expect { subject.
|
542
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
513
543
|
end
|
514
544
|
|
515
545
|
it 'should parse sample sentences from lesson 2-B' do
|
516
546
|
# Sentence 2-04a: "Lisa does something."
|
517
547
|
literals = [lisa, does, something, dot]
|
518
|
-
expect { subject.
|
548
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
519
549
|
|
520
550
|
# Sentence 2-04b: "Lisa does something with this thing."
|
521
551
|
literals = [lisa, does, something, with, this, thing, dot]
|
522
|
-
|
552
|
+
# Ambiguous parse
|
553
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
523
554
|
|
524
555
|
# Sentence 2-04c: "Lisa does something to Tony."
|
525
556
|
literals = [lisa, does, something, to, tony, dot]
|
526
|
-
|
557
|
+
# Ambiguous parse
|
558
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
527
559
|
|
528
560
|
# Sentence 2-04d: "Lisa does something to Tony with this thing."
|
529
561
|
literals = [lisa, does, something, to, tony, with, this, thing, dot]
|
530
|
-
|
562
|
+
# Ambiguous parse
|
563
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
531
564
|
|
532
565
|
# Sentence 2-05a: "Something happens."
|
533
566
|
literals = [something, happens, dot]
|
534
|
-
expect { subject.
|
567
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
535
568
|
|
536
569
|
# Sentence 2-05b: "Something happens to Lisa."
|
537
570
|
literals = [something, happens, to, lisa, dot]
|
538
|
-
expect { subject.
|
571
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
539
572
|
|
540
573
|
# Sentence 2-06a: "Tony does something."
|
541
574
|
literals = [tony, does, something, dot]
|
542
|
-
expect { subject.
|
575
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
543
576
|
|
544
577
|
# Sentence 2-06b: "Something happens to Lisa because of this."
|
545
578
|
literals = [something, happens, to, lisa, because, of, this_as_pronoun, dot]
|
546
|
-
expect { subject.
|
579
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
547
580
|
|
548
581
|
# Sentence 2-06c: "Something happens to Lisa because Tony does this."
|
549
582
|
literals = [something, happens, to, lisa, because, tony, does, this_as_pronoun, dot]
|
550
|
-
expect { subject.
|
583
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
551
584
|
|
552
585
|
# Sentence 2-06: "Something happens to this living thing."
|
553
586
|
literals = [something, happens, to, this, living, thing, dot]
|
554
|
-
expect { subject.
|
587
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
555
588
|
end
|
556
589
|
|
557
590
|
it 'should parse sample sentences from lesson 2-C' do
|
558
591
|
# Sentence 2-07a: "Lisa thinks Tony is inside this thing."
|
559
592
|
literals = [lisa, thinks, tony, is, inside, this, thing, dot]
|
560
|
-
|
593
|
+
# Ambiguous parse
|
594
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
561
595
|
|
562
596
|
# Sentence 2-07b: "Lisa thinks something about Tony."
|
563
597
|
literals = [lisa, thinks, something, about, tony, dot]
|
564
|
-
|
598
|
+
# Ambiguous parse
|
599
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
565
600
|
|
566
601
|
# Sentence 2-08a: "Tony knows Lisa is inside this thing, because Tony sees Lisa inside."
|
567
602
|
literals = [tony, knows, lisa, is, inside, this, thing, comma,
|
568
603
|
because, tony, sees, lisa, inside, dot]
|
569
|
-
|
604
|
+
# Ambiguous parse
|
605
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
570
606
|
|
571
607
|
# Sentence 2-08b: "Tony knows something about Lisa."
|
572
608
|
literals = [tony, knows, something, about, lisa, dot]
|
573
|
-
|
609
|
+
# Ambiguous parse
|
610
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
574
611
|
|
575
612
|
# Sentence 2-09a: "Tony wants this thing."
|
576
613
|
literals = [tony, wants, this, thing, dot]
|
577
|
-
expect { subject.
|
614
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
578
615
|
|
579
616
|
# Sentence 2-09b: "Tony wants to have this thing."
|
580
617
|
literals = [tony, wants, to, have, this, thing, dot]
|
581
|
-
|
618
|
+
# Ambiguous parse
|
619
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
582
620
|
|
583
621
|
# Sentence 2-10a: "Tony wants to do something."
|
584
622
|
literals = [tony, wants, to, do_, something, dot]
|
585
|
-
|
623
|
+
# Ambiguous parse
|
624
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
586
625
|
|
587
626
|
# Sentence 2-10b: "Lisa wants to do the same thing."
|
588
627
|
literals = [lisa, wants, to, do_, the, same, thing, dot]
|
589
|
-
|
628
|
+
# Ambiguous parse
|
629
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
590
630
|
|
591
631
|
# Sentence 2-10c: "Tony can do this."
|
592
632
|
literals = [tony, can, do_, this_as_pronoun, dot]
|
593
|
-
expect { subject.
|
633
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
594
634
|
|
595
635
|
# Sentence 2-10d: "This is not something Lisa can do."
|
596
636
|
literals = [this_as_pronoun, is, not_, something, lisa, can, do_, dot]
|
597
|
-
expect { subject.
|
637
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
598
638
|
|
599
639
|
# Sentence 2-10e: "Lisa cannot do this."
|
600
640
|
literals = [lisa, can, not_, do_, this_as_pronoun, dot]
|
601
|
-
expect { subject.
|
641
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
602
642
|
end
|
603
643
|
|
604
644
|
it 'should parse sample sentences from lesson 2-D' do
|
605
645
|
# Sentence 2-11a: "This person does something bad."
|
606
646
|
literals = [this, person, does, something, bad, dot]
|
607
|
-
|
647
|
+
# Ambiguous parse
|
648
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
608
649
|
|
609
650
|
# Sentence 2-11b: "This person does something bad for Tony."
|
610
651
|
literals = [this, person, does, something, bad, for_, tony, dot]
|
611
|
-
|
652
|
+
# Ambiguous parse
|
653
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
612
654
|
|
613
655
|
# Sentence 2-12a: "Tony does something good."
|
614
656
|
literals = [tony, does, something, good, dot]
|
615
|
-
expect { subject.
|
657
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
616
658
|
|
617
659
|
# Sentence 2-12b: "Tony does something good for Lisa."
|
618
660
|
literals = [tony, does, something, good, for_, lisa, dot]
|
619
|
-
expect { subject.
|
661
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
620
662
|
|
621
663
|
# Sentence 2-13a: "Tony feels something."
|
622
664
|
literals = [tony, feels, something, dot]
|
623
|
-
expect { subject.
|
665
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
624
666
|
|
625
667
|
# Sentence 2-13b: "This does not feel good for Tony."
|
626
668
|
literals = [this_as_pronoun, does_aux, not_, feel, good, for_, tony, dot]
|
627
|
-
expect { subject.
|
669
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
628
670
|
|
629
671
|
# Sentence 2-13b: "This feels bad for Tony."
|
630
672
|
literals = [this_as_pronoun, feels, bad, for_, tony, dot]
|
631
|
-
expect { subject.
|
673
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
632
674
|
|
633
675
|
# Sentence 2-Dx: "Lisa thinks about something bad happening to this
|
634
676
|
# living thing. Thinking about this feels bad for Lisa."
|
635
|
-
|
636
|
-
|
637
|
-
|
677
|
+
literals = [lisa, thinks, about, something, bad, happening, to, this,
|
678
|
+
living, thing, dot,
|
679
|
+
#thinking, about, this_as_pronoun, feels, bad,
|
680
|
+
#for_, lisa, dot
|
681
|
+
]
|
682
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
638
683
|
end
|
639
684
|
|
640
685
|
it 'should parse sample sentences from lesson 2-E' do
|
641
686
|
# Sentence 2-14a: "Lisa says something at this time."
|
642
687
|
literals = [lisa, says, something, at, this, time, dot]
|
643
|
-
|
688
|
+
# Ambiguous parse
|
689
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
644
690
|
|
645
691
|
# Sentence 2-14b: "Tony is not in this place at this time."
|
646
692
|
literals = [tony, is, not_, in_, this, place, at, this, time, dot]
|
647
|
-
expect { subject.
|
693
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
648
694
|
|
649
695
|
# Sentence 2-15a: "At one time, Tony does something to this thing."
|
650
696
|
literals = [at, one, time, comma, tony, does, something, to, this, thing, dot]
|
651
|
-
expect { subject.
|
697
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
652
698
|
|
653
699
|
# Sentence 2-15b: "At another time, Lisa says something."
|
654
700
|
literals = [at, another, time, comma, lisa, says, something, dot]
|
655
|
-
expect { subject.
|
701
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
656
702
|
|
657
703
|
# Sentence 2-15c: "Tony does something to this thing before Lisa says something."
|
658
704
|
literals = [tony, does, something, to, this, thing, before, lisa, says, something, dot]
|
659
|
-
expect { subject.
|
705
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
660
706
|
|
661
707
|
# Sentence 2-16a: "Lisa does something for a long time."
|
662
708
|
literals = [lisa, does, something, for_, a_as_art, long, time, dot]
|
663
|
-
expect { subject.
|
709
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
664
710
|
|
665
711
|
# Sentence 2-17a: "Tony does something for a short time."
|
666
712
|
literals = [tony, does, something, for_, a_as_art, short, time, dot]
|
667
|
-
expect { subject.
|
713
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
668
714
|
|
669
715
|
# Sentence 2-17a: "Tony does not do this for a long time."
|
670
716
|
literals = [tony, does_aux, not_, do_, this_as_pronoun, for_, a_as_art, long, time, dot]
|
671
|
-
expect { subject.
|
717
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
672
718
|
|
673
719
|
# Sentence 2-18a: "Lisa sees something move."
|
674
720
|
literals = [lisa, sees, something, move, dot]
|
675
|
-
expect { subject.
|
721
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
676
722
|
|
677
723
|
# Sentence 2-18a: "Lisa moves near to this thing."
|
678
724
|
literals = [lisa, moves, near_to, this, thing, dot]
|
679
|
-
expect { subject.
|
725
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
680
726
|
|
681
727
|
# Sentence 2-E-Xa: "A short time before, Tony was far from Lisa."
|
682
728
|
# Case of a time adverbial adjunct that is put in front position.
|
683
729
|
literals = [a_as_art, short, time, before_adverb, comma, tony, was, far, from, lisa, dot]
|
684
|
-
expect { subject.
|
730
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
685
731
|
|
686
732
|
# Sentence 2-E-Xa: "At this time, Tony is near to Lisa"
|
687
733
|
literals = [at, this, time, comma, tony, is, near_to, lisa, dot]
|
688
|
-
expect { subject.
|
734
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
689
735
|
|
690
736
|
# Sentence 2-E-Xa: "Tony is near to Lisa because Tony moved"
|
691
737
|
# Case of a time adverbial adjunct that is put in front position.
|
692
738
|
literals = [tony, is, near_to, lisa, because, tony, moved, dot]
|
693
|
-
expect { subject.
|
739
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
694
740
|
end
|
695
741
|
|
696
|
-
it 'should parse sample sentences from lesson 2-F' do
|
742
|
+
it 'should parse sample sentences from lesson 2-F' do
|
697
743
|
# Sentence 2-19a: 'Tony says: "I did X.".'
|
698
744
|
literals = [tony, says, colon, quote, i_pronoun, did, x_as_noun, dot, quote, dot]
|
699
|
-
expect { subject.
|
745
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
700
746
|
|
701
747
|
# Sentence 2-19a definiendum: 'Tony says: "I did X.".'
|
702
748
|
literals = [tony, says, colon, quote, i_pronoun, did, x_as_noun, dot, quote, dot]
|
703
|
-
expect { subject.
|
749
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
704
750
|
|
705
751
|
# Sentence 2-19a definiens: 'Tony says something about Tony. Tony says: Tony did X.'
|
706
752
|
literals = [tony, says, something, about, tony, dot,
|
707
753
|
tony, says, colon, tony, did, x_as_noun, dot]
|
708
|
-
expect { subject.
|
754
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
709
755
|
|
710
756
|
# Sentence 2-19a: 'Tony says: "I see Lisa.".'
|
711
757
|
literals = [tony, says, colon, quote, i_pronoun, see, lisa, dot, quote, dot]
|
712
|
-
expect { subject.
|
758
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
713
759
|
|
714
760
|
# Sentence 2-19b definiendum: 'Lisa says: "X happened to me.".'
|
715
761
|
literals = [lisa, says, colon, quote, x_as_noun, happened, to, me, dot, quote, dot]
|
716
|
-
expect { subject.
|
762
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
717
763
|
|
718
764
|
# Sentence 2-19b definiens: 'Lisa says something about Lisa. Lisa says: X happened to Lisa.'
|
719
765
|
literals = [lisa, says, something, about, lisa, dot,
|
720
766
|
lisa, says, colon, x_as_noun, happened, to, lisa, dot]
|
721
|
-
expect { subject.
|
767
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
722
768
|
|
723
769
|
# Sentence 2-19c: 'Lisa says: "Tony sees me."'
|
724
770
|
literals = [lisa, says, colon, quote, tony, sees, me, dot, quote, dot]
|
725
|
-
expect { subject.
|
771
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
726
772
|
|
727
773
|
# Sentence 2-20a definiendum: 'Tony says to Lisa: "I can see you.".'
|
728
774
|
literals = [tony, says, to, lisa, colon, quote, i_pronoun, can, see, you, dot, quote, dot]
|
729
|
-
expect { subject.
|
775
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
730
776
|
|
731
777
|
# Sentence 2-20a definiens: 'Tony says something about Lisa.
|
732
778
|
# Tony says this to Lisa. Tony says: Tony can see Lisa.'
|
733
779
|
literals = [tony, says, something, about, lisa, dot,
|
734
780
|
tony, says, this_as_pronoun, to, lisa, dot,
|
735
781
|
tony, says, colon, tony, can, see, lisa, dot]
|
736
|
-
expect { subject.
|
782
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
737
783
|
|
738
784
|
# Sentence 2-20b: "I know you have something good."
|
739
785
|
literals = [i_pronoun, know, you, have, something, good, dot]
|
740
|
-
expect { subject.
|
786
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
741
787
|
|
742
788
|
# Sentence 2-20c: "I want you to do something good for me."
|
743
789
|
literals = [i_pronoun, want, you, to, do_, something, good, for_, me, dot]
|
744
|
-
expect { subject.
|
790
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
745
791
|
|
746
792
|
# Sentence 2-21a definiendum: 'Tony says: "X happens here.".'
|
747
793
|
literals = [tony, says, colon, quote, x_as_noun, happens, here, dot, quote, dot]
|
748
|
-
expect { subject.
|
794
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
749
795
|
|
750
796
|
# Sentence 2-21a definiens: "Tony is in a place. Tony says: X happens in this place."
|
751
797
|
literals = [tony, is, in_, a_as_art, place, dot,
|
752
798
|
tony, says, colon, x_as_noun, happens, in_, this, place, dot]
|
753
|
-
expect { subject.
|
799
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
754
800
|
|
755
801
|
# Sentence 2-21b: "Many people were here at one time."
|
756
802
|
literals = [many, people, were, here, at, one, time, dot]
|
757
|
-
expect { subject.
|
803
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
758
804
|
|
759
805
|
# Sentence 2-22a definiendum: 'Lisa says: "X happens now.".'
|
760
806
|
literals = [lisa, says, colon, quote, x_as_noun, happens, now, dot, quote, dot]
|
761
|
-
expect { subject.
|
807
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
762
808
|
|
763
809
|
# Sentence 2-22a definiens: 'Lisa says something at a time.
|
764
810
|
# Lisa says: X happens at this same time.'
|
765
811
|
literals = [lisa, says, something, at, a_as_art, time, dot,
|
766
812
|
lisa, says, colon, x_as_noun, happens, at, this, time, dot]
|
767
|
-
expect { subject.
|
813
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
768
814
|
|
769
815
|
# Sentence 2-22b: "There are not many people here now."
|
770
816
|
literals = [there, are, not_, many, people, here, now , dot]
|
771
|
-
expect { subject.
|
817
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
772
818
|
|
773
819
|
# Sentence 2-Fa: "Lisa says to Tony: "I can see many living things here."."
|
774
820
|
literals = [lisa, says, to, tony, colon, quote, i_pronoun,
|
775
821
|
can, see, many, living, things, here, dot, quote, dot]
|
776
|
-
expect { subject.
|
822
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
777
823
|
end
|
778
824
|
|
779
825
|
it 'should parse sample sentences from lesson 2-G' do
|
780
826
|
# Sentence 2-23a definiendum: 'Someone does X.'
|
781
827
|
literals = [someone, does, x_as_noun, dot]
|
782
|
-
expect { subject.
|
828
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
783
829
|
|
784
830
|
# Sentence 2-23a definiens: 'Something does X. This something can
|
785
831
|
# think like people think. This something can be one person.'
|
786
832
|
literals = [something, does, x_as_noun, dot,
|
787
833
|
this, something, can, think, like, people, think, dot,
|
788
834
|
this, something, can, be_, a_as_art, person, dot]
|
789
|
-
expect { subject.
|
835
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
790
836
|
|
791
837
|
# Sentence 2-23b: Someone said something to Tony.
|
792
838
|
literals = [someone, said, something, to, tony, dot]
|
793
|
-
expect { subject.
|
839
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
794
840
|
|
795
841
|
# Sentence 2-23c definiendum: 'J knows who did K.'
|
796
842
|
literals = [j_, knows, who, did, k_, dot]
|
797
|
-
expect { subject.
|
843
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
798
844
|
|
799
845
|
# Sentence 2-23c definiens: J thinks about someone.
|
800
846
|
# J knows this someone did K.
|
801
847
|
literals = [j_, thinks, about, someone, dot,
|
802
848
|
j_, knows, this, someone, did, k_, dot]
|
803
|
-
expect { subject.
|
849
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
804
850
|
|
805
851
|
# Sentence 2-23d: Tony knows who said something.
|
806
852
|
literals = [tony, knows, who, said, something, dot]
|
807
|
-
expect { subject.
|
853
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
808
854
|
|
809
855
|
# Sentence 2-24a definiendum: 'J happens after K happens.'
|
810
856
|
literals = [j_, happens, after_, k_, happens, dot]
|
811
|
-
expect { subject.
|
857
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
812
858
|
|
813
859
|
# Sentence 2-24a definiens: K happens before J happens.
|
814
860
|
literals = [k_, happens, before, j_, happens, dot]
|
815
|
-
expect { subject.
|
861
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
816
862
|
|
817
863
|
# Sentence 2-24b: After you do something for a long time,
|
818
864
|
# you can know much more about this.
|
819
865
|
literals = [after_, you, do_, something, for_, a_as_art, long, time,
|
820
866
|
comma, you, can, know, much, more_as_adverb, about, this_as_pronoun, dot]
|
821
|
-
expect { subject.
|
867
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
822
868
|
|
823
869
|
# Sentence 2-25a definiendum: 'X is true for some time.'
|
824
870
|
literals = [x_as_noun, is, true_, for_, some, time, dot]
|
825
|
-
expect { subject.
|
871
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
826
872
|
|
827
873
|
# Sentence 2-25a definiens: X is true at a time.
|
828
874
|
# Some parts of this one time happen before other parts.
|
@@ -832,17 +878,17 @@ module Zenlish
|
|
832
878
|
some, parts, of, this, one, time, happen, before_adverb, other, parts, dot,
|
833
879
|
some, parts, of, this, one, time, happen, after_adverb, other, parts, dot,
|
834
880
|
x_as_noun, is, true_, at, all, parts, of, this, one, time, dot]
|
835
|
-
expect { subject.
|
881
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
836
882
|
|
837
883
|
# Sentence 2-25b: After I moved for some time,
|
838
884
|
# I was near the other side of this place.
|
839
885
|
literals = [after_, i_pronoun, moved, for_, some, time,
|
840
886
|
comma, i_pronoun, was, near, the, other, side, of, this, place, dot]
|
841
|
-
expect { subject.
|
887
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
842
888
|
|
843
889
|
# Sentence 2-26a definiendum: 'X happens in a moment.'
|
844
890
|
literals = [x_as_noun, happens, in_, a_as_art, moment, dot]
|
845
|
-
expect { subject.
|
891
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
846
892
|
|
847
893
|
# Sentence 2-26a definiens: X happens for one very short time.
|
848
894
|
# There are not parts of this very short time when one part
|
@@ -850,13 +896,13 @@ module Zenlish
|
|
850
896
|
literals = [x_as_noun, happens, for_, one, very, short, time, dot,
|
851
897
|
there, are, not_, parts, of, this, very, short, time, when_,
|
852
898
|
one, part, happens, before_adverb, other, part, dot]
|
853
|
-
expect { subject.
|
899
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
854
900
|
|
855
901
|
# Sentence 2-26b: In a moment, I knew something here was not good.
|
856
902
|
# 'here' is adverb that modifies the 'knew' verb
|
857
903
|
literals = [in_, a_as_art, moment, comma, i_pronoun, knew, something,
|
858
904
|
here, was, not_, good, dot ]
|
859
|
-
expect { subject.
|
905
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
860
906
|
|
861
907
|
# Sentence 2-Gx: Tony is inside this thing for some time.
|
862
908
|
# Lisa says: "I want to know who is inside this thing.".
|
@@ -868,10 +914,37 @@ module Zenlish
|
|
868
914
|
because, of, this_as_pronoun, comma, tony, says, colon,
|
869
915
|
quote, i_pronoun, am, inside, dot, quote, dot,
|
870
916
|
tony, says, this_as_pronoun, after_, tony, hears, lisa, dot]
|
871
|
-
expect { subject.
|
917
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
918
|
+
end
|
919
|
+
|
920
|
+
it 'should parse sample sentences from lesson 2-H' do
|
921
|
+
# Sentence 2-27a definiendum: 'X is the body of this person.'
|
922
|
+
literals = [x_as_noun, is, the, body, of, this, person, dot]
|
923
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
872
924
|
end
|
873
925
|
=begin
|
874
926
|
TODO
|
927
|
+
Lesson 2-H
|
928
|
+
2-27. body, bodies, the body of, the bodies of.
|
929
|
+
[X is the body of this person.] = Parts of this person can touch other things. Parts of this person can touch other parts inside this person. X is all of these parts of this person.
|
930
|
+
[One part of the body of this person felt very bad.]
|
931
|
+
|
932
|
+
2-28. die, dies, to die, dying, died, dead, is dead.
|
933
|
+
[X dies.] = Something happens to X in a moment. X is alive before this moment. X is not alive after this moment.
|
934
|
+
[After this person lived for a long time, this person died.]
|
935
|
+
|
936
|
+
2-29. maybe.
|
937
|
+
[You think maybe X is true.] = You think something like X can be true. You do not know X is true. You do not know X is not true.
|
938
|
+
[Maybe some people far from here can see me.]
|
939
|
+
|
940
|
+
2-30. below, is below.
|
941
|
+
[J is below K.] = K is above J.
|
942
|
+
[I am touching this thing below me.]
|
943
|
+
|
944
|
+
Someone sees this thing.
|
945
|
+
The body of this thing is not moving.
|
946
|
+
Maybe this thing __________.
|
947
|
+
is far below this person
|
875
948
|
|
876
949
|
Lesson 2.C
|
877
950
|
|