zenlish 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -3
- data/README.md +5 -5
- data/lib/zenlish/parser/zenlish_grammar.rb +6 -2
- data/lib/zenlish/version.rb +1 -1
- data/spec/zenlish/parser/zparser_spec.rb +40 -0
- data/spec/zenlish/support/minimal_lexicon.rb +4 -0
- 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: 1e5db95ff9cbd925516f4bec6a4ccf6930b236f3746cef3d166e22825fb605ca
|
4
|
+
data.tar.gz: b73c216e43a15abcc9b387cb4e69d689a07e4cfc8bc5ec708921980f6fd27606
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b25c381ba8c04f4fe46e2fb8cd6f1bce5d9bf999312f25a8a410f1c6c217c218dd99aef7881c7d9883dd14cfbbce581c2198b9c05b1c4e8c397cff99c2417a9
|
7
|
+
data.tar.gz: c74ed672568c17bdc824c5afcbb308dfb5f769ac57f004a275c8f78b43b8f69986b059ab3f9bac97183800e98b1dbdf67f3824e8a190f70465fe60f09a3a2a5f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## [0.1.12] - 2019-10-26
|
4
|
+
__Zenlish__ can parse all sentences in lesson 1 and 2-A..2-D from
|
5
|
+
[Learn These Words First](http://learnthesewordsfirst.com/).
|
6
|
+
|
3
7
|
## [0.1.11] - 2019-10-24
|
4
8
|
__Zenlish__ can parse all sentences in lesson 1 and 2-A..2-C from
|
5
9
|
[Learn These Words First](http://learnthesewordsfirst.com/).
|
@@ -9,9 +13,9 @@ __Zenlish__ can parse all sentences in lesson 1 and 2-A..2-C from
|
|
9
13
|
- Class `RegularVerbWant` to represent the lexical verb `want`.
|
10
14
|
|
11
15
|
### Changed
|
12
|
-
- File `zparser_spec.rb`: tests include all sentences from lesson 2-
|
13
|
-
- `ZenlishGrammar`:
|
14
|
-
- File `minimal_lexicon.rb`: new entries in lexicon `
|
16
|
+
- File `zparser_spec.rb`: tests include all sentences from lesson 2-D (105 sentences in total).
|
17
|
+
- `ZenlishGrammar`: generalized one `negative_sentence` production rule.
|
18
|
+
- File `minimal_lexicon.rb`: new entries in lexicon `bad`, `feel`, `for`, `good`.
|
15
19
|
- File `README.md` Updated the metrics table
|
16
20
|
|
17
21
|
## [0.1.10] - 2019-10-23
|
data/README.md
CHANGED
@@ -50,11 +50,11 @@ The intent is to deliver gem versions in small increments.
|
|
50
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 | 73 |
|
54
|
+
| [Coverage 100 commonest English words](https://en.wikipedia.org/wiki/Most_common_words_in_English) | 36 |
|
55
|
+
| Number of production rules in grammar | 98 |
|
56
|
+
| Number of lessons covered | 12 |
|
57
|
+
| Number of sentences in spec files | 105 |
|
58
58
|
|
59
59
|
|
60
60
|
### Roadmap
|
@@ -28,11 +28,12 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
28
28
|
rule 'affirmative_sentence' => 'AdverbThere IrregularVerbBe verb_be_complement'
|
29
29
|
rule 'affirmative_sentence' => 'numeral_of IrregularVerbBe verb_be_complement'
|
30
30
|
rule 'affirmative_sentence' => 'DemonstrativePronoun IrregularVerbBe verb_be_complement'
|
31
|
+
rule 'affirmative_sentence' => 'DemonstrativePronoun IrregularVerb verb_complement'
|
31
32
|
rule 'affirmative_sentence' => 'conjunctive_prefix IrregularVerbBe verb_be_complement'
|
32
33
|
rule 'negative_sentence' => 'noun_phrase negative_verb_phrase'
|
33
34
|
rule 'negative_sentence' => 'AdverbThere negative_verb_phrase'
|
34
35
|
rule 'negative_sentence' => 'numeral_of negative_verb_phrase'
|
35
|
-
rule 'negative_sentence' => 'DemonstrativePronoun
|
36
|
+
rule 'negative_sentence' => 'DemonstrativePronoun negative_verb_phrase'
|
36
37
|
rule 'negative_sentence' => 'conjunctive_prefix negative_verb_phrase'
|
37
38
|
rule 'conjunctive_prefix' => 'ConjunctivePronoun noun_phrase verb_phrase'
|
38
39
|
rule 'noun_phrase' => 'simple_noun_phrase'
|
@@ -41,7 +42,7 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
41
42
|
rule 'simple_noun_phrase' => 'determiner nominal'
|
42
43
|
rule 'simple_noun_phrase' => 'numeral nominal'
|
43
44
|
rule 'simple_noun_phrase' => 'determiner numeral nominal'
|
44
|
-
rule 'simple_noun_phrase' => 'simple_noun_phrase
|
45
|
+
rule 'simple_noun_phrase' => 'simple_noun_phrase simple_noun_phrase verb_phrase'
|
45
46
|
|
46
47
|
# Case: (all|many|some) one of (this|these)
|
47
48
|
rule 'simple_noun_phrase' => 'subset_of noun_phrase'
|
@@ -51,6 +52,8 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
51
52
|
rule 'simple_noun_phrase' => 'ProperNoun'
|
52
53
|
# rule 'simple_noun_phrase' => 'DemonstrativePronoun'
|
53
54
|
rule 'simple_noun_phrase' => 'IndefinitePronoun'
|
55
|
+
rule 'simple_noun_phrase' => 'IndefinitePronoun Adjective'
|
56
|
+
|
54
57
|
|
55
58
|
rule 'compound_noun_phrase' => 'simple_noun_phrase propositional_phrase'
|
56
59
|
rule 'compound_noun_phrase' => 'simple_noun_phrase comparative_clause'
|
@@ -76,6 +79,7 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
76
79
|
rule 'verb_phrase' => 'IrregularVerbBe verb_be_complement'
|
77
80
|
rule 'verb_phrase' => 'IrregularVerbSay Colon Quote affirmative_sentence Period Quote'
|
78
81
|
rule 'verb_complement' => 'noun_phrase'
|
82
|
+
rule 'verb_complement' => 'Adjective propositional_phrase'
|
79
83
|
rule 'verb_complement' => 'noun_phrase IrregularVerbBe verb_be_complement'
|
80
84
|
rule 'verb_complement' => 'adverb_phrase'
|
81
85
|
rule 'verb_complement' => 'noun_phrase adverb_phrase'
|
data/lib/zenlish/version.rb
CHANGED
@@ -37,6 +37,7 @@ module Zenlish
|
|
37
37
|
literal2var('another', 'another')
|
38
38
|
def are ; Lex::Literal.new('are', get_lexeme('be', WClasses::IrregularVerbBe), 0) ; end
|
39
39
|
literal2var('as', 'as')
|
40
|
+
literal2var('bad', 'bad')
|
40
41
|
literal2var('because', 'because')
|
41
42
|
literal2var('big', 'big')
|
42
43
|
literal2var('big', 'bigger')
|
@@ -47,7 +48,11 @@ module Zenlish
|
|
47
48
|
def does_aux ; Lex::Literal.new('does', get_lexeme('do', WClasses::AuxiliaryDo), 0) ; end
|
48
49
|
literal2var('false', 'false', '_')
|
49
50
|
literal2var('far', 'far')
|
51
|
+
literal2var('feel', 'feel')
|
52
|
+
literal2var('feel', 'feels')
|
53
|
+
literal2var('for', 'for', '_')
|
50
54
|
literal2var('from', 'from')
|
55
|
+
literal2var('good', 'good')
|
51
56
|
literal2var('happen', 'happens')
|
52
57
|
literal2var('have', 'has')
|
53
58
|
literal2var('have', 'have')
|
@@ -550,6 +555,36 @@ module Zenlish
|
|
550
555
|
literals = [lisa, can, not_, do_, this_as_pronoun, dot]
|
551
556
|
expect { subject.parse(literals) }.not_to raise_error
|
552
557
|
end
|
558
|
+
|
559
|
+
it 'should parse sample sentences from lesson 2-D' do
|
560
|
+
# Sentence 2-11a: "This person does something bad."
|
561
|
+
literals = [this, person, does, something, bad, dot]
|
562
|
+
expect { subject.parse(literals) }.not_to raise_error
|
563
|
+
|
564
|
+
# Sentence 2-11b: "This person does something bad for Tony."
|
565
|
+
literals = [this, person, does, something, bad, for_, tony, dot]
|
566
|
+
expect { subject.parse(literals) }.not_to raise_error
|
567
|
+
|
568
|
+
# Sentence 2-12a: "Tony does something good."
|
569
|
+
literals = [tony, does, something, good, dot]
|
570
|
+
expect { subject.parse(literals) }.not_to raise_error
|
571
|
+
|
572
|
+
# Sentence 2-12b: "Tony does something good for Lisa."
|
573
|
+
literals = [tony, does, something, good, for_, lisa, dot]
|
574
|
+
expect { subject.parse(literals) }.not_to raise_error
|
575
|
+
|
576
|
+
# Sentence 2-13a: "Tony feels something."
|
577
|
+
literals = [tony, feels, something, dot]
|
578
|
+
expect { subject.parse(literals) }.not_to raise_error
|
579
|
+
|
580
|
+
# Sentence 2-13b: "This does not feel good for Tony."
|
581
|
+
literals = [this_as_pronoun, does_aux, not_, feel, good, for_, tony, dot]
|
582
|
+
expect { subject.parse(literals) }.not_to raise_error
|
583
|
+
|
584
|
+
# Sentence 2-13b: "This feels bad for Tony."
|
585
|
+
literals = [this_as_pronoun, feels, bad, for_, tony, dot]
|
586
|
+
expect { subject.parse(literals) }.not_to raise_error
|
587
|
+
end
|
553
588
|
=begin
|
554
589
|
TODO
|
555
590
|
Lesson 2.A
|
@@ -562,6 +597,11 @@ Lesson 2.C
|
|
562
597
|
Tony knows Lisa has something, because Tony sees what Lisa has.
|
563
598
|
Tony thinks about what Lisa has, because Tony want to have the same kind of thing.
|
564
599
|
|
600
|
+
Lesson 2.D
|
601
|
+
|
602
|
+
extra
|
603
|
+
Lisa thinks about something bad happening to this living thing.
|
604
|
+
Thinking about this feels bad for Lisa
|
565
605
|
=end
|
566
606
|
end # context
|
567
607
|
end # describe
|
@@ -55,6 +55,7 @@ add_entry('alive', adjective)
|
|
55
55
|
add_entry('all', indefinite_quantifier)
|
56
56
|
add_entry('another', adjective)
|
57
57
|
add_entry('as', comparative_particle)
|
58
|
+
add_entry('bad', adjective)
|
58
59
|
add_entry('be', auxiliary_be)
|
59
60
|
add_entry('be', irregular_verb_be)
|
60
61
|
add_entry('because', subordinating_conjunction)
|
@@ -64,7 +65,10 @@ add_entry('do', auxiliary_do)
|
|
64
65
|
add_entry('do', irregular_verb_do)
|
65
66
|
add_entry('false', adjective)
|
66
67
|
add_entry('far', adverb)
|
68
|
+
add_entry('feel', irregular_verb)
|
69
|
+
add_entry('for', preposition)
|
67
70
|
add_entry('from', preposition)
|
71
|
+
add_entry('good', adjective)
|
68
72
|
add_entry('have', irregular_verb_have)
|
69
73
|
add_entry('happen', regular_verb)
|
70
74
|
add_entry('hear', irregular_verb)
|
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.12
|
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-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rley
|