zenlish 0.2.05 → 0.2.07
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +228 -0
- data/CHANGELOG.md +19 -0
- data/Gemfile +5 -3
- data/LICENSE.txt +1 -1
- data/Rakefile +5 -3
- data/lib/zenlish/feature/boolean_domain.rb +6 -4
- data/lib/zenlish/feature/boolean_value.rb +3 -2
- data/lib/zenlish/feature/enumeration_domain.rb +5 -2
- data/lib/zenlish/feature/feature.rb +9 -7
- data/lib/zenlish/feature/feature_def.rb +9 -6
- data/lib/zenlish/feature/feature_domain.rb +4 -2
- data/lib/zenlish/feature/feature_struct.rb +3 -1
- data/lib/zenlish/feature/feature_struct_def.rb +5 -3
- data/lib/zenlish/feature/feature_struct_def_bearer.rb +6 -4
- data/lib/zenlish/feature/feature_value.rb +4 -2
- data/lib/zenlish/feature/identifier_domain.rb +5 -3
- data/lib/zenlish/feature/identifier_value.rb +3 -2
- data/lib/zenlish/feature/symbol_value.rb +3 -1
- data/lib/zenlish/inflect/atomic_o_expression.rb +2 -1
- data/lib/zenlish/inflect/composite_o_expression.rb +3 -1
- data/lib/zenlish/inflect/concatenation.rb +3 -2
- data/lib/zenlish/inflect/equals_literal.rb +3 -1
- data/lib/zenlish/inflect/feature_heading.rb +2 -5
- data/lib/zenlish/inflect/formal_argument.rb +3 -1
- data/lib/zenlish/inflect/function_call.rb +4 -1
- data/lib/zenlish/inflect/heading.rb +2 -0
- data/lib/zenlish/inflect/inflection_rule.rb +2 -0
- data/lib/zenlish/inflect/inflection_table.rb +6 -4
- data/lib/zenlish/inflect/inflection_table_builder.rb +21 -18
- data/lib/zenlish/inflect/input_asis.rb +3 -0
- data/lib/zenlish/inflect/input_expression.rb +4 -2
- data/lib/zenlish/inflect/literal_asis.rb +4 -1
- data/lib/zenlish/inflect/matches_pattern.rb +2 -0
- data/lib/zenlish/inflect/membership.rb +2 -0
- data/lib/zenlish/inflect/method_heading.rb +3 -6
- data/lib/zenlish/inflect/not_equals_literal.rb +2 -0
- data/lib/zenlish/inflect/nullary_input_expression.rb +3 -1
- data/lib/zenlish/inflect/output_expression.rb +6 -0
- data/lib/zenlish/inflect/substitution.rb +3 -1
- data/lib/zenlish/inflect/unary_input_expression.rb +4 -1
- data/lib/zenlish/inflect/unconditionally_true.rb +4 -2
- data/lib/zenlish/lang/dictionary.rb +19 -16
- data/lib/zenlish/lang/lemmatizer.rb +40 -0
- data/lib/zenlish/lang/zenlish_grammar.rb +6 -4
- data/lib/zenlish/lex/empty_lexicon_factory.rb +3 -2
- data/lib/zenlish/lex/lexeme.rb +6 -4
- data/lib/zenlish/lex/lexical_entry.rb +6 -4
- data/lib/zenlish/lex/lexicon.rb +4 -3
- data/lib/zenlish/lex/literal.rb +3 -1
- data/lib/zenlish/lexer/lexer.rb +144 -0
- data/lib/zenlish/trie/base_trie_node.rb +27 -0
- data/lib/zenlish/trie/trie.rb +132 -0
- data/lib/zenlish/trie/trie_node.rb +21 -0
- data/lib/zenlish/trie/trie_root.rb +10 -0
- data/lib/zenlish/version.rb +3 -1
- data/lib/zenlish/wclasses/adjective.rb +4 -2
- data/lib/zenlish/wclasses/adverb.rb +3 -1
- data/lib/zenlish/wclasses/adverb_maybe.rb +3 -1
- data/lib/zenlish/wclasses/adverb_not.rb +2 -0
- data/lib/zenlish/wclasses/all_word_classes.rb +3 -1
- data/lib/zenlish/wclasses/article.rb +2 -0
- data/lib/zenlish/wclasses/auxiliary.rb +2 -0
- data/lib/zenlish/wclasses/auxiliary_be.rb +7 -6
- data/lib/zenlish/wclasses/auxiliary_do.rb +6 -5
- data/lib/zenlish/wclasses/cardinal.rb +3 -1
- data/lib/zenlish/wclasses/common_noun.rb +2 -0
- data/lib/zenlish/wclasses/comparative_particle.rb +5 -3
- data/lib/zenlish/wclasses/conjunction.rb +2 -0
- data/lib/zenlish/wclasses/conjunctive_pronoun.rb +2 -0
- data/lib/zenlish/wclasses/coordinator.rb +4 -2
- data/lib/zenlish/wclasses/definite_article.rb +2 -0
- data/lib/zenlish/wclasses/degree_adverb.rb +2 -0
- data/lib/zenlish/wclasses/demonstrative_determiner.rb +6 -4
- data/lib/zenlish/wclasses/demonstrative_pronoun.rb +2 -0
- data/lib/zenlish/wclasses/determiner.rb +3 -1
- data/lib/zenlish/wclasses/distributive_determiner.rb +2 -0
- data/lib/zenlish/wclasses/existential_there.rb +2 -0
- data/lib/zenlish/wclasses/fronting_quantifier.rb +3 -1
- data/lib/zenlish/wclasses/indefinite_article.rb +2 -0
- data/lib/zenlish/wclasses/indefinite_pronoun.rb +3 -1
- data/lib/zenlish/wclasses/irregular_linking_verb.rb +3 -1
- data/lib/zenlish/wclasses/irregular_verb.rb +13 -15
- data/lib/zenlish/wclasses/irregular_verb_be.rb +8 -7
- data/lib/zenlish/wclasses/irregular_verb_can.rb +8 -7
- data/lib/zenlish/wclasses/irregular_verb_do.rb +7 -6
- data/lib/zenlish/wclasses/irregular_verb_extension.rb +8 -7
- data/lib/zenlish/wclasses/irregular_verb_have.rb +12 -11
- data/lib/zenlish/wclasses/irregular_verb_know.rb +3 -1
- data/lib/zenlish/wclasses/irregular_verb_say.rb +3 -1
- data/lib/zenlish/wclasses/irregular_verb_think.rb +3 -1
- data/lib/zenlish/wclasses/lexical_verb.rb +3 -4
- data/lib/zenlish/wclasses/linking_adverb.rb +2 -0
- data/lib/zenlish/wclasses/modal_verb_can.rb +7 -5
- data/lib/zenlish/wclasses/noun.rb +4 -2
- data/lib/zenlish/wclasses/numeral.rb +2 -0
- data/lib/zenlish/wclasses/personal_pronoun.rb +8 -6
- data/lib/zenlish/wclasses/possessive_determiner.rb +13 -12
- data/lib/zenlish/wclasses/preposition.rb +3 -1
- data/lib/zenlish/wclasses/preposition_of.rb +2 -0
- data/lib/zenlish/wclasses/preposition_than.rb +2 -0
- data/lib/zenlish/wclasses/pronoun.rb +3 -1
- data/lib/zenlish/wclasses/proper_noun.rb +10 -8
- data/lib/zenlish/wclasses/quantifier.rb +3 -1
- data/lib/zenlish/wclasses/regular_verb.rb +9 -9
- data/lib/zenlish/wclasses/regular_verb_want.rb +4 -2
- data/lib/zenlish/wclasses/relative_pronoun.rb +4 -2
- data/lib/zenlish/wclasses/subordinating_conjunction.rb +7 -5
- data/lib/zenlish/wclasses/verb.rb +5 -3
- data/lib/zenlish/wclasses/word_class.rb +7 -5
- data/lib/zenlish.rb +3 -3
- data/spec/spec_helper.rb +3 -1
- data/spec/zenlish/feature/boolean_domain_spec.rb +16 -16
- data/spec/zenlish/feature/boolean_value_spec.rb +7 -6
- data/spec/zenlish/feature/enumeration_domain_spec.rb +21 -21
- data/spec/zenlish/feature/feature_def_spec.rb +15 -14
- data/spec/zenlish/feature/feature_spec.rb +17 -17
- data/spec/zenlish/feature/feature_struct_def_bearer_spec.rb +23 -21
- data/spec/zenlish/feature/feature_struct_def_spec.rb +26 -25
- data/spec/zenlish/feature/identifier_domain_spec.rb +15 -15
- data/spec/zenlish/feature/identifier_value_spec.rb +10 -9
- data/spec/zenlish/feature/symbol_value_spec.rb +9 -8
- data/spec/zenlish/inflect/concatenation_spec.rb +14 -14
- data/spec/zenlish/inflect/equals_literal_spec.rb +17 -16
- data/spec/zenlish/inflect/feature_heading_spec.rb +22 -21
- data/spec/zenlish/inflect/formal_argument_spec.rb +7 -7
- data/spec/zenlish/inflect/function_call_spec.rb +11 -12
- data/spec/zenlish/inflect/inflection_rule_spec.rb +28 -24
- data/spec/zenlish/inflect/inflection_table_builder_spec.rb +62 -57
- data/spec/zenlish/inflect/inflection_table_spec.rb +49 -46
- data/spec/zenlish/inflect/input_asis_spec.rb +12 -15
- data/spec/zenlish/inflect/literal_asis_spec.rb +10 -10
- data/spec/zenlish/inflect/matches_pattern_spec.rb +16 -15
- data/spec/zenlish/inflect/membership_spec.rb +17 -16
- data/spec/zenlish/inflect/method_heading_spec.rb +15 -14
- data/spec/zenlish/inflect/not_equals_literal_spec.rb +17 -16
- data/spec/zenlish/inflect/substitution_spec.rb +10 -11
- data/spec/zenlish/inflect/unconditionally_true_spec.rb +8 -6
- data/spec/zenlish/lang/dictionary_spec.rb +28 -31
- data/spec/zenlish/lang/lemmatizer_spec.rb +43 -0
- data/spec/zenlish/lang/zenlish_grammar_spec.rb +5 -5
- data/spec/zenlish/lex/empty_lexicon_factory_spec.rb +8 -8
- data/spec/zenlish/lex/lexeme_spec.rb +27 -28
- data/spec/zenlish/lex/lexical_entry_spec.rb +15 -15
- data/spec/zenlish/lex/lexicon_spec.rb +52 -50
- data/spec/zenlish/lex/literal_spec.rb +8 -8
- data/spec/zenlish/lexer/lexer_spec.rb +52 -0
- data/spec/zenlish/parser/lesson1_spec.rb +81 -81
- data/spec/zenlish/parser/lesson2_spec.rb +133 -138
- data/spec/zenlish/parser/lesson3_spec.rb +186 -226
- data/spec/zenlish/parser/zparser_spec.rb +8 -7
- data/spec/zenlish/support/minimal_lexicon.rb +2 -0
- data/spec/zenlish/support/var2word.rb +16 -9
- data/spec/zenlish/trie/base_trie_node_spec.rb +33 -0
- data/spec/zenlish/trie/trie_spec.rb +108 -0
- data/spec/zenlish/wclasses/common_noun_spec.rb +15 -19
- data/spec/zenlish/wclasses/demonstrative_determiner_spec.rb +12 -12
- data/spec/zenlish/wclasses/irregular_verb_can_spec.rb +18 -18
- data/spec/zenlish/wclasses/irregular_verb_extension_spec.rb +10 -10
- data/spec/zenlish/wclasses/irregular_verb_spec.rb +28 -28
- data/spec/zenlish/wclasses/lexical_verb_spec.rb +9 -9
- data/spec/zenlish/wclasses/modal_verb_can_spec.rb +12 -12
- data/spec/zenlish/wclasses/noun_spec.rb +7 -7
- data/spec/zenlish/wclasses/personal_pronoun_spec.rb +20 -23
- data/spec/zenlish/wclasses/possessive_determiner_spec.rb +28 -31
- data/spec/zenlish/wclasses/preposition_spec.rb +5 -5
- data/spec/zenlish/wclasses/proper_noun_spec.rb +3 -3
- data/spec/zenlish/wclasses/regular_verb_spec.rb +30 -30
- data/spec/zenlish/wclasses/regular_verb_want_spec.rb +30 -0
- data/spec/zenlish/wclasses/verb_spec.rb +9 -9
- data/spec/zenlish_spec.rb +4 -2
- data/zenlish.gemspec +18 -14
- metadata +49 -16
@@ -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
|
@@ -8,39 +9,37 @@ module Zenlish
|
|
8
9
|
describe ZParser do
|
9
10
|
include Var2Word
|
10
11
|
|
11
|
-
subject {
|
12
|
+
subject(:parser) { described_class.new }
|
12
13
|
|
13
14
|
context 'Parsing lesson 3:' do
|
14
|
-
it '
|
15
|
+
it 'parses sample sentences from lesson 3-A' do
|
15
16
|
# Sentence 3-01a definiendum: 'J happens to something that does K.'
|
16
17
|
literals = [j_, happens, to, something, that, does, k_, dot]
|
17
|
-
expect {
|
18
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
18
19
|
|
19
20
|
# Sentence 3-01b definiens: 'J happens to something.
|
20
21
|
# This same something does K.
|
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
|
-
|
26
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
25
|
+
tony, has, something, that, lisa, wants, dot]
|
26
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
27
27
|
|
28
28
|
# Sentence 3-02a definiendum: 'J is true, and K is true.'
|
29
29
|
literals = [j_, is, true_, comma, and_, k_, is, true_, dot]
|
30
|
-
expect {
|
30
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
31
31
|
|
32
32
|
# Sentence 3-02b definiens: 'These two things are true: J is true.
|
33
33
|
# K is true.'
|
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
|
-
|
39
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
37
|
+
lisa, sees, tony, comma, and_, tony, sees, lisa, dot]
|
38
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
40
39
|
|
41
40
|
# Sentence 3-02c definiendum: 'J and K do X.'
|
42
41
|
literals = [j_, and_, k_, do_, x_as_noun, dot]
|
43
|
-
expect {
|
42
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
44
43
|
|
45
44
|
# Sentence 3-02d definiens: 'These two things do X.
|
46
45
|
# J is one that does this.
|
@@ -51,112 +50,100 @@ 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
|
-
|
56
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
53
|
+
i_pronoun, see, tony, and_, lisa, dot]
|
54
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
57
55
|
|
58
56
|
# Sentence 3-03a definiendum: 'J is true, or K is true.'
|
59
57
|
literals = [j_, is, true_, comma, or_, k_, is, true_, dot]
|
60
|
-
expect {
|
58
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
61
59
|
|
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
|
-
|
66
|
-
tony, saw, me, comma, or_, lisa, heard, me, dot
|
67
|
-
|
68
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
63
|
+
then_, k_, is, true_, dot,
|
64
|
+
tony, saw, me, comma, or_, lisa, heard, me, dot]
|
65
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
69
66
|
|
70
67
|
# Sentence 3-03c definiendum: 'J or K does this.'
|
71
68
|
literals = [j_, or_, k_, does, this_as_pronoun, dot]
|
72
|
-
expect {
|
69
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
73
70
|
|
74
71
|
# Sentence 3-03d definiendum: 'If J does not do this, then K does this.'
|
75
72
|
literals = [if_, j_, does_aux, not_, do_, this_as_pronoun, comma,
|
76
73
|
then_, k_, does, this_as_pronoun, dot]
|
77
|
-
expect {
|
74
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
78
75
|
|
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
|
-
|
84
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
79
|
+
this_as_pronoun, belongs, to, tony, or_, lisa, dot]
|
80
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
85
81
|
|
86
82
|
# Sentence 3-04a definiendum: 'It does something.'
|
87
83
|
literals = [it_, does, something, dot]
|
88
|
-
expect {
|
84
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
89
85
|
|
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
|
-
|
95
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
89
|
+
i_pronoun, touched, this, thing, comma, and_, it_, moved, dot]
|
90
|
+
expect { parser.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
|
-
|
100
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
93
|
+
literals = [they, does, something, dot]
|
94
|
+
expect { parser.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 = [
|
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
|
-
|
108
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
100
|
+
something, happens, to, these, things, or_, people, dot]
|
101
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
109
102
|
end
|
110
103
|
|
111
|
-
it '
|
104
|
+
it 'parses 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
|
-
|
115
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
106
|
+
literals = [this_as_pronoun, is, its, x_as_noun, dot]
|
107
|
+
expect { parser.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
|
-
|
123
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
113
|
+
i_pronoun, saw, this, thing, and_, touched, some, of, its, parts, dot]
|
114
|
+
expect { parser.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
|
-
|
128
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
117
|
+
literals = [these, things, are, their, things, dot]
|
118
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
129
119
|
|
130
120
|
# Sentence 3-05d definiens: 'These things belong to them.
|
131
121
|
literals = [these, things, belong, to, them, dot]
|
132
|
-
expect {
|
122
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
133
123
|
|
134
124
|
# Sentence 3-06a definiendum: 'This is your X.'
|
135
125
|
literals = [this_as_pronoun, is, your, x_as_noun, dot]
|
136
|
-
expect {
|
126
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
137
127
|
|
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
|
-
|
143
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
131
|
+
you, feel, something, touching, your, body, dot]
|
132
|
+
expect { parser.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
|
-
|
148
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
135
|
+
literals = [this_as_pronoun, is, my, x_as_noun, dot]
|
136
|
+
expect { parser.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
|
-
|
155
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
141
|
+
i_pronoun, do_aux, not_, want, to, touch, my, body, dot]
|
142
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
156
143
|
|
157
144
|
# Sentence 3-08a definiendum: 'There is an X here.'
|
158
145
|
literals = [there, is, an, x_as_noun, here, dot]
|
159
|
-
expect {
|
146
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
160
147
|
|
161
148
|
# Sentence 3-08b definiens: 'X is some kind of thing.
|
162
149
|
# There is one of this kind of thing here.
|
@@ -165,24 +152,23 @@ 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
|
-
|
169
|
-
|
170
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
155
|
+
about, a_as_art, short, time, before_as_adj, now_as_noun, dot]
|
156
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
171
157
|
|
172
158
|
# Sentence 3-Bxa 'Lisa sees a living thing that is very big.
|
173
159
|
# Lisa says: "I see one living thing. Its body is bigger than my body.", dot
|
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
|
-
|
163
|
+
its, body, is, bigger, than, my, body, dot, quote, dot
|
178
164
|
]
|
179
|
-
expect {
|
165
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
180
166
|
end
|
181
167
|
|
182
|
-
it '
|
168
|
+
it 'parses sample sentences from lesson 3-C' do
|
183
169
|
# Sentence 3-09a definiendum: 'Something happens to the X.'
|
184
170
|
literals = [something, happens, to, the, x_as_noun, dot]
|
185
|
-
expect {
|
171
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
186
172
|
|
187
173
|
# Sentence 3-09b definiens: Something happens to X.
|
188
174
|
# This is the same X that someone said something about a short time before,
|
@@ -190,87 +176,81 @@ 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
|
-
|
194
|
-
|
195
|
-
|
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
|
-
|
198
|
-
|
199
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
183
|
+
and_, now, i_pronoun, do_aux, not_, see, the, people, dot]
|
184
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
200
185
|
|
201
186
|
# Sentence 3-10a definiendum: 'X is an animal.'
|
202
187
|
literals = [x_as_noun, is, an, animal, dot]
|
203
|
-
expect {
|
188
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
204
189
|
|
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 = [
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
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]
|
197
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
214
198
|
|
215
199
|
# Sentence 3-11a definiendum: 'J causes K to happen.'
|
216
200
|
literals = [j_, causes, k_, to, happen, dot]
|
217
|
-
expect {
|
201
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
218
202
|
|
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 = [
|
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
|
-
|
226
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
208
|
+
something, bad, caused, these, people, to, die, dot]
|
209
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
227
210
|
|
228
211
|
# Sentence 3-12a definiendum: 'J is true, but K is not true.'
|
229
212
|
literals = [j_, is, true_, comma, but, k_, is, not_, true_, dot]
|
230
|
-
expect {
|
213
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
231
214
|
|
232
215
|
# Sentence 3-12b definiens: You say J is true.
|
233
216
|
# Maybe when some people hear J is true,
|
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 = [
|
238
|
-
|
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
|
-
|
243
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
224
|
+
i_pronoun, hear, tony, comma, but, i_pronoun, do_aux, not_, see, lisa, dot]
|
225
|
+
expect { parser.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 = [
|
248
|
-
|
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
|
-
|
251
|
-
|
252
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
232
|
+
that, you, hear, dot, quote, dot]
|
233
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
253
234
|
end
|
254
235
|
|
255
|
-
it '
|
236
|
+
it 'parses sample sentences from lesson 3-D' do
|
256
237
|
# Sentence 3-13a definiendum: 'You use this thing.'
|
257
238
|
literals = [you, use, this, thing, dot]
|
258
|
-
expect {
|
239
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
259
240
|
|
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 = [
|
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
|
-
|
269
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
248
|
+
here_as_noun, to, see, me, dot]
|
249
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
270
250
|
|
271
251
|
# Sentence 3-14a definiendum: 'You know X about each of these things.'
|
272
252
|
literals = [you, know, x_as_noun, about, each_, of, these, things, dot]
|
273
|
-
expect {
|
253
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
274
254
|
|
275
255
|
# Sentence 3-14b definiens: There are two or more things.
|
276
256
|
# You think about all these things like this:
|
@@ -278,70 +258,66 @@ 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 = [
|
261
|
+
literals = [there, are, two, or_, more, things, dot,
|
282
262
|
you, think, about, all, these, things, like, this_as_pronoun, colon,
|
283
|
-
|
284
|
-
|
285
|
-
each_, person, here, said, something, to, me, dot
|
286
|
-
|
287
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
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]
|
266
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
288
267
|
|
289
268
|
# Sentence 3-15a definiendum: 'Someplace an X exists.'
|
290
269
|
literals = [someplace, an, x_as_noun, exists, dot]
|
291
|
-
expect {
|
270
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
292
271
|
|
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 = [
|
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
|
-
expect {
|
278
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
300
279
|
|
301
280
|
# Sentence 3-16a definiendum: 'J became K.'
|
302
281
|
literals = [j_, became, k_, dot]
|
303
|
-
expect {
|
282
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
304
283
|
|
305
284
|
# Sentence 3-16b definiens: Something happened to J for some time.
|
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 = [
|
288
|
+
literals = [something, happened, to, j_, for_, some, time, dot,
|
310
289
|
after_, this_as_pronoun, happened, comma, k_, is, something, true_,
|
311
|
-
|
290
|
+
you, can, know, about, j_, dot,
|
312
291
|
these, two, animals, were, small, before_adverb, comma,
|
313
|
-
but, they, became, big, dot
|
314
|
-
|
315
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
292
|
+
but, they, became, big, dot]
|
293
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
316
294
|
|
317
295
|
# Sentence 3-Dx: There are some animals here.
|
318
296
|
# Each of these animals was small when it existed a short time.
|
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
|
-
|
300
|
+
existed, a_as_art, short, time, dot,
|
323
301
|
after_, a_as_art, long, time, comma, each_, of, these, animals,
|
324
|
-
|
325
|
-
|
326
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
302
|
+
became, big, dot]
|
303
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
327
304
|
end
|
328
305
|
|
329
|
-
it '
|
306
|
+
it 'parses sample sentences from lesson 3-E' do
|
330
307
|
# Sentence 3-17a definiendum: 'These things are different.'
|
331
308
|
literals = [things, are, different, dot]
|
332
|
-
expect {
|
309
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
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 = [
|
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
|
-
|
340
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
315
|
+
but, you, want, something, different, dot]
|
316
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
341
317
|
|
342
318
|
# Sentence 3-18a definiendum: 'J made K.'
|
343
319
|
literals = [j_, made, k_, dot]
|
344
|
-
expect {
|
320
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
345
321
|
|
346
322
|
# Sentence 3-18b definiens: J did something to some things
|
347
323
|
# and caused them to become parts of one different
|
@@ -349,96 +325,89 @@ 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 = [
|
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
|
-
|
360
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
334
|
+
j_, caused, k_, to, happen, dot]
|
335
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
361
336
|
|
362
337
|
# Sentence 3-19a definiendum: 'J contains K.'
|
363
338
|
literals = [j_, contains, k_, dot]
|
364
|
-
expect {
|
339
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
365
340
|
|
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 = [
|
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
|
-
|
373
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
346
|
+
your, body, contains, many, parts, dot]
|
347
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
374
348
|
|
375
349
|
# Sentence 3-20a definiendum: 'X is a container.'
|
376
350
|
literals = [x_as_noun, is, a_as_art, container, dot]
|
377
|
-
expect {
|
351
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
378
352
|
|
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 = [
|
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
|
-
|
386
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
358
|
+
there, are, two, things, inside, this, container, dot]
|
359
|
+
expect { parser.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
|
-
|
393
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
364
|
+
each_as_pronoun, contains, a_as_art, different, kind, of, animal, dot]
|
365
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
394
366
|
end
|
395
367
|
|
396
|
-
it '
|
368
|
+
it 'parses sample sentences from lesson 3-F' do
|
397
369
|
# Sentence 3-21a definiendum: 'You try to do X.'
|
398
370
|
literals = [you, try_, to, do_, x_as_noun, dot]
|
399
|
-
expect {
|
371
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
400
372
|
|
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 = [
|
405
|
-
you,
|
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
|
-
|
409
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
379
|
+
i_pronoun, tried, to, do_, something, good, dot]
|
380
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
410
381
|
|
411
382
|
# Sentence 3-22a definiendum: 'X changed.'
|
412
383
|
literals = [x_as_noun, changed, dot]
|
413
|
-
expect {
|
384
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
414
385
|
|
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 = [
|
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
|
-
|
423
|
-
|
424
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
393
|
+
its, body, changes, dot]
|
394
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
425
395
|
|
426
396
|
# Sentence 3-22c definiendum: 'J changed K.'
|
427
397
|
literals = [j_, changed, k_, dot]
|
428
|
-
expect {
|
398
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
429
399
|
|
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 = [
|
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
|
-
|
437
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
405
|
+
it_, changed, what, i_pronoun, thought, about, them, dot]
|
406
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
438
407
|
|
439
408
|
# Sentence 3-23a definiendum: 'You see the surface of X.'
|
440
409
|
literals = [you, see, the, surface, of, x_as_noun, dot]
|
441
|
-
expect {
|
410
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
442
411
|
|
443
412
|
# Sentence 3-23b definiens: You see part of X.
|
444
413
|
# This part is where other things can touch X.
|
@@ -446,33 +415,31 @@ 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 = [
|
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
|
-
|
453
|
-
|
454
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
421
|
+
feel, parts, of, it_, moving, below, its, surface, dot]
|
422
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
455
423
|
|
456
424
|
# Sentence 3-23c definiendum: 'J is on the surface of K.'
|
457
425
|
literals = [j_, is, on, the, surface, of, k_, dot]
|
458
|
-
expect {
|
426
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
459
427
|
|
460
428
|
# Sentence 3-23d definiens: J is touching the surface of K.
|
461
|
-
literals = [
|
462
|
-
expect {
|
429
|
+
literals = [j_, is, touching, the, surface, of, k_, dot]
|
430
|
+
expect { parser.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 = [
|
467
|
-
tony, tries, to, touch, things, inside, the, container, dot
|
468
|
-
|
469
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
434
|
+
literals = [tony, wants, to, know, what, is, inside, this, container, dot,
|
435
|
+
tony, tries, to, touch, things, inside, the, container, dot]
|
436
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
470
437
|
end
|
471
438
|
|
472
|
-
it '
|
439
|
+
it 'parses sample sentences from lesson 3-G' do
|
473
440
|
# Sentence 3-24a definiendum: 'You choose one of these things.'
|
474
441
|
literals = [you, choose, one, of, these, things, dot]
|
475
|
-
expect {
|
442
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
476
443
|
|
477
444
|
# Sentence 3-24b definiendum: 'There are two or more things you can do.
|
478
445
|
# If you do one of these, you cannot do another.
|
@@ -483,52 +450,49 @@ 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
|
-
|
453
|
+
you, can, not_, do_, another_as_pronoun, dot,
|
487
454
|
you, think, about, these_as_pronoun, and_,
|
488
|
-
|
455
|
+
what, you, want, to, do_, dot,
|
489
456
|
there, is, one, moment, when_, you, know, what, one, of, these_as_pronoun,
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
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]
|
462
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
497
463
|
|
498
464
|
# Sentence 3-25a definiendum: 'X is in a place between J and K.'
|
499
465
|
literals = [x_as_noun, is, in_, a_as_art, place, between, j_, and_, k_, dot]
|
500
|
-
expect {
|
466
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
501
467
|
|
502
468
|
# Sentence 3-25b definiens: X is in a place.
|
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
|
-
|
508
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
472
|
+
k_, is, on, the, other, side, of, x_as_noun, dot]
|
473
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
509
474
|
|
510
475
|
# Sentence 3-25c definiendum: 'X happens at a time between J and K.'
|
511
476
|
literals = [x_as_noun, happens, at, a_as_art, time, between, j_, and_, k_, dot]
|
512
|
-
expect {
|
477
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
513
478
|
|
514
479
|
# Sentence 3-25d definiens: X happens after J and before K
|
515
480
|
literals = [x_as_noun, happens, after_as_prep, j_, and_,
|
516
481
|
before_as_prep, k_, dot]
|
517
|
-
expect {
|
482
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
518
483
|
|
519
484
|
# Sentence 3-25e definiendum: 'X is between J and K.'
|
520
485
|
literals = [x_as_noun, is, between, j_, and_, k_, dot]
|
521
|
-
expect {
|
486
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
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
|
-
|
527
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
490
|
+
but, not_, more, than, k_, dot]
|
491
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
528
492
|
|
529
493
|
# Sentence 3-26a definiendum: 'X moved here from this other place.'
|
530
494
|
literals = [x_as_noun, moved, here, from, this, other, place, dot]
|
531
|
-
expect {
|
495
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
532
496
|
|
533
497
|
# Sentence 3-26b definiens: 'X was in this other place before
|
534
498
|
# it moved for some time. Because X moved, it is here after this,
|
@@ -536,13 +500,12 @@ 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
|
-
|
541
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
503
|
+
this_as_pronoun, comma, and_, it_, is, not_, in_, this, other, place, dot]
|
504
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
542
505
|
|
543
506
|
# Sentence 3-27a definiendum: 'X is a machine.'
|
544
507
|
literals = [x_as_noun, is, a_as_art, machine, dot]
|
545
|
-
expect {
|
508
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
546
509
|
|
547
510
|
# Sentence 3-27b definiens: 'X is something people make.
|
548
511
|
# When people make some things like X, they use many parts to make these things.
|
@@ -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
|
-
|
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
|
-
|
522
|
+
something, that, people, want, dot,
|
560
523
|
these, things, can, do_, more_as_adverb, than, people, can, do_,
|
561
|
-
|
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
|
-
|
564
|
-
|
565
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
526
|
+
to, move, dot]
|
527
|
+
expect { parser.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 = [
|
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
|
-
|
575
|
-
|
576
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
536
|
+
one, of, these, machines, dot, quote, dot]
|
537
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
577
538
|
end
|
578
|
-
|
579
|
-
it '
|
539
|
+
|
540
|
+
it 'parses sample sentences from lesson 3-H' do
|
580
541
|
# Sentence 3-28a definiendum: 'J damaged K.'
|
581
542
|
literals = [j_, damaged, k_, dot]
|
582
|
-
expect {
|
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.
|
543
|
+
expect { parser.to_pforest(literals) }.not_to raise_error
|
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
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
expect { subject.to_pforest(literals) }.not_to raise_error
|
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]
|
558
|
+
expect { parser.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 {
|
562
|
+
# expect { parser.to_pforest(literals) }.not_to raise_error
|
603
563
|
end
|
604
564
|
=begin
|
605
565
|
3-29. difficult.
|