zenlish 0.1.05 → 0.1.06

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: 893bd9e1c08f440d12c832af5341761618ad1eae4f2aad0ef422396fca126212
4
- data.tar.gz: 3baa066201d7e7eb5b941c0e1e8c4f231967af2584d52ff90c966044032c6c7a
3
+ metadata.gz: 88bf0326296e3a557eabe3c13ff8469544a54659cf9aafbfb4d590e2de2eac41
4
+ data.tar.gz: b840363f817ec3b33a3dc27aaa25ad91e4afbfbb24e893ad29e9860ee24e4897
5
5
  SHA512:
6
- metadata.gz: 956d515847ca4d0762c54a485984b81c47544365ae5937bfff3b922766f2cb80c89e9eaab0d64dda525d870f2d51ffe06e6f5662f688a2a3e884709add439558
7
- data.tar.gz: 76dd07d10526a8e0eaa0bdc3fc0ee9fd3740aa0d1fe77cf6ac04cf412ec2e4d8327db90b450d4d575621b1d35500c93ae48687c237faeb8dc57aa48ef1bf7c8b
6
+ metadata.gz: ef7d68c72d8b4d3b6eca0b83e57ce44dcc578823079170522c88b9d35103a70348f675348ee2df784e89d9702c8f3f4bf15fe139991b03b4a51931584af9fe91
7
+ data.tar.gz: 8f370c5a284a736f19d548e434c0f3cb99f16a0ec5ce5d8052b38c0c85a09db7e3d3a71e57acce24046e2a5a4cb522ce9fe6c13f7ce4715d28b8d7ea8dc35df2
data/.travis.yml CHANGED
@@ -17,9 +17,9 @@ rvm:
17
17
  matrix:
18
18
  allow_failures:
19
19
  - rvm: ruby-head
20
+ - rvm: jruby-9.1.9.0
20
21
  - rvm: jruby-head
21
22
 
22
-
23
23
  # whitelist
24
24
  branches:
25
25
  only:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## [0.1.06] - 2019-10-20
