zenlish 0.1.10 → 0.1.11
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 +18 -4
- data/README.md +32 -14
- data/lib/zenlish/lex/empty_lexicon_factory.rb +12 -10
- data/lib/zenlish/parser/zenlish_grammar.rb +15 -4
- data/lib/zenlish/version.rb +1 -1
- data/lib/zenlish/wclasses/all_word_classes.rb +2 -0
- data/lib/zenlish/wclasses/modal_verb_can.rb +9 -0
- data/lib/zenlish/wclasses/regular_verb_want.rb +10 -0
- data/spec/zenlish/parser/zparser_spec.rb +65 -4
- data/spec/zenlish/support/minimal_lexicon.rb +7 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8c515fb74b0d6dea385aab166974dbbeb798ab46d444140557d769ee791f3c1
|
4
|
+
data.tar.gz: 17377ced02bf9873315e1d5148d27c6566cc9c9973926f803b691e0496d98ebc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce88a49ab39ef1f543b1e7f7744da908aa1cc20681ef4152784abf21aa794a3c99b4c97f76a1977e9a77a2eb6c0fe921c7c0f34b96421581edb74ae1302959bc
|
7
|
+
data.tar.gz: 8bc3d88b037bd6512227e1e5e5bd93f12568adf995e676108e1b96b33f69c788cff266df646f60c3a9b685890aa2b958f9d95d5ea2ba67257916551aa4fa3a57
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,23 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## [0.1.11] - 2019-10-24
|
4
|
+
__Zenlish__ can parse all sentences in lesson 1 and 2-A..2-C from
|
5
|
+
[Learn These Words First](http://learnthesewordsfirst.com/).
|
6
|
+
|
7
|
+
### Added
|
8
|
+
- Class `ModalVerbCan` to represent the modal verb `can`.
|
9
|
+
- Class `RegularVerbWant` to represent the lexical verb `want`.
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
- File `zparser_spec.rb`: tests include all sentences from lesson 2-C (98 sentences in total).
|
13
|
+
- `ZenlishGrammar`: added support for `want` + `to` + infinitive construct, `can` modal verb".
|
14
|
+
- File `minimal_lexicon.rb`: new entries in lexicon `can`, `know`, `think`, `want`.
|
15
|
+
- File `README.md` Updated the metrics table
|
16
|
+
|
3
17
|
## [0.1.10] - 2019-10-23
|
4
18
|
__Zenlish__ can parse all sentences in lesson 1 and 2-A..2-B from
|
5
19
|
[Learn These Words First](http://learnthesewordsfirst.com/).
|
6
|
-
|
20
|
+
|
7
21
|
### Added
|
8
22
|
- Class `ConjunctivePronoun` to represent the conjunctive `what`.
|
9
23
|
- Class `IrregularVerbDo` to represent the lexical verb `do`.
|
@@ -11,13 +25,13 @@ __Zenlish__ can parse all sentences in lesson 1 and 2-A..2-B from
|
|
11
25
|
### Changed
|
12
26
|
- File `zparser_spec.rb`: tests include all sentences from lesson 2-B (87 sentences in total).
|
13
27
|
- `ZenlishGrammar`: added support for complex sentence with one dependent clause like: "Something happens to Lisa because Tony does this.".
|
14
|
-
- File `minimal_lexicon.rb`: new entries in lexicon `because`, `do`, `happen
|
15
|
-
- File `README.md` Updated the metrics table
|
28
|
+
- File `minimal_lexicon.rb`: new entries in lexicon `because`, `do`, `happen`,`with`.
|
29
|
+
- File `README.md` Updated the metrics table
|
16
30
|
|
17
31
|
## [0.1.09] - 2019-10-22
|
18
32
|
__Zenlish__ can parse all sentences in lesson 1 and 2-A from
|
19
33
|
[Learn These Words First](http://learnthesewordsfirst.com/).
|
20
|
-
|
34
|
+
|
21
35
|
### Added
|
22
36
|
- Class `ConjunctivePronoun` to represent the conjunctive `what`.
|
23
37
|
- Class `IrregularVerbHave` to represent the lexical verb `have`.
|
data/README.md
CHANGED
@@ -28,12 +28,12 @@ Litmus test: a Zenlish text should be easy to read to a English reading person.
|
|
28
28
|
|
29
29
|
### Zenlish as a library (gem)
|
30
30
|
Over time, the zenlish gem will contain:
|
31
|
-
- A tokenizer (tagging, lemmatizer)
|
31
|
+
- A tokenizer (tagging, lemmatizer)[TODO]
|
32
32
|
- A lexicon [STARTED]
|
33
33
|
- A context-free grammar [STARTED]
|
34
34
|
- A parser [STARTED]
|
35
|
-
- Feature unification (for number, gender agreement)
|
36
|
-
- A simplified ontology
|
35
|
+
- Feature unification (for number, gender agreement)[TODO]
|
36
|
+
- A simplified ontology[TODO]
|
37
37
|
|
38
38
|
|
39
39
|
### What is the purpose of __Zenlish__ ?
|
@@ -47,21 +47,22 @@ sentences of the first lesson.
|
|
47
47
|
|
48
48
|
The intent is to deliver gem versions in small increments.
|
49
49
|
|
50
|
-
#### Some project metrics (v. 0.1.
|
50
|
+
#### Some project metrics (v. 0.1.11)
|
51
51
|
|Metric|Value|
|
52
52
|
|:-:|:-:|
|
53
|
-
| Number of lemmas in lexicon |
|
54
|
-
| [Coverage 100 commonest English words](https://en.wikipedia.org/wiki/Most_common_words_in_English) |
|
55
|
-
| Number of production rules in grammar |
|
56
|
-
| Number of lessons covered |
|
57
|
-
| Number of sentences in spec files |
|
53
|
+
| Number of lemmas in lexicon | 69 |
|
54
|
+
| [Coverage 100 commonest English words](https://en.wikipedia.org/wiki/Most_common_words_in_English) | 34 |
|
55
|
+
| Number of production rules in grammar | 95 |
|
56
|
+
| Number of lessons covered | 11 |
|
57
|
+
| Number of sentences in spec files | 98 |
|
58
58
|
|
59
59
|
|
60
60
|
### Roadmap
|
61
61
|
|
62
62
|
Here a tentative roadmap:
|
63
63
|
|
64
|
-
#### A)
|
64
|
+
#### A) Ability to parse sentences from [Learn These Words First](http://learnthesewordsfirst.com/)
|
65
|
+
*STARTED*. 11% complete
|
65
66
|
This website advocates the idea of a multi-layered dictionary.
|
66
67
|
At the core, there are about 300 essential words.
|
67
68
|
The choice of these words is inspired by the semantic primitives of [NSM
|
@@ -69,12 +70,29 @@ The choice of these words is inspired by the semantic primitives of [NSM
|
|
69
70
|
The essential words are introduced in twelve lessons. Each lesson put the words
|
70
71
|
in exemplar sentences and pictures.
|
71
72
|
|
72
|
-
The
|
73
|
+
The milestone sub-goals are:
|
73
74
|
- To inject the 300 core words into Zenlish lexicon,
|
74
75
|
- Zenlish should be able to parse all the example sentences
|
75
|
-
- Also Zenlish should determine the semantics (i.e. meaning) of the sentences
|
76
76
|
|
77
|
-
#### B)
|
77
|
+
#### B) Associate lexical features to terms in lexicon
|
78
|
+
The sub-goals are:
|
79
|
+
- To enrich the lexicon entries with lexical and syntactical features.
|
80
|
+
- Zenlish should be able to derive the declensions of nouns, conjugation of verbs,
|
81
|
+
- Also Zenlish should detect agreement errors
|
82
|
+
- Ideally, Zenlish should have a lemmatizer
|
83
|
+
|
84
|
+
#### C) Enrich lexicon entries with semantical features and relationships
|
85
|
+
The sub-goals are:
|
86
|
+
- To enrich the lexicon entries with lexical and syntactical features.
|
87
|
+
- Zenlish should be able to derive the declensions of nouns, conjugation of verbs,
|
88
|
+
- Also Zenlish should detect agreement errors
|
89
|
+
|
90
|
+
#### D) Build a generic ontology and map Zenlish text to it.
|
91
|
+
The sub-goals are:
|
92
|
+
- To have a simplified ontology that covers the concepts covered in the lesson sentences.
|
93
|
+
- Hopefully Zenlish should be answer to queries related to the lesson sentences.
|
94
|
+
|
95
|
+
#### E) Capability to parse a complete book
|
78
96
|
A good candidate book is "The Edge of the Sky" by Roberto Trotta (ISBN 978-0-465-04471-9 : hardcover, ISBN 978-0-465-04490-0 : ebook).
|
79
97
|
Professor Trotta challenged himself by writing a book on Cosmology with the 1000 most used words. More details [here](http://robertotrotta.com/the-edge-of-the-sky/).
|
80
98
|
|
@@ -82,7 +100,7 @@ In order to achieve this goal, Zenlish should:
|
|
82
100
|
- Incorporate the 1000 words in its lexicon
|
83
101
|
- Have a grammar that allows the parsing of the sentences in the book.
|
84
102
|
|
85
|
-
####
|
103
|
+
#### F) Capability to interpret the meaning of a complete book
|
86
104
|
Probably, far-fetched. But it will be nice to launch query to Zenlish to check if
|
87
105
|
it has some understanding of the text it reads (i.e. has a semantic representation).
|
88
106
|
|
@@ -20,7 +20,7 @@ module Zenlish
|
|
20
20
|
aLexicon.add_terminal(WClasses::AdverbNot.new.freeze)
|
21
21
|
aLexicon.add_terminal(WClasses::AdverbThere.new.freeze)
|
22
22
|
aLexicon.add_terminal(WClasses::AuxiliaryBe.new.freeze)
|
23
|
-
aLexicon.add_terminal(WClasses::AuxiliaryDo.new.freeze)
|
23
|
+
aLexicon.add_terminal(WClasses::AuxiliaryDo.new.freeze)
|
24
24
|
aLexicon.add_terminal(WClasses::Cardinal.new.freeze)
|
25
25
|
aLexicon.add_terminal(WClasses::CommonNoun.new.freeze)
|
26
26
|
aLexicon.add_terminal(WClasses::ComparativeParticle.new.freeze)
|
@@ -28,21 +28,23 @@ module Zenlish
|
|
28
28
|
aLexicon.add_terminal(WClasses::DegreeAdverb.new.freeze)
|
29
29
|
aLexicon.add_terminal(WClasses::DemonstrativeDeterminer.new.freeze)
|
30
30
|
aLexicon.add_terminal(WClasses::ConjunctivePronoun.new.freeze)
|
31
|
-
aLexicon.add_terminal(WClasses::DemonstrativePronoun.new.freeze)
|
31
|
+
aLexicon.add_terminal(WClasses::DemonstrativePronoun.new.freeze)
|
32
32
|
aLexicon.add_terminal(WClasses::IndefinitePronoun.new.freeze)
|
33
33
|
aLexicon.add_terminal(WClasses::IrregularVerb.new.freeze)
|
34
34
|
aLexicon.add_terminal(WClasses::IrregularVerbBe.new.freeze)
|
35
|
-
aLexicon.add_terminal(WClasses::IrregularVerbDo.new.freeze)
|
36
|
-
aLexicon.add_terminal(WClasses::IrregularVerbHave.new.freeze)
|
37
|
-
aLexicon.add_terminal(WClasses::IrregularVerbSay.new.freeze)
|
38
|
-
aLexicon.add_terminal(WClasses::LinkingAdverb.new.freeze)
|
35
|
+
aLexicon.add_terminal(WClasses::IrregularVerbDo.new.freeze)
|
36
|
+
aLexicon.add_terminal(WClasses::IrregularVerbHave.new.freeze)
|
37
|
+
aLexicon.add_terminal(WClasses::IrregularVerbSay.new.freeze)
|
38
|
+
aLexicon.add_terminal(WClasses::LinkingAdverb.new.freeze)
|
39
|
+
aLexicon.add_terminal(WClasses::ModalVerbCan.new.freeze)
|
39
40
|
aLexicon.add_terminal(WClasses::Preposition.new.freeze)
|
40
|
-
aLexicon.add_terminal(WClasses::PrepositionOf.new.freeze)
|
41
|
-
aLexicon.add_terminal(WClasses::PrepositionThan.new.freeze)
|
42
|
-
aLexicon.add_terminal(WClasses::RegularVerb.new.freeze)
|
41
|
+
aLexicon.add_terminal(WClasses::PrepositionOf.new.freeze)
|
42
|
+
aLexicon.add_terminal(WClasses::PrepositionThan.new.freeze)
|
43
|
+
aLexicon.add_terminal(WClasses::RegularVerb.new.freeze)
|
44
|
+
aLexicon.add_terminal(WClasses::RegularVerbWant.new.freeze)
|
43
45
|
aLexicon.add_terminal(WClasses::ProperNoun.new.freeze)
|
44
46
|
aLexicon.add_terminal(WClasses::IndefiniteQuantifier.new.freeze)
|
45
|
-
aLexicon.add_terminal(WClasses::SubordinatingConjunction.new.freeze)
|
47
|
+
aLexicon.add_terminal(WClasses::SubordinatingConjunction.new.freeze)
|
46
48
|
end
|
47
49
|
|
48
50
|
def add_punctuation(aLexicon)
|
@@ -11,9 +11,10 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
11
11
|
|
12
12
|
rule 'language' => 'sentence'
|
13
13
|
rule 'sentence' => 'simple_sentence Period'
|
14
|
-
rule 'sentence' => 'complex_sentence Period'
|
14
|
+
rule 'sentence' => 'complex_sentence Period'
|
15
15
|
rule 'simple_sentence' => 'declarative_simple_sentence'
|
16
16
|
rule 'complex_sentence' => 'main_clause subordination_marker dependent_clause'
|
17
|
+
rule 'complex_sentence' => 'main_clause Comma subordination_marker dependent_clause'
|
17
18
|
rule 'complex_sentence' => 'subordination_marker dependent_clause Comma main_clause'
|
18
19
|
rule 'complex_sentence' => 'subordination_marker dependent_clause Comma LinkingAdverb main_clause'
|
19
20
|
rule 'subordination_marker' => 'SubordinatingConjunction'
|
@@ -31,6 +32,7 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
31
32
|
rule 'negative_sentence' => 'noun_phrase negative_verb_phrase'
|
32
33
|
rule 'negative_sentence' => 'AdverbThere negative_verb_phrase'
|
33
34
|
rule 'negative_sentence' => 'numeral_of negative_verb_phrase'
|
35
|
+
rule 'negative_sentence' => 'DemonstrativePronoun IrregularVerbBe AdverbNot verb_be_complement'
|
34
36
|
rule 'negative_sentence' => 'conjunctive_prefix negative_verb_phrase'
|
35
37
|
rule 'conjunctive_prefix' => 'ConjunctivePronoun noun_phrase verb_phrase'
|
36
38
|
rule 'noun_phrase' => 'simple_noun_phrase'
|
@@ -39,6 +41,7 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
39
41
|
rule 'simple_noun_phrase' => 'determiner nominal'
|
40
42
|
rule 'simple_noun_phrase' => 'numeral nominal'
|
41
43
|
rule 'simple_noun_phrase' => 'determiner numeral nominal'
|
44
|
+
rule 'simple_noun_phrase' => 'simple_noun_phrase noun_phrase verb_phrase'
|
42
45
|
|
43
46
|
# Case: (all|many|some) one of (this|these)
|
44
47
|
rule 'simple_noun_phrase' => 'subset_of noun_phrase'
|
@@ -66,10 +69,14 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
66
69
|
rule 'verb_phrase' => 'verb_group'
|
67
70
|
rule 'verb_phrase' => 'verb_group verb_complement'
|
68
71
|
rule 'verb_phrase' => 'RegularVerb propositional_phrase'
|
72
|
+
rule 'verb_phrase' => 'RegularVerbWant Preposition verb_group'
|
73
|
+
rule 'verb_phrase' => 'RegularVerbWant Preposition verb_group noun_phrase'
|
69
74
|
rule 'verb_phrase' => 'IrregularVerbDo DemonstrativePronoun'
|
75
|
+
rule 'verb_phrase' => 'ModalVerbCan verb_group DemonstrativePronoun'
|
70
76
|
rule 'verb_phrase' => 'IrregularVerbBe verb_be_complement'
|
71
77
|
rule 'verb_phrase' => 'IrregularVerbSay Colon Quote affirmative_sentence Period Quote'
|
72
78
|
rule 'verb_complement' => 'noun_phrase'
|
79
|
+
rule 'verb_complement' => 'noun_phrase IrregularVerbBe verb_be_complement'
|
73
80
|
rule 'verb_complement' => 'adverb_phrase'
|
74
81
|
rule 'verb_complement' => 'noun_phrase adverb_phrase'
|
75
82
|
rule 'verb_be_complement' => 'noun_phrase'
|
@@ -80,13 +87,17 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
80
87
|
rule 'adjective_as_complement' => 'Adjective comparative_clause'
|
81
88
|
rule 'negative_verb_phrase' => 'IrregularVerbBe AdverbNot verb_be_complement'
|
82
89
|
rule 'negative_verb_phrase' => 'AuxiliaryDo AdverbNot verb_phrase'
|
90
|
+
# rule 'negative_verb_phrase' => 'ModalVerbCan AdverbNot verb_phrase'
|
91
|
+
rule 'negative_verb_phrase' => 'ModalVerbCan AdverbNot verb_group DemonstrativePronoun'
|
83
92
|
rule 'verb_group' => 'lexical_verb'
|
84
93
|
rule 'verb_group' => 'AuxiliaryBe lexical_verb'
|
94
|
+
rule 'verb_group' => 'ModalVerbCan lexical_verb'
|
85
95
|
rule 'lexical_verb' => 'RegularVerb'
|
96
|
+
rule 'lexical_verb' => 'RegularVerbWant'
|
86
97
|
rule 'lexical_verb' => 'IrregularVerb'
|
87
98
|
rule 'lexical_verb' => 'IrregularVerbBe'
|
88
|
-
rule 'lexical_verb' => 'IrregularVerbDo'
|
89
|
-
rule 'lexical_verb' => 'IrregularVerbHave'
|
99
|
+
rule 'lexical_verb' => 'IrregularVerbDo'
|
100
|
+
rule 'lexical_verb' => 'IrregularVerbHave'
|
90
101
|
rule 'lexical_verb' => 'IrregularVerbSay'
|
91
102
|
rule 'numeral' => 'Cardinal'
|
92
103
|
rule 'comparative_clause' => 'comparative_start noun_phrase'
|
@@ -100,7 +111,7 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
100
111
|
rule 'propositional_phrase' => 'preposition'
|
101
112
|
rule 'propositional_complement' => 'noun_phrase'
|
102
113
|
rule 'preposition' => 'Preposition'
|
103
|
-
rule 'preposition' => 'PrepositionOf'
|
114
|
+
rule 'preposition' => 'PrepositionOf'
|
104
115
|
end
|
105
116
|
|
106
117
|
|
data/lib/zenlish/version.rb
CHANGED
@@ -25,8 +25,10 @@ require_relative 'demonstrative_pronoun'
|
|
25
25
|
require_relative 'indefinite_pronoun'
|
26
26
|
require_relative 'indefinite_quantifier'
|
27
27
|
require_relative 'linking_adverb'
|
28
|
+
require_relative 'modal_verb_can'
|
28
29
|
require_relative 'preposition'
|
29
30
|
require_relative 'preposition_of'
|
30
31
|
require_relative 'preposition_than'
|
31
32
|
require_relative 'regular_verb'
|
33
|
+
require_relative 'regular_verb_want'
|
32
34
|
require_relative 'subordinating_conjunction'
|
@@ -36,11 +36,13 @@ module Zenlish
|
|
36
36
|
literal2var('all', 'all')
|
37
37
|
literal2var('another', 'another')
|
38
38
|
def are ; Lex::Literal.new('are', get_lexeme('be', WClasses::IrregularVerbBe), 0) ; end
|
39
|
+
literal2var('as', 'as')
|
39
40
|
literal2var('because', 'because')
|
40
41
|
literal2var('big', 'big')
|
41
42
|
literal2var('big', 'bigger')
|
42
|
-
literal2var('
|
43
|
+
literal2var('can', 'can')
|
43
44
|
literal2var('of', 'of')
|
45
|
+
def do_ ; Lex::Literal.new('do', get_lexeme('do', WClasses::IrregularVerbDo), 0) ; end
|
44
46
|
def does ; Lex::Literal.new('does', get_lexeme('do', WClasses::IrregularVerbDo), 0) ; end
|
45
47
|
def does_aux ; Lex::Literal.new('does', get_lexeme('do', WClasses::AuxiliaryDo), 0) ; end
|
46
48
|
literal2var('false', 'false', '_')
|
@@ -56,6 +58,7 @@ module Zenlish
|
|
56
58
|
def is ; Lex::Literal.new('is', get_lexeme('be', WClasses::IrregularVerbBe), 0) ; end
|
57
59
|
def is_aux ; Lex::Literal.new('is', get_lexeme('be', WClasses::AuxiliaryBe), 0) ; end
|
58
60
|
literal2var('kind', 'kind')
|
61
|
+
literal2var('know', 'knows')
|
59
62
|
literal2var('like', 'like')
|
60
63
|
literal2var('Lisa', 'Lisa')
|
61
64
|
literal2var('living', 'living')
|
@@ -85,6 +88,7 @@ module Zenlish
|
|
85
88
|
literal2var('there', 'there')
|
86
89
|
literal2var('thing', 'thing')
|
87
90
|
literal2var('thing', 'things')
|
91
|
+
literal2var('think', 'thinks')
|
88
92
|
def these ; Lex::Literal.new('these', get_lexeme('this', WClasses::DemonstrativeDeterminer), 0) ; end
|
89
93
|
def these_as_pronoun ; Lex::Literal.new('these', get_lexeme('this', WClasses::DemonstrativePronoun), 0) ; end
|
90
94
|
def this ; Lex::Literal.new('this', get_lexeme('this', WClasses::DemonstrativeDeterminer), 0) ; end
|
@@ -96,6 +100,7 @@ module Zenlish
|
|
96
100
|
literal2var('true', 'true', '_')
|
97
101
|
literal2var('two', 'two')
|
98
102
|
literal2var('very', 'very')
|
103
|
+
literal2var('want', 'wants')
|
99
104
|
literal2var('what', 'what')
|
100
105
|
literal2var('with', 'with')
|
101
106
|
literal2var('word', 'words')
|
@@ -455,7 +460,9 @@ module Zenlish
|
|
455
460
|
# Sentence 2-03b: "Tony is touching the other part."
|
456
461
|
literals = [tony, is_aux, touching, the, other, part, dot]
|
457
462
|
expect { subject.parse(literals) }.not_to raise_error
|
463
|
+
end
|
458
464
|
|
465
|
+
it 'should parse sample sentences from lesson 2-B' do
|
459
466
|
# Sentence 2-04a: "Lisa does something."
|
460
467
|
literals = [lisa, does, something, dot]
|
461
468
|
expect { subject.parse(literals) }.not_to raise_error
|
@@ -487,20 +494,74 @@ module Zenlish
|
|
487
494
|
# Sentence 2-06b: "Something happens to Lisa because of this."
|
488
495
|
literals = [something, happens, to, lisa, because, of, this_as_pronoun, dot]
|
489
496
|
expect { subject.parse(literals) }.not_to raise_error
|
490
|
-
|
497
|
+
|
491
498
|
# Sentence 2-06c: "Something happens to Lisa because Tony does this."
|
492
499
|
literals = [something, happens, to, lisa, because, tony, does, this_as_pronoun, dot]
|
493
|
-
expect { subject.parse(literals) }.not_to raise_error
|
494
|
-
|
500
|
+
expect { subject.parse(literals) }.not_to raise_error
|
501
|
+
|
495
502
|
# Sentence 2-06: "Something happens to this living thing."
|
496
503
|
literals = [something, happens, to, this, living, thing, dot]
|
497
504
|
expect { subject.parse(literals) }.not_to raise_error
|
498
505
|
end
|
506
|
+
|
507
|
+
it 'should parse sample sentences from lesson 2-C' do
|
508
|
+
# Sentence 2-07a: "Lisa thinks Tony is inside this thing."
|
509
|
+
literals = [lisa, thinks, tony, is, inside, this, thing, dot]
|
510
|
+
expect { subject.parse(literals) }.not_to raise_error
|
511
|
+
|
512
|
+
# Sentence 2-07b: "Lisa thinks something about Tony."
|
513
|
+
literals = [lisa, thinks, something, about, tony, dot]
|
514
|
+
expect { subject.parse(literals) }.not_to raise_error
|
515
|
+
|
516
|
+
# Sentence 2-08a: "Tony knows Lisa is inside this thing, because Tony sees Lisa inside."
|
517
|
+
literals = [tony, knows, lisa, is, inside, this, thing, comma,
|
518
|
+
because, tony, sees, lisa, inside, dot]
|
519
|
+
expect { subject.parse(literals) }.not_to raise_error
|
520
|
+
|
521
|
+
# Sentence 2-08b: "Tony knows something about Lisa."
|
522
|
+
literals = [tony, knows, something, about, lisa, dot]
|
523
|
+
expect { subject.parse(literals) }.not_to raise_error
|
524
|
+
|
525
|
+
# Sentence 2-09a: "Tony wants this thing."
|
526
|
+
literals = [tony, wants, this, thing, dot]
|
527
|
+
expect { subject.parse(literals) }.not_to raise_error
|
528
|
+
|
529
|
+
# Sentence 2-09b: "Tony wants to have this thing."
|
530
|
+
literals = [tony, wants, to, have, this, thing, dot]
|
531
|
+
expect { subject.parse(literals) }.not_to raise_error
|
532
|
+
|
533
|
+
# Sentence 2-10a: "Tony wants to do something."
|
534
|
+
literals = [tony, wants, to, do_, something, dot]
|
535
|
+
expect { subject.parse(literals) }.not_to raise_error
|
536
|
+
|
537
|
+
# Sentence 2-10b: "Lisa wants to do the same thing."
|
538
|
+
literals = [lisa, wants, to, do_, the, same, thing, dot]
|
539
|
+
expect { subject.parse(literals) }.not_to raise_error
|
540
|
+
|
541
|
+
# Sentence 2-10c: "Tony can do this."
|
542
|
+
literals = [tony, can, do_, this_as_pronoun, dot]
|
543
|
+
expect { subject.parse(literals) }.not_to raise_error
|
544
|
+
|
545
|
+
# Sentence 2-10d: "This is not something Lisa can do."
|
546
|
+
literals = [this_as_pronoun, is, not_, something, lisa, can, do_, dot]
|
547
|
+
expect { subject.parse(literals) }.not_to raise_error
|
548
|
+
|
549
|
+
# Sentence 2-10e: "Lisa cannot do this."
|
550
|
+
literals = [lisa, can, not_, do_, this_as_pronoun, dot]
|
551
|
+
expect { subject.parse(literals) }.not_to raise_error
|
552
|
+
end
|
499
553
|
=begin
|
500
554
|
TODO
|
501
555
|
Lesson 2.A
|
502
556
|
Xtra:
|
503
557
|
What Tony has is like what Lisa has.
|
558
|
+
|
559
|
+
Lesson 2.C
|
560
|
+
|
561
|
+
Xtra:
|
562
|
+
Tony knows Lisa has something, because Tony sees what Lisa has.
|
563
|
+
Tony thinks about what Lisa has, because Tony want to have the same kind of thing.
|
564
|
+
|
504
565
|
=end
|
505
566
|
end # context
|
506
567
|
end # describe
|
@@ -19,6 +19,7 @@ preposition = $ZenlishLexicon.name2terminal['Preposition']
|
|
19
19
|
preposition_of = $ZenlishLexicon.name2terminal['PrepositionOf']
|
20
20
|
preposition_than = $ZenlishLexicon.name2terminal['PrepositionThan']
|
21
21
|
regular_verb = $ZenlishLexicon.name2terminal['RegularVerb']
|
22
|
+
regular_verb_want = $ZenlishLexicon.name2terminal['RegularVerbWant']
|
22
23
|
irregular_verb = $ZenlishLexicon.name2terminal['IrregularVerb']
|
23
24
|
irregular_verb_be = $ZenlishLexicon.name2terminal['IrregularVerbBe']
|
24
25
|
irregular_verb_do = $ZenlishLexicon.name2terminal['IrregularVerbDo']
|
@@ -32,6 +33,7 @@ definite_article = $ZenlishLexicon.name2terminal['DefiniteArticle']
|
|
32
33
|
cardinal = $ZenlishLexicon.name2terminal['Cardinal']
|
33
34
|
comparative_particle = $ZenlishLexicon.name2terminal['ComparativeParticle']
|
34
35
|
indefinite_quantifier = $ZenlishLexicon.name2terminal['IndefiniteQuantifier']
|
36
|
+
modal_verb_can = $ZenlishLexicon.name2terminal['ModalVerbCan']
|
35
37
|
subordinating_conjunction = $ZenlishLexicon.name2terminal['SubordinatingConjunction']
|
36
38
|
|
37
39
|
colon = $ZenlishLexicon.name2terminal['Colon']
|
@@ -57,6 +59,7 @@ add_entry('be', auxiliary_be)
|
|
57
59
|
add_entry('be', irregular_verb_be)
|
58
60
|
add_entry('because', subordinating_conjunction)
|
59
61
|
add_entry('big', adjective)
|
62
|
+
add_entry('can', modal_verb_can)
|
60
63
|
add_entry('do', auxiliary_do)
|
61
64
|
add_entry('do', irregular_verb_do)
|
62
65
|
add_entry('false', adjective)
|
@@ -64,11 +67,12 @@ add_entry('far', adverb)
|
|
64
67
|
add_entry('from', preposition)
|
65
68
|
add_entry('have', irregular_verb_have)
|
66
69
|
add_entry('happen', regular_verb)
|
67
|
-
add_entry('hear', irregular_verb)
|
70
|
+
add_entry('hear', irregular_verb)
|
68
71
|
add_entry('if', subordinating_conjunction)
|
69
72
|
add_entry('in', preposition)
|
70
73
|
add_entry('inside', preposition)
|
71
74
|
add_entry('kind', common_noun)
|
75
|
+
add_entry('know', irregular_verb)
|
72
76
|
add_entry('like', preposition)
|
73
77
|
add_entry('Lisa', proper_noun)
|
74
78
|
add_entry('living', adjective)
|
@@ -96,6 +100,7 @@ add_entry('the', definite_article)
|
|
96
100
|
add_entry('then', linking_adverb)
|
97
101
|
add_entry('there', adverb_there)
|
98
102
|
add_entry('thing', common_noun)
|
103
|
+
add_entry('think', irregular_verb)
|
99
104
|
add_entry('this', demonstrative_determiner)
|
100
105
|
add_entry('this', demonstrative_pronoun)
|
101
106
|
add_entry('this one', demonstrative_pronoun)
|
@@ -105,6 +110,7 @@ add_entry('touch', regular_verb)
|
|
105
110
|
add_entry('true', adjective)
|
106
111
|
add_entry('two', cardinal)
|
107
112
|
add_entry('very', degree_adverb)
|
113
|
+
add_entry('want', regular_verb_want)
|
108
114
|
add_entry('what',conjunctive_pronoun)
|
109
115
|
add_entry('with',preposition)
|
110
116
|
add_entry('word', common_noun)
|
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.11
|
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-10-
|
11
|
+
date: 2019-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rley
|
@@ -122,6 +122,7 @@ files:
|
|
122
122
|
- lib/zenlish/wclasses/irregular_verb_say.rb
|
123
123
|
- lib/zenlish/wclasses/lexical_verb.rb
|
124
124
|
- lib/zenlish/wclasses/linking_adverb.rb
|
125
|
+
- lib/zenlish/wclasses/modal_verb_can.rb
|
125
126
|
- lib/zenlish/wclasses/noun.rb
|
126
127
|
- lib/zenlish/wclasses/numeral.rb
|
127
128
|
- lib/zenlish/wclasses/preposition.rb
|
@@ -130,6 +131,7 @@ files:
|
|
130
131
|
- lib/zenlish/wclasses/pronoun.rb
|
131
132
|
- lib/zenlish/wclasses/proper_noun.rb
|
132
133
|
- lib/zenlish/wclasses/regular_verb.rb
|
134
|
+
- lib/zenlish/wclasses/regular_verb_want.rb
|
133
135
|
- lib/zenlish/wclasses/subordinating_conjunction.rb
|
134
136
|
- lib/zenlish/wclasses/test_hierarchy.rb
|
135
137
|
- lib/zenlish/wclasses/verb.rb
|