zenlish 0.1.02 → 0.1.03

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33ea0d4f4ce6b47acec5b160c5f83e8149f23572fdb5a20a254ad1c191b49f3a
4
- data.tar.gz: b6ebbc91c0e75e3ff55e42e4955e15a63fa16804447a0c5c50c5b9e7761e2410
3
+ metadata.gz: 303e2acef033aed91d93a33892c22bf003940b47ee7acf53e77530d04a7b720d
4
+ data.tar.gz: f7593cd6c3610aff0e37aa2b2671540a466e01f5a20134d65e671dc7b8d8ad3f
5
5
  SHA512:
6
- metadata.gz: 54332bc6951d015fcb1697efe5f3415e04e34de6e703b460ecedb7a16e4639d999ab007105e8f70b20f992dc31937a2ab5332c50d677aa3e426c7ab646fc5b0c
7
- data.tar.gz: 0fbd311e26da2a6b024da6cc150f7a86fe0cd40c7736c7a0c7e1b700836aee04bb89a0b3946b42b75e070adc5444889bfdecb9d8236a23dcd2a261ed93c4ce09
6
+ metadata.gz: 63d9af886477840162a302b7cbd03cfadba340f9795af9f53d65278860518196c6ecec9eb576b35f3135cb86faac1a5ece827e6988530f3b6d4245cde46b5d1b
7
+ data.tar.gz: 4c40e0909145729bd671b179bc62831209c6bd2fa8dc598c58be097af7c64b343e6695bf01e438a6a2069496e45ac9e57826b873473006d35f41dbf46f8766e2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## [0.1.03] - 2019-10-13
4
+ __Zenlish__ can parse all the sentences in lessons 1-A ... 1-D from
5
+ [Learn These Words First](http://learnthesewordsfirst.com/).
6
+
7
+ ### Added
8
+ - Class `AdverbNot` to represent adverb `not` (for negative sentences).
9
+ - Class `AdverbThere` to represent the adverb `there` (for `there is`, `there are`).
10
+ - Class `AuxiliaryDo` to represent the auxiliary `do` verb.
11
+ - Class `IrregularVerbBe` to represent the verb `be` when used as a lexical verb.
12
+ - Class `PrepositionThan` to use with comparative clauses.
13
+
14
+ ### Changed
15
+ - File `zparser_spec.rb`: tests include all sentences from lesson 1-C.
16
+ - `ZenlishGrammar`: new rules (i.e. negative_sentence, ...).
17
+
3
18
  ## [0.1.02] - 2019-10-11
4
19
  __Zenlish__ can parse all the sentences in lessons 1-A, 1-B, 1-C from
5
20
  [Learn These Words First](http://learnthesewordsfirst.com/).
@@ -16,7 +16,11 @@ module Zenlish
16
16
 
17
17
  def add_word_classes(aLexicon)
18
18
  aLexicon.add_terminal(WClasses::Adjective.new.freeze)
19
- aLexicon.add_terminal(WClasses::Adverb.new.freeze)
19
+ aLexicon.add_terminal(WClasses::Adverb.new.freeze)
20
+ aLexicon.add_terminal(WClasses::AdverbNot.new.freeze)
21
+ aLexicon.add_terminal(WClasses::AdverbThere.new.freeze)
22
+ # aLexicon.add_terminal(WClasses::AuxiliaryBe.new.freeze)
23
+ aLexicon.add_terminal(WClasses::AuxiliaryDo.new.freeze)
20
24
  aLexicon.add_terminal(WClasses::Cardinal.new.freeze)
21
25
  aLexicon.add_terminal(WClasses::CommonNoun.new.freeze)
22
26
  aLexicon.add_terminal(WClasses::ComparativeParticle.new.freeze)
@@ -24,7 +28,9 @@ module Zenlish
24
28
  aLexicon.add_terminal(WClasses::DemonstrativeDeterminer.new.freeze)
25
29
  aLexicon.add_terminal(WClasses::IndefinitePronoun.new.freeze)
26
30
  aLexicon.add_terminal(WClasses::IrregularVerb.new.freeze)
27
- aLexicon.add_terminal(WClasses::Preposition.new.freeze)
31
+ aLexicon.add_terminal(WClasses::IrregularVerbBe.new.freeze)
32
+ aLexicon.add_terminal(WClasses::Preposition.new.freeze)
33
+ aLexicon.add_terminal(WClasses::PrepositionThan.new.freeze)
28
34
  aLexicon.add_terminal(WClasses::ProperNoun.new.freeze)
29
35
  aLexicon.add_terminal(WClasses::IndefiniteQuantifier.new.freeze)
30
36
  end
@@ -2,7 +2,10 @@ module Zenlish
2
2
  module Lex
3
3
  # TODO: document
4
4
  class Lexeme
5
+ # @return Zenlish::WClasses::WordClass
5
6
  attr_reader :wclass
7
+
8
+ # @return Zenlish::Lex::LexicalEntry
6
9
  attr_reader :entry
7
10
 
8
11
  def initialize(aWordClass, anEntry)
@@ -19,8 +19,27 @@ module Zenlish
19
19
  @name2terminal = {}
20
20
  end
21
21
 
22
- def get_lexeme(aLemma)
23
- lemma2entry.fetch(aLemma).lexemes.first
22
+ def get_lexeme(aLemma, aWordClass = nil)
23
+ if aWordClass
24
+ lexeme = nil
25
+ candidate = nil
26
+
27
+ entries = lemma2entry.fetch(aLemma)
28
+ if entries.kind_of?(Array)
29
+ entries.each do |e|
30
+ candidate = e.lexemes.first
31
+ break if candidate.wclass.kind_of?(aWordClass)
32
+ end
33
+ lexeme = candidate
34
+ else
35
+ candidate = entries.lexemes.first
36
+ lexeme = candidate if candidate.wclass.kind_of?(aWordClass)
37
+ end
38
+
39
+ lexeme
40
+ else
41
+ lemma2entry.fetch(aLemma).lexemes.first
42
+ end
24
43
  end
25
44
 
26
45
  def add_terminal(aTerminal)
@@ -13,11 +13,22 @@ builder = Rley::Syntax::GrammarBuilder.new do
13
13
  rule 'language' => 'sentence'
14
14
  rule 'sentence' => 'simple_sentence'
15
15
  rule 'simple_sentence' => 'declarative_simple_sentence Period'
16
- rule 'declarative_simple_sentence' => 'noun_phrase verb_phrase'
16
+ rule 'declarative_simple_sentence' => 'affirmative_sentence'
17
+ rule 'declarative_simple_sentence' => 'negative_sentence'
18
+ rule 'affirmative_sentence' => 'noun_phrase verb_phrase'
19
+ rule 'affirmative_sentence' => 'AdverbThere IrregularVerbBe verb_complement'
20
+ rule 'negative_sentence' => 'noun_phrase negative_verb_phrase'
21
+ rule 'negative_sentence' => 'AdverbThere negative_verb_phrase'
17
22
  rule 'noun_phrase' => 'nominal'
18
23
  rule 'noun_phrase' => 'determiner nominal'
19
- rule 'noun_phrase' => 'numeral nominal'
20
- rule 'noun_phrase' => 'determiner numeral nominal'
24
+ rule 'noun_phrase' => 'numeral nominal'
25
+
26
+ # Case: ... one of these things.
27
+ rule 'noun_phrase' => 'numeral Preposition DemonstrativeDeterminer noun_phrase'
28
+ rule 'noun_phrase' => 'determiner numeral nominal'
29
+
30
+ # CGE p.359, 360: of + definite noun phrase
31
+ rule 'noun_phrase' => 'determiner Preposition DemonstrativeDeterminer noun_phrase'
21
32
  rule 'noun_phrase' => 'ProperNoun'
22
33
  rule 'noun_phrase' => 'IndefinitePronoun'
23
34
  rule 'nominal' => 'CommonNoun'
@@ -28,15 +39,21 @@ builder = Rley::Syntax::GrammarBuilder.new do
28
39
  rule 'single_determiner' => 'DemonstrativeDeterminer'
29
40
  rule 'single_determiner' => 'DefiniteArticle'
30
41
  rule 'single_determiner' => 'IndefiniteQuantifier'
31
- rule 'verb_phrase' => 'lexical_verb'
32
- rule 'verb_phrase' => 'lexical_verb noun_phrase'
33
- rule 'verb_phrase' => 'lexical_verb adverb_phrase'
34
- rule 'verb_phrase' => 'lexical_verb propositional_phrase'
35
- rule 'verb_phrase' => 'lexical_verb noun_phrase adverb_phrase'
36
- rule 'verb_phrase' => 'lexical_verb noun_phrase propositional_phrase'
42
+ rule 'verb_phrase' => 'lexical_verb'
43
+ rule 'verb_phrase' => 'lexical_verb verb_complement'
44
+ rule 'verb_complement' => 'noun_phrase'
45
+ rule 'verb_complement' => 'adverb_phrase'
46
+ rule 'verb_complement' => 'propositional_phrase'
47
+ rule 'verb_complement' => 'noun_phrase adverb_phrase'
48
+ rule 'verb_complement' => 'noun_phrase propositional_phrase'
49
+ rule 'negative_verb_phrase' => 'IrregularVerbBe AdverbNot verb_complement'
50
+ rule 'negative_verb_phrase' => 'AuxiliaryDo AdverbNot verb_phrase'
37
51
  rule 'lexical_verb' => 'IrregularVerb'
52
+ rule 'lexical_verb' => 'IrregularVerbBe'
38
53
  rule 'numeral' => 'Cardinal'
39
- rule 'comparative_clause' => 'comparative_start noun_phrase verb_phrase'
54
+ rule 'comparative_clause' => 'comparative_start noun_phrase'
55
+ rule 'comparative_clause' => 'comparative_start affirmative_sentence'
56
+ rule 'comparative_start' => 'PrepositionThan'
40
57
  rule 'comparative_start' => 'ComparativeParticle'
41
58
  rule 'adverb_phrase' => 'Adverb'
42
59
  rule 'adverb_phrase' => 'Adverb propositional_phrase'
@@ -1,3 +1,3 @@
1
1
  module Zenlish
2
- VERSION = '0.1.02'
2
+ VERSION = '0.1.03'
3
3
  end
@@ -0,0 +1,9 @@
1
+ require_relative 'adverb'
2
+
3
+ module Zenlish
4
+ module WClasses
5
+ # TODO: document
6
+ class AdverbNot < Adverb
7
+ end # class
8
+ end # module
9
+ end # module
@@ -0,0 +1,9 @@
1
+ require_relative 'adverb'
2
+
3
+ module Zenlish
4
+ module WClasses
5
+ # TODO: document
6
+ class AdverbThere < Adverb
7
+ end # class
8
+ end # module
9
+ end # module
@@ -3,14 +3,20 @@
3
3
 
4
4
  require_relative 'adjective'
5
5
  require_relative 'adverb'
6
+ require_relative 'adverb_not'
7
+ require_relative 'adverb_there'
8
+ require_relative 'auxiliary_be'
9
+ require_relative 'auxiliary_do'
6
10
  require_relative 'cardinal'
7
11
  require_relative 'comparative_particle'
8
12
  require_relative 'common_noun'
9
13
  require_relative 'pronoun'
10
14
  require_relative 'proper_noun'
11
15
  require_relative 'irregular_verb'
16
+ require_relative 'irregular_verb_be'
12
17
  require_relative 'definite_article'
13
18
  require_relative 'demonstrative_determiner'
14
19
  require_relative 'indefinite_pronoun'
15
20
  require_relative 'indefinite_quantifier'
16
- require_relative 'preposition'
21
+ require_relative 'preposition'
22
+ require_relative 'preposition_than'
@@ -0,0 +1,11 @@
1
+ require_relative 'verb'
2
+
3
+ module Zenlish
4
+ module WClasses
5
+ # The verbs: be, have, do
6
+ # As they are so important to the English language, they deserve
7
+ # their own class
8
+ class Auxiliary < Verb
9
+ end # class
10
+ end # module
11
+ end # module
@@ -0,0 +1,9 @@
1
+ require_relative 'auxiliary'
2
+
3
+ module Zenlish
4
+ module WClasses
5
+ # TODO: document
6
+ class AuxiliaryBe < Auxiliary
7
+ end # class
8
+ end # module
9
+ end # module
@@ -0,0 +1,9 @@
1
+ require_relative 'auxiliary'
2
+
3
+ module Zenlish
4
+ module WClasses
5
+ # TODO: document
6
+ class AuxiliaryDo < Auxiliary
7
+ end # class
8
+ end # module
9
+ end # module
@@ -0,0 +1,9 @@
1
+ require_relative 'irregular_verb'
2
+
3
+ module Zenlish
4
+ module WClasses
5
+ # TODO: document
6
+ class IrregularVerbBe < IrregularVerb
7
+ end # class
8
+ end # module
9
+ end # module
@@ -0,0 +1,9 @@
1
+ require_relative 'preposition_than'
2
+
3
+ module Zenlish
4
+ module WClasses
5
+ # the 'than' preposition
6
+ class PrepositionThan < Preposition
7
+ end # class
8
+ end # module
9
+ end # module
@@ -6,22 +6,6 @@ require_relative '../../../lib/zenlish/lex/lexical_entry'
6
6
  require_relative '../../../lib/zenlish/lex/lexeme'
7
7
  require_relative '../../../lib/zenlish/lex/lexicon' # Load the class under test
8
8
 
9
- =begin
10
-
11
- minimal_lexicon = Zenlish::Lex::Lexicon.new
12
- ent = Zenlish::Lex::LexicalEntry.new('Lisa')
13
- lexeme = Zenlish::Lex::Lexeme.new(o_proper_noun, ent)
14
- minimal_lexicon.add_entry(ent)
15
-
16
- ent = Zenlish::Lex::LexicalEntry.new('see')
17
- lexeme = Zenlish::Lex::Lexeme.new(o_irregular_verb, ent)
18
- minimal_lexicon.add_entry(ent)
19
-
20
- ent = Zenlish::Lex::LexicalEntry.new('Tony')
21
- lexeme = Zenlish::Lex::Lexeme.new(o_proper_noun, ent)
22
- minimal_lexicon.add_entry(ent)
23
- =end
24
-
25
9
 
26
10
  module Zenlish
27
11
  module Lex
@@ -33,16 +17,12 @@ module Zenlish
33
17
  end
34
18
 
35
19
  let(:adjective) { Zenlish::WClasses::Adjective.new }
36
- let(:proper_noun) { Zenlish::WClasses::ProperNoun.new }
37
20
  let(:pronoun) { Zenlish::WClasses::Pronoun.new }
38
21
  let(:irregular_verb) { Zenlish::WClasses::IrregularVerb.new }
39
22
 
40
- let(:sample_lexeme) { double('other-as-adjective') }
41
- let(:sample_entry) { LexicalEntry.new('other', sample_lexeme) }
42
- let(:other_lexeme) { double('other-as-pronoun') }
43
- let(:similar_entry) { LexicalEntry.new('other', other_lexeme) }
44
- let(:verb_lexeme) { double('hope-as-verb') }
45
- let(:distinct_entry) {LexicalEntry.new('hope', verb_lexeme) }
23
+ let(:sample_entry) { create_entry('other', adjective) }
24
+ let(:similar_entry) { create_entry('other', pronoun) }
25
+ let(:distinct_entry) { create_entry('hope', irregular_verb) }
46
26
  subject { Lexicon.new }
47
27
 
48
28
  context 'Initialization:' do
@@ -62,7 +42,7 @@ module Zenlish
62
42
 
63
43
  context 'Provided services:' do
64
44
  it 'should accept the addition of terminals' do
65
- terminal1 = proper_noun
45
+ terminal1 = pronoun
66
46
  terminal2 = irregular_verb
67
47
  terminal3 = adjective
68
48
 
@@ -72,7 +52,7 @@ module Zenlish
72
52
  expect(subject.terminals).to eq([terminal1, terminal2])
73
53
  subject.add_terminal(terminal3)
74
54
  expect(subject.terminals).to eq([terminal1, terminal2, terminal3])
75
- expect(subject.name2terminal['ProperNoun']).to eq(terminal1)
55
+ expect(subject.name2terminal['Pronoun']).to eq(terminal1)
76
56
  expect(subject.name2terminal['IrregularVerb']).to eq(terminal2)
77
57
  expect(subject.name2terminal['Adjective']).to eq(terminal3)
78
58
  end
@@ -92,6 +72,24 @@ module Zenlish
92
72
  expect(subject.entries).to eq([sample_entry, distinct_entry, similar_entry])
93
73
  expect(subject.lemma2entry['other']).to eq([sample_entry, similar_entry])
94
74
  end
75
+
76
+ it 'should retrieve the lexeme of an entry with unique lemma' do
77
+ subject.add_entry(sample_entry)
78
+ subject.add_entry(distinct_entry)
79
+ subject.add_entry(similar_entry)
80
+
81
+ lexeme = subject.get_lexeme('hope')
82
+ expect(lexeme.wclass).to be_kind_of(Zenlish::WClasses::IrregularVerb)
83
+ end
84
+
85
+ it 'should retrieve the lexeme of an entry with duplicate lemma' do
86
+ subject.add_entry(sample_entry)
87
+ subject.add_entry(distinct_entry)
88
+ subject.add_entry(similar_entry)
89
+
90
+ lexeme = subject.get_lexeme('other', Zenlish::WClasses::Pronoun)
91
+ expect(lexeme).to be_kind_of(Zenlish::Lex::Lexeme)
92
+ end
95
93
 
96
94
  it 'should complain when retrieving an non-existing entry' do
97
95
  subject.add_entry(sample_entry)
@@ -16,15 +16,20 @@ module Zenlish
16
16
  end
17
17
  end # context
18
18
 
19
- def get_lexeme(aLemma)
20
- $ZenlishLexicon.get_lexeme(aLemma)
19
+ def get_lexeme(aLemma, aWordClass = nil)
20
+ $ZenlishLexicon.get_lexeme(aLemma, aWordClass)
21
21
  end
22
22
 
23
+ def all ; Lex::Literal.new('all', get_lexeme('all'), 0) ; end
24
+ def are ; Lex::Literal.new('are', get_lexeme('be'), 0) ; end
23
25
  def as ; Lex::Literal.new('as', get_lexeme('as'), 0) ; end
26
+ def of ; Lex::Literal.new('of', get_lexeme('of'), 0) ; end
27
+ def does ; Lex::Literal.new('does', get_lexeme('do'), 0) ; end
24
28
  def inside ; Lex::Literal.new('inside', get_lexeme('inside'), 0) ; end
25
- def is ; Lex::Literal.new('is', get_lexeme('be'), 0) ; end
29
+ def is ; Lex::Literal.new('is', get_lexeme('be', WClasses::IrregularVerbBe), 0) ; end
26
30
  def lisa ; Lex::Literal.new('Lisa', get_lexeme('Lisa'), 0) ; end
27
31
  def many ; Lex::Literal.new('many', get_lexeme('many'), 0) ; end
32
+ def more ; Lex::Literal.new('more', get_lexeme('more'), 0) ; end
28
33
  def not_ ; Lex::Literal.new('not', get_lexeme('not'), 0) ; end
29
34
  def one ; Lex::Literal.new('one', get_lexeme('one'), 0) ; end
30
35
  def two ; Lex::Literal.new('two', get_lexeme('two'), 0) ; end
@@ -32,9 +37,14 @@ module Zenlish
32
37
  def people ; Lex::Literal.new('people', get_lexeme('people'), 0) ; end
33
38
  def person ; Lex::Literal.new('person', get_lexeme('person'), 0) ; end
34
39
  def same ; Lex::Literal.new('same', get_lexeme('same'), 0) ; end
40
+ def some_ ; Lex::Literal.new('some', get_lexeme('some'), 0) ; end
41
+ def see ; Lex::Literal.new('see', get_lexeme('see'), 0) ; end
35
42
  def sees ; Lex::Literal.new('sees', get_lexeme('see'), 0) ; end
36
43
  def something ; Lex::Literal.new('something', get_lexeme('something'), 0) ; end
37
44
  def the ; Lex::Literal.new('the', get_lexeme('the'), 0) ; end
45
+ def than ; Lex::Literal.new('than', get_lexeme('than'), 0) ; end
46
+ def there ; Lex::Literal.new('there', get_lexeme('there'), 0) ; end
47
+ def these ; Lex::Literal.new('these', get_lexeme('this'), 0) ; end
38
48
  def thing ; Lex::Literal.new('thing', get_lexeme('thing'), 0) ; end
39
49
  def things ; Lex::Literal.new('things', get_lexeme('thing'), 0) ; end
40
50
  def this ; Lex::Literal.new('this', get_lexeme('this'), 0) ; end
@@ -107,13 +117,13 @@ module Zenlish
107
117
  # Sentence 1-08b: "Lisa sees two people."
108
118
  literals = [lisa, sees, two, people, dot]
109
119
  expect { subject.parse(literals) }.not_to raise_error
110
-
120
+
111
121
  # Sentence 1-05b: "Tony sees the same person as Lisa sees."
112
122
  literals = [tony, sees, the, same, person, as, lisa, sees, dot]
113
123
  # same is an adjective of equality comparison
114
124
  # as is part of same ... as combination
115
125
  # it introduces a comparative clause
116
- expect { subject.parse(literals) }.not_to raise_error
126
+ expect { subject.parse(literals) }.not_to raise_error
117
127
  end
118
128
 
119
129
  it 'should parse sample sentences from lesson 1-C' do
@@ -124,14 +134,52 @@ module Zenlish
124
134
  # Sentence 1-09b: "Lisa sees many people."
125
135
  literals = [lisa, sees, many, people, dot]
126
136
  expect { subject.parse(literals) }.not_to raise_error
127
-
137
+
128
138
  # Sentence 1-10: "Tony is inside this thing."
129
139
  literals = [tony, is, inside, this, thing, dot]
130
- expect { subject.parse(literals) }.not_to raise_error
140
+ expect { subject.parse(literals) }.not_to raise_error
131
141
 
132
142
  # Sentence 1-11: "Lisa is not inside this thing."
133
143
  literals = [lisa, is, not_, inside, this, thing, dot]
134
- expect { subject.parse(literals) }.not_to raise_error
144
+ expect { subject.parse(literals) }.not_to raise_error
145
+
146
+ # Sentence: "Lisa does not see people inside the other thing."
147
+ literals = [lisa, does, not_, see, people, inside, the, other, thing, dot]
148
+ expect { subject.parse(literals) }.not_to raise_error
149
+ end
150
+
151
+ it 'should parse sample sentences from lesson 1-D' do
152
+ # Sentence 1-12a: "Some of these people are inside this thing."
153
+ literals = [some_, of, these, people, are, inside, this, thing, dot]
154
+ expect { subject.parse(literals) }.not_to raise_error
155
+
156
+ # Sentence 1-12b: "Some of these people are not inside this thing."
157
+ literals = [some_, of, these, people, are, not_, inside, this, thing, dot]
158
+ expect { subject.parse(literals) }.not_to raise_error
159
+
160
+ # Sentence 1-13: "All of these people are inside this thing."
161
+ literals = [all, of, these, people, are, not_, inside, this, thing, dot]
162
+ expect { subject.parse(literals) }.not_to raise_error
163
+
164
+ # Sentence 1-14a: "There are two people inside one of these things."
165
+ literals = [there, are, two, people, inside, one, of, these, things, dot]
166
+ expect { subject.parse(literals) }.not_to raise_error
167
+
168
+ # Sentence 1-14b: "There are not people inside the other thing."
169
+ literals = [there, are, not_, people, inside, the, other, thing, dot]
170
+ expect { subject.parse(literals) }.not_to raise_error
171
+
172
+ # Sentence 1-15a: "There are many people inside this thing."
173
+ literals = [there, are, many, people, inside, this, thing, dot]
174
+ expect { subject.parse(literals) }.not_to raise_error
175
+
176
+ # Sentence 1-15b: "There are more people inside this thing."
177
+ literals = [there, are, more, people, inside, this, thing, dot]
178
+ expect { subject.parse(literals) }.not_to raise_error
179
+
180
+ # Sentence 1-15c: "There are more people inside the other thing than there are inside this thing."
181
+ literals = [there, are, more, people, inside, the, other, thing, than, there, are, inside, this, thing, dot]
182
+ expect { subject.parse(literals) }.not_to raise_error
135
183
  end
136
184
  end # context
137
185
  end # describe
@@ -4,12 +4,19 @@ require_relative '../../../lib/zenlish/lex/lexeme'
4
4
  require_relative '../../../lib/zenlish/lex/lexicon'
5
5
 
6
6
 
7
- common_noun = $ZenlishLexicon.name2terminal['CommonNoun']
7
+
8
8
  adjective = $ZenlishLexicon.name2terminal['Adjective']
9
9
  adverb = $ZenlishLexicon.name2terminal['Adverb']
10
+ adverb_not = $ZenlishLexicon.name2terminal['AdverbNot']
11
+ adverb_there = $ZenlishLexicon.name2terminal['AdverbThere']
12
+ # auxiliary_be = $ZenlishLexicon.name2terminal['AuxiliaryBe']
13
+ auxiliary_do = $ZenlishLexicon.name2terminal['AuxiliaryDo']
14
+ common_noun = $ZenlishLexicon.name2terminal['CommonNoun']
10
15
  proper_noun = $ZenlishLexicon.name2terminal['ProperNoun']
11
16
  preposition = $ZenlishLexicon.name2terminal['Preposition']
17
+ preposition_than = $ZenlishLexicon.name2terminal['PrepositionThan']
12
18
  irregular_verb = $ZenlishLexicon.name2terminal['IrregularVerb']
19
+ irregular_verb_be = $ZenlishLexicon.name2terminal['IrregularVerbBe']
13
20
  indefinite_pronoun = $ZenlishLexicon.name2terminal['IndefinitePronoun']
14
21
  demonstrative_determiner = $ZenlishLexicon.name2terminal['DemonstrativeDeterminer']
15
22
  definite_article = $ZenlishLexicon.name2terminal['DefiniteArticle']
@@ -20,26 +27,34 @@ dot = $ZenlishLexicon.name2terminal['Period']
20
27
 
21
28
  def add_entry(aLemma, aWordClass)
22
29
  entry = Zenlish::Lex::LexicalEntry.new(aLemma)
23
- raise StandardError, 'Unregistered word class' unless aWordClass
30
+ raise StandardError, "Undefined word class for '#{aLemma}'" unless aWordClass
24
31
  lexeme = Zenlish::Lex::Lexeme.new(aWordClass, entry).freeze
25
32
  $ZenlishLexicon.add_entry(entry.freeze)
26
33
  end
27
34
 
28
35
  # Our minimalistic lexicon
36
+ add_entry('all', indefinite_quantifier)
29
37
  add_entry('as', comparative_particle)
30
- add_entry('be', irregular_verb)
38
+ # add_entry('be', auxiliary_be)
39
+ add_entry('be', irregular_verb_be)
40
+ add_entry('do', auxiliary_do)
31
41
  add_entry('inside', preposition)
32
42
  add_entry('Lisa', proper_noun)
33
43
  add_entry('many', indefinite_quantifier)
34
- add_entry('not', adverb)
44
+ add_entry('more', adjective)
45
+ add_entry('not', adverb_not)
46
+ add_entry('of', preposition)
35
47
  add_entry('one', cardinal)
36
48
  add_entry('other', adjective)
37
49
  add_entry('people', common_noun)
38
50
  add_entry('person', common_noun)
39
51
  add_entry('same', adjective)
40
52
  add_entry('see', irregular_verb)
53
+ add_entry('some', indefinite_quantifier)
41
54
  add_entry('something', indefinite_pronoun)
55
+ add_entry('than', preposition_than)
42
56
  add_entry('the', definite_article)
57
+ add_entry('there', adverb_there)
43
58
  add_entry('thing', common_noun)
44
59
  add_entry('this', demonstrative_determiner)
45
60
  add_entry('Tony', proper_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.02
4
+ version: 0.1.03
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 00:00:00.000000000 Z
11
+ date: 2019-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rley
@@ -95,8 +95,13 @@ files:
95
95
  - lib/zenlish/version.rb
96
96
  - lib/zenlish/wclasses/adjective.rb
97
97
  - lib/zenlish/wclasses/adverb.rb
98
+ - lib/zenlish/wclasses/adverb_not.rb
99
+ - lib/zenlish/wclasses/adverb_there.rb
98
100
  - lib/zenlish/wclasses/all_word_classes.rb
99
101
  - lib/zenlish/wclasses/article.rb
102
+ - lib/zenlish/wclasses/auxiliary.rb
103
+ - lib/zenlish/wclasses/auxiliary_be.rb
104
+ - lib/zenlish/wclasses/auxiliary_do.rb
100
105
  - lib/zenlish/wclasses/cardinal.rb
101
106
  - lib/zenlish/wclasses/common_noun.rb
102
107
  - lib/zenlish/wclasses/comparative_particle.rb
@@ -106,10 +111,12 @@ files:
106
111
  - lib/zenlish/wclasses/indefinite_pronoun.rb
107
112
  - lib/zenlish/wclasses/indefinite_quantifier.rb
108
113
  - lib/zenlish/wclasses/irregular_verb.rb
114
+ - lib/zenlish/wclasses/irregular_verb_be.rb
109
115
  - lib/zenlish/wclasses/lexical_verb.rb
110
116
  - lib/zenlish/wclasses/noun.rb
111
117
  - lib/zenlish/wclasses/numeral.rb
112
118
  - lib/zenlish/wclasses/preposition.rb
119
+ - lib/zenlish/wclasses/preposition_than.rb
113
120
  - lib/zenlish/wclasses/pronoun.rb
114
121
  - lib/zenlish/wclasses/proper_noun.rb
115
122
  - lib/zenlish/wclasses/test_hierarchy.rb