zenlish 0.1.04 → 0.1.05
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/LICENSE.txt +1 -1
- data/README.md +12 -10
- data/lib/zenlish/lex/empty_lexicon_factory.rb +9 -4
- data/lib/zenlish/parser/zenlish_grammar.rb +52 -33
- data/lib/zenlish/version.rb +1 -1
- data/lib/zenlish/wclasses/all_word_classes.rb +5 -1
- data/lib/zenlish/wclasses/conjunction.rb +9 -0
- data/lib/zenlish/wclasses/linking_adverb.rb +9 -0
- data/lib/zenlish/wclasses/preposition_of.rb +9 -0
- data/lib/zenlish/wclasses/preposition_than.rb +1 -1
- data/lib/zenlish/wclasses/regular_verb.rb +9 -0
- data/lib/zenlish/wclasses/subordinating_conjunction.rb +9 -0
- data/spec/zenlish/parser/zparser_spec.rb +67 -8
- data/spec/zenlish/support/minimal_lexicon.rb +18 -3
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 893bd9e1c08f440d12c832af5341761618ad1eae4f2aad0ef422396fca126212
|
4
|
+
data.tar.gz: 3baa066201d7e7eb5b941c0e1e8c4f231967af2584d52ff90c966044032c6c7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 956d515847ca4d0762c54a485984b81c47544365ae5937bfff3b922766f2cb80c89e9eaab0d64dda525d870f2d51ffe06e6f5662f688a2a3e884709add439558
|
7
|
+
data.tar.gz: 76dd07d10526a8e0eaa0bdc3fc0ee9fd3740aa0d1fe77cf6ac04cf412ec2e4d8327db90b450d4d575621b1d35500c93ae48687c237faeb8dc57aa48ef1bf7c8b
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## [0.1.05] - 2019-10-19
|
4
|
+
__Zenlish__ can parse all sentences in lessons 1-A ... 1-F from
|
5
|
+
[Learn These Words First](http://learnthesewordsfirst.com/).
|
6
|
+
|
7
|
+
### Added
|
8
|
+
- Class `Conjunction` to represent conjunctions.
|
9
|
+
- Class `LinkingAdverb` to represent adverbs like `then`.
|
10
|
+
- Class `PrepositionOf` to represent the preposition `of`.
|
11
|
+
- Class `RegularVerb` to represent lexical verbs that have a regular conjugation like `touch`.
|
12
|
+
- Class `SubordinatingConjunction` to represent subordinating conjunctions like `if`.
|
13
|
+
|
14
|
+
|
15
|
+
### Changed
|
16
|
+
- File `zparser_spec.rb`: tests include all sentences from lesson 1-F (37 sentences in total).
|
17
|
+
- `ZenlishGrammar`: rule refactoring and enhancements (i.e. conditional_statement, verb_grouping).
|
18
|
+
- File `minimal_lexicon.rb`: new entries in lexicon `another`, `be` (as auxiliary verb),
|
19
|
+
`far`, `from`, `if`, `kind`, `near to`, `of`, `then`, `touch`.
|
20
|
+
- File `README.md` Updated the metrics table. Added badges for Travis CI and license.
|
21
|
+
|
22
|
+
### Fixed
|
23
|
+
- File `LICENSE.txt` Missing name.
|
24
|
+
|
3
25
|
## [0.1.04] - 2019-10-15
|
4
26
|
__Zenlish__ can parse all sentences in lessons 1-A ... 1-E from
|
5
27
|
[Learn These Words First](http://learnthesewordsfirst.com/).
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Zenlish
|
2
|
+
[![Linux build Status](https://travis-ci.org/famished-tiger/Zenlish.svg?branch=master)](https://travis-ci.org/famished-tiger/Zenlish)
|
2
3
|
[![Gem Version](https://badge.fury.io/rb/zenlish.svg)](https://badge.fury.io/rb/zenlish)
|
3
|
-
|
4
|
+
[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](https://github.com/famished-tiger/Zenlish/blob/master/LICENSE.txt)
|
4
5
|
### What is __Zenlish__ ?
|
5
6
|
|
6
7
|
Zenlish = Zen + English
|
@@ -40,18 +41,19 @@ users with a language that is close enough to English.
|
|
40
41
|
|
41
42
|
### Project status
|
42
43
|
|
43
|
-
The project is still in inception.
|
44
|
-
#### Some project metrics (v. 0.1.
|
44
|
+
The project is still in inception.
|
45
|
+
#### Some project metrics (v. 0.1.05)
|
45
46
|
|Metric|Value|
|
46
47
|
|:-:|:-:|
|
47
|
-
| Number of lemmas in lexicon |
|
48
|
-
|
|
49
|
-
| Number of
|
50
|
-
| Number of
|
48
|
+
| Number of lemmas in lexicon | 41 |
|
49
|
+
| [Coverage 100 commonest English words](https://en.wikipedia.org/wiki/Most_common_words_in_English) | 20 |
|
50
|
+
| Number of production rules in grammar | 69 |
|
51
|
+
| Number of lessons covered | 6 |
|
52
|
+
| Number of sentences in spec files | 48 |
|
51
53
|
|
52
54
|
|
53
55
|
### Roadmap
|
54
|
-
|
56
|
+
|
55
57
|
Here a tentative roadmap:
|
56
58
|
|
57
59
|
#### A) Support vocabulary and sentences from [Learn These Words First](http://learnthesewordsfirst.com/)
|
@@ -59,8 +61,8 @@ This website advocates the idea of a multi-layered dictionary.
|
|
59
61
|
At the core, there are about 300 essential words.
|
60
62
|
The choice of these words is inspired by the semantic primitives of [NSM
|
61
63
|
(Natural Semantic Metalanguage)](https://en.wikipedia.org/wiki/Natural_semantic_metalanguage).
|
62
|
-
The essential words are introduced in twelve lessons. Each lesson put the
|
63
|
-
in
|
64
|
+
The essential words are introduced in twelve lessons. Each lesson put the words
|
65
|
+
in exemplar sentences and pictures.
|
64
66
|
|
65
67
|
The project sub-goals are:
|
66
68
|
- To inject the 300 core words into Zenlish lexicon,
|
@@ -18,8 +18,8 @@ module Zenlish
|
|
18
18
|
aLexicon.add_terminal(WClasses::Adjective.new.freeze)
|
19
19
|
aLexicon.add_terminal(WClasses::Adverb.new.freeze)
|
20
20
|
aLexicon.add_terminal(WClasses::AdverbNot.new.freeze)
|
21
|
-
aLexicon.add_terminal(WClasses::AdverbThere.new.freeze)
|
22
|
-
|
21
|
+
aLexicon.add_terminal(WClasses::AdverbThere.new.freeze)
|
22
|
+
aLexicon.add_terminal(WClasses::AuxiliaryBe.new.freeze)
|
23
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)
|
@@ -30,14 +30,19 @@ module Zenlish
|
|
30
30
|
aLexicon.add_terminal(WClasses::DemonstrativePronoun.new.freeze)
|
31
31
|
aLexicon.add_terminal(WClasses::IndefinitePronoun.new.freeze)
|
32
32
|
aLexicon.add_terminal(WClasses::IrregularVerb.new.freeze)
|
33
|
-
aLexicon.add_terminal(WClasses::IrregularVerbBe.new.freeze)
|
33
|
+
aLexicon.add_terminal(WClasses::IrregularVerbBe.new.freeze)
|
34
|
+
aLexicon.add_terminal(WClasses::LinkingAdverb.new.freeze)
|
34
35
|
aLexicon.add_terminal(WClasses::Preposition.new.freeze)
|
35
|
-
aLexicon.add_terminal(WClasses::
|
36
|
+
aLexicon.add_terminal(WClasses::PrepositionOf.new.freeze)
|
37
|
+
aLexicon.add_terminal(WClasses::PrepositionThan.new.freeze)
|
38
|
+
aLexicon.add_terminal(WClasses::RegularVerb.new.freeze)
|
36
39
|
aLexicon.add_terminal(WClasses::ProperNoun.new.freeze)
|
37
40
|
aLexicon.add_terminal(WClasses::IndefiniteQuantifier.new.freeze)
|
41
|
+
aLexicon.add_terminal(WClasses::SubordinatingConjunction.new.freeze)
|
38
42
|
end
|
39
43
|
|
40
44
|
def add_punctuation(aLexicon)
|
45
|
+
aLexicon.add_terminal(Rley::Syntax::Terminal.new('Comma'))
|
41
46
|
aLexicon.add_terminal(Rley::Syntax::Terminal.new('Period'))
|
42
47
|
end
|
43
48
|
end # module
|
@@ -11,66 +11,85 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
11
11
|
# add_terminals('Period')
|
12
12
|
|
13
13
|
rule 'language' => 'sentence'
|
14
|
-
rule 'sentence' => 'simple_sentence'
|
15
|
-
rule 'simple_sentence' => 'declarative_simple_sentence
|
16
|
-
rule '
|
14
|
+
rule 'sentence' => 'simple_sentence Period'
|
15
|
+
rule 'simple_sentence' => 'declarative_simple_sentence'
|
16
|
+
rule 'simple_sentence' => 'conditional_statement'
|
17
|
+
rule 'declarative_simple_sentence' => 'affirmative_sentence'
|
17
18
|
rule 'declarative_simple_sentence' => 'negative_sentence'
|
18
19
|
rule 'affirmative_sentence' => 'noun_phrase verb_phrase'
|
19
|
-
rule 'affirmative_sentence' => 'AdverbThere IrregularVerbBe
|
20
|
+
rule 'affirmative_sentence' => 'AdverbThere IrregularVerbBe verb_be_complement'
|
21
|
+
rule 'affirmative_sentence' => 'numeral_of IrregularVerbBe verb_be_complement'
|
22
|
+
rule 'affirmative_sentence' => 'DemonstrativePronoun IrregularVerbBe verb_be_complement'
|
20
23
|
rule 'negative_sentence' => 'noun_phrase negative_verb_phrase'
|
21
|
-
rule 'negative_sentence' => 'AdverbThere negative_verb_phrase'
|
22
|
-
rule '
|
23
|
-
rule '
|
24
|
-
rule '
|
25
|
-
|
26
|
-
|
27
|
-
rule '
|
28
|
-
rule '
|
29
|
-
rule '
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
rule '
|
34
|
-
|
35
|
-
|
24
|
+
rule 'negative_sentence' => 'AdverbThere negative_verb_phrase'
|
25
|
+
rule 'negative_sentence' => 'numeral_of negative_verb_phrase'
|
26
|
+
rule 'conditional_statement' => 'condition_subordinate Comma LinkingAdverb declarative_simple_sentence'
|
27
|
+
rule 'condition_subordinate' => 'SubordinatingConjunction declarative_simple_sentence'
|
28
|
+
rule 'noun_phrase' => 'simple_noun_phrase'
|
29
|
+
rule 'noun_phrase' => 'compound_noun_phrase'
|
30
|
+
rule 'simple_noun_phrase' => 'nominal'
|
31
|
+
rule 'simple_noun_phrase' => 'determiner nominal'
|
32
|
+
rule 'simple_noun_phrase' => 'numeral nominal'
|
33
|
+
rule 'simple_noun_phrase' => 'determiner numeral nominal'
|
34
|
+
|
35
|
+
# Case: (all|many|some) one of (this|these)
|
36
|
+
rule 'simple_noun_phrase' => 'subset_of noun_phrase'
|
37
|
+
|
38
|
+
# CGE p.359, 360: <numeral> of + definite noun phrase
|
39
|
+
rule 'simple_noun_phrase' => 'numeral_of noun_phrase'
|
40
|
+
rule 'simple_noun_phrase' => 'ProperNoun'
|
41
|
+
# rule 'simple_noun_phrase' => 'DemonstrativePronoun'
|
42
|
+
rule 'simple_noun_phrase' => 'IndefinitePronoun'
|
43
|
+
|
44
|
+
rule 'compound_noun_phrase' => 'simple_noun_phrase propositional_phrase'
|
45
|
+
rule 'compound_noun_phrase' => 'simple_noun_phrase comparative_clause'
|
46
|
+
|
47
|
+
# <numeral> of this/these...
|
48
|
+
rule 'numeral_of' => 'numeral PrepositionOf DemonstrativeDeterminer'
|
49
|
+
rule 'subset_of' => 'IndefiniteQuantifier PrepositionOf DemonstrativeDeterminer'
|
36
50
|
rule 'nominal' => 'CommonNoun'
|
37
51
|
rule 'nominal' => 'Adjective CommonNoun'
|
38
|
-
rule 'nominal' => 'Adjective CommonNoun comparative_clause'
|
39
|
-
rule 'nominal' => 'Adjective comparative_clause'
|
40
52
|
rule 'determiner' => 'determiner single_determiner'
|
41
|
-
rule 'determiner' => 'single_determiner'
|
53
|
+
rule 'determiner' => 'single_determiner'
|
42
54
|
rule 'single_determiner' => 'DemonstrativeDeterminer'
|
43
55
|
rule 'single_determiner' => 'DefiniteArticle'
|
44
56
|
rule 'single_determiner' => 'IndefiniteQuantifier'
|
45
|
-
rule 'verb_phrase' => '
|
46
|
-
rule 'verb_phrase' => '
|
57
|
+
rule 'verb_phrase' => 'verb_group'
|
58
|
+
rule 'verb_phrase' => 'verb_group verb_complement'
|
47
59
|
rule 'verb_phrase' => 'IrregularVerbBe verb_be_complement'
|
48
60
|
rule 'verb_complement' => 'noun_phrase'
|
49
|
-
rule 'verb_complement' => 'adverb_phrase'
|
50
|
-
rule 'verb_complement' => 'propositional_phrase'
|
61
|
+
rule 'verb_complement' => 'adverb_phrase'
|
51
62
|
rule 'verb_complement' => 'noun_phrase adverb_phrase'
|
52
|
-
rule '
|
63
|
+
rule 'verb_be_complement' => 'noun_phrase'
|
53
64
|
rule 'verb_be_complement' => 'adjective_as_complement' # Specific to be as lexical verb
|
65
|
+
rule 'verb_be_complement' => 'propositional_phrase'
|
54
66
|
rule 'adjective_as_complement' => 'DegreeAdverb Adjective'
|
55
67
|
rule 'adjective_as_complement' => 'Adjective'
|
56
|
-
rule '
|
57
|
-
rule 'negative_verb_phrase' => 'IrregularVerbBe AdverbNot
|
68
|
+
rule 'adjective_as_complement' => 'Adjective comparative_clause'
|
69
|
+
rule 'negative_verb_phrase' => 'IrregularVerbBe AdverbNot verb_be_complement'
|
58
70
|
rule 'negative_verb_phrase' => 'AuxiliaryDo AdverbNot verb_phrase'
|
71
|
+
rule 'verb_group' => 'lexical_verb'
|
72
|
+
rule 'verb_group' => 'AuxiliaryBe lexical_verb'
|
73
|
+
rule 'lexical_verb' => 'RegularVerb'
|
59
74
|
rule 'lexical_verb' => 'IrregularVerb'
|
60
75
|
rule 'lexical_verb' => 'IrregularVerbBe'
|
61
76
|
rule 'numeral' => 'Cardinal'
|
62
|
-
rule 'comparative_clause' => 'comparative_start noun_phrase'
|
77
|
+
rule 'comparative_clause' => 'comparative_start noun_phrase'
|
63
78
|
rule 'comparative_clause' => 'comparative_start affirmative_sentence'
|
64
|
-
rule '
|
79
|
+
rule 'comparative_clause' => 'comparative_start DefiniteArticle Adjective Cardinal'
|
80
|
+
rule 'comparative_start' => 'PrepositionThan'
|
65
81
|
rule 'comparative_start' => 'ComparativeParticle'
|
66
82
|
rule 'adverb_phrase' => 'Adverb'
|
67
83
|
rule 'adverb_phrase' => 'Adverb propositional_phrase'
|
68
|
-
rule 'propositional_phrase' => '
|
84
|
+
rule 'propositional_phrase' => 'preposition propositional_complement'
|
85
|
+
rule 'propositional_phrase' => 'preposition'
|
69
86
|
rule 'propositional_complement' => 'noun_phrase'
|
87
|
+
rule 'preposition' => 'Preposition'
|
88
|
+
rule 'preposition' => 'PrepositionOf'
|
70
89
|
end
|
71
90
|
|
72
91
|
|
73
|
-
# CGE p. 354 The order of determiners: quantifier > article or demonstrative
|
92
|
+
# CGE p. 354 The order of determiners: quantifier > article or demonstrative
|
74
93
|
# or possessive > numeral > head
|
75
94
|
|
76
95
|
# And now build the grammar...
|
data/lib/zenlish/version.rb
CHANGED
@@ -20,5 +20,9 @@ require_relative 'demonstrative_determiner'
|
|
20
20
|
require_relative 'demonstrative_pronoun'
|
21
21
|
require_relative 'indefinite_pronoun'
|
22
22
|
require_relative 'indefinite_quantifier'
|
23
|
+
require_relative 'linking_adverb'
|
23
24
|
require_relative 'preposition'
|
24
|
-
require_relative '
|
25
|
+
require_relative 'preposition_of'
|
26
|
+
require_relative 'preposition_than'
|
27
|
+
require_relative 'regular_verb'
|
28
|
+
require_relative 'subordinating_conjunction'
|
@@ -32,18 +32,25 @@ module Zenlish
|
|
32
32
|
# For instance, next line will create a variable called 'alive'
|
33
33
|
literal2var('alive', 'alive')
|
34
34
|
literal2var('all', 'all')
|
35
|
-
literal2var('
|
35
|
+
literal2var('another', 'another')
|
36
|
+
def are ; Lex::Literal.new('are', get_lexeme('be', WClasses::IrregularVerbBe), 0) ; end
|
36
37
|
literal2var('big', 'big')
|
37
|
-
literal2var('big', 'bigger')
|
38
|
+
literal2var('big', 'bigger')
|
38
39
|
literal2var('as', 'as')
|
39
40
|
literal2var('of', 'of')
|
40
41
|
literal2var('do', 'does')
|
42
|
+
literal2var('far', 'far')
|
43
|
+
literal2var('from', 'from')
|
44
|
+
literal2var('if', 'if', '_')
|
41
45
|
literal2var('inside', 'inside')
|
42
|
-
def is ;
|
46
|
+
def is ; Lex::Literal.new('is', get_lexeme('be', WClasses::IrregularVerbBe), 0) ; end
|
47
|
+
def is_aux ; Lex::Literal.new('is', get_lexeme('be', WClasses::AuxiliaryBe), 0) ; end
|
48
|
+
literal2var('kind', 'kind')
|
43
49
|
literal2var('Lisa', 'Lisa')
|
44
50
|
literal2var('living', 'living')
|
45
51
|
literal2var('many', 'many')
|
46
52
|
literal2var('more', 'more')
|
53
|
+
literal2var('near to', 'near_to')
|
47
54
|
literal2var('not', 'not', '_')
|
48
55
|
literal2var('one', 'one')
|
49
56
|
literal2var('two', 'two')
|
@@ -52,22 +59,27 @@ module Zenlish
|
|
52
59
|
literal2var('person', 'person')
|
53
60
|
literal2var('same', 'same')
|
54
61
|
literal2var('small', 'small')
|
55
|
-
literal2var('small', 'smaller')
|
62
|
+
literal2var('small', 'smaller')
|
56
63
|
literal2var('some', 'some')
|
57
64
|
literal2var('see', 'see')
|
58
65
|
literal2var('see', 'sees')
|
59
66
|
literal2var('something', 'something')
|
60
67
|
literal2var('the', 'the')
|
68
|
+
literal2var('then', 'then', '_')
|
61
69
|
literal2var('than', 'than')
|
62
70
|
literal2var('there', 'there')
|
63
71
|
literal2var('thing', 'thing')
|
64
72
|
literal2var('thing', 'things')
|
65
|
-
|
66
|
-
|
73
|
+
def these ; Lex::Literal.new('these', get_lexeme('this', WClasses::DemonstrativeDeterminer), 0) ; end
|
74
|
+
def these_as_pronoun ; Lex::Literal.new('these', get_lexeme('this', WClasses::DemonstrativePronoun), 0) ; end
|
75
|
+
def this ; Lex::Literal.new('this', get_lexeme('this', WClasses::DemonstrativeDeterminer), 0) ; end
|
76
|
+
def this_as_pronoun ; Lex::Literal.new('this', get_lexeme('this', WClasses::DemonstrativePronoun), 0) ; end
|
67
77
|
literal2var('this one', 'this_one')
|
68
78
|
literal2var('Tony', 'Tony')
|
79
|
+
literal2var('touch', 'touching')
|
69
80
|
literal2var('very', 'very')
|
70
81
|
|
82
|
+
def comma ; Lex::Literal.new(',', get_lexeme(','), 0) ; end
|
71
83
|
def dot ; Lex::Literal.new('.', get_lexeme('.'), 0) ; end
|
72
84
|
|
73
85
|
class ZProxy
|
@@ -245,10 +257,57 @@ module Zenlish
|
|
245
257
|
# Sentence: "This thing is bigger than the other thing."
|
246
258
|
literals = [this, thing, is, bigger, than, the, other, thing, dot]
|
247
259
|
expect { subject.parse(literals) }.not_to raise_error
|
248
|
-
|
260
|
+
|
249
261
|
# Sentence: "This thing is smaller than the other thing."
|
250
262
|
literals = [this, thing, is, smaller, than, the, other, thing, dot]
|
251
|
-
expect { subject.parse(literals) }.not_to raise_error
|
263
|
+
expect { subject.parse(literals) }.not_to raise_error
|
264
|
+
end
|
265
|
+
|
266
|
+
it 'should parse sample sentences from lesson 1-E' do
|
267
|
+
# Sentence 1-20a: "Tony sees some living things."
|
268
|
+
literals = [tony, sees, some, living, things, dot]
|
269
|
+
expect { subject.parse(literals) }.not_to raise_error
|
270
|
+
|
271
|
+
# Sentence 1-20b: "Two of these are the same kind of living thing."
|
272
|
+
literals = [these_as_pronoun, are, the, same, kind, of, living, thing, dot]
|
273
|
+
expect { subject.parse(literals) }.not_to raise_error
|
274
|
+
|
275
|
+
# Sentence 1-20c: "One of these is not the same kind as the other two."
|
276
|
+
literals = [one, of, these, is, not_, the, same, kind, as, the, other, two, dot]
|
277
|
+
expect { subject.parse(literals) }.not_to raise_error
|
278
|
+
|
279
|
+
# Sentence 1-21a: "There is one person inside this thing."
|
280
|
+
literals = [there, is, one, person, inside, this, thing, dot]
|
281
|
+
expect { subject.parse(literals) }.not_to raise_error
|
282
|
+
|
283
|
+
# Sentence 1-21b: "If Tony is not inside this thing, then another person is inside."
|
284
|
+
literals = [if_, tony, is, not_, inside, this, thing, comma, then_,
|
285
|
+
another, person, is, inside, dot]
|
286
|
+
expect { subject.parse(literals) }.not_to raise_error
|
287
|
+
|
288
|
+
# Sentence 1-22a: "Tony is touching something."
|
289
|
+
literals = [tony, is_aux, touching, something, dot]
|
290
|
+
expect { subject.parse(literals) }.not_to raise_error
|
291
|
+
|
292
|
+
# Sentence 1-22b: Lisa is touching Tony."
|
293
|
+
literals = [lisa, is_aux, touching, tony, dot]
|
294
|
+
expect { subject.parse(literals) }.not_to raise_error
|
295
|
+
|
296
|
+
# Sentence 1-23a: Tony is far from Lisa."
|
297
|
+
literals = [tony, is, far, from, lisa, dot]
|
298
|
+
expect { subject.parse(literals) }.not_to raise_error
|
299
|
+
|
300
|
+
# Sentence 1-23b: Lisa is far from Tony."
|
301
|
+
literals = [lisa, is, far, from, tony, dot]
|
302
|
+
expect { subject.parse(literals) }.not_to raise_error
|
303
|
+
|
304
|
+
# Sentence 1-23c: Tony is not far from Lisa."
|
305
|
+
literals = [tony, is, far, from, lisa, dot]
|
306
|
+
expect { subject.parse(literals) }.not_to raise_error
|
307
|
+
|
308
|
+
# Sentence 1-24: Tony is near to Lisa."
|
309
|
+
literals = [tony, is, near_to, lisa, dot]
|
310
|
+
expect { subject.parse(literals) }.not_to raise_error
|
252
311
|
end
|
253
312
|
end # context
|
254
313
|
end # describe
|
@@ -10,12 +10,15 @@ adverb = $ZenlishLexicon.name2terminal['Adverb']
|
|
10
10
|
adverb_not = $ZenlishLexicon.name2terminal['AdverbNot']
|
11
11
|
adverb_there = $ZenlishLexicon.name2terminal['AdverbThere']
|
12
12
|
degree_adverb = $ZenlishLexicon.name2terminal['DegreeAdverb']
|
13
|
-
|
13
|
+
auxiliary_be = $ZenlishLexicon.name2terminal['AuxiliaryBe']
|
14
14
|
auxiliary_do = $ZenlishLexicon.name2terminal['AuxiliaryDo']
|
15
15
|
common_noun = $ZenlishLexicon.name2terminal['CommonNoun']
|
16
|
+
linking_adverb = $ZenlishLexicon.name2terminal['LinkingAdverb']
|
16
17
|
proper_noun = $ZenlishLexicon.name2terminal['ProperNoun']
|
17
18
|
preposition = $ZenlishLexicon.name2terminal['Preposition']
|
19
|
+
preposition_of = $ZenlishLexicon.name2terminal['PrepositionOf']
|
18
20
|
preposition_than = $ZenlishLexicon.name2terminal['PrepositionThan']
|
21
|
+
regular_verb = $ZenlishLexicon.name2terminal['RegularVerb']
|
19
22
|
irregular_verb = $ZenlishLexicon.name2terminal['IrregularVerb']
|
20
23
|
irregular_verb_be = $ZenlishLexicon.name2terminal['IrregularVerbBe']
|
21
24
|
indefinite_pronoun = $ZenlishLexicon.name2terminal['IndefinitePronoun']
|
@@ -25,6 +28,8 @@ definite_article = $ZenlishLexicon.name2terminal['DefiniteArticle']
|
|
25
28
|
cardinal = $ZenlishLexicon.name2terminal['Cardinal']
|
26
29
|
comparative_particle = $ZenlishLexicon.name2terminal['ComparativeParticle']
|
27
30
|
indefinite_quantifier = $ZenlishLexicon.name2terminal['IndefiniteQuantifier']
|
31
|
+
subordinating_conjunction = $ZenlishLexicon.name2terminal['SubordinatingConjunction']
|
32
|
+
comma = $ZenlishLexicon.name2terminal['Comma']
|
28
33
|
dot = $ZenlishLexicon.name2terminal['Period']
|
29
34
|
|
30
35
|
def add_entry(aLemma, aWordClass)
|
@@ -37,18 +42,24 @@ end
|
|
37
42
|
# Our minimalistic lexicon
|
38
43
|
add_entry('alive', adjective)
|
39
44
|
add_entry('all', indefinite_quantifier)
|
45
|
+
add_entry('another', adjective)
|
40
46
|
add_entry('as', comparative_particle)
|
41
|
-
|
47
|
+
add_entry('be', auxiliary_be)
|
42
48
|
add_entry('be', irregular_verb_be)
|
43
49
|
add_entry('big', adjective)
|
44
50
|
add_entry('do', auxiliary_do)
|
51
|
+
add_entry('far', adverb)
|
52
|
+
add_entry('from', preposition)
|
53
|
+
add_entry('if', subordinating_conjunction)
|
45
54
|
add_entry('inside', preposition)
|
55
|
+
add_entry('kind', common_noun)
|
46
56
|
add_entry('Lisa', proper_noun)
|
47
57
|
add_entry('living', adjective)
|
48
58
|
add_entry('many', indefinite_quantifier)
|
49
59
|
add_entry('more', adjective)
|
60
|
+
add_entry('near to', preposition)
|
50
61
|
add_entry('not', adverb_not)
|
51
|
-
add_entry('of',
|
62
|
+
add_entry('of', preposition_of)
|
52
63
|
add_entry('one', cardinal)
|
53
64
|
add_entry('other', adjective)
|
54
65
|
add_entry('people', common_noun)
|
@@ -60,12 +71,16 @@ add_entry('some', indefinite_quantifier)
|
|
60
71
|
add_entry('something', indefinite_pronoun)
|
61
72
|
add_entry('than', preposition_than)
|
62
73
|
add_entry('the', definite_article)
|
74
|
+
add_entry('then', linking_adverb)
|
63
75
|
add_entry('there', adverb_there)
|
64
76
|
add_entry('thing', common_noun)
|
65
77
|
add_entry('this', demonstrative_determiner)
|
78
|
+
add_entry('this', demonstrative_pronoun)
|
66
79
|
add_entry('this one', demonstrative_pronoun)
|
67
80
|
add_entry('Tony', proper_noun)
|
81
|
+
add_entry('touch', regular_verb)
|
68
82
|
add_entry('two', cardinal)
|
69
83
|
add_entry('very', degree_adverb)
|
70
84
|
|
85
|
+
add_entry(',', comma)
|
71
86
|
add_entry('.', dot)
|
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.05
|
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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rley
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- lib/zenlish/wclasses/cardinal.rb
|
106
106
|
- lib/zenlish/wclasses/common_noun.rb
|
107
107
|
- lib/zenlish/wclasses/comparative_particle.rb
|
108
|
+
- lib/zenlish/wclasses/conjunction.rb
|
108
109
|
- lib/zenlish/wclasses/definite_article.rb
|
109
110
|
- lib/zenlish/wclasses/degree_adverb.rb
|
110
111
|
- lib/zenlish/wclasses/demonstrative_determiner.rb
|
@@ -115,12 +116,16 @@ files:
|
|
115
116
|
- lib/zenlish/wclasses/irregular_verb.rb
|
116
117
|
- lib/zenlish/wclasses/irregular_verb_be.rb
|
117
118
|
- lib/zenlish/wclasses/lexical_verb.rb
|
119
|
+
- lib/zenlish/wclasses/linking_adverb.rb
|
118
120
|
- lib/zenlish/wclasses/noun.rb
|
119
121
|
- lib/zenlish/wclasses/numeral.rb
|
120
122
|
- lib/zenlish/wclasses/preposition.rb
|
123
|
+
- lib/zenlish/wclasses/preposition_of.rb
|
121
124
|
- lib/zenlish/wclasses/preposition_than.rb
|
122
125
|
- lib/zenlish/wclasses/pronoun.rb
|
123
126
|
- lib/zenlish/wclasses/proper_noun.rb
|
127
|
+
- lib/zenlish/wclasses/regular_verb.rb
|
128
|
+
- lib/zenlish/wclasses/subordinating_conjunction.rb
|
124
129
|
- lib/zenlish/wclasses/test_hierarchy.rb
|
125
130
|
- lib/zenlish/wclasses/verb.rb
|
126
131
|
- lib/zenlish/wclasses/word_class.rb
|