zenlish 0.1.07 → 0.1.09
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -1
- data/README.md +7 -6
- data/appveyor.yml +27 -0
- data/lib/zenlish/lex/empty_lexicon_factory.rb +1 -0
- data/lib/zenlish/parser/zenlish_grammar.rb +2 -0
- data/lib/zenlish/version.rb +1 -1
- data/lib/zenlish/wclasses/all_word_classes.rb +1 -0
- data/lib/zenlish/wclasses/irregular_verb_have.rb +9 -0
- data/spec/zenlish/parser/zparser_spec.rb +41 -1
- data/spec/zenlish/support/minimal_lexicon.rb +5 -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: 750e9535d2fb78ea38521e183fdd583c0d654d9ad4111081b261944d15a44775
|
4
|
+
data.tar.gz: b6daa5ab5b66248bdd91c2c3f26e4cc8f552852409cc2c1f5b0fb4b359b7923b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba7ad7bcdf5391c95d4ff846484b6b55d403c4b2ffd1e2501c228471b05a14b687339604e390c5d2337eb95d7f47ee4f104b1b7404455816a7d8afe91ee36e0d
|
7
|
+
data.tar.gz: c313789bc4eba7a8d403942f5f53e543730bba60f707fc7fb195851da3fc97d124d7525e1f04ee7494ddb64f89985e8b5793bee190b2f06a4a96b7bd898a0bc3
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,25 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## [0.1.08] - 2019-10-22
|
4
|
+
__Zenlish__ can parse all sentences in lesson 1 and 2-A from
|
5
|
+
[Learn These Words First](http://learnthesewordsfirst.com/).
|
6
|
+
|
7
|
+
### Added
|
8
|
+
- Class `ConjunctivePronoun` to represent the conjunctive `what`.
|
9
|
+
- Class `IrregularVerbHave` to represent the lexical verb `have`.
|
10
|
+
- File `.appveyor.yml`
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
- File `zparser_spec.rb`: tests include all sentences from lesson 1-H (77 sentences in total).
|
14
|
+
- `ZenlishGrammar`: added support for sentence like: "This thing is like two of the other things.".
|
15
|
+
- File `minimal_lexicon.rb`: new entries in lexicon `have`, `like`, `part`.
|
16
|
+
- File `README.md` Updated the metrics table, added AppVeyor badge
|
17
|
+
|
3
18
|
## [0.1.07] - 2019-10-21
|
4
19
|
__Zenlish__ can parse all sentences in lessons 1-A ... 1-H from
|
5
20
|
[Learn These Words First](http://learnthesewordsfirst.com/).
|
6
21
|
|
7
|
-
|
22
|
+
### Added
|
8
23
|
- Class `ConjunctivePronoun` to represent the conjunctive `what`.
|
9
24
|
- Class `IrregularVerbSay` to represent the verb `say`.
|
10
25
|
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Zenlish
|
2
2
|
[![Linux build Status](https://travis-ci.org/famished-tiger/Zenlish.svg?branch=master)](https://travis-ci.org/famished-tiger/Zenlish)
|
3
|
+
[![Build status](https://ci.appveyor.com/api/projects/status/bef59whiacuv51yn?svg=true)](https://ci.appveyor.com/project/famished-tiger/zenlish)
|
3
4
|
[![Gem Version](https://badge.fury.io/rb/zenlish.svg)](https://badge.fury.io/rb/zenlish)
|
4
5
|
[![License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](https://github.com/famished-tiger/Zenlish/blob/master/LICENSE.txt)
|
5
6
|
### What is __Zenlish__ ?
|
@@ -46,14 +47,14 @@ sentences of the first lesson.
|
|
46
47
|
|
47
48
|
The intent is to deliver gem versions in small increments.
|
48
49
|
|
49
|
-
#### Some project metrics (v. 0.1.
|
50
|
+
#### Some project metrics (v. 0.1.08)
|
50
51
|
|Metric|Value|
|
51
52
|
|:-:|:-:|
|
52
|
-
| Number of lemmas in lexicon |
|
53
|
-
| [Coverage 100 commonest English words](https://en.wikipedia.org/wiki/Most_common_words_in_English) |
|
54
|
-
| Number of production rules in grammar |
|
55
|
-
| Number of lessons covered |
|
56
|
-
| Number of sentences in spec files |
|
53
|
+
| Number of lemmas in lexicon | 56 |
|
54
|
+
| [Coverage 100 commonest English words](https://en.wikipedia.org/wiki/Most_common_words_in_English) | 28 |
|
55
|
+
| Number of production rules in grammar | 76 |
|
56
|
+
| Number of lessons covered | 9 |
|
57
|
+
| Number of sentences in spec files | 77 |
|
57
58
|
|
58
59
|
|
59
60
|
### Roadmap
|
data/appveyor.yml
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
version: '{build}'
|
2
|
+
max_jobs: 5
|
3
|
+
environment:
|
4
|
+
matrix:
|
5
|
+
- Ruby_version: 26-x64
|
6
|
+
- Ruby_version: 25-x64
|
7
|
+
- Ruby_version: 24-x64
|
8
|
+
- Ruby_version: 26
|
9
|
+
- Ruby_version: 25
|
10
|
+
- Ruby_version: 24
|
11
|
+
|
12
|
+
|
13
|
+
install:
|
14
|
+
- set PATH=C:\Ruby%Ruby_version%\bin;%PATH%
|
15
|
+
- gem update --system
|
16
|
+
- gem install bundler
|
17
|
+
- bundle install --retry=3 --clean --force
|
18
|
+
|
19
|
+
build: off
|
20
|
+
|
21
|
+
before_test:
|
22
|
+
- ruby -v
|
23
|
+
- gem -v
|
24
|
+
- bundle -v
|
25
|
+
|
26
|
+
test_script:
|
27
|
+
- bundle exec rake
|
@@ -32,6 +32,7 @@ module Zenlish
|
|
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::IrregularVerbHave.new.freeze)
|
35
36
|
aLexicon.add_terminal(WClasses::IrregularVerbSay.new.freeze)
|
36
37
|
aLexicon.add_terminal(WClasses::LinkingAdverb.new.freeze)
|
37
38
|
aLexicon.add_terminal(WClasses::Preposition.new.freeze)
|
@@ -48,6 +48,7 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
48
48
|
|
49
49
|
# <numeral> of this/these...
|
50
50
|
rule 'numeral_of' => 'numeral PrepositionOf DemonstrativeDeterminer'
|
51
|
+
rule 'numeral_of' => 'numeral PrepositionOf DefiniteArticle'
|
51
52
|
rule 'subset_of' => 'IndefiniteQuantifier PrepositionOf DemonstrativeDeterminer'
|
52
53
|
rule 'nominal' => 'CommonNoun'
|
53
54
|
rule 'nominal' => 'Adjective CommonNoun'
|
@@ -76,6 +77,7 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
76
77
|
rule 'lexical_verb' => 'RegularVerb'
|
77
78
|
rule 'lexical_verb' => 'IrregularVerb'
|
78
79
|
rule 'lexical_verb' => 'IrregularVerbBe'
|
80
|
+
rule 'lexical_verb' => 'IrregularVerbHave'
|
79
81
|
rule 'lexical_verb' => 'IrregularVerbSay'
|
80
82
|
rule 'numeral' => 'Cardinal'
|
81
83
|
rule 'comparative_clause' => 'comparative_start noun_phrase'
|
data/lib/zenlish/version.rb
CHANGED
@@ -15,6 +15,7 @@ require_relative 'pronoun'
|
|
15
15
|
require_relative 'proper_noun'
|
16
16
|
require_relative 'irregular_verb'
|
17
17
|
require_relative 'irregular_verb_be'
|
18
|
+
require_relative 'irregular_verb_have'
|
18
19
|
require_relative 'irregular_verb_say'
|
19
20
|
require_relative 'definite_article'
|
20
21
|
require_relative 'demonstrative_determiner'
|
@@ -44,6 +44,8 @@ module Zenlish
|
|
44
44
|
literal2var('false', 'false', '_')
|
45
45
|
literal2var('far', 'far')
|
46
46
|
literal2var('from', 'from')
|
47
|
+
literal2var('have', 'has')
|
48
|
+
literal2var('have', 'have')
|
47
49
|
literal2var('hear', 'hears')
|
48
50
|
literal2var('if', 'if', '_')
|
49
51
|
literal2var('in', 'in', '_')
|
@@ -51,6 +53,7 @@ module Zenlish
|
|
51
53
|
def is ; Lex::Literal.new('is', get_lexeme('be', WClasses::IrregularVerbBe), 0) ; end
|
52
54
|
def is_aux ; Lex::Literal.new('is', get_lexeme('be', WClasses::AuxiliaryBe), 0) ; end
|
53
55
|
literal2var('kind', 'kind')
|
56
|
+
literal2var('like', 'like')
|
54
57
|
literal2var('Lisa', 'Lisa')
|
55
58
|
literal2var('living', 'living')
|
56
59
|
literal2var('many', 'many')
|
@@ -59,8 +62,8 @@ module Zenlish
|
|
59
62
|
literal2var('not', 'not', '_')
|
60
63
|
literal2var('on', 'on')
|
61
64
|
literal2var('one', 'one')
|
62
|
-
literal2var('two', 'two')
|
63
65
|
literal2var('other', 'other')
|
66
|
+
literal2var('part', 'part')
|
64
67
|
literal2var('people', 'people')
|
65
68
|
literal2var('person', 'person')
|
66
69
|
literal2var('place', 'place')
|
@@ -88,6 +91,7 @@ module Zenlish
|
|
88
91
|
literal2var('Tony', 'Tony')
|
89
92
|
literal2var('touch', 'touching')
|
90
93
|
literal2var('true', 'true', '_')
|
94
|
+
literal2var('two', 'two')
|
91
95
|
literal2var('very', 'very')
|
92
96
|
literal2var('what', 'what')
|
93
97
|
literal2var('word', 'words')
|
@@ -418,6 +422,42 @@ module Zenlish
|
|
418
422
|
literals = [what, lisa, says, is, true_, dot]
|
419
423
|
expect { subject.parse(literals) }.not_to raise_error
|
420
424
|
end
|
425
|
+
|
426
|
+
it 'should parse sample sentences from lesson 2-A' do
|
427
|
+
# Sentence 2-01a: "This thing is like two of the other things."
|
428
|
+
literals = [this, thing, is, like, two, of, the, other, things, dot]
|
429
|
+
expect { subject.parse(literals) }.not_to raise_error
|
430
|
+
|
431
|
+
# Sentence 2-01b: "One of these things is not like the other things."
|
432
|
+
literals = [one, of, these, things, is, not_, like, the, other, things, dot]
|
433
|
+
expect { subject.parse(literals) }.not_to raise_error
|
434
|
+
|
435
|
+
# Sentence 2-02a: "Lisa has something."
|
436
|
+
literals = [lisa, has, something, dot]
|
437
|
+
expect { subject.parse(literals) }.not_to raise_error
|
438
|
+
|
439
|
+
# Sentence 2-02b: "Tony has another thing."
|
440
|
+
literals = [tony, has, another, thing, dot]
|
441
|
+
expect { subject.parse(literals) }.not_to raise_error
|
442
|
+
|
443
|
+
# Sentence 2-02c: "Lisa does not have the same kind of thing as Tony has."
|
444
|
+
literals = [lisa, does, not_, have, the, same, kind, of, thing, as, tony, has, dot]
|
445
|
+
expect { subject.parse(literals) }.not_to raise_error
|
446
|
+
|
447
|
+
# Sentence 2-03a: "Lisa is touching part of this thing."
|
448
|
+
literals = [lisa, is_aux, touching, part, of, this, thing, dot]
|
449
|
+
expect { subject.parse(literals) }.not_to raise_error
|
450
|
+
|
451
|
+
# Sentence 2-03b: "Tony is touching the other part."
|
452
|
+
literals = [tony, is_aux, touching, the, other, part, dot]
|
453
|
+
expect { subject.parse(literals) }.not_to raise_error
|
454
|
+
end
|
455
|
+
=begin
|
456
|
+
TODO
|
457
|
+
Lesson 2.A
|
458
|
+
Xtra:
|
459
|
+
What Tony has is like what Lisa has.
|
460
|
+
=end
|
421
461
|
end # context
|
422
462
|
end # describe
|
423
463
|
end # module
|
@@ -21,6 +21,7 @@ preposition_than = $ZenlishLexicon.name2terminal['PrepositionThan']
|
|
21
21
|
regular_verb = $ZenlishLexicon.name2terminal['RegularVerb']
|
22
22
|
irregular_verb = $ZenlishLexicon.name2terminal['IrregularVerb']
|
23
23
|
irregular_verb_be = $ZenlishLexicon.name2terminal['IrregularVerbBe']
|
24
|
+
irregular_verb_have = $ZenlishLexicon.name2terminal['IrregularVerbHave']
|
24
25
|
irregular_verb_say = $ZenlishLexicon.name2terminal['IrregularVerbSay']
|
25
26
|
indefinite_pronoun = $ZenlishLexicon.name2terminal['IndefinitePronoun']
|
26
27
|
conjunctive_pronoun = $ZenlishLexicon.name2terminal['ConjunctivePronoun']
|
@@ -58,11 +59,13 @@ add_entry('do', auxiliary_do)
|
|
58
59
|
add_entry('false', adjective)
|
59
60
|
add_entry('far', adverb)
|
60
61
|
add_entry('from', preposition)
|
61
|
-
add_entry('
|
62
|
+
add_entry('have', irregular_verb_have)
|
63
|
+
add_entry('hear', irregular_verb)
|
62
64
|
add_entry('if', subordinating_conjunction)
|
63
65
|
add_entry('in', preposition)
|
64
66
|
add_entry('inside', preposition)
|
65
67
|
add_entry('kind', common_noun)
|
68
|
+
add_entry('like', preposition)
|
66
69
|
add_entry('Lisa', proper_noun)
|
67
70
|
add_entry('living', adjective)
|
68
71
|
add_entry('many', indefinite_quantifier)
|
@@ -73,6 +76,7 @@ add_entry('of', preposition_of)
|
|
73
76
|
add_entry('on', preposition)
|
74
77
|
add_entry('one', cardinal)
|
75
78
|
add_entry('other', adjective)
|
79
|
+
add_entry('part', common_noun)
|
76
80
|
add_entry('people', common_noun)
|
77
81
|
add_entry('person', common_noun)
|
78
82
|
add_entry('place', 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.09
|
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-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rley
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- LICENSE.txt
|
84
84
|
- README.md
|
85
85
|
- Rakefile
|
86
|
+
- appveyor.yml
|
86
87
|
- lib/zenlish.rb
|
87
88
|
- lib/zenlish/lex/empty_lexicon.rb
|
88
89
|
- lib/zenlish/lex/empty_lexicon_factory.rb
|
@@ -116,6 +117,7 @@ files:
|
|
116
117
|
- lib/zenlish/wclasses/indefinite_quantifier.rb
|
117
118
|
- lib/zenlish/wclasses/irregular_verb.rb
|
118
119
|
- lib/zenlish/wclasses/irregular_verb_be.rb
|
120
|
+
- lib/zenlish/wclasses/irregular_verb_have.rb
|
119
121
|
- lib/zenlish/wclasses/irregular_verb_say.rb
|
120
122
|
- lib/zenlish/wclasses/lexical_verb.rb
|
121
123
|
- lib/zenlish/wclasses/linking_adverb.rb
|