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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7dad60dec43b90f6e075fea633061c76d32a1be7e829717a92a6cf839766a3e
4
- data.tar.gz: c353a68ac3f3388c3b6024232eaafa312efa86b6ccbe0b6bebe8632d9684fbaf
3
+ metadata.gz: 6ff9fe6b71c6807a241c2b87205c7548c9a6b235b3e299ed29a2bddb3647b06d
4
+ data.tar.gz: 5848cd30bc33670edcd39de4522b5a60cbadd6109aad7f94fa51806ad3c387a3
5
5
  SHA512:
6
- metadata.gz: fc526524c86d904177d86aca4cd5c66de3d0e219735e221d04eb8e43b591024e5b651aa6f4390b8b55770f343ecaefc3aa306bd1256ef3f4ab0c37cdb8c24c14
7
- data.tar.gz: f7ee26281e6d1efa1ab553942015bfc26b703f45344106ac8f731681ef273a5a1052d9e53289af330095a517dfca7879d3e6a1ab4e63506bc60f3fe1e892c9e4
6
+ metadata.gz: d0e361c9df02b285dd84c5228cc22fa5e4bb1c7f9d33a21c1eefccf53d87298482e87d99b6ad2cfd60523692321da372d508f94fe17ee82ecf99519f00d21b18
7
+ data.tar.gz: 47b17dd65f35c051f9ce2fe166b97555eb7ff520f985f3cb21846cbc53c9917757e5b668c1e52667ab941b9636b97036999a472a3dbeaaa3c0f5977dd8c704a3
@@ -1,5 +1,20 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## [0.1.24] - 2019-12-05
4
+ __Zenlish__ can parse all sentences in lesson 1, 2 and 3-A .. 3-F (323 sentences in total) from
5
+ [Learn These Words First](http://learnthesewordsfirst.com/).
6
+
7
+ ### Added
8
+ - Class `ModalVerbCould` to represent the auxiliary verb `could`.
9
+ - Support module `Var2Word`: used to create variable names and assign them specific `Literal` objects.
10
+
11
+ ### Changed
12
+ - File `zparser_spec.rb` splitted. Lesson-specific test suites have their own spec file.
13
+ - File `lesson3_spec.rb`: tests include all sentences from lesson 3-A .. 3-F.
14
+ - `ZenlishGrammar`: more rules for relative clauses.
15
+ - File `dictionary.rb`: new entries in lexicon `change`, `could`, `surface`, `try`.
16
+ - File `README.md` Updated the metrics table
17
+
3
18
  ## [0.1.23] - 2019-12-04
4
19
  __Zenlish__ can parse all sentences in lesson 1, 2 and 3-A .. 3-E from
5
20
  [Learn These Words First](http://learnthesewordsfirst.com/).
data/README.md CHANGED
@@ -20,8 +20,10 @@ users with a language that is close enough to English.
20
20
  ### Project status
21
21
 
22
22
  The project is still in inception. Currently, zenlish is able to parse all
23
- sentences from lessons 1-A up to 3-E. The parser is able to cope with syntactical
24
- ambiguities generating parse forests instead of parse trees.
23
+ sentences from lessons 1-A up to 3-F from
24
+ [Learn These Words First](http://learnthesewordsfirst.com/).
25
+ The parser is able to cope with syntactical ambiguities generating parse forests
26
+ instead of parse trees.
25
27
 
26
28
  The intent is to deliver gem versions in small increments.
27
29
 
@@ -35,14 +37,14 @@ Over time, the zenlish gem will contain:
35
37
  - A simplified ontology[TODO]
36
38
 
37
39
 
38
- #### Some project metrics (v. 0.1.23)
40
+ #### Some project metrics (v. 0.1.24)
39
41
  |Metric|Value|
40
42
  |:-:|:-:|
41
- | Number of lemmas in dictionary | 126 |
42
- | [Coverage 100 commonest English words](https://en.wikipedia.org/wiki/Most_common_words_in_English) | 59% |
43
- | Number of production rules in grammar | 176 |
44
- | Number of lessons covered | 21 |
45
- | Number of sentences in spec files | 308 |
43
+ | Number of lemmas in dictionary | 132 |
44
+ | [Coverage 100 commonest English words](https://en.wikipedia.org/wiki/Most_common_words_in_English) | 61% |
45
+ | Number of production rules in grammar | 181 |
46
+ | Number of lessons covered | 22 |
47
+ | Number of sentences in spec files | 323 |
46
48
 
47
49
 
48
50
  ## Installation...
@@ -121,7 +123,7 @@ Litmus test: a Zenlish text should be easy to read to a English reading person.
121
123
  Here a tentative roadmap:
122
124
 
123
125
  #### A) Ability to parse sentences from [Learn These Words First](http://learnthesewordsfirst.com/)
124
- *STARTED*. 21.9% complete
126
+ *STARTED*. 22.9% complete
125
127
  This website advocates the idea of a multi-layered dictionary.
126
128
  At the core, there are about 300 essential words.
127
129
  The choice of these words is inspired by the semantic primitives of [NSM
@@ -45,8 +45,10 @@ unless defined?(Zenlish::Lang::Dictionary)
45
45
  add_entry('but', 'Coordinator')
46
46
  add_entry('can', 'ModalVerbCan')
47
47
  add_entry('cause', 'RegularVerb')
48
+ add_entry('change', 'RegularVerb')
48
49
  add_entry('contain', 'RegularVerb')
49
50
  add_entry('container', 'CommonNoun')
51
+ add_entry('could', 'ModalVerbCould')
50
52
  add_entry('die', 'RegularVerb')
51
53
  add_entry('different', 'Adjective')
52
54
  add_entry('do', 'AuxiliaryDo')
@@ -115,6 +117,7 @@ unless defined?(Zenlish::Lang::Dictionary)
115
117
  add_entry('someone', 'IndefinitePronoun')
116
118
  add_entry('someplace', 'Adverb')
117
119
  add_entry('something', 'IndefinitePronoun')
120
+ add_entry('surface', 'CommonNoun')
118
121
  add_entry('than', 'PrepositionThan')
119
122
  add_entry('that', 'RelativePronoun')
120
123
  add_entry('the', 'DefiniteArticle')
@@ -131,16 +134,19 @@ unless defined?(Zenlish::Lang::Dictionary)
131
134
  add_entry('time', 'CommonNoun')
132
135
  add_entry('to', 'Preposition')
133
136
  add_entry('touch', 'RegularVerb')
137
+ add_entry('try', 'RegularVerb')
134
138
  add_entry('true', 'Adjective')
135
139
  add_entry('two', 'Cardinal')
136
140
  add_entry('two', 'IndefinitePronoun')
137
141
  add_entry('use', 'RegularVerb')
138
142
  add_entry('very', 'DegreeAdverb')
139
143
  add_entry('want', 'RegularVerbWant')
140
- add_entry('what','ConjunctivePronoun')
141
- add_entry('when','SubordinatingConjunction')
142
- add_entry('who','RelativePronoun')
143
- add_entry('with','Preposition')
144
+ add_entry('what', 'ConjunctivePronoun')
145
+ add_entry('when', 'SubordinatingConjunction')
146
+ add_entry('where', 'Adverb')
147
+ add_entry('where', 'SubordinatingConjunction')
148
+ add_entry('who', 'RelativePronoun')
149
+ add_entry('with', 'Preposition')
144
150
  add_entry('word', 'CommonNoun')
145
151
  add_entry('you', 'PersonalPronoun')
146
152
  add_entry('your', 'PossessiveDeterminer')
@@ -48,6 +48,8 @@ builder = Rley::Syntax::GrammarBuilder.new do
48
48
  rule 'affirmation' => 'IrregularVerbBe predicative_complement'
49
49
  rule 'negation' => 'IrregularVerbBe AdverbNot predicative_complement'
50
50
  rule 'predicative_complement' => 'noun_phrase'
51
+ # 3-22b: X is not the same as before.
52
+ rule 'predicative_complement' => 'noun_phrase ComparativeParticle Adverb'
51
53
  rule 'predicative_complement' => 'adjective_phrase comparative_clause_opt'
52
54
  # 3-02d J is one that does this.
53
55
  rule 'predicative_complement' => 'adjective_phrase relative_clause_opt'
@@ -66,6 +68,10 @@ builder = Rley::Syntax::GrammarBuilder.new do
66
68
  rule 'complex_sentence' => 'main_clause comma_opt subordinated_clause'
67
69
  rule 'complex_sentence' => 'main_clause comma_opt relative_clause'
68
70
  rule 'complex_sentence' => 'main_clause comma_opt coordinate_clause'
71
+ # 3-22d: ..., it changed what I thought about them.
72
+ rule 'complex_sentence' => 'main_clause conjunctive_prefix'
73
+ # 3-22d: I cannot see what is inside.
74
+ rule 'complex_sentence' => 'main_clause ConjunctivePronoun verb_phrase'
69
75
  rule 'complex_sentence' => 'subordinated_clause Comma main_clause'
70
76
  # 3-03b If J is not true, then K is true.
71
77
  rule 'complex_sentence' => 'subordinated_clause Comma LinkingAdverb main_clause'
@@ -124,6 +130,7 @@ builder = Rley::Syntax::GrammarBuilder.new do
124
130
  rule 'tense' => 'AuxiliaryBe'
125
131
  rule 'tense' => 'AuxiliaryDo'
126
132
  rule 'tense' => 'ModalVerbCan'
133
+ rule 'tense' => 'ModalVerbCould'
127
134
 
128
135
  #############
129
136
  # NOUN PHRASE
@@ -207,6 +214,8 @@ builder = Rley::Syntax::GrammarBuilder.new do
207
214
 
208
215
  # Cover case where ´that´ conjunction is dropped.
209
216
  rule 'head_vp' => 'mental_verb dependent_clause'
217
+ # 3-21b: ...that you think can cause X to happen.
218
+ rule 'head_vp' => 'mental_verb tense_verb_phrase'
210
219
  # ex. 2-23c
211
220
  rule 'head_vp' => 'mental_verb identifying_clause'
212
221
 
@@ -45,6 +45,7 @@ module Zenlish
45
45
  aLexicon.add_terminal(WClasses::IrregularVerbThink.new.freeze)
46
46
  aLexicon.add_terminal(WClasses::LinkingAdverb.new.freeze)
47
47
  aLexicon.add_terminal(WClasses::ModalVerbCan.new.freeze)
48
+ aLexicon.add_terminal(WClasses::ModalVerbCould.new.freeze)
48
49
  aLexicon.add_terminal(WClasses::PersonalPronoun.new.freeze)
49
50
  aLexicon.add_terminal(WClasses::PossessiveDeterminer.new.freeze)
50
51
  aLexicon.add_terminal(WClasses::Preposition.new.freeze)
@@ -19,6 +19,7 @@ module Zenlish
19
19
  @name2terminal = {}
20
20
  end
21
21
 
22
+ # @param aLemma[String] retrieve the lexeme form the given "head word".
22
23
  def get_lexeme(aLemma, aWordClass = nil)
23
24
  if aWordClass
24
25
  lexeme = nil
@@ -38,7 +39,12 @@ module Zenlish
38
39
 
39
40
  lexeme
40
41
  else
41
- lemma2entry.fetch(aLemma).lexemes.first
42
+ begin
43
+ lemma2entry.fetch(aLemma).lexemes.first
44
+ rescue NoMethodError => exc
45
+ $stderr.puts "Multiple lexemes for #{aLemma}"
46
+ raise exc
47
+ end
42
48
  end
43
49
  end
44
50
 
@@ -1,3 +1,3 @@
1
1
  module Zenlish
2
- VERSION = '0.1.23'
2
+ VERSION = '0.1.24'.freeze
3
3
  end
@@ -32,6 +32,7 @@ require_relative 'indefinite_article'
32
32
  require_relative 'indefinite_pronoun'
33
33
  require_relative 'linking_adverb'
34
34
  require_relative 'modal_verb_can'
35
+ require_relative 'modal_verb_could'
35
36
  require_relative 'personal_pronoun'
36
37
  require_relative 'possessive_determiner'
37
38
  require_relative 'preposition'
@@ -0,0 +1,9 @@
1
+ require_relative 'auxiliary'
2
+
3
+ module Zenlish
4
+ module WClasses
5
+ # The modal verb `could`
6
+ class ModalVerbCould < Auxiliary
7
+ end # class
8
+ end # module
9
+ end # module
@@ -0,0 +1,331 @@
1
+ # frozen_string_literal: true
2
+ require_relative '../../spec_helper' # Use the RSpec framework
3
+ require_relative '../support/var2word'
4
+ require_relative '../../../lib/zenlish/parser/zparser' # Load the class under test
5
+
6
+ module Zenlish
7
+ module Parser
8
+ describe ZParser do
9
+ include Var2Word
10
+
11
+ subject { ZParser.new }
12
+
13
+ context 'Parsing lesson 1:' do
14
+ it 'should parse sample sentences from lesson 1-A' do
15
+ # Sentence 1-01: "Tony sees Lisa."
16
+ # in absence of a tokenizer, we create a sequence of literals by hand...
17
+ # prox_tony = ZProxy.new(tony)
18
+ literals = [tony, sees, lisa, dot]
19
+ expect { subject.to_pforest(literals) }.not_to raise_error
20
+
21
+ # Sentence 1-02a: "Tony sees something."
22
+ sentence_literals = [tony, sees, something, dot]
23
+ expect { subject.to_pforest(sentence_literals) }.not_to raise_error
24
+
25
+ # Sentence 1-02b: "Lisa sees something."
26
+ sentence_literals = [lisa, sees, something, dot]
27
+ expect { subject.to_pforest(sentence_literals) }.not_to raise_error
28
+
29
+ # Sentence 1-03: "Tony sees this thing."
30
+ sentence_literals = [tony, sees, this, thing, dot]
31
+ expect { subject.to_pforest(sentence_literals) }.not_to raise_error
32
+
33
+ # Sentence 1-04: "Lisa sees the other thing."
34
+ sentence_literals = [lisa, sees, the, other, thing, dot]
35
+ expect { subject.to_pforest(sentence_literals) }.not_to raise_error
36
+ end
37
+
38
+ it 'should parse sample sentences from lesson 1-B' do
39
+ # Sentence 1-05a: "Lisa sees the same thing."
40
+ literals = [lisa, sees, the, same, thing, dot]
41
+ expect { subject.to_pforest(literals) }.not_to raise_error
42
+
43
+ # Sentence 1-05b: "Lisa sees the same thing as Tony sees."
44
+ literals = [lisa, sees, the, same, thing, as, tony, sees, dot]
45
+ # same is an adjective of equality comparison
46
+ # as is part of same ... as combination
47
+ # it introduces a comparative clause
48
+ expect { subject.to_pforest(literals) }.not_to raise_error
49
+
50
+ # Sentence 1-06: "Tony sees one thing."
51
+ literals = [tony, sees, one, thing, dot]
52
+ expect { subject.to_pforest(literals) }.not_to raise_error
53
+
54
+ # Sentence 1-07: "Lisa sees two things."
55
+ literals = [lisa, sees, two, things, dot]
56
+ expect { subject.to_pforest(literals) }.not_to raise_error
57
+
58
+ # Sentence 1-08a: "Tony sees one person."
59
+ literals = [tony, sees, one, person, dot]
60
+ expect { subject.to_pforest(literals) }.not_to raise_error
61
+
62
+ # Sentence 1-08b: "Lisa sees two people."
63
+ literals = [lisa, sees, two, people, dot]
64
+ expect { subject.to_pforest(literals) }.not_to raise_error
65
+
66
+ # Sentence 1-05b: "Tony sees the same person as Lisa sees."
67
+ literals = [tony, sees, the, same, person, as, lisa, sees, dot]
68
+ # same is an adjective of equality comparison
69
+ # as is part of same ... as combination
70
+ # it introduces a comparative clause
71
+ expect { subject.to_pforest(literals) }.not_to raise_error
72
+ end
73
+
74
+ it 'should parse sample sentences from lesson 1-C' do
75
+ # Sentence 1-09a: "Tony sees many things."
76
+ literals = [tony, sees, many, things, dot]
77
+ expect { subject.to_pforest(literals) }.not_to raise_error
78
+
79
+ # Sentence 1-09b: "Lisa sees many people."
80
+ literals = [lisa, sees, many, people, dot]
81
+ expect { subject.to_pforest(literals) }.not_to raise_error
82
+
83
+ # Sentence 1-10: "Tony is inside this thing."
84
+ literals = [tony, is, inside, this, thing, dot]
85
+ expect { subject.to_pforest(literals) }.not_to raise_error
86
+
87
+ # Sentence 1-11: "Lisa is not inside this thing."
88
+ literals = [lisa, is, not_, inside, this, thing, dot]
89
+ expect { subject.to_pforest(literals) }.not_to raise_error
90
+
91
+ # Sentence: "Lisa does not see people inside the other thing."
92
+ literals = [lisa, does_aux, not_, see, people, inside, the, other, thing, dot]
93
+ # Ambiguous parse...
94
+ expect { subject.to_pforest(literals) }.not_to raise_error
95
+ end
96
+
97
+ it 'should parse sample sentences from lesson 1-D' do
98
+ # Sentence 1-12a: "Some of these people are inside this thing."
99
+ literals = [some, of, these, people, are, inside, this, thing, dot]
100
+ expect { subject.to_pforest(literals) }.not_to raise_error
101
+
102
+ # Sentence 1-12b: "Some of these people are not inside this thing."
103
+ literals = [some, of, these, people, are, not_, inside, this, thing, dot]
104
+ expect { subject.to_pforest(literals) }.not_to raise_error
105
+
106
+ # Sentence 1-13: "All of these people are inside this thing."
107
+ literals = [all, of, these, people, are, not_, inside, this, thing, dot]
108
+ expect { subject.to_pforest(literals) }.not_to raise_error
109
+
110
+ # Sentence 1-14a: "There are two people inside one of these things."
111
+ literals = [there, are, two, people, inside, one, of, these, things, dot]
112
+ expect { subject.to_pforest(literals) }.not_to raise_error
113
+
114
+ # Sentence 1-14b: "There are not people inside the other thing."
115
+ literals = [there, are, not_, people, inside, the, other, thing, dot]
116
+ expect { subject.to_pforest(literals) }.not_to raise_error
117
+
118
+ # Sentence 1-15a: "There are many people inside this thing."
119
+ literals = [there, are, many, people, inside, this, thing, dot]
120
+ expect { subject.to_pforest(literals) }.not_to raise_error
121
+
122
+ # Sentence 1-15b: "There are more people inside this thing."
123
+ literals = [there, are, more, people, inside, this, thing, dot]
124
+ expect { subject.to_pforest(literals) }.not_to raise_error
125
+
126
+ # Sentence 1-15c: "There are more people inside the other thing
127
+ # than there are inside this thing."
128
+ literals = [there, are, more, people, inside, the, other, thing,
129
+ than, there, are, inside, this, thing, dot]
130
+ # Ambiguous parse
131
+ expect { subject.to_pforest(literals) }.not_to raise_error
132
+ end
133
+
134
+ it 'should parse sample sentences from lesson 1-E' do
135
+ # Sentence 1-16a: "Two of these things are alive."
136
+ literals = [two, of, these, things, are, alive, dot]
137
+ expect { subject.to_pforest(literals) }.not_to raise_error
138
+
139
+ # Sentence 1-16b: "One of these things is not alive."
140
+ literals = [one, of, these, things, is, not_, alive, dot]
141
+ expect { subject.to_pforest(literals) }.not_to raise_error
142
+
143
+ # Sentence 1-17a: "Tony sees some living things."
144
+ literals = [tony, sees, some, living, things, dot]
145
+ expect { subject.to_pforest(literals) }.not_to raise_error
146
+
147
+ # Sentence 1-17b: "Two of these things are big."
148
+ literals = [two, of, these, things, are, big, dot]
149
+ expect { subject.to_pforest(literals) }.not_to raise_error
150
+
151
+ # Sentence 1-17c: "One of these things is not big."
152
+ literals = [one, of, these, things, is, not_, big, dot]
153
+ expect { subject.to_pforest(literals) }.not_to raise_error
154
+
155
+ # Sentence 1-18a: "Tony sees some living things."
156
+ literals = [tony, sees, some, living, things, dot]
157
+ expect { subject.to_pforest(literals) }.not_to raise_error
158
+
159
+ # Sentence 1-18b: "One of these is big."
160
+ literals = [one, of, these_as_pronoun, is, big, dot]
161
+ expect { subject.to_pforest(literals) }.not_to raise_error
162
+
163
+ # Sentence 1-18c: "Two of these are small."
164
+ literals = [two, of, these_as_pronoun, are, small, dot]
165
+ expect { subject.to_pforest(literals) }.not_to raise_error
166
+
167
+ # Sentence 1-19a: "Tony sees one living thing."
168
+ literals = [tony, sees, one, living, thing, dot]
169
+ expect { subject.to_pforest(literals) }.not_to raise_error
170
+
171
+ # Sentence 1-19b: "This one is very big."
172
+ literals = [this_one, is, very, big, dot]
173
+ expect { subject.to_pforest(literals) }.not_to raise_error
174
+
175
+ # Sentence: "This thing is bigger than the other thing."
176
+ literals = [this, thing, is, bigger, than, the, other, thing, dot]
177
+ expect { subject.to_pforest(literals) }.not_to raise_error
178
+
179
+ # Sentence: "This thing is smaller than the other thing."
180
+ literals = [this, thing, is, smaller, than, the, other, thing, dot]
181
+ expect { subject.to_pforest(literals) }.not_to raise_error
182
+ end
183
+
184
+ it 'should parse sample sentences from lesson 1-F' do
185
+ # Sentence 1-20a: "Tony sees some living things."
186
+ literals = [tony, sees, some, living, things, dot]
187
+ expect { subject.to_pforest(literals) }.not_to raise_error
188
+
189
+ # Sentence 1-20b: "Two of these are the same kind of living thing."
190
+ literals = [these_as_pronoun, are, the, same, kind, of, living, thing, dot]
191
+ expect { subject.to_pforest(literals) }.not_to raise_error
192
+
193
+ # Sentence 1-20c: "One of these is not the same kind as the other two."
194
+ literals = [one, of, these_as_pronoun, is, not_, the, same, kind,
195
+ as, the, other, two_as_pronoun, dot]
196
+ expect { subject.to_pforest(literals) }.not_to raise_error
197
+
198
+ # Sentence 1-21a: "There is one person inside this thing."
199
+ literals = [there, is, one, person, inside, this, thing, dot]
200
+ expect { subject.to_pforest(literals) }.not_to raise_error
201
+
202
+ # Sentence 1-21b: "If Tony is not inside this thing, then another person is inside."
203
+ literals = [if_, tony, is, not_, inside, this, thing, comma, then_,
204
+ another, person, is, inside, dot]
205
+ # Ambiguous parse
206
+ expect { subject.to_pforest(literals) }.not_to raise_error
207
+
208
+ # Sentence 1-22a: "Tony is touching something."
209
+ literals = [tony, is_aux, touching, something, dot]
210
+ expect { subject.to_pforest(literals) }.not_to raise_error
211
+
212
+ # Sentence 1-22b: "Lisa is touching Tony."
213
+ literals = [lisa, is_aux, touching, tony, dot]
214
+ expect { subject.to_pforest(literals) }.not_to raise_error
215
+
216
+ # Sentence 1-23a: "Tony is far from Lisa."
217
+ literals = [tony, is, far, from, lisa, dot]
218
+ expect { subject.to_pforest(literals) }.not_to raise_error
219
+
220
+ # Sentence 1-23b: "Lisa is far from Tony."
221
+ literals = [lisa, is, far, from, tony, dot]
222
+ expect { subject.to_pforest(literals) }.not_to raise_error
223
+
224
+ # Sentence 1-23c: "Tony is not far from Lisa."
225
+ literals = [tony, is, far, from, lisa, dot]
226
+ expect { subject.to_pforest(literals) }.not_to raise_error
227
+
228
+ # Sentence 1-24: "Tony is near to Lisa."
229
+ literals = [tony, is, near_to, lisa, dot]
230
+ expect { subject.to_pforest(literals) }.not_to raise_error
231
+ end
232
+
233
+ it 'should parse sample sentences from lesson 1-G' do
234
+ # Sentence 1-25a: "Lisa is in this place."
235
+ literals = [lisa, is, in_, this, place, dot]
236
+ expect { subject.to_pforest(literals) }.not_to raise_error
237
+
238
+ # Sentence 1-25b: "There are two other things in this place."
239
+ literals = [there, are, two, other, things, in_, this, place, dot]
240
+ expect { subject.to_pforest(literals) }.not_to raise_error
241
+
242
+ # Sentence 1-25c: "Lisa is in the same place as these two other things."
243
+ literals = [lisa, is, in_, the, same, place, as, these, two, other, things, dot]
244
+ expect { subject.to_pforest(literals) }.not_to raise_error
245
+
246
+ # Sentence 1-25d: "Tony is not in this place."
247
+ literals = [tony, is, not_, in_, this, place, dot]
248
+ expect { subject.to_pforest(literals) }.not_to raise_error
249
+
250
+ # Sentence 1-25e: "Tony is in another place."
251
+ literals = [tony, is, in_, another, place, dot]
252
+ expect { subject.to_pforest(literals) }.not_to raise_error
253
+
254
+ # Sentence 1-26a: "Lisa is inside this thing."
255
+ literals = [lisa, is, inside, this, thing, dot]
256
+ expect { subject.to_pforest(literals) }.not_to raise_error
257
+
258
+ # Sentence 1-26b: "Tony is above this thing."
259
+ literals = [tony, is, above, this, thing, dot]
260
+ expect { subject.to_pforest(literals) }.not_to raise_error
261
+
262
+ # Sentence 1-26c: "Tony is above lisa."
263
+ literals = [tony, is, above, lisa, dot]
264
+ expect { subject.to_pforest(literals) }.not_to raise_error
265
+
266
+ # Sentence 1-27a: "Tony is on one side of this thing."
267
+ literals = [tony, is, on, one, side, of, this, thing, dot]
268
+ expect { subject.to_pforest(literals) }.not_to raise_error
269
+
270
+ # Sentence 1-27b: "Lisa is on the other side."
271
+ literals = [lisa, is, on, the, other, side, dot]
272
+ expect { subject.to_pforest(literals) }.not_to raise_error
273
+
274
+ # Sentence 1-27c: "Tony is touching one side of this thing."
275
+ literals = [tony, is_aux, touching, one, side, of, this, thing, dot]
276
+ # Ambiguous parse
277
+ expect { subject.to_pforest(literals) }.not_to raise_error
278
+ end
279
+
280
+ it 'should parse sample sentences from lesson 1-H' do
281
+ # Sentence 1-28: "Tony hears something."
282
+ literals = [tony, hears, something, dot]
283
+ expect { subject.to_pforest(literals) }.not_to raise_error
284
+
285
+ # Sentence 1-29a: "Tony says something."
286
+ literals = [tony, says, something, dot]
287
+ expect { subject.to_pforest(literals) }.not_to raise_error
288
+
289
+ # Sentence 1-29b: "Tony says something to Lisa."
290
+ literals = [tony, says, something, to, lisa, dot]
291
+ # Ambiguous parse
292
+ expect { subject.to_pforest(literals) }.not_to raise_error
293
+
294
+ # Sentence 1-29c: "Tony says something about this living thing."
295
+ literals = [tony, says, something, about, this, living, thing, dot]
296
+ expect { subject.to_pforest(literals) }.not_to raise_error
297
+
298
+ # Sentence 1-29d: 'Tony says: "This living thing is small."'
299
+ literals = [tony, says, colon, quote, this, living, thing, is, small, dot, quote, dot]
300
+ expect { subject.to_pforest(literals) }.not_to raise_error
301
+
302
+ # Sentence 1-30a: "Tony says some words."
303
+ literals = [tony, says, some, words, dot]
304
+ expect { subject.to_pforest(literals) }.not_to raise_error
305
+
306
+ # Sentence 1-30b: "Lisa says more words."
307
+ literals = [lisa, says, more, words, dot]
308
+ expect { subject.to_pforest(literals) }.not_to raise_error
309
+
310
+ # Sentence 1-31a: 'Tony says: "There are two people inside this thing."'
311
+ literals = [tony, says, colon, quote, there, are, two, people, inside,
312
+ this, thing, dot, quote, dot]
313
+ expect { subject.to_pforest(literals) }.not_to raise_error
314
+
315
+ # Sentence 1-31b: 'Lisa says: "There is one person inside this thing."'
316
+ literals = [lisa, says, colon, quote, there, is, one, person, inside,
317
+ this, thing, dot, quote, dot]
318
+ expect { subject.to_pforest(literals) }.not_to raise_error
319
+
320
+ # Sentence 1-31c: "What Tony says is not true."
321
+ literals = [what, tony, says, is, not_, true_, dot]
322
+ expect { subject.to_pforest(literals) }.not_to raise_error
323
+
324
+ # Sentence 1-31d: "What Lisa says is true."
325
+ literals = [what, lisa, says, is, true_, dot]
326
+ expect { subject.to_pforest(literals) }.not_to raise_error
327
+ end
328
+ end # context
329
+ end # describe
330
+ end # module
331
+ end # module