zenlish 0.2.02 → 0.2.06

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