zenlish 0.1.24 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +8 -8
- data/lib/zenlish/lang/dictionary.rb +6 -0
- data/lib/zenlish/lang/zenlish_grammar.rb +21 -12
- data/lib/zenlish/lex/empty_lexicon_factory.rb +48 -43
- data/lib/zenlish/version.rb +1 -1
- data/spec/zenlish/parser/lesson3_spec.rb +108 -0
- data/spec/zenlish/support/var2word.rb +11 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d2f0746a4aeb453208667a3e6eed3f97ffda61a31bb9b551f3f80a09e04881bd
|
|
4
|
+
data.tar.gz: 958188827568032a3a71cc8021c3b6bdbaab6ddcd56508c2e13b93773b073631
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 738bbeefbef76458d197b0dc5e7de3d9f0994304500933532da3a7935070a1981d8456e32e945c0d4f6e7e51f2f55389e9eb6debf7f945a2b441531a829e4963
|
|
7
|
+
data.tar.gz: 83237e8124d9d57ecd8d572b69ed88d26970c348ca2c2cef8b52a02a11a19d813eb867c1c44b56e9014a2e8f3bc5218e1ddf422cc08e42287f0b053bfdf9af7d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## [0.1.25] - 2019-12-06
|
|
4
|
+
__Zenlish__ can parse all sentences in lesson 1, 2 and 3-A .. 3-G (352 sentences in total) from
|
|
5
|
+
[Learn These Words First](http://learnthesewordsfirst.com/).
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- File `lesson3_spec.rb`: tests include all sentences from lesson 3-A to 3-G.
|
|
9
|
+
- `ZenlishGrammar`: refactoring of the predicative_sentence rules.
|
|
10
|
+
- File `dictionary.rb`: new entries in lexicon `between`, `choose`, `machine`.
|
|
11
|
+
- File `README.md` Updated the metrics table
|
|
12
|
+
|
|
3
13
|
## [0.1.24] - 2019-12-05
|
|
4
14
|
__Zenlish__ can parse all sentences in lesson 1, 2 and 3-A .. 3-F (323 sentences in total) from
|
|
5
15
|
[Learn These Words First](http://learnthesewordsfirst.com/).
|
data/README.md
CHANGED
|
@@ -20,7 +20,7 @@ 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-
|
|
23
|
+
sentences from lessons 1-A up to 3-G from
|
|
24
24
|
[Learn These Words First](http://learnthesewordsfirst.com/).
|
|
25
25
|
The parser is able to cope with syntactical ambiguities generating parse forests
|
|
26
26
|
instead of parse trees.
|
|
@@ -33,18 +33,18 @@ Over time, the zenlish gem will contain:
|
|
|
33
33
|
- A lexicon [STARTED]
|
|
34
34
|
- A context-free grammar [STARTED]
|
|
35
35
|
- A parser [STARTED]
|
|
36
|
-
- Feature unification (for number, gender agreement)[TODO]
|
|
36
|
+
- Feature unification (for number, gender agreement,...)[TODO]
|
|
37
37
|
- A simplified ontology[TODO]
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
#### Some project metrics (v. 0.1.
|
|
40
|
+
#### Some project metrics (v. 0.1.25)
|
|
41
41
|
|Metric|Value|
|
|
42
42
|
|:-:|:-:|
|
|
43
|
-
| Number of lemmas in dictionary |
|
|
43
|
+
| Number of lemmas in dictionary | 138 |
|
|
44
44
|
| [Coverage 100 commonest English words](https://en.wikipedia.org/wiki/Most_common_words_in_English) | 61% |
|
|
45
|
-
| Number of production rules in grammar |
|
|
46
|
-
| Number of lessons covered |
|
|
47
|
-
| Number of sentences in spec files |
|
|
45
|
+
| Number of production rules in grammar | 185 |
|
|
46
|
+
| Number of lessons covered | 23 |
|
|
47
|
+
| Number of sentences in spec files | 352 |
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
## Installation...
|
|
@@ -123,7 +123,7 @@ Litmus test: a Zenlish text should be easy to read to a English reading person.
|
|
|
123
123
|
Here a tentative roadmap:
|
|
124
124
|
|
|
125
125
|
#### A) Ability to parse sentences from [Learn These Words First](http://learnthesewordsfirst.com/)
|
|
126
|
-
*STARTED*.
|
|
126
|
+
*STARTED*. 24% complete
|
|
127
127
|
This website advocates the idea of a multi-layered dictionary.
|
|
128
128
|
At the core, there are about 300 essential words.
|
|
129
129
|
The choice of these words is inspired by the semantic primitives of [NSM
|
|
@@ -22,12 +22,14 @@ unless defined?(Zenlish::Lang::Dictionary)
|
|
|
22
22
|
add_entry('about', 'Preposition')
|
|
23
23
|
add_entry('above', 'Preposition')
|
|
24
24
|
add_entry('after', 'Adverb')
|
|
25
|
+
add_entry('after', 'Preposition')
|
|
25
26
|
add_entry('after', 'SubordinatingConjunction')
|
|
26
27
|
add_entry('alive', 'Adjective')
|
|
27
28
|
add_entry('all', 'FrontingQuantifier')
|
|
28
29
|
add_entry('and', 'Coordinator')
|
|
29
30
|
add_entry('animal', 'CommonNoun')
|
|
30
31
|
add_entry('another', 'Adjective')
|
|
32
|
+
add_entry('another', 'Pronoun')
|
|
31
33
|
add_entry('as', 'ComparativeParticle')
|
|
32
34
|
add_entry('at', 'Preposition')
|
|
33
35
|
add_entry('bad', 'Adjective')
|
|
@@ -37,15 +39,18 @@ unless defined?(Zenlish::Lang::Dictionary)
|
|
|
37
39
|
add_entry('become', 'IrregularLinkingVerb')
|
|
38
40
|
add_entry('before', 'Adverb')
|
|
39
41
|
add_entry('before', 'Adjective')
|
|
42
|
+
add_entry('before', 'Preposition')
|
|
40
43
|
add_entry('before', 'SubordinatingConjunction')
|
|
41
44
|
add_entry('belong', 'RegularVerb')
|
|
42
45
|
add_entry('below', 'Preposition')
|
|
46
|
+
add_entry('between', 'Preposition')
|
|
43
47
|
add_entry('big', 'Adjective')
|
|
44
48
|
add_entry('body', 'CommonNoun')
|
|
45
49
|
add_entry('but', 'Coordinator')
|
|
46
50
|
add_entry('can', 'ModalVerbCan')
|
|
47
51
|
add_entry('cause', 'RegularVerb')
|
|
48
52
|
add_entry('change', 'RegularVerb')
|
|
53
|
+
add_entry('choose', 'IrregularVerb')
|
|
49
54
|
add_entry('contain', 'RegularVerb')
|
|
50
55
|
add_entry('container', 'CommonNoun')
|
|
51
56
|
add_entry('could', 'ModalVerbCould')
|
|
@@ -80,6 +85,7 @@ unless defined?(Zenlish::Lang::Dictionary)
|
|
|
80
85
|
add_entry('live', 'RegularVerb')
|
|
81
86
|
add_entry('living', 'Adjective')
|
|
82
87
|
add_entry('long', 'Adjective')
|
|
88
|
+
add_entry('machine', 'CommonNoun')
|
|
83
89
|
add_entry('make', 'IrregularVerb')
|
|
84
90
|
add_entry('many', 'Quantifier')
|
|
85
91
|
add_entry('maybe', 'AdverbMaybe')
|
|
@@ -36,18 +36,17 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
|
36
36
|
# there + (auxiliary/raising verb) + be + notional subject.
|
|
37
37
|
rule 'existential_sentence' => 'ExistentialThere IrregularVerbBe existential_subject'
|
|
38
38
|
rule 'negative_sentence' => 'negative_tense_phrase'
|
|
39
|
-
rule 'negative_sentence' => 'negated_predicate_sentence'
|
|
40
39
|
rule 'inexistential_sentence' => 'ExistentialThere IrregularVerbBe AdverbNot existential_subject'
|
|
41
40
|
rule 'existential_subject' => 'noun_phrase adverb_phrase_opt'
|
|
42
41
|
rule 'existential_subject' => 'prepositional_phrase'
|
|
43
42
|
|
|
44
|
-
rule 'predicative_sentence' => 'noun_phrase
|
|
45
|
-
rule 'predicative_sentence' => 'conjunctive_prefix
|
|
46
|
-
rule '
|
|
47
|
-
rule 'negated_predicate_sentence' => 'conjunctive_prefix negation'
|
|
48
|
-
rule 'affirmation' => 'IrregularVerbBe predicative_complement'
|
|
49
|
-
rule 'negation' => 'IrregularVerbBe AdverbNot predicative_complement'
|
|
43
|
+
rule 'predicative_sentence' => 'noun_phrase adverb_phrase_opt assertion'
|
|
44
|
+
rule 'predicative_sentence' => 'conjunctive_prefix assertion'
|
|
45
|
+
rule 'assertion' => 'IrregularVerbBe adverb_not_opt predicative_complement'
|
|
50
46
|
rule 'predicative_complement' => 'noun_phrase'
|
|
47
|
+
# Sentence 3-25f definiens: X is more than J but not more than K
|
|
48
|
+
rule 'predicative_complement' => 'predicative_complement Coordinator adverb_not_opt predicative_complement'
|
|
49
|
+
rule 'adverb_not_opt' => 'AdverbNot'
|
|
51
50
|
# 3-22b: X is not the same as before.
|
|
52
51
|
rule 'predicative_complement' => 'noun_phrase ComparativeParticle Adverb'
|
|
53
52
|
rule 'predicative_complement' => 'adjective_phrase comparative_clause_opt'
|
|
@@ -59,15 +58,17 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
|
59
58
|
rule 'predicative_complement' => 'adverb_phrase_opt prepositional_phrase'
|
|
60
59
|
# something that was not here before.
|
|
61
60
|
rule 'predicative_complement' => 'adverb_phrase_star'
|
|
61
|
+
rule 'adverb_not_opt' => []
|
|
62
62
|
|
|
63
63
|
#################
|
|
64
64
|
# Complex sentence
|
|
65
65
|
#################
|
|
66
|
-
# Case of dropped ´that´ conjunction
|
|
67
66
|
rule 'complex_sentence' => 'AdverbMaybe complex_sentence'
|
|
68
67
|
rule 'complex_sentence' => 'main_clause comma_opt subordinated_clause'
|
|
69
68
|
rule 'complex_sentence' => 'main_clause comma_opt relative_clause'
|
|
70
69
|
rule 'complex_sentence' => 'main_clause comma_opt coordinate_clause'
|
|
70
|
+
# 3-27b: They can do more than people can do.
|
|
71
|
+
rule 'complex_sentence' => 'main_clause comma_opt comparative_clause'
|
|
71
72
|
# 3-22d: ..., it changed what I thought about them.
|
|
72
73
|
rule 'complex_sentence' => 'main_clause conjunctive_prefix'
|
|
73
74
|
# 3-22d: I cannot see what is inside.
|
|
@@ -79,6 +80,9 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
|
79
80
|
rule 'complex_sentence' => 'main_clause infinitive_clause'
|
|
80
81
|
# Colon used to introduce an explanatory sentence.
|
|
81
82
|
rule 'complex_sentence' => 'main_clause Colon sentence'
|
|
83
|
+
# sentence 3-24b: after this moment, you try for some time to do this one.
|
|
84
|
+
rule 'complex_sentence' => 'adverbial Comma main_clause'
|
|
85
|
+
rule 'adverbial' => 'adverb_phrase noun_phrase'
|
|
82
86
|
rule 'comma_opt' => 'Comma'
|
|
83
87
|
rule 'comma_opt' => []
|
|
84
88
|
|
|
@@ -94,6 +98,8 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
|
94
98
|
rule 'infinitive_clause' => 'verb_phrase' # Too broad
|
|
95
99
|
rule 'comparative_clause_opt' => 'comparative_clause'
|
|
96
100
|
rule 'comparative_clause_opt' => []
|
|
101
|
+
# 3-27b: they can do more than people can do AND more than people want to do.
|
|
102
|
+
rule 'comparative_clause' => 'comparative_clause Coordinator adverb_phrase comparative_clause'
|
|
97
103
|
rule 'comparative_clause' => 'comparative_start noun_phrase'
|
|
98
104
|
rule 'comparative_clause' => 'comparative_start declarative_simple_sentence'
|
|
99
105
|
# rule 'comparative_clause' => 'comparative_start DefiniteArticle Adjective Cardinal'
|
|
@@ -105,13 +111,14 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
|
105
111
|
rule 'relative_clause_opt' => []
|
|
106
112
|
rule 'relative_clause' => 'RelativePronoun tense_phrase'
|
|
107
113
|
# Sentence 3-Bxa 'Lisa sees a living thing that is very big.
|
|
108
|
-
rule 'relative_clause' => 'RelativePronoun affirmation'
|
|
109
114
|
# Sentence 3-18b: something that was not here before.
|
|
110
|
-
rule 'relative_clause' => 'RelativePronoun
|
|
115
|
+
rule 'relative_clause' => 'RelativePronoun assertion'
|
|
111
116
|
rule 'relative_clause' => 'identifying_clause'
|
|
112
|
-
rule 'coordinate_clause' => 'Coordinator
|
|
113
|
-
# Sentence 3-11b K happens because J happens or because J does something.
|
|
117
|
+
rule 'coordinate_clause' => 'Coordinator sentence'
|
|
118
|
+
# Sentence 3-11b: K happens because J happens or because J does something.
|
|
114
119
|
rule 'coordinate_clause' => 'Coordinator subordinated_clause'
|
|
120
|
+
# Sentence 3-24b: You think about these and what you want to do.
|
|
121
|
+
rule 'coordinate_clause' => 'Coordinator conjunctive_prefix'
|
|
115
122
|
|
|
116
123
|
# Implicit subject. 3-05b: I saw this thing and touched some of its parts.
|
|
117
124
|
rule 'coordinate_clause' => 'Coordinator tense_verb_phrase'
|
|
@@ -273,6 +280,8 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
|
273
280
|
######################
|
|
274
281
|
rule 'prepositional_phrases' => 'prepositional_phrases prepositional_phrase'
|
|
275
282
|
rule 'prepositional_phrases' => []
|
|
283
|
+
# Sentence 3-25b definiens: X happens after J and before K
|
|
284
|
+
rule 'prepositional_phrase' => 'prepositional_phrase Coordinator prepositional_phrase'
|
|
276
285
|
rule 'prepositional_phrase' => 'premodifier_prep preposition_head preposition_object'
|
|
277
286
|
# premodifier_prep => # "A degree word" example 1: _straight_ across the street example 2: _right_ from the start
|
|
278
287
|
rule 'premodifier_prep' => []
|
|
@@ -15,49 +15,49 @@ module Zenlish
|
|
|
15
15
|
private
|
|
16
16
|
|
|
17
17
|
def add_word_classes(aLexicon)
|
|
18
|
-
aLexicon
|
|
19
|
-
aLexicon
|
|
20
|
-
aLexicon
|
|
21
|
-
aLexicon
|
|
22
|
-
aLexicon
|
|
23
|
-
aLexicon
|
|
24
|
-
aLexicon
|
|
25
|
-
aLexicon
|
|
26
|
-
aLexicon
|
|
27
|
-
aLexicon
|
|
28
|
-
aLexicon
|
|
29
|
-
aLexicon
|
|
30
|
-
aLexicon
|
|
31
|
-
aLexicon
|
|
32
|
-
aLexicon
|
|
33
|
-
aLexicon
|
|
34
|
-
aLexicon
|
|
35
|
-
aLexicon
|
|
36
|
-
aLexicon
|
|
37
|
-
aLexicon
|
|
38
|
-
aLexicon
|
|
39
|
-
aLexicon
|
|
40
|
-
aLexicon
|
|
41
|
-
aLexicon
|
|
42
|
-
aLexicon
|
|
43
|
-
aLexicon
|
|
44
|
-
aLexicon
|
|
45
|
-
aLexicon
|
|
46
|
-
aLexicon
|
|
47
|
-
aLexicon
|
|
48
|
-
aLexicon
|
|
49
|
-
aLexicon
|
|
50
|
-
aLexicon
|
|
51
|
-
aLexicon
|
|
52
|
-
aLexicon
|
|
53
|
-
aLexicon
|
|
54
|
-
aLexicon
|
|
55
|
-
aLexicon
|
|
56
|
-
aLexicon
|
|
57
|
-
aLexicon
|
|
58
|
-
aLexicon
|
|
59
|
-
aLexicon
|
|
60
|
-
aLexicon
|
|
18
|
+
add_wclass(aLexicon, WClasses::Adjective)
|
|
19
|
+
add_wclass(aLexicon, WClasses::Adverb)
|
|
20
|
+
add_wclass(aLexicon, WClasses::AdverbMaybe)
|
|
21
|
+
add_wclass(aLexicon, WClasses::AdverbNot)
|
|
22
|
+
add_wclass(aLexicon, WClasses::AuxiliaryBe)
|
|
23
|
+
add_wclass(aLexicon, WClasses::AuxiliaryDo)
|
|
24
|
+
add_wclass(aLexicon, WClasses::Cardinal)
|
|
25
|
+
add_wclass(aLexicon, WClasses::CommonNoun)
|
|
26
|
+
add_wclass(aLexicon, WClasses::ComparativeParticle)
|
|
27
|
+
add_wclass(aLexicon, WClasses::ConjunctivePronoun)
|
|
28
|
+
add_wclass(aLexicon, WClasses::Coordinator)
|
|
29
|
+
add_wclass(aLexicon, WClasses::DefiniteArticle)
|
|
30
|
+
add_wclass(aLexicon, WClasses::DegreeAdverb)
|
|
31
|
+
add_wclass(aLexicon, WClasses::DemonstrativeDeterminer)
|
|
32
|
+
add_wclass(aLexicon, WClasses::DemonstrativePronoun)
|
|
33
|
+
add_wclass(aLexicon, WClasses::DistributiveDeterminer)
|
|
34
|
+
add_wclass(aLexicon, WClasses::ExistentialThere)
|
|
35
|
+
add_wclass(aLexicon, WClasses::FrontingQuantifier)
|
|
36
|
+
add_wclass(aLexicon, WClasses::IndefiniteArticle)
|
|
37
|
+
add_wclass(aLexicon, WClasses::IndefinitePronoun)
|
|
38
|
+
add_wclass(aLexicon, WClasses::IrregularLinkingVerb)
|
|
39
|
+
add_wclass(aLexicon, WClasses::IrregularVerb)
|
|
40
|
+
add_wclass(aLexicon, WClasses::IrregularVerbBe)
|
|
41
|
+
add_wclass(aLexicon, WClasses::IrregularVerbDo)
|
|
42
|
+
add_wclass(aLexicon, WClasses::IrregularVerbHave)
|
|
43
|
+
add_wclass(aLexicon, WClasses::IrregularVerbKnow)
|
|
44
|
+
add_wclass(aLexicon, WClasses::IrregularVerbSay)
|
|
45
|
+
add_wclass(aLexicon, WClasses::IrregularVerbThink)
|
|
46
|
+
add_wclass(aLexicon, WClasses::LinkingAdverb)
|
|
47
|
+
add_wclass(aLexicon, WClasses::ModalVerbCan)
|
|
48
|
+
add_wclass(aLexicon, WClasses::ModalVerbCould)
|
|
49
|
+
add_wclass(aLexicon, WClasses::PersonalPronoun)
|
|
50
|
+
add_wclass(aLexicon, WClasses::PossessiveDeterminer)
|
|
51
|
+
add_wclass(aLexicon, WClasses::Preposition)
|
|
52
|
+
add_wclass(aLexicon, WClasses::PrepositionOf)
|
|
53
|
+
add_wclass(aLexicon, WClasses::PrepositionThan)
|
|
54
|
+
add_wclass(aLexicon, WClasses::Pronoun)
|
|
55
|
+
add_wclass(aLexicon, WClasses::Quantifier)
|
|
56
|
+
add_wclass(aLexicon, WClasses::RegularVerb)
|
|
57
|
+
add_wclass(aLexicon, WClasses::RegularVerbWant)
|
|
58
|
+
add_wclass(aLexicon, WClasses::RelativePronoun)
|
|
59
|
+
add_wclass(aLexicon, WClasses::ProperNoun)
|
|
60
|
+
add_wclass(aLexicon, WClasses::SubordinatingConjunction)
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
def add_punctuation(aLexicon)
|
|
@@ -66,6 +66,11 @@ module Zenlish
|
|
|
66
66
|
aLexicon.add_terminal(Rley::Syntax::Terminal.new('Period'))
|
|
67
67
|
aLexicon.add_terminal(Rley::Syntax::Terminal.new('Quote'))
|
|
68
68
|
end
|
|
69
|
+
|
|
70
|
+
def add_wclass(aLexicon, aClass)
|
|
71
|
+
aLexicon.add_terminal(aClass.new.freeze)
|
|
72
|
+
end
|
|
73
|
+
|
|
69
74
|
end # module
|
|
70
75
|
end # module
|
|
71
76
|
end # module
|
data/lib/zenlish/version.rb
CHANGED
|
@@ -392,6 +392,7 @@ module Zenlish
|
|
|
392
392
|
]
|
|
393
393
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
|
394
394
|
end
|
|
395
|
+
|
|
395
396
|
it 'should parse sample sentences from lesson 3-F' do
|
|
396
397
|
# Sentence 3-21a definiendum: 'You try to do X.'
|
|
397
398
|
literals = [you, try_, to, do_, x_as_noun, dot]
|
|
@@ -467,6 +468,113 @@ module Zenlish
|
|
|
467
468
|
]
|
|
468
469
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
|
469
470
|
end
|
|
471
|
+
|
|
472
|
+
it 'should parse sample sentences from lesson 3-G' do
|
|
473
|
+
# Sentence 3-24a definiendum: 'You choose one of these things.'
|
|
474
|
+
literals = [you, choose, one, of, these, things, dot]
|
|
475
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
|
476
|
+
|
|
477
|
+
# Sentence 3-24b definiendum: 'There are two or more things you can do.
|
|
478
|
+
# If you do one of these, you cannot do another.
|
|
479
|
+
# You think about these and what you want to do.
|
|
480
|
+
# There is one moment when you know what one of these you want more,
|
|
481
|
+
# and after this moment, you try for some time to do this one.
|
|
482
|
+
# [You can choose to have one of these things.]
|
|
483
|
+
# [I chose this big one.]'
|
|
484
|
+
literals = [there, are, two, or_, more, things, you, can, do_, dot,
|
|
485
|
+
if_, you, do_, one, of, these_as_pronoun, comma,
|
|
486
|
+
you, can, not_, do_, another_as_pronoun, dot,
|
|
487
|
+
you, think, about, these_as_pronoun, and_,
|
|
488
|
+
what, you, want, to, do_, dot,
|
|
489
|
+
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
|
+
]
|
|
496
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
|
497
|
+
|
|
498
|
+
# Sentence 3-25a definiendum: 'X is in a place between J and K.'
|
|
499
|
+
literals = [x_as_noun, is, in_, a_as_art, place, between, j_, and_, k_, dot]
|
|
500
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
|
501
|
+
|
|
502
|
+
# Sentence 3-25b definiens: X is in a place.
|
|
503
|
+
# J is on one side of X, and K is on the other side of X.
|
|
504
|
+
literals = [x_as_noun, is, in_, a_as_art, place, dot,
|
|
505
|
+
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
|
|
509
|
+
|
|
510
|
+
# Sentence 3-25c definiendum: 'X happens at a time between J and K.'
|
|
511
|
+
literals = [x_as_noun, happens, at, a_as_art, time, between, j_, and_, k_, dot]
|
|
512
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
|
513
|
+
|
|
514
|
+
# Sentence 3-25d definiens: X happens after J and before K
|
|
515
|
+
literals = [x_as_noun, happens, after_as_prep, j_, and_,
|
|
516
|
+
before_as_prep, k_, dot]
|
|
517
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
|
518
|
+
|
|
519
|
+
# Sentence 3-25e definiendum: 'X is between J and K.'
|
|
520
|
+
literals = [x_as_noun, is, between, j_, and_, k_, dot]
|
|
521
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
|
522
|
+
|
|
523
|
+
# Sentence 3-25f definiens: X is more than J but not more than K.
|
|
524
|
+
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
|
|
528
|
+
|
|
529
|
+
# Sentence 3-26a definiendum: 'X moved here from this other place.'
|
|
530
|
+
literals = [x_as_noun, moved, here, from, this, other, place, dot]
|
|
531
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
|
532
|
+
|
|
533
|
+
# Sentence 3-26b definiens: 'X was in this other place before
|
|
534
|
+
# it moved for some time. Because X moved, it is here after this,
|
|
535
|
+
# and it is not in this other place.'
|
|
536
|
+
literals = [x_as_noun, was, in_, this, other, place, before,
|
|
537
|
+
it_, moved, for_, some, time, dot,
|
|
538
|
+
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
|
|
542
|
+
|
|
543
|
+
# Sentence 3-27a definiendum: 'X is a machine.'
|
|
544
|
+
literals = [x_as_noun, is, a_as_art, machine, dot]
|
|
545
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
|
546
|
+
|
|
547
|
+
# Sentence 3-27b definiens: 'X is something people make.
|
|
548
|
+
# When people make some things like X, they use many parts to make these things.
|
|
549
|
+
# Some parts of X move. Some parts can cause other parts to move.
|
|
550
|
+
# People make things like this because these things do something that people want.
|
|
551
|
+
# These things can do more than people can do and more than people want to do.
|
|
552
|
+
# [I used a machine to cause these big things to move.].'
|
|
553
|
+
literals = [x_as_noun, is, something, people, make, dot,
|
|
554
|
+
when_, people, make, some, things, like, x_as_noun, comma,
|
|
555
|
+
they, use, many, parts, to, make, these, things, dot,
|
|
556
|
+
some, parts, of, x_as_noun, move, dot,
|
|
557
|
+
some, parts, can, cause, other, parts, to, move, dot,
|
|
558
|
+
people, make, things, like, this_as_pronoun, because, these, things, do_,
|
|
559
|
+
something, that, people, want, dot,
|
|
560
|
+
these, things, can, do_, more_as_adverb, than, people, can, do_,
|
|
561
|
+
and_, more_as_adverb, than, people, want, to, do_, dot,
|
|
562
|
+
i_pronoun, used, a_as_art, machine, to, cause, these, big, things,
|
|
563
|
+
to, move, dot
|
|
564
|
+
]
|
|
565
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
|
566
|
+
|
|
567
|
+
# Sentence 3-G xtra: Tony wants to make something using a machine.
|
|
568
|
+
# Tony is between two different machines.
|
|
569
|
+
# Tony says: "I can choose to use one of these machines."
|
|
570
|
+
literals = [ tony, wants, to, make, something, using, a_as_art,
|
|
571
|
+
machine, dot,
|
|
572
|
+
tony, is, between, two, different, machines, dot,
|
|
573
|
+
tony, says, colon, quote, i_pronoun, can, choose, to, use,
|
|
574
|
+
one, of, these, machines, dot, quote, dot
|
|
575
|
+
]
|
|
576
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
|
577
|
+
end
|
|
470
578
|
end # context
|
|
471
579
|
end # describe
|
|
472
580
|
end # module
|
|
@@ -24,6 +24,7 @@ module Zenlish
|
|
|
24
24
|
literal2var('about', 'about')
|
|
25
25
|
literal2var('above', 'above')
|
|
26
26
|
def after_adverb ; Lex::Literal.new('after', get_lexeme('after', WClasses::Adverb), 0) ; end
|
|
27
|
+
def after_as_prep ; Lex::Literal.new('after', get_lexeme('after', WClasses::Preposition), 0) ; end
|
|
27
28
|
def after_ ; Lex::Literal.new('after', get_lexeme('after', WClasses::SubordinatingConjunction), 0) ; end
|
|
28
29
|
literal2var('alive', 'alive')
|
|
29
30
|
literal2var('all', 'all')
|
|
@@ -31,8 +32,9 @@ module Zenlish
|
|
|
31
32
|
literal2var('and', 'and', '_')
|
|
32
33
|
literal2var('animal', 'animal')
|
|
33
34
|
literal2var('animal', 'animals')
|
|
34
|
-
|
|
35
|
-
def
|
|
35
|
+
def another ; Lex::Literal.new('another', get_lexeme('another', WClasses::Adjective), 0) ; end
|
|
36
|
+
def another_as_pronoun ; Lex::Literal.new('another', get_lexeme('another', WClasses::Pronoun), 0) ; end
|
|
37
|
+
def are ; Lex::Literal.new('are', get_lexeme('be', WClasses::IrregularVerbBe), 0) ; end
|
|
36
38
|
literal2var('as', 'as')
|
|
37
39
|
literal2var('at', 'at')
|
|
38
40
|
literal2var('bad', 'bad')
|
|
@@ -43,10 +45,12 @@ module Zenlish
|
|
|
43
45
|
literal2var('become', 'becomes')
|
|
44
46
|
def before_adverb ; Lex::Literal.new('before', get_lexeme('before', WClasses::Adverb), 0) ; end
|
|
45
47
|
def before_as_adj ; Lex::Literal.new('before', get_lexeme('before', WClasses::Adjective), 0) ; end
|
|
48
|
+
def before_as_prep ; Lex::Literal.new('before', get_lexeme('before', WClasses::Preposition), 0) ; end
|
|
46
49
|
def before ; Lex::Literal.new('before', get_lexeme('before', WClasses::SubordinatingConjunction), 0) ; end
|
|
47
50
|
literal2var('belong', 'belong')
|
|
48
51
|
literal2var('belong', 'belongs')
|
|
49
52
|
literal2var('below', 'below')
|
|
53
|
+
literal2var('between', 'between')
|
|
50
54
|
literal2var('big', 'big')
|
|
51
55
|
literal2var('big', 'bigger')
|
|
52
56
|
literal2var('body', 'body')
|
|
@@ -58,6 +62,8 @@ module Zenlish
|
|
|
58
62
|
literal2var('change', 'change', '_')
|
|
59
63
|
literal2var('change', 'changed')
|
|
60
64
|
literal2var('change', 'changes')
|
|
65
|
+
literal2var('choose', 'choose')
|
|
66
|
+
literal2var('choose', 'chose')
|
|
61
67
|
literal2var('contain', 'contain')
|
|
62
68
|
literal2var('contain', 'contains')
|
|
63
69
|
literal2var('container', 'container')
|
|
@@ -118,6 +124,8 @@ module Zenlish
|
|
|
118
124
|
literal2var('live', 'lived')
|
|
119
125
|
literal2var('living', 'living')
|
|
120
126
|
literal2var('long', 'long')
|
|
127
|
+
literal2var('machine', 'machine')
|
|
128
|
+
literal2var('machine', 'machines')
|
|
121
129
|
literal2var('make', 'made')
|
|
122
130
|
literal2var('make', 'make')
|
|
123
131
|
literal2var('many', 'many')
|
|
@@ -199,6 +207,7 @@ module Zenlish
|
|
|
199
207
|
def two_as_pronoun ; Lex::Literal.new('two', get_lexeme('two', WClasses::IndefinitePronoun), 0) ; end
|
|
200
208
|
literal2var('use', 'use')
|
|
201
209
|
literal2var('use', 'used')
|
|
210
|
+
literal2var('use', 'using')
|
|
202
211
|
literal2var('very', 'very')
|
|
203
212
|
literal2var('want', 'want')
|
|
204
213
|
literal2var('want', 'wants')
|