zenlish 0.1.23 → 0.1.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +11 -9
- data/lib/zenlish/lang/dictionary.rb +10 -4
- data/lib/zenlish/lang/zenlish_grammar.rb +9 -0
- data/lib/zenlish/lex/empty_lexicon_factory.rb +1 -0
- data/lib/zenlish/lex/lexicon.rb +7 -1
- data/lib/zenlish/version.rb +1 -1
- data/lib/zenlish/wclasses/all_word_classes.rb +1 -0
- data/lib/zenlish/wclasses/modal_verb_could.rb +9 -0
- data/spec/zenlish/parser/lesson1_spec.rb +331 -0
- data/spec/zenlish/parser/lesson2_spec.rb +503 -0
- data/spec/zenlish/parser/lesson3_spec.rb +473 -0
- data/spec/zenlish/parser/zparser_spec.rb +3 -1407
- data/spec/zenlish/support/var2word.rb +223 -0
- metadata +10 -2
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
2
|
require_relative '../../spec_helper' # Use the RSpec framework
|
4
|
-
require_relative '
|
5
|
-
require_relative '../support/minimal_lexicon'
|
3
|
+
require_relative '../support/var2word'
|
6
4
|
require_relative '../../../lib/zenlish/parser/zparser' # Load the class under test
|
7
5
|
|
8
6
|
module Zenlish
|
9
7
|
module Parser
|
10
8
|
describe ZParser do
|
9
|
+
include Var2Word
|
10
|
+
|
11
11
|
subject { ZParser.new }
|
12
12
|
|
13
13
|
context 'Initialization:' do
|
@@ -16,224 +16,6 @@ module Zenlish
|
|
16
16
|
end
|
17
17
|
end # context
|
18
18
|
|
19
|
-
def get_lexeme(aLemma, aWordClass = nil)
|
20
|
-
Zenlish::Lang::Dictionary.get_lexeme(aLemma, aWordClass)
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.literal2var(aLemma, aLiteral, aSuffix = '')
|
24
|
-
mth_name = aLiteral.downcase + aSuffix
|
25
|
-
define_method(mth_name.to_sym) do
|
26
|
-
Lex::Literal.new(aLiteral, get_lexeme(aLemma), 0)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
# In absence of a POS tagger/lemmatizer, we map input words
|
31
|
-
# to variables that themselves return Literal objects.
|
32
|
-
# For instance, next line will create a variable called 'alive'
|
33
|
-
literal2var('a', 'a', '_as_art')
|
34
|
-
literal2var('a', 'an')
|
35
|
-
literal2var('about', 'about')
|
36
|
-
literal2var('above', 'above')
|
37
|
-
def after_adverb ; Lex::Literal.new('after', get_lexeme('after', WClasses::Adverb), 0) ; end
|
38
|
-
def after_ ; Lex::Literal.new('after', get_lexeme('after', WClasses::SubordinatingConjunction), 0) ; end
|
39
|
-
literal2var('alive', 'alive')
|
40
|
-
literal2var('all', 'all')
|
41
|
-
def am ; Lex::Literal.new('am', get_lexeme('be', WClasses::IrregularVerbBe), 0) ; end
|
42
|
-
literal2var('and', 'and', '_')
|
43
|
-
literal2var('animal', 'animal')
|
44
|
-
literal2var('animal', 'animals')
|
45
|
-
literal2var('another', 'another')
|
46
|
-
def are ; Lex::Literal.new('are', get_lexeme('be', WClasses::IrregularVerbBe), 0) ; end
|
47
|
-
literal2var('as', 'as')
|
48
|
-
literal2var('at', 'at')
|
49
|
-
literal2var('bad', 'bad')
|
50
|
-
def be_ ; Lex::Literal.new('be', get_lexeme('be', WClasses::IrregularVerbBe), 0) ; end
|
51
|
-
literal2var('because', 'because')
|
52
|
-
literal2var('become', 'became')
|
53
|
-
literal2var('become', 'become')
|
54
|
-
literal2var('become', 'becomes')
|
55
|
-
def before_adverb ; Lex::Literal.new('before', get_lexeme('before', WClasses::Adverb), 0) ; end
|
56
|
-
def before_as_adj ; Lex::Literal.new('before', get_lexeme('before', WClasses::Adjective), 0) ; end
|
57
|
-
def before ; Lex::Literal.new('before', get_lexeme('before', WClasses::SubordinatingConjunction), 0) ; end
|
58
|
-
literal2var('belong', 'belong')
|
59
|
-
literal2var('belong', 'belongs')
|
60
|
-
literal2var('below', 'below')
|
61
|
-
literal2var('big', 'big')
|
62
|
-
literal2var('big', 'bigger')
|
63
|
-
literal2var('body', 'body')
|
64
|
-
literal2var('but', 'but')
|
65
|
-
literal2var('can', 'can')
|
66
|
-
literal2var('cause', 'cause')
|
67
|
-
literal2var('cause', 'caused')
|
68
|
-
literal2var('cause', 'causes')
|
69
|
-
literal2var('contain', 'contain')
|
70
|
-
literal2var('contain', 'contains')
|
71
|
-
literal2var('container', 'container')
|
72
|
-
literal2var('container', 'containers')
|
73
|
-
def did ; Lex::Literal.new('did', get_lexeme('do', WClasses::IrregularVerbDo), 0) ; end
|
74
|
-
literal2var('die', 'die')
|
75
|
-
literal2var('die', 'died')
|
76
|
-
literal2var('die', 'dies')
|
77
|
-
literal2var('different', 'different')
|
78
|
-
def do_ ; Lex::Literal.new('do', get_lexeme('do', WClasses::IrregularVerbDo), 0) ; end
|
79
|
-
def do_aux ; Lex::Literal.new('do', get_lexeme('do', WClasses::AuxiliaryDo), 0) ; end
|
80
|
-
def does ; Lex::Literal.new('does', get_lexeme('do', WClasses::IrregularVerbDo), 0) ; end
|
81
|
-
def does_aux ; Lex::Literal.new('does', get_lexeme('do', WClasses::AuxiliaryDo), 0) ; end
|
82
|
-
literal2var('each', 'each', '_')
|
83
|
-
def each_ ; Lex::Literal.new('each', get_lexeme('each', WClasses::DistributiveDeterminer), 0) ; end
|
84
|
-
def each_as_pronoun ; Lex::Literal.new('each', get_lexeme('each', WClasses::Pronoun), 0) ; end
|
85
|
-
literal2var('exist', 'exist')
|
86
|
-
literal2var('exist', 'existed')
|
87
|
-
literal2var('exist', 'exists')
|
88
|
-
literal2var('false', 'false', '_')
|
89
|
-
literal2var('far', 'far')
|
90
|
-
literal2var('far from', 'far_from')
|
91
|
-
literal2var('feel', 'feel')
|
92
|
-
literal2var('feel', 'feels')
|
93
|
-
literal2var('feel', 'felt')
|
94
|
-
literal2var('for', 'for', '_')
|
95
|
-
literal2var('from', 'from')
|
96
|
-
literal2var('good', 'good')
|
97
|
-
literal2var('happen', 'happen')
|
98
|
-
literal2var('happen', 'happened')
|
99
|
-
literal2var('happen', 'happening')
|
100
|
-
literal2var('happen', 'happens')
|
101
|
-
literal2var('have', 'has')
|
102
|
-
literal2var('have', 'have')
|
103
|
-
literal2var('hear', 'hear')
|
104
|
-
literal2var('hear', 'heard')
|
105
|
-
literal2var('hear', 'hears')
|
106
|
-
def here ; Lex::Literal.new('here', get_lexeme('here', WClasses::Adverb), 0) ; end
|
107
|
-
def here_as_noun ; Lex::Literal.new('here', get_lexeme('here', WClasses::CommonNoun), 0) ; end
|
108
|
-
def i_pronoun ; Lex::Literal.new('I', get_lexeme('I'), 0) ; end
|
109
|
-
literal2var('if', 'if', '_')
|
110
|
-
literal2var('in', 'in', '_')
|
111
|
-
literal2var('inside', 'inside')
|
112
|
-
literal2var('it', 'it', '_')
|
113
|
-
literal2var('its', 'its')
|
114
|
-
literal2var('J', 'j', '_')
|
115
|
-
def is ; Lex::Literal.new('is', get_lexeme('be', WClasses::IrregularVerbBe), 0) ; end
|
116
|
-
def is_aux ; Lex::Literal.new('is', get_lexeme('be', WClasses::AuxiliaryBe), 0) ; end
|
117
|
-
literal2var('K', 'k', '_')
|
118
|
-
literal2var('kind', 'kind')
|
119
|
-
literal2var('kind', 'kinds')
|
120
|
-
literal2var('know', 'knew')
|
121
|
-
literal2var('know', 'know')
|
122
|
-
literal2var('know', 'knows')
|
123
|
-
literal2var('like', 'like')
|
124
|
-
literal2var('Lisa', 'Lisa')
|
125
|
-
literal2var('live', 'lived')
|
126
|
-
literal2var('living', 'living')
|
127
|
-
literal2var('long', 'long')
|
128
|
-
literal2var('make', 'made')
|
129
|
-
literal2var('make', 'make')
|
130
|
-
literal2var('many', 'many')
|
131
|
-
literal2var('maybe', 'maybe')
|
132
|
-
literal2var('me', 'me')
|
133
|
-
literal2var('moment', 'moment')
|
134
|
-
def more ; Lex::Literal.new('more', get_lexeme('more', WClasses::Adjective), 0) ; end
|
135
|
-
def more_as_adverb ; Lex::Literal.new('more', get_lexeme('more', WClasses::Adverb), 0) ; end
|
136
|
-
literal2var('move', 'move')
|
137
|
-
literal2var('move', 'moved')
|
138
|
-
literal2var('move', 'moving')
|
139
|
-
literal2var('move', 'moves')
|
140
|
-
literal2var('much', 'much')
|
141
|
-
literal2var('my', 'my')
|
142
|
-
literal2var('near', 'near')
|
143
|
-
literal2var('near to', 'near_to')
|
144
|
-
literal2var('not', 'not', '_')
|
145
|
-
def now ; Lex::Literal.new('now', get_lexeme('now', WClasses::Adverb), 0) ; end
|
146
|
-
def now_as_noun ; Lex::Literal.new('now', get_lexeme('now', WClasses::CommonNoun), 0) ; end
|
147
|
-
literal2var('of', 'of')
|
148
|
-
literal2var('on', 'on')
|
149
|
-
def one ; Lex::Literal.new('one', get_lexeme('one', WClasses::Cardinal), 0) ; end
|
150
|
-
def one_as_adj ; Lex::Literal.new('one', get_lexeme('one', WClasses::Adjective), 0) ; end
|
151
|
-
def one_as_pronoun ; Lex::Literal.new('one', get_lexeme('one', WClasses::IndefinitePronoun), 0) ; end
|
152
|
-
literal2var('or', 'or', '_')
|
153
|
-
literal2var('other', 'other')
|
154
|
-
literal2var('part', 'part')
|
155
|
-
literal2var('part', 'parts')
|
156
|
-
literal2var('people', 'people')
|
157
|
-
literal2var('person', 'person')
|
158
|
-
literal2var('place', 'place')
|
159
|
-
def same ; Lex::Literal.new('same', get_lexeme('same', WClasses::Adjective), 0) ; end
|
160
|
-
def same_as_pronoun ; Lex::Literal.new('same', get_lexeme('same', WClasses::Pronoun), 0) ; end
|
161
|
-
literal2var('see', 'saw')
|
162
|
-
literal2var('short', 'short')
|
163
|
-
literal2var('side', 'side')
|
164
|
-
literal2var('small', 'small')
|
165
|
-
literal2var('small', 'smaller')
|
166
|
-
literal2var('some', 'some')
|
167
|
-
literal2var('say', 'say')
|
168
|
-
literal2var('say', 'said')
|
169
|
-
literal2var('say', 'says')
|
170
|
-
literal2var('see', 'see')
|
171
|
-
literal2var('see', 'sees')
|
172
|
-
literal2var('someone', 'someone')
|
173
|
-
literal2var('someplace', 'someplace')
|
174
|
-
literal2var('something', 'something')
|
175
|
-
literal2var('the', 'the')
|
176
|
-
literal2var('their', 'their')
|
177
|
-
literal2var('them', 'them')
|
178
|
-
literal2var('then', 'then', '_')
|
179
|
-
literal2var('they', 'they')
|
180
|
-
literal2var('than', 'than')
|
181
|
-
literal2var('that', 'that')
|
182
|
-
literal2var('there', 'there')
|
183
|
-
literal2var('thing', 'thing')
|
184
|
-
literal2var('thing', 'things')
|
185
|
-
literal2var('think', 'think')
|
186
|
-
literal2var('think', 'thinking')
|
187
|
-
literal2var('think', 'thinks')
|
188
|
-
def these ; Lex::Literal.new('these', get_lexeme('this', WClasses::DemonstrativeDeterminer), 0) ; end
|
189
|
-
def these_as_pronoun ; Lex::Literal.new('these', get_lexeme('this', WClasses::DemonstrativePronoun), 0) ; end
|
190
|
-
def this ; Lex::Literal.new('this', get_lexeme('this', WClasses::DemonstrativeDeterminer), 0) ; end
|
191
|
-
def this_as_pronoun ; Lex::Literal.new('this', get_lexeme('this', WClasses::DemonstrativePronoun), 0) ; end
|
192
|
-
literal2var('this one', 'this_one')
|
193
|
-
literal2var('time', 'time')
|
194
|
-
literal2var('to', 'to')
|
195
|
-
literal2var('Tony', 'Tony')
|
196
|
-
literal2var('touch', 'touch')
|
197
|
-
literal2var('touch', 'touched')
|
198
|
-
literal2var('touch', 'touching')
|
199
|
-
literal2var('true', 'true', '_')
|
200
|
-
def two ; Lex::Literal.new('two', get_lexeme('two', WClasses::Cardinal), 0) ; end
|
201
|
-
def two_as_pronoun ; Lex::Literal.new('two', get_lexeme('two', WClasses::IndefinitePronoun), 0) ; end
|
202
|
-
literal2var('use', 'use')
|
203
|
-
literal2var('use', 'used')
|
204
|
-
literal2var('very', 'very')
|
205
|
-
literal2var('want', 'want')
|
206
|
-
literal2var('want', 'wants')
|
207
|
-
def was ; Lex::Literal.new('was', get_lexeme('be', WClasses::IrregularVerbBe), 0) ; end
|
208
|
-
def were ; Lex::Literal.new('were', get_lexeme('be', WClasses::IrregularVerbBe), 0) ; end
|
209
|
-
literal2var('what', 'what')
|
210
|
-
literal2var('when', 'when', '_')
|
211
|
-
literal2var('who', 'who')
|
212
|
-
literal2var('with', 'with')
|
213
|
-
literal2var('word', 'words')
|
214
|
-
def x_as_noun ; Lex::Literal.new('X', get_lexeme('X'), 0) ; end
|
215
|
-
literal2var('you', 'you')
|
216
|
-
literal2var('you', 'your')
|
217
|
-
|
218
|
-
def colon ; Lex::Literal.new(':', get_lexeme(':'), 0) ; end
|
219
|
-
def comma ; Lex::Literal.new(',', get_lexeme(','), 0) ; end
|
220
|
-
def dot ; Lex::Literal.new('.', get_lexeme('.'), 0) ; end
|
221
|
-
def quote ; Lex::Literal.new('"', get_lexeme('"'), 0) ; end
|
222
|
-
|
223
|
-
class ZProxy
|
224
|
-
attr_reader :literal
|
225
|
-
|
226
|
-
def initialize(aTarget)
|
227
|
-
@literal = aTarget
|
228
|
-
end
|
229
|
-
|
230
|
-
def method_missing(name, *args, &aBlock)
|
231
|
-
puts "#{literal.lexeme} about to receive #{name}"
|
232
|
-
$stdout.flush
|
233
|
-
literal.send(name, *args, &aBlock)
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|
237
19
|
context 'Producing parse tree or forest:' do
|
238
20
|
# it 'should produce trees (for non ambiguous input)' do
|
239
21
|
# # OK, non-ambiguous sentence: "Lisa sees Tony."
|
@@ -249,1192 +31,6 @@ module Zenlish
|
|
249
31
|
expect(subject.to_pforest(literals)).to be_kind_of(result_type)
|
250
32
|
end
|
251
33
|
end # context
|
252
|
-
|
253
|
-
context 'Parsing lessons:' do
|
254
|
-
it 'should parse sample sentences from lesson 1-A' do
|
255
|
-
# Sentence 1-01: "Tony sees Lisa."
|
256
|
-
# in absence of a tokenizer, we create a sequence of literals by hand...
|
257
|
-
# prox_tony = ZProxy.new(tony)
|
258
|
-
literals = [tony, sees, lisa, dot]
|
259
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
260
|
-
|
261
|
-
# Sentence 1-02a: "Tony sees something."
|
262
|
-
sentence_literals = [tony, sees, something, dot]
|
263
|
-
expect { subject.to_pforest(sentence_literals) }.not_to raise_error
|
264
|
-
|
265
|
-
# Sentence 1-02b: "Lisa sees something."
|
266
|
-
sentence_literals = [lisa, sees, something, dot]
|
267
|
-
expect { subject.to_pforest(sentence_literals) }.not_to raise_error
|
268
|
-
|
269
|
-
# Sentence 1-03: "Tony sees this thing."
|
270
|
-
sentence_literals = [tony, sees, this, thing, dot]
|
271
|
-
expect { subject.to_pforest(sentence_literals) }.not_to raise_error
|
272
|
-
|
273
|
-
# Sentence 1-04: "Lisa sees the other thing."
|
274
|
-
sentence_literals = [lisa, sees, the, other, thing, dot]
|
275
|
-
expect { subject.to_pforest(sentence_literals) }.not_to raise_error
|
276
|
-
end
|
277
|
-
|
278
|
-
it 'should parse sample sentences from lesson 1-B' do
|
279
|
-
# Sentence 1-05a: "Lisa sees the same thing."
|
280
|
-
literals = [lisa, sees, the, same, thing, dot]
|
281
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
282
|
-
|
283
|
-
# Sentence 1-05b: "Lisa sees the same thing as Tony sees."
|
284
|
-
literals = [lisa, sees, the, same, thing, as, tony, sees, dot]
|
285
|
-
# same is an adjective of equality comparison
|
286
|
-
# as is part of same ... as combination
|
287
|
-
# it introduces a comparative clause
|
288
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
289
|
-
|
290
|
-
# Sentence 1-06: "Tony sees one thing."
|
291
|
-
literals = [tony, sees, one, thing, dot]
|
292
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
293
|
-
|
294
|
-
# Sentence 1-07: "Lisa sees two things."
|
295
|
-
literals = [lisa, sees, two, things, dot]
|
296
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
297
|
-
|
298
|
-
# Sentence 1-08a: "Tony sees one person."
|
299
|
-
literals = [tony, sees, one, person, dot]
|
300
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
301
|
-
|
302
|
-
# Sentence 1-08b: "Lisa sees two people."
|
303
|
-
literals = [lisa, sees, two, people, dot]
|
304
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
305
|
-
|
306
|
-
# Sentence 1-05b: "Tony sees the same person as Lisa sees."
|
307
|
-
literals = [tony, sees, the, same, person, as, lisa, sees, dot]
|
308
|
-
# same is an adjective of equality comparison
|
309
|
-
# as is part of same ... as combination
|
310
|
-
# it introduces a comparative clause
|
311
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
312
|
-
end
|
313
|
-
|
314
|
-
it 'should parse sample sentences from lesson 1-C' do
|
315
|
-
# Sentence 1-09a: "Tony sees many things."
|
316
|
-
literals = [tony, sees, many, things, dot]
|
317
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
318
|
-
|
319
|
-
# Sentence 1-09b: "Lisa sees many people."
|
320
|
-
literals = [lisa, sees, many, people, dot]
|
321
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
322
|
-
|
323
|
-
# Sentence 1-10: "Tony is inside this thing."
|
324
|
-
literals = [tony, is, inside, this, thing, dot]
|
325
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
326
|
-
|
327
|
-
# Sentence 1-11: "Lisa is not inside this thing."
|
328
|
-
literals = [lisa, is, not_, inside, this, thing, dot]
|
329
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
330
|
-
|
331
|
-
# Sentence: "Lisa does not see people inside the other thing."
|
332
|
-
literals = [lisa, does_aux, not_, see, people, inside, the, other, thing, dot]
|
333
|
-
# Ambiguous parse...
|
334
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
335
|
-
end
|
336
|
-
|
337
|
-
it 'should parse sample sentences from lesson 1-D' do
|
338
|
-
# Sentence 1-12a: "Some of these people are inside this thing."
|
339
|
-
literals = [some, of, these, people, are, inside, this, thing, dot]
|
340
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
341
|
-
|
342
|
-
# Sentence 1-12b: "Some of these people are not inside this thing."
|
343
|
-
literals = [some, of, these, people, are, not_, inside, this, thing, dot]
|
344
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
345
|
-
|
346
|
-
# Sentence 1-13: "All of these people are inside this thing."
|
347
|
-
literals = [all, of, these, people, are, not_, inside, this, thing, dot]
|
348
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
349
|
-
|
350
|
-
# Sentence 1-14a: "There are two people inside one of these things."
|
351
|
-
literals = [there, are, two, people, inside, one, of, these, things, dot]
|
352
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
353
|
-
|
354
|
-
# Sentence 1-14b: "There are not people inside the other thing."
|
355
|
-
literals = [there, are, not_, people, inside, the, other, thing, dot]
|
356
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
357
|
-
|
358
|
-
# Sentence 1-15a: "There are many people inside this thing."
|
359
|
-
literals = [there, are, many, people, inside, this, thing, dot]
|
360
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
361
|
-
|
362
|
-
# Sentence 1-15b: "There are more people inside this thing."
|
363
|
-
literals = [there, are, more, people, inside, this, thing, dot]
|
364
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
365
|
-
|
366
|
-
# Sentence 1-15c: "There are more people inside the other thing
|
367
|
-
# than there are inside this thing."
|
368
|
-
literals = [there, are, more, people, inside, the, other, thing,
|
369
|
-
than, there, are, inside, this, thing, dot]
|
370
|
-
# Ambiguous parse
|
371
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
372
|
-
end
|
373
|
-
|
374
|
-
it 'should parse sample sentences from lesson 1-E' do
|
375
|
-
# Sentence 1-16a: "Two of these things are alive."
|
376
|
-
literals = [two, of, these, things, are, alive, dot]
|
377
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
378
|
-
|
379
|
-
# Sentence 1-16b: "One of these things is not alive."
|
380
|
-
literals = [one, of, these, things, is, not_, alive, dot]
|
381
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
382
|
-
|
383
|
-
# Sentence 1-17a: "Tony sees some living things."
|
384
|
-
literals = [tony, sees, some, living, things, dot]
|
385
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
386
|
-
|
387
|
-
# Sentence 1-17b: "Two of these things are big."
|
388
|
-
literals = [two, of, these, things, are, big, dot]
|
389
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
390
|
-
|
391
|
-
# Sentence 1-17c: "One of these things is not big."
|
392
|
-
literals = [one, of, these, things, is, not_, big, dot]
|
393
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
394
|
-
|
395
|
-
# Sentence 1-18a: "Tony sees some living things."
|
396
|
-
literals = [tony, sees, some, living, things, dot]
|
397
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
398
|
-
|
399
|
-
# Sentence 1-18b: "One of these is big."
|
400
|
-
literals = [one, of, these_as_pronoun, is, big, dot]
|
401
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
402
|
-
|
403
|
-
# Sentence 1-18c: "Two of these are small."
|
404
|
-
literals = [two, of, these_as_pronoun, are, small, dot]
|
405
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
406
|
-
|
407
|
-
# Sentence 1-19a: "Tony sees one living thing."
|
408
|
-
literals = [tony, sees, one, living, thing, dot]
|
409
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
410
|
-
|
411
|
-
# Sentence 1-19b: "This one is very big."
|
412
|
-
literals = [this_one, is, very, big, dot]
|
413
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
414
|
-
|
415
|
-
# Sentence: "This thing is bigger than the other thing."
|
416
|
-
literals = [this, thing, is, bigger, than, the, other, thing, dot]
|
417
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
418
|
-
|
419
|
-
# Sentence: "This thing is smaller than the other thing."
|
420
|
-
literals = [this, thing, is, smaller, than, the, other, thing, dot]
|
421
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
422
|
-
end
|
423
|
-
|
424
|
-
it 'should parse sample sentences from lesson 1-F' do
|
425
|
-
# Sentence 1-20a: "Tony sees some living things."
|
426
|
-
literals = [tony, sees, some, living, things, dot]
|
427
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
428
|
-
|
429
|
-
# Sentence 1-20b: "Two of these are the same kind of living thing."
|
430
|
-
literals = [these_as_pronoun, are, the, same, kind, of, living, thing, dot]
|
431
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
432
|
-
|
433
|
-
# Sentence 1-20c: "One of these is not the same kind as the other two."
|
434
|
-
literals = [one, of, these_as_pronoun, is, not_, the, same, kind,
|
435
|
-
as, the, other, two_as_pronoun, dot]
|
436
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
437
|
-
|
438
|
-
# Sentence 1-21a: "There is one person inside this thing."
|
439
|
-
literals = [there, is, one, person, inside, this, thing, dot]
|
440
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
441
|
-
|
442
|
-
# Sentence 1-21b: "If Tony is not inside this thing, then another person is inside."
|
443
|
-
literals = [if_, tony, is, not_, inside, this, thing, comma, then_,
|
444
|
-
another, person, is, inside, dot]
|
445
|
-
# Ambiguous parse
|
446
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
447
|
-
|
448
|
-
# Sentence 1-22a: "Tony is touching something."
|
449
|
-
literals = [tony, is_aux, touching, something, dot]
|
450
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
451
|
-
|
452
|
-
# Sentence 1-22b: "Lisa is touching Tony."
|
453
|
-
literals = [lisa, is_aux, touching, tony, dot]
|
454
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
455
|
-
|
456
|
-
# Sentence 1-23a: "Tony is far from Lisa."
|
457
|
-
literals = [tony, is, far, from, lisa, dot]
|
458
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
459
|
-
|
460
|
-
# Sentence 1-23b: "Lisa is far from Tony."
|
461
|
-
literals = [lisa, is, far, from, tony, dot]
|
462
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
463
|
-
|
464
|
-
# Sentence 1-23c: "Tony is not far from Lisa."
|
465
|
-
literals = [tony, is, far, from, lisa, dot]
|
466
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
467
|
-
|
468
|
-
# Sentence 1-24: "Tony is near to Lisa."
|
469
|
-
literals = [tony, is, near_to, lisa, dot]
|
470
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
471
|
-
end
|
472
|
-
|
473
|
-
it 'should parse sample sentences from lesson 1-G' do
|
474
|
-
# Sentence 1-25a: "Lisa is in this place."
|
475
|
-
literals = [lisa, is, in_, this, place, dot]
|
476
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
477
|
-
|
478
|
-
# Sentence 1-25b: "There are two other things in this place."
|
479
|
-
literals = [there, are, two, other, things, in_, this, place, dot]
|
480
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
481
|
-
|
482
|
-
# Sentence 1-25c: "Lisa is in the same place as these two other things."
|
483
|
-
literals = [lisa, is, in_, the, same, place, as, these, two, other, things, dot]
|
484
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
485
|
-
|
486
|
-
# Sentence 1-25d: "Tony is not in this place."
|
487
|
-
literals = [tony, is, not_, in_, this, place, dot]
|
488
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
489
|
-
|
490
|
-
# Sentence 1-25e: "Tony is in another place."
|
491
|
-
literals = [tony, is, in_, another, place, dot]
|
492
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
493
|
-
|
494
|
-
# Sentence 1-26a: "Lisa is inside this thing."
|
495
|
-
literals = [lisa, is, inside, this, thing, dot]
|
496
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
497
|
-
|
498
|
-
# Sentence 1-26b: "Tony is above this thing."
|
499
|
-
literals = [tony, is, above, this, thing, dot]
|
500
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
501
|
-
|
502
|
-
# Sentence 1-26c: "Tony is above lisa."
|
503
|
-
literals = [tony, is, above, lisa, dot]
|
504
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
505
|
-
|
506
|
-
# Sentence 1-27a: "Tony is on one side of this thing."
|
507
|
-
literals = [tony, is, on, one, side, of, this, thing, dot]
|
508
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
509
|
-
|
510
|
-
# Sentence 1-27b: "Lisa is on the other side."
|
511
|
-
literals = [lisa, is, on, the, other, side, dot]
|
512
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
513
|
-
|
514
|
-
# Sentence 1-27c: "Tony is touching one side of this thing."
|
515
|
-
literals = [tony, is_aux, touching, one, side, of, this, thing, dot]
|
516
|
-
# Ambiguous parse
|
517
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
518
|
-
end
|
519
|
-
|
520
|
-
it 'should parse sample sentences from lesson 1-H' do
|
521
|
-
# Sentence 1-28: "Tony hears something."
|
522
|
-
literals = [tony, hears, something, dot]
|
523
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
524
|
-
|
525
|
-
# Sentence 1-29a: "Tony says something."
|
526
|
-
literals = [tony, says, something, dot]
|
527
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
528
|
-
|
529
|
-
# Sentence 1-29b: "Tony says something to Lisa."
|
530
|
-
literals = [tony, says, something, to, lisa, dot]
|
531
|
-
# Ambiguous parse
|
532
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
533
|
-
|
534
|
-
# Sentence 1-29c: "Tony says something about this living thing."
|
535
|
-
literals = [tony, says, something, about, this, living, thing, dot]
|
536
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
537
|
-
|
538
|
-
# Sentence 1-29d: 'Tony says: "This living thing is small."'
|
539
|
-
literals = [tony, says, colon, quote, this, living, thing, is, small, dot, quote, dot]
|
540
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
541
|
-
|
542
|
-
# Sentence 1-30a: "Tony says some words."
|
543
|
-
literals = [tony, says, some, words, dot]
|
544
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
545
|
-
|
546
|
-
# Sentence 1-30b: "Lisa says more words."
|
547
|
-
literals = [lisa, says, more, words, dot]
|
548
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
549
|
-
|
550
|
-
# Sentence 1-31a: 'Tony says: "There are two people inside this thing."'
|
551
|
-
literals = [tony, says, colon, quote, there, are, two, people, inside,
|
552
|
-
this, thing, dot, quote, dot]
|
553
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
554
|
-
|
555
|
-
# Sentence 1-31b: 'Lisa says: "There is one person inside this thing."'
|
556
|
-
literals = [lisa, says, colon, quote, there, is, one, person, inside,
|
557
|
-
this, thing, dot, quote, dot]
|
558
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
559
|
-
|
560
|
-
# Sentence 1-31c: "What Tony says is not true."
|
561
|
-
literals = [what, tony, says, is, not_, true_, dot]
|
562
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
563
|
-
|
564
|
-
# Sentence 1-31d: "What Lisa says is true."
|
565
|
-
literals = [what, lisa, says, is, true_, dot]
|
566
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
567
|
-
end
|
568
|
-
|
569
|
-
it 'should parse sample sentences from lesson 2-A' do
|
570
|
-
# Sentence 2-01a: "This thing is like two of the other things."
|
571
|
-
literals = [this, thing, is, like, two, of, the, other, things, dot]
|
572
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
573
|
-
|
574
|
-
# Sentence 2-01b: "One of these things is not like the other things."
|
575
|
-
literals = [one, of, these, things, is, not_, like, the, other, things, dot]
|
576
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
577
|
-
|
578
|
-
# Sentence 2-02a: "Lisa has something."
|
579
|
-
literals = [lisa, has, something, dot]
|
580
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
581
|
-
|
582
|
-
# Sentence 2-02b: "Tony has another thing."
|
583
|
-
literals = [tony, has, another, thing, dot]
|
584
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
585
|
-
|
586
|
-
# Sentence 2-02c: "Lisa does not have the same kind of thing as Tony has."
|
587
|
-
literals = [lisa, does_aux, not_, have, the, same, kind, of, thing, as, tony, has, dot]
|
588
|
-
# Ambiguous parse
|
589
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
590
|
-
|
591
|
-
# Sentence 2-03a: "Lisa is touching part of this thing."
|
592
|
-
literals = [lisa, is_aux, touching, part, of, this, thing, dot]
|
593
|
-
# Ambiguous parse
|
594
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
595
|
-
|
596
|
-
# Sentence 2-03b: "Tony is touching the other part."
|
597
|
-
literals = [tony, is_aux, touching, the, other, part, dot]
|
598
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
599
|
-
|
600
|
-
# Sentence 2-Ax: "What Tony has is like what Lisa has."
|
601
|
-
literals = [what, tony, has, is, like, what, lisa, has, dot]
|
602
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
603
|
-
end
|
604
|
-
|
605
|
-
it 'should parse sample sentences from lesson 2-B' do
|
606
|
-
# Sentence 2-04a: "Lisa does something."
|
607
|
-
literals = [lisa, does, something, dot]
|
608
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
609
|
-
|
610
|
-
# Sentence 2-04b: "Lisa does something with this thing."
|
611
|
-
literals = [lisa, does, something, with, this, thing, dot]
|
612
|
-
# Ambiguous parse
|
613
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
614
|
-
|
615
|
-
# Sentence 2-04c: "Lisa does something to Tony."
|
616
|
-
literals = [lisa, does, something, to, tony, dot]
|
617
|
-
# Ambiguous parse
|
618
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
619
|
-
|
620
|
-
# Sentence 2-04d: "Lisa does something to Tony with this thing."
|
621
|
-
literals = [lisa, does, something, to, tony, with, this, thing, dot]
|
622
|
-
# Ambiguous parse
|
623
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
624
|
-
|
625
|
-
# Sentence 2-05a: "Something happens."
|
626
|
-
literals = [something, happens, dot]
|
627
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
628
|
-
|
629
|
-
# Sentence 2-05b: "Something happens to Lisa."
|
630
|
-
literals = [something, happens, to, lisa, dot]
|
631
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
632
|
-
|
633
|
-
# Sentence 2-06a: "Tony does something."
|
634
|
-
literals = [tony, does, something, dot]
|
635
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
636
|
-
|
637
|
-
# Sentence 2-06b: "Something happens to Lisa because of this."
|
638
|
-
literals = [something, happens, to, lisa, because, of, this_as_pronoun, dot]
|
639
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
640
|
-
|
641
|
-
# Sentence 2-06c: "Something happens to Lisa because Tony does this."
|
642
|
-
literals = [something, happens, to, lisa, because, tony, does, this_as_pronoun, dot]
|
643
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
644
|
-
|
645
|
-
# Sentence 2-06: "Something happens to this living thing."
|
646
|
-
literals = [something, happens, to, this, living, thing, dot]
|
647
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
648
|
-
end
|
649
|
-
|
650
|
-
it 'should parse sample sentences from lesson 2-C' do
|
651
|
-
# Sentence 2-07a: "Lisa thinks Tony is inside this thing."
|
652
|
-
literals = [lisa, thinks, tony, is, inside, this, thing, dot]
|
653
|
-
# Ambiguous parse
|
654
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
655
|
-
|
656
|
-
# Sentence 2-07b: "Lisa thinks something about Tony."
|
657
|
-
literals = [lisa, thinks, something, about, tony, dot]
|
658
|
-
# Ambiguous parse
|
659
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
660
|
-
|
661
|
-
# Sentence 2-08a: "Tony knows Lisa is inside this thing, because Tony sees Lisa inside."
|
662
|
-
literals = [tony, knows, lisa, is, inside, this, thing, comma,
|
663
|
-
because, tony, sees, lisa, inside, dot]
|
664
|
-
# Ambiguous parse
|
665
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
666
|
-
|
667
|
-
# Sentence 2-08b: "Tony knows something about Lisa."
|
668
|
-
literals = [tony, knows, something, about, lisa, dot]
|
669
|
-
# Ambiguous parse
|
670
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
671
|
-
|
672
|
-
# Sentence 2-09a: "Tony wants this thing."
|
673
|
-
literals = [tony, wants, this, thing, dot]
|
674
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
675
|
-
|
676
|
-
# Sentence 2-09b: "Tony wants to have this thing."
|
677
|
-
literals = [tony, wants, to, have, this, thing, dot]
|
678
|
-
# Ambiguous parse
|
679
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
680
|
-
|
681
|
-
# Sentence 2-10a: "Tony wants to do something."
|
682
|
-
literals = [tony, wants, to, do_, something, dot]
|
683
|
-
# Ambiguous parse
|
684
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
685
|
-
|
686
|
-
# Sentence 2-10b: "Lisa wants to do the same thing."
|
687
|
-
literals = [lisa, wants, to, do_, the, same, thing, dot]
|
688
|
-
# Ambiguous parse
|
689
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
690
|
-
|
691
|
-
# Sentence 2-10c: "Tony can do this."
|
692
|
-
literals = [tony, can, do_, this_as_pronoun, dot]
|
693
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
694
|
-
|
695
|
-
# Sentence 2-10d: "This is not something Lisa can do."
|
696
|
-
literals = [this_as_pronoun, is, not_, something, lisa, can, do_, dot]
|
697
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
698
|
-
|
699
|
-
# Sentence 2-10e: "Lisa cannot do this."
|
700
|
-
literals = [lisa, can, not_, do_, this_as_pronoun, dot]
|
701
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
702
|
-
end
|
703
|
-
|
704
|
-
it 'should parse sample sentences from lesson 2-D' do
|
705
|
-
# Sentence 2-11a: "This person does something bad."
|
706
|
-
literals = [this, person, does, something, bad, dot]
|
707
|
-
# Ambiguous parse
|
708
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
709
|
-
|
710
|
-
# Sentence 2-11b: "This person does something bad for Tony."
|
711
|
-
literals = [this, person, does, something, bad, for_, tony, dot]
|
712
|
-
# Ambiguous parse
|
713
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
714
|
-
|
715
|
-
# Sentence 2-12a: "Tony does something good."
|
716
|
-
literals = [tony, does, something, good, dot]
|
717
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
718
|
-
|
719
|
-
# Sentence 2-12b: "Tony does something good for Lisa."
|
720
|
-
literals = [tony, does, something, good, for_, lisa, dot]
|
721
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
722
|
-
|
723
|
-
# Sentence 2-13a: "Tony feels something."
|
724
|
-
literals = [tony, feels, something, dot]
|
725
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
726
|
-
|
727
|
-
# Sentence 2-13b: "This does not feel good for Tony."
|
728
|
-
literals = [this_as_pronoun, does_aux, not_, feel, good, for_, tony, dot]
|
729
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
730
|
-
|
731
|
-
# Sentence 2-13b: "This feels bad for Tony."
|
732
|
-
literals = [this_as_pronoun, feels, bad, for_, tony, dot]
|
733
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
734
|
-
|
735
|
-
# Sentence 2-Dx: "Lisa thinks about something bad happening to this
|
736
|
-
# living thing. Thinking about this feels bad for Lisa."
|
737
|
-
literals = [lisa, thinks, about, something, bad, happening, to, this,
|
738
|
-
living, thing, dot,
|
739
|
-
#thinking, about, this_as_pronoun, feels, bad,
|
740
|
-
#for_, lisa, dot
|
741
|
-
]
|
742
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
743
|
-
end
|
744
|
-
|
745
|
-
it 'should parse sample sentences from lesson 2-E' do
|
746
|
-
# Sentence 2-14a: "Lisa says something at this time."
|
747
|
-
literals = [lisa, says, something, at, this, time, dot]
|
748
|
-
# Ambiguous parse
|
749
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
750
|
-
|
751
|
-
# Sentence 2-14b: "Tony is not in this place at this time."
|
752
|
-
literals = [tony, is, not_, in_, this, place, at, this, time, dot]
|
753
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
754
|
-
|
755
|
-
# Sentence 2-15a: "At one time, Tony does something to this thing."
|
756
|
-
literals = [at, one, time, comma, tony, does, something, to, this, thing, dot]
|
757
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
758
|
-
|
759
|
-
# Sentence 2-15b: "At another time, Lisa says something."
|
760
|
-
literals = [at, another, time, comma, lisa, says, something, dot]
|
761
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
762
|
-
|
763
|
-
# Sentence 2-15c: "Tony does something to this thing before Lisa says something."
|
764
|
-
literals = [tony, does, something, to, this, thing, before, lisa, says, something, dot]
|
765
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
766
|
-
|
767
|
-
# Sentence 2-16a: "Lisa does something for a long time."
|
768
|
-
literals = [lisa, does, something, for_, a_as_art, long, time, dot]
|
769
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
770
|
-
|
771
|
-
# Sentence 2-17a: "Tony does something for a short time."
|
772
|
-
literals = [tony, does, something, for_, a_as_art, short, time, dot]
|
773
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
774
|
-
|
775
|
-
# Sentence 2-17a: "Tony does not do this for a long time."
|
776
|
-
literals = [tony, does_aux, not_, do_, this_as_pronoun, for_, a_as_art, long, time, dot]
|
777
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
778
|
-
|
779
|
-
# Sentence 2-18a: "Lisa sees something move."
|
780
|
-
literals = [lisa, sees, something, move, dot]
|
781
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
782
|
-
|
783
|
-
# Sentence 2-18a: "Lisa moves near to this thing."
|
784
|
-
literals = [lisa, moves, near_to, this, thing, dot]
|
785
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
786
|
-
|
787
|
-
# Sentence 2-E-Xa: "A short time before, Tony was far from Lisa."
|
788
|
-
# Case of a time adverbial adjunct that is put in front position.
|
789
|
-
literals = [a_as_art, short, time, before_adverb, comma, tony, was, far, from, lisa, dot]
|
790
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
791
|
-
|
792
|
-
# Sentence 2-E-Xa: "At this time, Tony is near to Lisa"
|
793
|
-
literals = [at, this, time, comma, tony, is, near_to, lisa, dot]
|
794
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
795
|
-
|
796
|
-
# Sentence 2-E-Xa: "Tony is near to Lisa because Tony moved"
|
797
|
-
# Case of a time adverbial adjunct that is put in front position.
|
798
|
-
literals = [tony, is, near_to, lisa, because, tony, moved, dot]
|
799
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
800
|
-
end
|
801
|
-
|
802
|
-
it 'should parse sample sentences from lesson 2-F' do
|
803
|
-
# Sentence 2-19a: 'Tony says: "I did X.".'
|
804
|
-
literals = [tony, says, colon, quote, i_pronoun, did, x_as_noun, dot, quote, dot]
|
805
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
806
|
-
|
807
|
-
# Sentence 2-19a definiendum: 'Tony says: "I did X.".'
|
808
|
-
literals = [tony, says, colon, quote, i_pronoun, did, x_as_noun, dot, quote, dot]
|
809
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
810
|
-
|
811
|
-
# Sentence 2-19a definiens: 'Tony says something about Tony. Tony says: Tony did X.'
|
812
|
-
literals = [tony, says, something, about, tony, dot,
|
813
|
-
tony, says, colon, tony, did, x_as_noun, dot]
|
814
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
815
|
-
|
816
|
-
# Sentence 2-19a: 'Tony says: "I see Lisa.".'
|
817
|
-
literals = [tony, says, colon, quote, i_pronoun, see, lisa, dot, quote, dot]
|
818
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
819
|
-
|
820
|
-
# Sentence 2-19b definiendum: 'Lisa says: "X happened to me.".'
|
821
|
-
literals = [lisa, says, colon, quote, x_as_noun, happened, to, me, dot, quote, dot]
|
822
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
823
|
-
|
824
|
-
# Sentence 2-19b definiens: 'Lisa says something about Lisa. Lisa says: X happened to Lisa.'
|
825
|
-
literals = [lisa, says, something, about, lisa, dot,
|
826
|
-
lisa, says, colon, x_as_noun, happened, to, lisa, dot]
|
827
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
828
|
-
|
829
|
-
# Sentence 2-19c: 'Lisa says: "Tony sees me."'
|
830
|
-
literals = [lisa, says, colon, quote, tony, sees, me, dot, quote, dot]
|
831
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
832
|
-
|
833
|
-
# Sentence 2-20a definiendum: 'Tony says to Lisa: "I can see you.".'
|
834
|
-
literals = [tony, says, to, lisa, colon, quote, i_pronoun, can, see, you, dot, quote, dot]
|
835
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
836
|
-
|
837
|
-
# Sentence 2-20a definiens: 'Tony says something about Lisa.
|
838
|
-
# Tony says this to Lisa. Tony says: Tony can see Lisa.'
|
839
|
-
literals = [tony, says, something, about, lisa, dot,
|
840
|
-
tony, says, this_as_pronoun, to, lisa, dot,
|
841
|
-
tony, says, colon, tony, can, see, lisa, dot]
|
842
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
843
|
-
|
844
|
-
# Sentence 2-20b: "I know you have something good."
|
845
|
-
literals = [i_pronoun, know, you, have, something, good, dot]
|
846
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
847
|
-
|
848
|
-
# Sentence 2-20c: "I want you to do something good for me."
|
849
|
-
literals = [i_pronoun, want, you, to, do_, something, good, for_, me, dot]
|
850
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
851
|
-
|
852
|
-
# Sentence 2-21a definiendum: 'Tony says: "X happens here.".'
|
853
|
-
literals = [tony, says, colon, quote, x_as_noun, happens, here, dot, quote, dot]
|
854
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
855
|
-
|
856
|
-
# Sentence 2-21a definiens: "Tony is in a place. Tony says: X happens in this place."
|
857
|
-
literals = [tony, is, in_, a_as_art, place, dot,
|
858
|
-
tony, says, colon, x_as_noun, happens, in_, this, place, dot]
|
859
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
860
|
-
|
861
|
-
# Sentence 2-21b: "Many people were here at one time."
|
862
|
-
literals = [many, people, were, here, at, one, time, dot]
|
863
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
864
|
-
|
865
|
-
# Sentence 2-22a definiendum: 'Lisa says: "X happens now.".'
|
866
|
-
literals = [lisa, says, colon, quote, x_as_noun, happens, now, dot, quote, dot]
|
867
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
868
|
-
|
869
|
-
# Sentence 2-22a definiens: 'Lisa says something at a time.
|
870
|
-
# Lisa says: X happens at this same time.'
|
871
|
-
literals = [lisa, says, something, at, a_as_art, time, dot,
|
872
|
-
lisa, says, colon, x_as_noun, happens, at, this, time, dot]
|
873
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
874
|
-
|
875
|
-
# Sentence 2-22b: "There are not many people here now."
|
876
|
-
literals = [there, are, not_, many, people, here, now , dot]
|
877
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
878
|
-
|
879
|
-
# Sentence 2-Fa: "Lisa says to Tony: "I can see many living things here."."
|
880
|
-
literals = [lisa, says, to, tony, colon, quote, i_pronoun,
|
881
|
-
can, see, many, living, things, here, dot, quote, dot]
|
882
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
883
|
-
end
|
884
|
-
|
885
|
-
it 'should parse sample sentences from lesson 2-G' do
|
886
|
-
# Sentence 2-23a definiendum: 'Someone does X.'
|
887
|
-
literals = [someone, does, x_as_noun, dot]
|
888
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
889
|
-
|
890
|
-
# Sentence 2-23a definiens: 'Something does X. This something can
|
891
|
-
# think like people think. This something can be one person.'
|
892
|
-
literals = [something, does, x_as_noun, dot,
|
893
|
-
this, something, can, think, like, people, think, dot,
|
894
|
-
this, something, can, be_, a_as_art, person, dot]
|
895
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
896
|
-
|
897
|
-
# Sentence 2-23b: Someone said something to Tony.
|
898
|
-
literals = [someone, said, something, to, tony, dot]
|
899
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
900
|
-
|
901
|
-
# Sentence 2-23c definiendum: 'J knows who did K.'
|
902
|
-
literals = [j_, knows, who, did, k_, dot]
|
903
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
904
|
-
|
905
|
-
# Sentence 2-23c definiens: J thinks about someone.
|
906
|
-
# J knows this someone did K.
|
907
|
-
literals = [j_, thinks, about, someone, dot,
|
908
|
-
j_, knows, this, someone, did, k_, dot]
|
909
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
910
|
-
|
911
|
-
# Sentence 2-23d: Tony knows who said something.
|
912
|
-
literals = [tony, knows, who, said, something, dot]
|
913
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
914
|
-
|
915
|
-
# Sentence 2-24a definiendum: 'J happens after K happens.'
|
916
|
-
literals = [j_, happens, after_, k_, happens, dot]
|
917
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
918
|
-
|
919
|
-
# Sentence 2-24a definiens: K happens before J happens.
|
920
|
-
literals = [k_, happens, before, j_, happens, dot]
|
921
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
922
|
-
|
923
|
-
# Sentence 2-24b: After you do something for a long time,
|
924
|
-
# you can know much more about this.
|
925
|
-
literals = [after_, you, do_, something, for_, a_as_art, long, time,
|
926
|
-
comma, you, can, know, much, more_as_adverb, about, this_as_pronoun, dot]
|
927
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
928
|
-
|
929
|
-
# Sentence 2-25a definiendum: 'X is true for some time.'
|
930
|
-
literals = [x_as_noun, is, true_, for_, some, time, dot]
|
931
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
932
|
-
|
933
|
-
# Sentence 2-25a definiens: X is true at a time.
|
934
|
-
# Some parts of this one time happen before other parts.
|
935
|
-
# Some parts of this one time happen after other parts.
|
936
|
-
# X is true at all parts of this one time.
|
937
|
-
literals = [x_as_noun, is, true_, at, a_as_art, time, dot,
|
938
|
-
some, parts, of, this, one, time, happen, before_adverb, other, parts, dot,
|
939
|
-
some, parts, of, this, one, time, happen, after_adverb, other, parts, dot,
|
940
|
-
x_as_noun, is, true_, at, all, parts, of, this, one, time, dot]
|
941
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
942
|
-
|
943
|
-
# Sentence 2-25b: After I moved for some time,
|
944
|
-
# I was near the other side of this place.
|
945
|
-
literals = [after_, i_pronoun, moved, for_, some, time,
|
946
|
-
comma, i_pronoun, was, near, the, other, side, of, this, place, dot]
|
947
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
948
|
-
|
949
|
-
# Sentence 2-26a definiendum: 'X happens in a moment.'
|
950
|
-
literals = [x_as_noun, happens, in_, a_as_art, moment, dot]
|
951
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
952
|
-
|
953
|
-
# Sentence 2-26a definiens: X happens for one very short time.
|
954
|
-
# There are not parts of this very short time when one part
|
955
|
-
# happens before other parts.
|
956
|
-
literals = [x_as_noun, happens, for_, one, very, short, time, dot,
|
957
|
-
there, are, not_, parts, of, this, very, short, time, when_,
|
958
|
-
one, part, happens, before_adverb, other, part, dot]
|
959
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
960
|
-
|
961
|
-
# Sentence 2-26b: In a moment, I knew something here was not good.
|
962
|
-
# 'here' is adverb that modifies the 'knew' verb
|
963
|
-
literals = [in_, a_as_art, moment, comma, i_pronoun, knew, something,
|
964
|
-
here, was, not_, good, dot ]
|
965
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
966
|
-
|
967
|
-
# Sentence 2-Gx: Tony is inside this thing for some time.
|
968
|
-
# Lisa says: "I want to know who is inside this thing.".
|
969
|
-
# Tony hears Lisa. Because of this, Tony says: "I am inside.".
|
970
|
-
# Tony says this after Tony hears Lisa.
|
971
|
-
literals = [tony, is, inside, this, thing, for_, some, time, dot,
|
972
|
-
lisa, says, colon, quote, i_pronoun, want, to, know, who, is,
|
973
|
-
inside, this, thing, dot, quote, dot, tony, hears, lisa, dot,
|
974
|
-
because, of, this_as_pronoun, comma, tony, says, colon,
|
975
|
-
quote, i_pronoun, am, inside, dot, quote, dot,
|
976
|
-
tony, says, this_as_pronoun, after_, tony, hears, lisa, dot]
|
977
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
978
|
-
end
|
979
|
-
|
980
|
-
it 'should parse sample sentences from lesson 2-H' do
|
981
|
-
# Sentence 2-27a definiendum: 'X is the body of this person.'
|
982
|
-
literals = [x_as_noun, is, the, body, of, this, person, dot]
|
983
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
984
|
-
|
985
|
-
# Sentence 2-27b "Parts of this person can touch other things.
|
986
|
-
# Parts of this person can touch other parts inside this person.
|
987
|
-
# X is all of these parts of this person."
|
988
|
-
# [One part of the body of this person felt very bad.]
|
989
|
-
literals = [ parts, of, this, person, can, touch, other, things, dot,
|
990
|
-
parts, of, this, person, can, touch, other, parts, inside,
|
991
|
-
this, person, dot,
|
992
|
-
x_as_noun, is, all, of, these, parts, of, this, person, dot,
|
993
|
-
one, part, of, the, body, of, this, person, felt, very, bad, dot
|
994
|
-
]
|
995
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
996
|
-
|
997
|
-
# Sentence 2-28a definiendum "X dies."
|
998
|
-
literals = [x_as_noun, dies, dot]
|
999
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1000
|
-
|
1001
|
-
# Sentence 2-28b definiens "Something happens to X in a moment.
|
1002
|
-
# X is alive before this moment. X is not alive after this moment.
|
1003
|
-
# [After this person lived for a long time, this person died."
|
1004
|
-
literals = [ something, happens, to, x_as_noun, in_, a_as_art,
|
1005
|
-
moment, dot,
|
1006
|
-
x_as_noun, is, alive, before_adverb, this, moment, dot,
|
1007
|
-
x_as_noun, is, not_, alive, after_adverb, this, moment, dot,
|
1008
|
-
after_, this, person, lived, for_, a_as_art, long, time, comma,
|
1009
|
-
this, person, died, dot
|
1010
|
-
]
|
1011
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1012
|
-
|
1013
|
-
# Sentence 2-29a definiendum "You think maybe X is true."
|
1014
|
-
literals = [you, think, maybe, x_as_noun, is, true_, dot]
|
1015
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1016
|
-
|
1017
|
-
# Sentence 2-29b definiens "You think something like X
|
1018
|
-
# can be true. You do not know X is true.
|
1019
|
-
# You do not know X is not true.
|
1020
|
-
# [Maybe some people far from here can see me.]"
|
1021
|
-
literals = [ you, do_aux, not_, know, x_as_noun, is, true_, dot,
|
1022
|
-
you, do_aux, not_, know, x_as_noun, is, not_, true_, dot,
|
1023
|
-
maybe, some, people, far_from, here_as_noun, can, see, me, dot
|
1024
|
-
]
|
1025
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1026
|
-
|
1027
|
-
# Sentence 2-30a definiendum "J is below K."
|
1028
|
-
literals = [j_, is, below, k_, dot]
|
1029
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1030
|
-
|
1031
|
-
# Sentence 2-30b definiens "K is above J.
|
1032
|
-
# [I am touching this thing below me.]
|
1033
|
-
literals = [ j_, is, below, k_, dot,
|
1034
|
-
i_pronoun, am, touching, this, thing, below, me, dot
|
1035
|
-
]
|
1036
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1037
|
-
|
1038
|
-
# Sentence 2-H extra "Someone sees this thing.
|
1039
|
-
# The body of this thing is not moving.
|
1040
|
-
# Maybe this thing is dead."
|
1041
|
-
literals = [ someone, sees, thing, dot,
|
1042
|
-
the, body, of, this, thing, is_aux, not_, moving, dot
|
1043
|
-
]
|
1044
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1045
|
-
end
|
1046
|
-
|
1047
|
-
it 'should parse sample sentences from lesson 3-A' do
|
1048
|
-
# Sentence 3-01a definiendum: 'J happens to something that does K.'
|
1049
|
-
literals = [j_, happens, to, something, that, does, k_, dot]
|
1050
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1051
|
-
|
1052
|
-
# Sentence 3-01b definiens: 'J happens to something.
|
1053
|
-
# This same something does K.
|
1054
|
-
# [Tony has something that Lisa wants.]'
|
1055
|
-
literals = [j_, happens, to, something, dot,
|
1056
|
-
this, same, thing, does, k_, dot,
|
1057
|
-
tony, has, something, that, lisa, wants, dot
|
1058
|
-
]
|
1059
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1060
|
-
|
1061
|
-
# Sentence 3-02a definiendum: 'J is true, and K is true.'
|
1062
|
-
literals = [j_, is, true_, comma, and_, k_, is, true_, dot]
|
1063
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1064
|
-
|
1065
|
-
# Sentence 3-02b definiens: 'These two things are true: J is true.
|
1066
|
-
# K is true.'
|
1067
|
-
# [Lisa sees Tony, and Tony sees Lisa.]'
|
1068
|
-
literals = [these, two, things, are, true_, colon, j_, is, true_, dot,
|
1069
|
-
k_, is, true_, dot,
|
1070
|
-
lisa, sees, tony, comma, and_, tony, sees, lisa, dot
|
1071
|
-
]
|
1072
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1073
|
-
|
1074
|
-
# Sentence 3-02c definiendum: 'J and K do X.'
|
1075
|
-
literals = [j_, and_, k_, do_, x_as_noun, dot]
|
1076
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1077
|
-
|
1078
|
-
# Sentence 3-02d definiens: 'These two things do X.
|
1079
|
-
# J is one that does this.
|
1080
|
-
# K is another that does this.'
|
1081
|
-
# [Tony and Lisa want to see me.]
|
1082
|
-
# [I see Tony and Lisa.]'
|
1083
|
-
literals = [these, two, things, do_, x_as_noun, dot,
|
1084
|
-
j_, is, one_as_adj, that, does, this_as_pronoun, dot,
|
1085
|
-
k_, is, another, that, does, this_as_pronoun, dot,
|
1086
|
-
tony, and_, lisa, want, to, see, me, dot,
|
1087
|
-
i_pronoun, see, tony, and_, lisa, dot
|
1088
|
-
]
|
1089
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1090
|
-
|
1091
|
-
# Sentence 3-03a definiendum: 'J is true, or K is true.'
|
1092
|
-
literals = [j_, is, true_, comma, or_, k_, is, true_, dot]
|
1093
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1094
|
-
|
1095
|
-
# Sentence 3-03b definiens: 'If J is not true, then K is true.
|
1096
|
-
# [Tony saw me, or Lisa heard me.]
|
1097
|
-
literals = [if_, j_, is, not_, true_, comma,
|
1098
|
-
then_, k_, is, true_, dot,
|
1099
|
-
tony, saw, me, comma, or_, lisa, heard, me, dot
|
1100
|
-
]
|
1101
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1102
|
-
|
1103
|
-
# Sentence 3-03c definiendum: 'J or K does this.'
|
1104
|
-
literals = [j_, or_, k_, does, this_as_pronoun, dot]
|
1105
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1106
|
-
|
1107
|
-
# Sentence 3-03d definiendum: 'If J does not do this, then K does this.'
|
1108
|
-
literals = [if_, j_, does_aux, not_, do_, this_as_pronoun, comma,
|
1109
|
-
then_, k_, does, this_as_pronoun, dot]
|
1110
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1111
|
-
|
1112
|
-
# Sentence 3-03e: '[Lisa or Tony said something.]
|
1113
|
-
# [This belongs to Tony or Lisa.]'
|
1114
|
-
literals = [lisa, or_, tony, said, something, dot,
|
1115
|
-
this_as_pronoun, belongs, to, tony, or_, lisa, dot
|
1116
|
-
]
|
1117
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1118
|
-
|
1119
|
-
# Sentence 3-04a definiendum: 'It does something.'
|
1120
|
-
literals = [it_, does, something, dot]
|
1121
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1122
|
-
|
1123
|
-
# Sentence 3-04b definiens: 'This thing does something.'
|
1124
|
-
# [I touched this thing, and it moved.]
|
1125
|
-
literals = [this, thing, does, something, dot,
|
1126
|
-
i_pronoun, touched, this, thing, comma, and_, it_, moved, dot
|
1127
|
-
]
|
1128
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1129
|
-
|
1130
|
-
# Sentence 3-04c definiendum: 'They do something.'
|
1131
|
-
literals = [they, does, something, dot
|
1132
|
-
]
|
1133
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1134
|
-
|
1135
|
-
# Sentence 3-04d definiens: 'These things or people do something.'
|
1136
|
-
# [Something happens to them.] = Something happens to these things or people.
|
1137
|
-
literals = [ these, things, or_, people, do_, something, dot,
|
1138
|
-
something, happens, to, them, dot,
|
1139
|
-
something, happens, to, these, things, or_, people, dot
|
1140
|
-
]
|
1141
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1142
|
-
end
|
1143
|
-
|
1144
|
-
it 'should parse sample sentences from lesson 3-B' do
|
1145
|
-
# Sentence 3-05a definiendum: 'This is its X.'
|
1146
|
-
literals = [this_as_pronoun, is, its, x_as_noun, dot
|
1147
|
-
]
|
1148
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1149
|
-
|
1150
|
-
# Sentence 3-05b definiens: 'This X belongs to it.
|
1151
|
-
# [I saw this thing and touched some of its parts.]
|
1152
|
-
# [These things are their things.] = These things belong to them.
|
1153
|
-
literals = [this, x_as_noun, belongs, to, it_, dot,
|
1154
|
-
i_pronoun, saw, this, thing, and_, touched, some, of, its, parts, dot
|
1155
|
-
]
|
1156
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1157
|
-
|
1158
|
-
# Sentence 3-05c definiendum: 'These things are their things.'
|
1159
|
-
literals = [these, things, are, their, things, dot
|
1160
|
-
]
|
1161
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1162
|
-
|
1163
|
-
# Sentence 3-05d definiens: 'These things belong to them.
|
1164
|
-
literals = [these, things, belong, to, them, dot]
|
1165
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1166
|
-
|
1167
|
-
# Sentence 3-06a definiendum: 'This is your X.'
|
1168
|
-
literals = [this_as_pronoun, is, your, x_as_noun, dot]
|
1169
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1170
|
-
|
1171
|
-
# Sentence 3-06b definien: 'This X belongs to you.
|
1172
|
-
# [You feel something touching your body.]
|
1173
|
-
literals = [this, x_as_noun, belongs, to, you, dot,
|
1174
|
-
you, feel, something, touching, your, body, dot
|
1175
|
-
]
|
1176
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1177
|
-
|
1178
|
-
# Sentence 3-07a definiendum: 'This is my X.'
|
1179
|
-
literals = [this_as_pronoun, is, my, x_as_noun, dot,
|
1180
|
-
]
|
1181
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1182
|
-
|
1183
|
-
# Sentence 3-07b definiens: 'This X belongs to me.
|
1184
|
-
# [I do not want you to touch my body.]
|
1185
|
-
literals = [this, x_as_noun, belongs, to, me, dot,
|
1186
|
-
i_pronoun, do_aux, not_, want, to, touch, my, body, dot
|
1187
|
-
]
|
1188
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1189
|
-
|
1190
|
-
# Sentence 3-08a definiendum: 'There is an X here.'
|
1191
|
-
literals = [there, is, an, x_as_noun, here, dot]
|
1192
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1193
|
-
|
1194
|
-
# Sentence 3-08b definiens: 'X is some kind of thing.
|
1195
|
-
# There is one of this kind of thing here.
|
1196
|
-
# This is not one that you said something about a short time before now.
|
1197
|
-
# [I did not know there was a person in this place.]
|
1198
|
-
literals = [x_as_noun, is, some, kind, of, thing, dot,
|
1199
|
-
there, is, one, of, this, kind, of, thing, here, dot,
|
1200
|
-
this_as_pronoun, is, not_, one_as_adj, that, you, said, something,
|
1201
|
-
about, a_as_art, short, time, before_as_adj, now_as_noun, dot
|
1202
|
-
]
|
1203
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1204
|
-
|
1205
|
-
# Sentence 3-Bxa 'Lisa sees a living thing that is very big.
|
1206
|
-
# Lisa says: "I see one living thing. Its body is bigger than my body.", dot
|
1207
|
-
literals = [
|
1208
|
-
lisa, sees, a_as_art, living, thing, that, is, very, big, dot,
|
1209
|
-
lisa, says, colon, quote, i_pronoun, see, one, living, thing, dot,
|
1210
|
-
its, body, is, bigger, than, my, body, dot, quote, dot
|
1211
|
-
]
|
1212
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1213
|
-
end
|
1214
|
-
|
1215
|
-
it 'should parse sample sentences from lesson 3-C' do
|
1216
|
-
# Sentence 3-09a definiendum: 'Something happens to the X.'
|
1217
|
-
literals = [something, happens, to, the, x_as_noun, dot]
|
1218
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1219
|
-
|
1220
|
-
# Sentence 3-09b definiens: Something happens to X.
|
1221
|
-
# This is the same X that someone said something about a short time before,
|
1222
|
-
# or there is not another thing that is the same kind as X.
|
1223
|
-
# [I saw two people here before, and now I do not see the people.]
|
1224
|
-
literals = [something, happens, to, x_as_noun, dot,
|
1225
|
-
this_as_pronoun, is, the, same, x_as_noun, that, someone, said, something, about,
|
1226
|
-
a_as_art, short, time, before_as_adj, comma,
|
1227
|
-
or_, there, is, not_, another, thing, that, is, the, same, kind,
|
1228
|
-
as, x_as_noun, dot,
|
1229
|
-
i_pronoun, saw, two, people, here, before_adverb, comma,
|
1230
|
-
and_, now, i_pronoun, do_aux, not_, see, the, people, dot
|
1231
|
-
]
|
1232
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1233
|
-
|
1234
|
-
# Sentence 3-10a definiendum: 'X is an animal.'
|
1235
|
-
literals = [x_as_noun, is, an, animal, dot]
|
1236
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1237
|
-
|
1238
|
-
# Sentence 3-10b definiens: There are many kinds of living things
|
1239
|
-
# that can feel and can move when they want. X is one of these.
|
1240
|
-
# [The animal moved when someone touched its body.]
|
1241
|
-
literals = [ there, are, many, kinds, of, living, things,
|
1242
|
-
that, can, feel, and_, can, move, when_, they, want, dot,
|
1243
|
-
x_as_noun, is, one, of, these_as_pronoun, dot,
|
1244
|
-
the, animal, moved, when_, someone, touched, its, body, dot
|
1245
|
-
]
|
1246
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1247
|
-
|
1248
|
-
# Sentence 3-11a definiendum: 'J causes K to happen.'
|
1249
|
-
literals = [j_, causes, k_, to, happen, dot]
|
1250
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1251
|
-
|
1252
|
-
# Sentence 3-11b definiens: K happens because J happens
|
1253
|
-
# or because J does something.
|
1254
|
-
# [Someone bad caused these people to die.]
|
1255
|
-
literals = [ k_, happens, because, j_, happens,
|
1256
|
-
or_, because, j_, does, something, dot,
|
1257
|
-
something, bad, caused, these, people, to, die, dot
|
1258
|
-
]
|
1259
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1260
|
-
|
1261
|
-
# Sentence 3-12a definiendum: 'J is true, but K is not true.'
|
1262
|
-
literals = [j_, is, true_, comma, but, k_, is, not_, true_, dot]
|
1263
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1264
|
-
|
1265
|
-
# Sentence 3-12b definiens: You say J is true.
|
1266
|
-
# Maybe when some people hear J is true,
|
1267
|
-
# they think K is true because of this.
|
1268
|
-
# You want them to know K is not true, and you say this.
|
1269
|
-
# [I hear Tony, but I do not see Tony.]
|
1270
|
-
literals = [ maybe, when_, some, people, hear, j_, is, true_, comma,
|
1271
|
-
they, think, k_, is, true_, because, of, this_as_pronoun, dot,
|
1272
|
-
you, want, them, to, know, k_, is, not_, true_, comma,
|
1273
|
-
and_, you, say, this_as_pronoun, dot,
|
1274
|
-
i_pronoun, hear, tony, comma, but, i_pronoun, do_aux, not_, see, lisa, dot
|
1275
|
-
]
|
1276
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1277
|
-
|
1278
|
-
# Sentence 3-C Xtra Lisa says: "I can hear an animal, but I do not see it."
|
1279
|
-
# Tony says: "I can see the animal that you hear.".
|
1280
|
-
literals = [ lisa, says, colon, quote, i_pronoun, can, hear, an,
|
1281
|
-
animal, comma, but, i_pronoun, do_aux, not_, see, it_, dot, quote,
|
1282
|
-
dot, tony, says, colon, quote, i_pronoun, can, see, the, animal,
|
1283
|
-
that, you, hear, dot, quote, dot
|
1284
|
-
]
|
1285
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1286
|
-
end
|
1287
|
-
|
1288
|
-
it 'should parse sample sentences from lesson 3-D' do
|
1289
|
-
# Sentence 3-13a definiendum: 'You use this thing.'
|
1290
|
-
literals = [you, use, this, thing, dot]
|
1291
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1292
|
-
|
1293
|
-
# Sentence 3-13b definiens: You do something with this thing
|
1294
|
-
# because you think this can cause something to happen that you want.
|
1295
|
-
# [I used something big to cause people far from here to see me.]
|
1296
|
-
literals = [ you, do_, something, with, this, thing, because, you,
|
1297
|
-
think, this_as_pronoun, can, cause, something, to, happen,
|
1298
|
-
that, you, want, dot,
|
1299
|
-
i_pronoun, used, something, big, to, cause, people, far, from,
|
1300
|
-
here_as_noun, to, see, me, dot
|
1301
|
-
]
|
1302
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1303
|
-
|
1304
|
-
# Sentence 3-14a definiendum: 'You know X about each of these things.'
|
1305
|
-
literals = [you, know, x_as_noun, about, each_, of, these, things, dot]
|
1306
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1307
|
-
|
1308
|
-
# Sentence 3-14b definiens: There are two or more things.
|
1309
|
-
# You think about all these things like this:
|
1310
|
-
# If something is one of these things, then you know X about it.
|
1311
|
-
# [Each person here said something to me.]
|
1312
|
-
# because you think this can cause something to happen that you want.
|
1313
|
-
# [I used something big to cause people far from here to see me.]
|
1314
|
-
literals = [ there, are, two, or_, more, things, dot,
|
1315
|
-
you, think, about, all, these, things, like, this_as_pronoun, colon,
|
1316
|
-
if_, something, is, one, of, these, things, comma,
|
1317
|
-
then_, you, know, x_as_noun, about, it_, dot,
|
1318
|
-
each_, person, here, said, something, to, me, dot
|
1319
|
-
]
|
1320
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1321
|
-
|
1322
|
-
# Sentence 3-15a definiendum: 'Someplace an X exists.'
|
1323
|
-
literals = [someplace, an, x_as_noun, exists, dot]
|
1324
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1325
|
-
|
1326
|
-
# Sentence 3-15b definiens: Someplace there is an X,
|
1327
|
-
# or someplace an X is alive.
|
1328
|
-
# [This kind of thing did not exist before this time.]
|
1329
|
-
literals = [ someplace, there, is, an, x_as_noun, comma,
|
1330
|
-
or_, someplace, an, x_as_noun, is, alive, dot,
|
1331
|
-
this, kind, of, thing, did, not_, exist, before, this, time, dot]
|
1332
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1333
|
-
|
1334
|
-
# Sentence 3-16a definiendum: 'J became K.'
|
1335
|
-
literals = [j_, became, k_, dot]
|
1336
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1337
|
-
|
1338
|
-
# Sentence 3-16b definiens: Something happened to J for some time.
|
1339
|
-
# After this happened, K is something true you can know about J.
|
1340
|
-
# But before this happened, K was not true.
|
1341
|
-
# [These two animals were small before, but they became big.]
|
1342
|
-
literals = [ something, happened, to, j_, for_, some, time, dot,
|
1343
|
-
after_, this_as_pronoun, happened, comma, k_, is, something, true_,
|
1344
|
-
you, can, know, about, j_, dot,
|
1345
|
-
these, two, animals, were, small, before_adverb, comma,
|
1346
|
-
but, they, became, big, dot
|
1347
|
-
]
|
1348
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1349
|
-
|
1350
|
-
# Sentence 3-Dx: There are some animals here.
|
1351
|
-
# Each of these animals was small when it existed a short time.
|
1352
|
-
# After a long time, each of these animals became big.
|
1353
|
-
literals = [there, are, some, animal, here, dot,
|
1354
|
-
each_, of, these, animals, was, small, when_, it_,
|
1355
|
-
existed, a_as_art, short, time, dot,
|
1356
|
-
after_, a_as_art, long, time, comma, each_, of, these, animals,
|
1357
|
-
became, big, dot
|
1358
|
-
]
|
1359
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1360
|
-
end
|
1361
|
-
|
1362
|
-
it 'should parse sample sentences from lesson 3-E' do
|
1363
|
-
# Sentence 3-17a definiendum: 'These things are different.'
|
1364
|
-
literals = [things, are, different, dot]
|
1365
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1366
|
-
|
1367
|
-
# Sentence 3-17b definiens: These things are not the same.
|
1368
|
-
# [I want this kind of thing, but you want something different.]
|
1369
|
-
literals = [ these, things, are, not_, the, same_as_pronoun, dot,
|
1370
|
-
i_pronoun, want, this, kind, of, thing, comma,
|
1371
|
-
but, you, want, something, different, dot
|
1372
|
-
]
|
1373
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1374
|
-
|
1375
|
-
# Sentence 3-18a definiendum: 'J made K.'
|
1376
|
-
literals = [j_, made, k_, dot]
|
1377
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1378
|
-
|
1379
|
-
# Sentence 3-18b definiens: J did something to some things
|
1380
|
-
# and caused them to become parts of one different
|
1381
|
-
# kind of thing that was not here before.
|
1382
|
-
# K is this thing that now exists because of this.
|
1383
|
-
# [I used many small things to make this big thing.]
|
1384
|
-
# [J made K happen.] = J caused K to happen.
|
1385
|
-
literals = [ j_, did, something, to, some, things, and_,
|
1386
|
-
caused, them, to, become, parts, of, one, different, kind, of,
|
1387
|
-
thing, that, was, not_, here, before_adverb, dot,
|
1388
|
-
k_, is, this, thing, that, now, exists, because, of, this_as_pronoun, dot,
|
1389
|
-
i_pronoun, used, many, small, things, to, make, this, big, thing, dot,
|
1390
|
-
j_, made, k_, happen, dot,
|
1391
|
-
j_, caused, k_, to, happen, dot
|
1392
|
-
]
|
1393
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1394
|
-
|
1395
|
-
# Sentence 3-19a definiendum: 'J contains K.'
|
1396
|
-
literals = [j_, contains, k_, dot]
|
1397
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1398
|
-
|
1399
|
-
# Sentence 3-19b definiens: K is inside J.
|
1400
|
-
# [I made something to contain all these small things.]
|
1401
|
-
# [Your body contains many parts.]
|
1402
|
-
literals = [ k_, is, inside, j_, dot,
|
1403
|
-
i_pronoun, made, something, to, contain, all, these, small, things, dot,
|
1404
|
-
your, body, contains, many, parts, dot,
|
1405
|
-
]
|
1406
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1407
|
-
|
1408
|
-
# Sentence 3-20a definiendum: 'X is a container.'
|
1409
|
-
literals = [x_as_noun, is, a_as_art, container, dot]
|
1410
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1411
|
-
|
1412
|
-
# Sentence 3-20b definiens: X is something that people make because
|
1413
|
-
# they want to use it to contain other things.
|
1414
|
-
# [There are two things inside this container.]
|
1415
|
-
literals = [ x_as_noun, is, something, that, people, make, because,
|
1416
|
-
they, want, to, use, it_, to, contain, other, things, dot,
|
1417
|
-
there, are, two, things, inside, this, container, dot
|
1418
|
-
]
|
1419
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1420
|
-
|
1421
|
-
# Sentence 3-Fxtra: Someone made these containers.
|
1422
|
-
# Each contains a different kind of animal.
|
1423
|
-
literals = [someone, made, these, containers, dot,
|
1424
|
-
each_as_pronoun, contains, a_as_art, different, kind, of, animal, dot
|
1425
|
-
]
|
1426
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
1427
|
-
end
|
1428
|
-
=begin
|
1429
|
-
TODO
|
1430
|
-
|
1431
|
-
Lesson 2.C
|
1432
|
-
|
1433
|
-
Xtra:
|
1434
|
-
Tony knows Lisa has something, because Tony sees what Lisa has.
|
1435
|
-
Tony thinks about what Lisa has, because Tony want to have the same kind of thing.
|
1436
|
-
=end
|
1437
|
-
end # context
|
1438
34
|
end # describe
|
1439
35
|
end # module
|
1440
36
|
end # module
|