zenlish 0.1.19 → 0.1.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +7 -7
- data/lib/zenlish/lang/dictionary.rb +5 -1
- data/lib/zenlish/lang/zenlish_grammar.rb +34 -38
- data/lib/zenlish/version.rb +1 -1
- data/spec/zenlish/parser/zparser_spec.rb +88 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3519feabe83a0684d2c2db5d0f9ea30723d8dc70e53d339a8aa9f36e3f24c47
|
4
|
+
data.tar.gz: d625df15958d87ee74bd7ea24bb94ca38fb9a64332cbfc394e43881beaa456e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da5d57f4213d57e6354b437ce1b349904bfc581446b37769c08be6f8fa46a86dea8f23445652d47ba61c58cde83a7f13c8af0bc3b98b2ad7b1dabb0e14652d78
|
7
|
+
data.tar.gz: 9c563f5bb79fabc14d78e62ecf1fec0926228c5484059c76bcd89a0885f4a16d5733f4afaef2b7e2ffe7271b9cf0a62ed01e3de63e3ae57783f29f5195668215
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## [0.1.20] - 2019-11-30
|
4
|
+
__Zenlish__ can parse all sentences in lesson 1, 2 and 3-A .. 3-C from
|
5
|
+
[Learn These Words First](http://learnthesewordsfirst.com/).
|
6
|
+
|
7
|
+
### Added
|
8
|
+
- Class `PossessiveDeterminer` to represent the posessive determiners `its`, `my`, `their`, `your`.
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
- File `zparser_spec.rb`: tests include all sentences from lesson 1, 2, and 3-C (255 sentences in total).
|
12
|
+
- `ZenlishGrammar`: new production rules added (especially for posessive determiners a multiple sentences in direct speech).
|
13
|
+
- File `dictionary.rb`: new entries in lexicon `animal`, `but`, `cause`.
|
14
|
+
- File `README.md` Updated the metrics table
|
15
|
+
|
3
16
|
## [0.1.19] - 2019-11-28
|
4
17
|
__Zenlish__ can parse all sentences in lesson 1, 2 and 3-A .. 3-B from
|
5
18
|
[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-C. The parser is able to cope with syntactical
|
24
24
|
ambiguities generating parse forests instead of parse trees.
|
25
25
|
|
26
26
|
The intent is to deliver gem versions in small increments.
|
@@ -38,11 +38,11 @@ Over time, the zenlish gem will contain:
|
|
38
38
|
#### Some project metrics (v. 0.1.15)
|
39
39
|
|Metric|Value|
|
40
40
|
|:-:|:-:|
|
41
|
-
| Number of lemmas in dictionary |
|
42
|
-
| [Coverage 100 commonest English words](https://en.wikipedia.org/wiki/Most_common_words_in_English) |
|
43
|
-
| Number of production rules in grammar |
|
44
|
-
| Number of lessons covered |
|
45
|
-
| Number of sentences in spec files |
|
41
|
+
| Number of lemmas in dictionary | 115 |
|
42
|
+
| [Coverage 100 commonest English words](https://en.wikipedia.org/wiki/Most_common_words_in_English) | 57% |
|
43
|
+
| Number of production rules in grammar | 160 |
|
44
|
+
| Number of lessons covered | 19 |
|
45
|
+
| Number of sentences in spec files | 273 |
|
46
46
|
|
47
47
|
|
48
48
|
## Installation...
|
@@ -121,7 +121,7 @@ Litmus test: a Zenlish text should be easy to read to a English reading person.
|
|
121
121
|
Here a tentative roadmap:
|
122
122
|
|
123
123
|
#### A) Ability to parse sentences from [Learn These Words First](http://learnthesewordsfirst.com/)
|
124
|
-
*STARTED*.
|
124
|
+
*STARTED*. 19.8% complete
|
125
125
|
This website advocates the idea of a multi-layered dictionary.
|
126
126
|
At the core, there are about 300 essential words.
|
127
127
|
The choice of these words is inspired by the semantic primitives of [NSM
|
@@ -26,6 +26,7 @@ unless defined?(Zenlish::Lang::Dictionary)
|
|
26
26
|
add_entry('alive', 'Adjective')
|
27
27
|
add_entry('all', 'IndefiniteQuantifier')
|
28
28
|
add_entry('and', 'Coordinator')
|
29
|
+
add_entry('animal', 'CommonNoun')
|
29
30
|
add_entry('another', 'Adjective')
|
30
31
|
add_entry('as', 'ComparativeParticle')
|
31
32
|
add_entry('at', 'Preposition')
|
@@ -34,12 +35,15 @@ unless defined?(Zenlish::Lang::Dictionary)
|
|
34
35
|
add_entry('be', 'IrregularVerbBe')
|
35
36
|
add_entry('because', 'SubordinatingConjunction')
|
36
37
|
add_entry('before', 'Adverb')
|
38
|
+
add_entry('before', 'Adjective')
|
37
39
|
add_entry('before', 'SubordinatingConjunction')
|
38
40
|
add_entry('belong', 'RegularVerb')
|
39
41
|
add_entry('below', 'Preposition')
|
40
42
|
add_entry('big', 'Adjective')
|
41
43
|
add_entry('body', 'CommonNoun')
|
44
|
+
add_entry('but', 'Coordinator')
|
42
45
|
add_entry('can', 'ModalVerbCan')
|
46
|
+
add_entry('cause', 'RegularVerb')
|
43
47
|
add_entry('die', 'RegularVerb')
|
44
48
|
add_entry('do', 'AuxiliaryDo')
|
45
49
|
add_entry('do', 'IrregularVerbDo')
|
@@ -52,7 +56,7 @@ unless defined?(Zenlish::Lang::Dictionary)
|
|
52
56
|
add_entry('good', 'Adjective')
|
53
57
|
add_entry('have', 'IrregularVerbHave')
|
54
58
|
add_entry('happen', 'RegularVerb')
|
55
|
-
add_entry('hear', '
|
59
|
+
add_entry('hear', 'IrregularLinkingVerb')
|
56
60
|
add_entry('here', 'Adverb')
|
57
61
|
add_entry('here', 'CommonNoun') # from here (works as a pronoun of a place)
|
58
62
|
add_entry('I', 'PersonalPronoun')
|
@@ -4,39 +4,25 @@
|
|
4
4
|
require 'rley' # Load the Rley parsing library
|
5
5
|
require_relative 'dictionary'
|
6
6
|
|
7
|
-
# Carnie 2012
|
8
|
-
# CP ➝ (C) TP
|
9
|
-
# TP ➝ {NP/CP} (T) VP
|
10
|
-
# VP ➝(AdvP+) V (NP)({NP/CP}) (AdvP+) (PP+) (AdvP+)
|
11
|
-
# NP ➝ (D) (AdjP+) N (PP+) (CP)
|
12
|
-
# PP ➝ P (NP)
|
13
|
-
# AdjP ➝ (AdvP) Adj
|
14
|
-
# AdvP ➝ (AdvP) Adv
|
15
|
-
|
16
|
-
# Slide show on ajective and adverb phrases
|
17
|
-
# https://www.slideshare.net/UtTramTran/advadj-phrase
|
18
|
-
|
19
|
-
# A Lexicalized Tree Adjoining Grammar for English
|
20
|
-
# https://www.cis.upenn.edu/~xtag/tech-report/tech-report.html
|
21
|
-
|
22
|
-
|
23
7
|
########################################
|
24
8
|
# Define a grammar for a highly English-like language
|
25
9
|
builder = Rley::Syntax::GrammarBuilder.new do
|
26
10
|
add_terminals(*Zenlish::Lang::Dictionary.terminals)
|
27
11
|
|
28
12
|
rule 'zenlish' => 'prose'
|
29
|
-
rule 'prose' => 'sentence'
|
30
|
-
rule 'prose' => 'prose sentence'
|
13
|
+
rule 'prose' => 'sentence Period'
|
14
|
+
rule 'prose' => 'prose sentence Period'
|
31
15
|
|
32
|
-
rule 'sentence' => 'simple_sentence
|
33
|
-
rule 'sentence' => 'complex_sentence
|
16
|
+
rule 'sentence' => 'simple_sentence'
|
17
|
+
rule 'sentence' => 'complex_sentence'
|
34
18
|
|
35
19
|
#################
|
36
20
|
# Simple sentence
|
37
21
|
#################
|
22
|
+
rule 'simple_sentence' => 'front_adverb simple_sentence'
|
23
|
+
rule 'front_adverb' => 'AdverbMaybe'
|
24
|
+
rule 'front_adverb' => 'Adverb'
|
38
25
|
rule 'simple_sentence' => 'declarative_simple_sentence'
|
39
|
-
rule 'simple_sentence' => 'AdverbMaybe declarative_simple_sentence'
|
40
26
|
rule 'declarative_simple_sentence' => 'affirmative_sentence'
|
41
27
|
rule 'declarative_simple_sentence' => 'existential_sentence'
|
42
28
|
rule 'declarative_simple_sentence' => 'predicative_sentence'
|
@@ -55,10 +41,12 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
55
41
|
rule 'existential_subject' => 'noun_phrase adverb_phrase_opt'
|
56
42
|
rule 'existential_subject' => 'prepositional_phrase'
|
57
43
|
|
58
|
-
rule 'predicative_sentence' => 'noun_phrase
|
59
|
-
rule 'predicative_sentence' => 'conjunctive_prefix
|
60
|
-
rule 'negated_predicate_sentence' => 'noun_phrase adverb_phrase_opt
|
61
|
-
rule 'negated_predicate_sentence' => 'conjunctive_prefix
|
44
|
+
rule 'predicative_sentence' => 'noun_phrase affirmation'
|
45
|
+
rule 'predicative_sentence' => 'conjunctive_prefix affirmation'
|
46
|
+
rule 'negated_predicate_sentence' => 'noun_phrase adverb_phrase_opt negation'
|
47
|
+
rule 'negated_predicate_sentence' => 'conjunctive_prefix negation'
|
48
|
+
rule 'affirmation' => 'IrregularVerbBe predicative_complement'
|
49
|
+
rule 'negation' => 'IrregularVerbBe AdverbNot predicative_complement'
|
62
50
|
rule 'predicative_complement' => 'noun_phrase'
|
63
51
|
rule 'predicative_complement' => 'adjective_phrase comparative_clause_opt'
|
64
52
|
# 3-02d J is one that does this.
|
@@ -72,6 +60,7 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
72
60
|
# Complex sentence
|
73
61
|
#################
|
74
62
|
# Case of dropped ´that´ conjunction
|
63
|
+
rule 'complex_sentence' => 'AdverbMaybe complex_sentence'
|
75
64
|
rule 'complex_sentence' => 'main_clause comma_opt subordinated_clause'
|
76
65
|
rule 'complex_sentence' => 'main_clause comma_opt relative_clause'
|
77
66
|
rule 'complex_sentence' => 'main_clause comma_opt coordinate_clause'
|
@@ -88,7 +77,7 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
88
77
|
######################
|
89
78
|
# CLAUSES
|
90
79
|
######################
|
91
|
-
rule 'main_clause' => '
|
80
|
+
rule 'main_clause' => 'sentence'
|
92
81
|
rule 'subordinated_clause' => 'subordination_marker dependent_clause'
|
93
82
|
rule 'subordination_marker' => 'SubordinatingConjunction'
|
94
83
|
rule 'subordination_marker' => 'SubordinatingConjunction PrepositionOf'
|
@@ -103,23 +92,29 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
103
92
|
rule 'comparative_start' => 'PrepositionThan'
|
104
93
|
rule 'comparative_start' => 'ComparativeParticle'
|
105
94
|
rule 'conjunctive_prefix' => 'ConjunctivePronoun noun_phrase verb_phrase'
|
106
|
-
rule 'identifying_clause' => 'RelativePronoun
|
95
|
+
rule 'identifying_clause' => 'RelativePronoun tense_verb_phrase'
|
107
96
|
rule 'relative_clause_opt' => 'relative_clause'
|
108
97
|
rule 'relative_clause_opt' => []
|
109
98
|
rule 'relative_clause' => 'RelativePronoun tense_phrase'
|
110
99
|
# Sentence 3-Bxa 'Lisa sees a living thing that is very big.
|
111
|
-
rule 'relative_clause' => 'RelativePronoun
|
100
|
+
rule 'relative_clause' => 'RelativePronoun affirmation'
|
112
101
|
rule 'relative_clause' => 'identifying_clause'
|
113
102
|
rule 'coordinate_clause' => 'Coordinator simple_sentence'
|
103
|
+
# Sentence 3-11b K happens because J happens or because J does something.
|
104
|
+
rule 'coordinate_clause' => 'Coordinator subordinated_clause'
|
105
|
+
|
114
106
|
# Implicit subject. 3-05b: I saw this thing and touched some of its parts.
|
115
|
-
rule 'coordinate_clause' => 'Coordinator
|
107
|
+
rule 'coordinate_clause' => 'Coordinator tense_verb_phrase'
|
116
108
|
|
117
109
|
|
118
110
|
##############
|
119
111
|
# TENSE PHRASE
|
120
112
|
##############
|
121
|
-
|
122
|
-
rule '
|
113
|
+
# Leading adverb phrase: now I see it. now is an adjunct)
|
114
|
+
rule 'tense_phrase' => 'adverb_phrase_opt noun_phrase tense_verb_phrase'
|
115
|
+
rule 'negative_tense_phrase' => 'noun_phrase negative_tense_verb_phrase'
|
116
|
+
rule 'tense_verb_phrase' => 'tense_opt verb_phrase'
|
117
|
+
rule 'negative_tense_verb_phrase' => 'tense_opt AdverbNot verb_phrase'
|
123
118
|
rule 'tense_opt' => 'tense'
|
124
119
|
rule 'tense_opt' => []
|
125
120
|
rule 'tense' => 'AuxiliaryBe'
|
@@ -149,11 +144,10 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
149
144
|
rule 'clause_noun' => 'comparative_clause'
|
150
145
|
rule 'clause_noun' => 'dependent_clause'
|
151
146
|
|
152
|
-
|
153
147
|
#############
|
154
148
|
# DETERMINERS
|
155
149
|
#############
|
156
|
-
rule 'determiners' => 'predeterminers
|
150
|
+
rule 'determiners' => 'predeterminers central_determiner postdeterminers'
|
157
151
|
|
158
152
|
# Pre-determiners
|
159
153
|
rule 'predeterminers' => 'IndefiniteQuantifier' # all, ... both, half
|
@@ -164,10 +158,10 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
164
158
|
rule 'partitive_predeterminer' => 'IndefiniteQuantifier PrepositionOf' # some of...
|
165
159
|
|
166
160
|
# Central determiners: article, demonstrative or possessive
|
167
|
-
rule '
|
168
|
-
rule '
|
169
|
-
rule '
|
170
|
-
rule '
|
161
|
+
rule 'central_determiner' => 'article'
|
162
|
+
rule 'central_determiner' => 'demonstrative'
|
163
|
+
rule 'central_determiner' => 'PossessiveDeterminer'
|
164
|
+
rule 'central_determiner' => []
|
171
165
|
rule 'article' => 'DefiniteArticle' # 'the'
|
172
166
|
rule 'article' => 'IndefiniteArticle' # 'a/an', .., any, some, that, those,
|
173
167
|
rule 'demonstrative' => 'DemonstrativeDeterminer' # 'this', .., that, these, those
|
@@ -177,12 +171,15 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
177
171
|
rule 'postdeterminers' => 'numeral'
|
178
172
|
rule 'postdeterminers' => []
|
179
173
|
|
174
|
+
|
180
175
|
#############
|
181
176
|
# VERB PHRASE
|
182
177
|
#############
|
183
178
|
rule 'verb_phrase' => 'pre_head_vp head_vp post_head_vp'
|
184
179
|
# Rule specific to linking/copular verbs (CEG 288b). Example: I feel very bad.
|
185
180
|
rule 'verb_phrase' => 'pre_head_vp linking_verb adjective_phrase'
|
181
|
+
# Sentence 3-12b: Maybe when some people hear J is true
|
182
|
+
rule 'verb_phrase' => 'pre_head_vp linking_verb dependent_clause'
|
186
183
|
rule 'pre_head_vp' => 'adverb_phrase_opt'
|
187
184
|
rule 'head_vp' => 'lexical_verb'
|
188
185
|
rule 'head_vp' => 'IrregularVerbSay direct_speech'
|
@@ -205,7 +202,6 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
205
202
|
rule 'lexical_verb' => 'IrregularVerbSay'
|
206
203
|
rule 'lexical_verb' => 'IrregularVerbThink'
|
207
204
|
|
208
|
-
|
209
205
|
rule 'linking_verb' => 'IrregularLinkingVerb'
|
210
206
|
|
211
207
|
rule 'mental_verb' => 'IrregularVerbKnow'
|
data/lib/zenlish/version.rb
CHANGED
@@ -40,6 +40,7 @@ module Zenlish
|
|
40
40
|
literal2var('all', 'all')
|
41
41
|
def am ; Lex::Literal.new('am', get_lexeme('be', WClasses::IrregularVerbBe), 0) ; end
|
42
42
|
literal2var('and', 'and', '_')
|
43
|
+
literal2var('animal', 'animal')
|
43
44
|
literal2var('another', 'another')
|
44
45
|
def are ; Lex::Literal.new('are', get_lexeme('be', WClasses::IrregularVerbBe), 0) ; end
|
45
46
|
literal2var('as', 'as')
|
@@ -48,6 +49,7 @@ module Zenlish
|
|
48
49
|
def be_ ; Lex::Literal.new('be', get_lexeme('be', WClasses::IrregularVerbBe), 0) ; end
|
49
50
|
literal2var('because', 'because')
|
50
51
|
def before_adverb ; Lex::Literal.new('before', get_lexeme('before', WClasses::Adverb), 0) ; end
|
52
|
+
def before_as_adj ; Lex::Literal.new('before', get_lexeme('before', WClasses::Adjective), 0) ; end
|
51
53
|
def before ; Lex::Literal.new('before', get_lexeme('before', WClasses::SubordinatingConjunction), 0) ; end
|
52
54
|
literal2var('belong', 'belong')
|
53
55
|
literal2var('belong', 'belongs')
|
@@ -55,8 +57,12 @@ module Zenlish
|
|
55
57
|
literal2var('big', 'big')
|
56
58
|
literal2var('big', 'bigger')
|
57
59
|
literal2var('body', 'body')
|
60
|
+
literal2var('but', 'but')
|
58
61
|
literal2var('can', 'can')
|
62
|
+
literal2var('cause', 'caused')
|
63
|
+
literal2var('cause', 'causes')
|
59
64
|
def did ; Lex::Literal.new('did', get_lexeme('do', WClasses::IrregularVerbDo), 0) ; end
|
65
|
+
literal2var('die', 'die')
|
60
66
|
literal2var('die', 'died')
|
61
67
|
literal2var('die', 'dies')
|
62
68
|
def do_ ; Lex::Literal.new('do', get_lexeme('do', WClasses::IrregularVerbDo), 0) ; end
|
@@ -78,6 +84,7 @@ module Zenlish
|
|
78
84
|
literal2var('happen', 'happens')
|
79
85
|
literal2var('have', 'has')
|
80
86
|
literal2var('have', 'have')
|
87
|
+
literal2var('hear', 'hear')
|
81
88
|
literal2var('hear', 'heard')
|
82
89
|
literal2var('hear', 'hears')
|
83
90
|
def here ; Lex::Literal.new('here', get_lexeme('here', WClasses::Adverb), 0) ; end
|
@@ -93,6 +100,7 @@ module Zenlish
|
|
93
100
|
def is_aux ; Lex::Literal.new('is', get_lexeme('be', WClasses::AuxiliaryBe), 0) ; end
|
94
101
|
literal2var('K', 'k', '_')
|
95
102
|
literal2var('kind', 'kind')
|
103
|
+
literal2var('kind', 'kinds')
|
96
104
|
literal2var('know', 'knew')
|
97
105
|
literal2var('know', 'know')
|
98
106
|
literal2var('know', 'knows')
|
@@ -137,6 +145,7 @@ module Zenlish
|
|
137
145
|
literal2var('small', 'small')
|
138
146
|
literal2var('small', 'smaller')
|
139
147
|
literal2var('some', 'some')
|
148
|
+
literal2var('say', 'say')
|
140
149
|
literal2var('say', 'said')
|
141
150
|
literal2var('say', 'says')
|
142
151
|
literal2var('see', 'see')
|
@@ -1086,8 +1095,7 @@ module Zenlish
|
|
1086
1095
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
1087
1096
|
|
1088
1097
|
# Sentence 3-04a definiendum: 'It does something.'
|
1089
|
-
literals = [it_, does, something, dot
|
1090
|
-
]
|
1098
|
+
literals = [it_, does, something, dot]
|
1091
1099
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
1092
1100
|
|
1093
1101
|
# Sentence 3-04b definiens: 'This thing does something.'
|
@@ -1131,13 +1139,11 @@ module Zenlish
|
|
1131
1139
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
1132
1140
|
|
1133
1141
|
# Sentence 3-05d definiens: 'These things belong to them.
|
1134
|
-
literals = [these, things, belong, to, them, dot
|
1135
|
-
]
|
1142
|
+
literals = [these, things, belong, to, them, dot]
|
1136
1143
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
1137
1144
|
|
1138
1145
|
# Sentence 3-06a definiendum: 'This is your X.'
|
1139
|
-
literals = [this_as_pronoun, is, your, x_as_noun, dot
|
1140
|
-
]
|
1146
|
+
literals = [this_as_pronoun, is, your, x_as_noun, dot]
|
1141
1147
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
1142
1148
|
|
1143
1149
|
# Sentence 3-06b definien: 'This X belongs to you.
|
@@ -1160,18 +1166,17 @@ module Zenlish
|
|
1160
1166
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
1161
1167
|
|
1162
1168
|
# Sentence 3-08a definiendum: 'There is an X here.'
|
1163
|
-
literals = [there, is, an, x_as_noun, here, dot
|
1164
|
-
]
|
1169
|
+
literals = [there, is, an, x_as_noun, here, dot]
|
1165
1170
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
1166
1171
|
|
1167
|
-
# Sentence 3-
|
1172
|
+
# Sentence 3-08b definiens: 'X is some kind of thing.
|
1168
1173
|
# There is one of this kind of thing here.
|
1169
1174
|
# This is not one that you said something about a short time before now.
|
1170
1175
|
# [I did not know there was a person in this place.]
|
1171
1176
|
literals = [x_as_noun, is, some, kind, of, thing, dot,
|
1172
1177
|
there, is, one, of, this, kind, of, thing, here, dot,
|
1173
1178
|
this_as_pronoun, is, not_, one_as_adj, that, you, said, something,
|
1174
|
-
about, a_as_art, short, time,
|
1179
|
+
about, a_as_art, short, time, before_as_adj, now_as_noun, dot
|
1175
1180
|
]
|
1176
1181
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
1177
1182
|
|
@@ -1184,6 +1189,79 @@ module Zenlish
|
|
1184
1189
|
]
|
1185
1190
|
expect { subject.to_pforest(literals) }.not_to raise_error
|
1186
1191
|
end
|
1192
|
+
|
1193
|
+
it 'should parse sample sentences from lesson 3-C' do
|
1194
|
+
# Sentence 3-09a definiendum: 'Something happens to the X.'
|
1195
|
+
literals = [something, happens, to, the, x_as_noun, dot]
|
1196
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
1197
|
+
|
1198
|
+
# Sentence 3-09b definiens: Something happens to X.
|
1199
|
+
# This is the same X that someone said something about a short time before,
|
1200
|
+
# or there is not another thing that is the same kind as X.
|
1201
|
+
# [I saw two people here before, and now I do not see the people.]
|
1202
|
+
literals = [something, happens, to, x_as_noun, dot,
|
1203
|
+
this_as_pronoun, is, the, same, x_as_noun, that, someone, said, something, about,
|
1204
|
+
a_as_art, short, time, before_as_adj, comma,
|
1205
|
+
or_, there, is, not_, another, thing, that, is, the, same, kind,
|
1206
|
+
as, x_as_noun, dot,
|
1207
|
+
i_pronoun, saw, two, people, here, before_adverb, comma,
|
1208
|
+
and_, now, i_pronoun, do_aux, not_, see, the, people, dot
|
1209
|
+
]
|
1210
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
1211
|
+
|
1212
|
+
# Sentence 3-10a definiendum: 'X is an animal.'
|
1213
|
+
literals = [x_as_noun, is, an, animal, dot]
|
1214
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
1215
|
+
|
1216
|
+
# Sentence 3-10b definiens: There are many kinds of living things
|
1217
|
+
# that can feel and can move when they want. X is one of these.
|
1218
|
+
# [The animal moved when someone touched its body.]
|
1219
|
+
literals = [ there, are, many, kinds, of, living, things,
|
1220
|
+
that, can, feel, and_, can, move, when_, they, want, dot,
|
1221
|
+
x_as_noun, is, one, of, these_as_pronoun, dot,
|
1222
|
+
the, animal, moved, when_, someone, touched, its, body, dot
|
1223
|
+
]
|
1224
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
1225
|
+
|
1226
|
+
# Sentence 3-11a definiendum: 'J causes K to happen.'
|
1227
|
+
literals = [j_, causes, k_, to, happen, dot]
|
1228
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
1229
|
+
|
1230
|
+
# Sentence 3-11b definiens: K happens because J happens
|
1231
|
+
# or because J does something.
|
1232
|
+
# [Someone bad caused these people to die.]
|
1233
|
+
literals = [ k_, happens, because, j_, happens,
|
1234
|
+
or_, because, j_, does, something, dot,
|
1235
|
+
something, bad, caused, these, people, to, die, dot
|
1236
|
+
]
|
1237
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
1238
|
+
|
1239
|
+
# Sentence 3-12a definiendum: 'J is true, but K is not true.'
|
1240
|
+
literals = [j_, is, true_, comma, but, k_, is, not_, true_, dot]
|
1241
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
1242
|
+
|
1243
|
+
# Sentence 3-12b definiens: You say J is true.
|
1244
|
+
# Maybe when some people hear J is true,
|
1245
|
+
# they think K is true because of this.
|
1246
|
+
# You want them to know K is not true, and you say this.
|
1247
|
+
# [I hear Tony, but I do not see Tony.]
|
1248
|
+
literals = [ maybe, when_, some, people, hear, j_, is, true_, comma,
|
1249
|
+
they, think, k_, is, true_, because, of, this_as_pronoun, dot,
|
1250
|
+
you, want, them, to, know, k_, is, not_, true_, comma,
|
1251
|
+
and_, you, say, this_as_pronoun, dot,
|
1252
|
+
i_pronoun, hear, tony, comma, but, i_pronoun, do_aux, not_, see, lisa, dot
|
1253
|
+
]
|
1254
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
1255
|
+
|
1256
|
+
# Sentence 3-C Xtra Lisa says: "I can hear an animal, but I do not see it."
|
1257
|
+
# Tony says: "I can see the animal that you hear.".
|
1258
|
+
literals = [ lisa, says, colon, quote, i_pronoun, can, hear, an,
|
1259
|
+
animal, comma, but, i_pronoun, do_aux, not_, see, it_, dot, quote,
|
1260
|
+
dot, tony, says, colon, quote, i_pronoun, can, see, the, animal,
|
1261
|
+
that, you, hear, dot, quote, dot
|
1262
|
+
]
|
1263
|
+
expect { subject.to_pforest(literals) }.not_to raise_error
|
1264
|
+
end
|
1187
1265
|
=begin
|
1188
1266
|
TODO
|
1189
1267
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zenlish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitri Geshef
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rley
|