4
+ __Zenlish__ can parse all sentences in lessons 1-A ... 1-G from
5
+ [Learn These Words First](http://learnthesewordsfirst.com/).
6
+
7
+ ### Changed
8
+ - File `zparser_spec.rb`: tests include all sentences from lesson 1-F (59 sentences in total).
9
+ - File `minimal_lexicon.rb`: new entries in lexicon `above`, `in`, `on`,
10
+ `place`, `side`.
11
+ - File `README.md` Updated the metrics table.
12
+
13
+
3
14
  ## [0.1.05] - 2019-10-19
4
15
  __Zenlish__ can parse all sentences in lessons 1-A ... 1-F from
5
16
  [Learn These Words First](http://learnthesewordsfirst.com/).
@@ -13,7 +24,7 @@ __Zenlish__ can parse all sentences in lessons 1-A ... 1-F from
13
24
 
14
25
 
15
26
  ### Changed
16
- - File `zparser_spec.rb`: tests include all sentences from lesson 1-F (37 sentences in total).
27
+ - File `zparser_spec.rb`: tests include all sentences from lesson 1-F (48 sentences in total).
17
28
  - `ZenlishGrammar`: rule refactoring and enhancements (i.e. conditional_statement, verb_grouping).
18
29
  - File `minimal_lexicon.rb`: new entries in lexicon `another`, `be` (as auxiliary verb),
19
30
  `far`, `from`, `if`, `kind`, `near to`, `of`, `then`, `touch`.
data/README.md CHANGED
@@ -45,11 +45,11 @@ The project is still in inception.
45
45
  #### Some project metrics (v. 0.1.05)
46
46
  |Metric|Value|
47
47
  |:-:|:-:|
48
- | Number of lemmas in lexicon | 41 |
49
- | [Coverage 100 commonest English words](https://en.wikipedia.org/wiki/Most_common_words_in_English) | 20 |
48
+ | Number of lemmas in lexicon | 45 |
49
+ | [Coverage 100 commonest English words](https://en.wikipedia.org/wiki/Most_common_words_in_English) | 22 |
50
50
  | Number of production rules in grammar | 69 |
51
- | Number of lessons covered | 6 |
52
- | Number of sentences in spec files | 48 |
51
+ | Number of lessons covered | 7 |
52
+ | Number of sentences in spec files | 59 |
53
53
 
54
54
 
55
55
  ### Roadmap
@@ -8,7 +8,6 @@ require_relative '../lex/empty_lexicon'
8
8
  # Define a grammar for a highly English-like language
9
9
  builder = Rley::Syntax::GrammarBuilder.new do
10
10
  add_terminals(*$ZenlishLexicon.terminals)
11
- # add_terminals('Period')
12
11
 
13
12
  rule 'language' => 'sentence'
14
13
  rule 'sentence' => 'simple_sentence Period'
@@ -24,7 +23,7 @@ builder = Rley::Syntax::GrammarBuilder.new do
24
23
  rule 'negative_sentence' => 'AdverbThere negative_verb_phrase'
25
24
  rule 'negative_sentence' => 'numeral_of negative_verb_phrase'
26
25
  rule 'conditional_statement' => 'condition_subordinate Comma LinkingAdverb declarative_simple_sentence'
27
- rule 'condition_subordinate' => 'SubordinatingConjunction declarative_simple_sentence'
26
+ rule 'condition_subordinate' => 'SubordinatingConjunction declarative_simple_sentence'
28
27
  rule 'noun_phrase' => 'simple_noun_phrase'
29
28
  rule 'noun_phrase' => 'compound_noun_phrase'
30
29
  rule 'simple_noun_phrase' => 'nominal'
@@ -62,21 +61,21 @@ builder = Rley::Syntax::GrammarBuilder.new do
62
61
  rule 'verb_complement' => 'noun_phrase adverb_phrase'
63
62
  rule 'verb_be_complement' => 'noun_phrase'
64
63
  rule 'verb_be_complement' => 'adjective_as_complement' # Specific to be as lexical verb
65
- rule 'verb_be_complement' => 'propositional_phrase'
64
+ rule 'verb_be_complement' => 'propositional_phrase'
66
65
  rule 'adjective_as_complement' => 'DegreeAdverb Adjective'
67
66
  rule 'adjective_as_complement' => 'Adjective'
68
- rule 'adjective_as_complement' => 'Adjective comparative_clause'
67
+ rule 'adjective_as_complement' => 'Adjective comparative_clause'
69
68
  rule 'negative_verb_phrase' => 'IrregularVerbBe AdverbNot verb_be_complement'
70
69
  rule 'negative_verb_phrase' => 'AuxiliaryDo AdverbNot verb_phrase'
71
70
  rule 'verb_group' => 'lexical_verb'
72
- rule 'verb_group' => 'AuxiliaryBe lexical_verb'
73
- rule 'lexical_verb' => 'RegularVerb'
71
+ rule 'verb_group' => 'AuxiliaryBe lexical_verb'
72
+ rule 'lexical_verb' => 'RegularVerb'
74
73
  rule 'lexical_verb' => 'IrregularVerb'
75
74
  rule 'lexical_verb' => 'IrregularVerbBe'
76
75
  rule 'numeral' => 'Cardinal'
77
76
  rule 'comparative_clause' => 'comparative_start noun_phrase'
78
77
  rule 'comparative_clause' => 'comparative_start affirmative_sentence'
79
- rule 'comparative_clause' => 'comparative_start DefiniteArticle Adjective Cardinal'
78
+ rule 'comparative_clause' => 'comparative_start DefiniteArticle Adjective Cardinal'
80
79
  rule 'comparative_start' => 'PrepositionThan'
81
80
  rule 'comparative_start' => 'ComparativeParticle'
82
81
  rule 'adverb_phrase' => 'Adverb'
@@ -1,3 +1,3 @@
1
1
  module Zenlish
2
- VERSION = '0.1.05'
2
+ VERSION = '0.1.06'
3
3
  end
@@ -30,6 +30,7 @@ module Zenlish
30
30
  # In absence of a POS tagger/lemmatizer, we map input words
31
31
  # to variables that themselves return Literal objects.
32
32
  # For instance, next line will create a variable called 'alive'
33
+ literal2var('above', 'above')
33
34
  literal2var('alive', 'alive')
34
35
  literal2var('all', 'all')
35
36
  literal2var('another', 'another')
@@ -42,6 +43,7 @@ module Zenlish
42
43
  literal2var('far', 'far')
43
44
  literal2var('from', 'from')
44
45
  literal2var('if', 'if', '_')
46
+ literal2var('in', 'in', '_')
45
47
  literal2var('inside', 'inside')
46
48
  def is ; Lex::Literal.new('is', get_lexeme('be', WClasses::IrregularVerbBe), 0) ; end
47
49
  def is_aux ; Lex::Literal.new('is', get_lexeme('be', WClasses::AuxiliaryBe), 0) ; end
@@ -50,14 +52,17 @@ module Zenlish
50
52
  literal2var('living', 'living')
51
53
  literal2var('many', 'many')
52
54
  literal2var('more', 'more')
53
- literal2var('near to', 'near_to')
55
+ literal2var('near to', 'near_to')
54
56
  literal2var('not', 'not', '_')
57
+ literal2var('on', 'on')
55
58
  literal2var('one', 'one')
56
59
  literal2var('two', 'two')
57
60
  literal2var('other', 'other')
58
61
  literal2var('people', 'people')
59
62
  literal2var('person', 'person')
63
+ literal2var('place', 'place')
60
64
  literal2var('same', 'same')
65
+ literal2var('side', 'side')
61
66
  literal2var('small', 'small')
62
67
  literal2var('small', 'smaller')
63
68
  literal2var('some', 'some')
@@ -263,7 +268,7 @@ module Zenlish
263
268
  expect { subject.parse(literals) }.not_to raise_error
264
269
  end
265
270
 
266
- it 'should parse sample sentences from lesson 1-E' do
271
+ it 'should parse sample sentences from lesson 1-F' do
267
272
  # Sentence 1-20a: "Tony sees some living things."
268
273
  literals = [tony, sees, some, living, things, dot]
269
274
  expect { subject.parse(literals) }.not_to raise_error
@@ -296,7 +301,7 @@ module Zenlish
296
301
  # Sentence 1-23a: Tony is far from Lisa."
297
302
  literals = [tony, is, far, from, lisa, dot]
298
303
  expect { subject.parse(literals) }.not_to raise_error
299
-
304
+
300
305
  # Sentence 1-23b: Lisa is far from Tony."
301
306
  literals = [lisa, is, far, from, tony, dot]
302
307
  expect { subject.parse(literals) }.not_to raise_error
@@ -307,7 +312,53 @@ module Zenlish
307
312
 
308
313
  # Sentence 1-24: Tony is near to Lisa."
309
314
  literals = [tony, is, near_to, lisa, dot]
310
- expect { subject.parse(literals) }.not_to raise_error
315
+ expect { subject.parse(literals) }.not_to raise_error
316
+ end
317
+
318
+ it 'should parse sample sentences from lesson 1-G' do
319
+ # Sentence 1-25a: Lisa is in this place."
320
+ literals = [lisa, is, in_, this, place, dot]
321
+ expect { subject.parse(literals) }.not_to raise_error
322
+
323
+ # Sentence 1-25b: There are two other things in this place."
324
+ literals = [there, are, two, other, things, in_, this, place, dot]
325
+ expect { subject.parse(literals) }.not_to raise_error
326
+
327
+ # Sentence 1-25c: Lisa is in the same place as these two other things."
328
+ literals = [lisa, is, in_, the, same, place, as, these, two, other, things, dot]
329
+ expect { subject.parse(literals) }.not_to raise_error
330
+
331
+ # Sentence 1-25d: Tony is not in this place."
332
+ literals = [tony, is, not_, in_, this, place, dot]
333
+ expect { subject.parse(literals) }.not_to raise_error
334
+
335
+ # Sentence 1-25e: Tony is in another place."
336
+ literals = [tony, is, in_, another, place, dot]
337
+ expect { subject.parse(literals) }.not_to raise_error
338
+
339
+ # Sentence 1-26a: Lisa is inside this thing."
340
+ literals = [lisa, is, inside, this, thing, dot]
341
+ expect { subject.parse(literals) }.not_to raise_error
342
+
343
+ # Sentence 1-26b: Tony is above this thing."
344
+ literals = [tony, is, above, this, thing, dot]
345
+ expect { subject.parse(literals) }.not_to raise_error
346
+
347
+ # Sentence 1-26c: Tony is above lisa."
348
+ literals = [tony, is, above, lisa, dot]
349
+ expect { subject.parse(literals) }.not_to raise_error
350
+
351
+ # Sentence 1-27a: Tony is on one side of this thing."
352
+ literals = [tony, is, on, one, side, of, this, thing, dot]
353
+ expect { subject.parse(literals) }.not_to raise_error
354
+
355
+ # Sentence 1-27b: Lisa is on the other side."
356
+ literals = [lisa, is, on, the, other, side, dot]
357
+ expect { subject.parse(literals) }.not_to raise_error
358
+
359
+ # Sentence 1-27c: Tony is touching one side of this thing."
360
+ literals = [tony, is_aux, touching, one, side, of, this, thing, dot]
361
+ expect { subject.parse(literals) }.not_to raise_error
311
362
  end
312
363
  end # context
313
364
  end # describe
@@ -40,6 +40,7 @@ def add_entry(aLemma, aWordClass)
40
40
  end
41
41
 
42
42
  # Our minimalistic lexicon
43
+ add_entry('above', preposition)
43
44
  add_entry('alive', adjective)
44
45
  add_entry('all', indefinite_quantifier)
45
46
  add_entry('another', adjective)
@@ -51,6 +52,7 @@ add_entry('do', auxiliary_do)
51
52
  add_entry('far', adverb)
52
53
  add_entry('from', preposition)
53
54
  add_entry('if', subordinating_conjunction)
55
+ add_entry('in', preposition)
54
56
  add_entry('inside', preposition)
55
57
  add_entry('kind', common_noun)
56
58
  add_entry('Lisa', proper_noun)
@@ -60,12 +62,15 @@ add_entry('more', adjective)
60
62
  add_entry('near to', preposition)
61
63
  add_entry('not', adverb_not)
62
64
  add_entry('of', preposition_of)
65
+ add_entry('on', preposition)
63
66
  add_entry('one', cardinal)
64
67
  add_entry('other', adjective)
65
68
  add_entry('people', common_noun)
66
69
  add_entry('person', common_noun)
70
+ add_entry('place', common_noun)
67
71
  add_entry('same', adjective)
68
72
  add_entry('see', irregular_verb)
73
+ add_entry('side', common_noun)
69
74
  add_entry('small', adjective)
70
75
  add_entry('some', indefinite_quantifier)
71
76
  add_entry('something', indefinite_pronoun)
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.05
4
+ version: 0.1.06
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-19 00:00:00.000000000 Z
11
+ date: 2019-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rley