zenlish 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.yardopts +6 -0
  4. data/Gemfile +6 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +95 -0
  7. data/Rakefile +6 -0
  8. data/lib/zenlish.rb +9 -0
  9. data/lib/zenlish/lex/empty_lexicon.rb +7 -0
  10. data/lib/zenlish/lex/empty_lexicon_factory.rb +32 -0
  11. data/lib/zenlish/lex/lexeme.rb +19 -0
  12. data/lib/zenlish/lex/lexical_entry.rb +19 -0
  13. data/lib/zenlish/lex/lexicon.rb +55 -0
  14. data/lib/zenlish/lex/literal.rb +16 -0
  15. data/lib/zenlish/parser/zenlish_grammar.rb +29 -0
  16. data/lib/zenlish/parser/zparser.rb +30 -0
  17. data/lib/zenlish/version.rb +3 -0
  18. data/lib/zenlish/wclasses/adjective.rb +9 -0
  19. data/lib/zenlish/wclasses/all_word_classes.rb +11 -0
  20. data/lib/zenlish/wclasses/article.rb +9 -0
  21. data/lib/zenlish/wclasses/common_noun.rb +9 -0
  22. data/lib/zenlish/wclasses/definite_article.rb +9 -0
  23. data/lib/zenlish/wclasses/demonstrative_determiner.rb +9 -0
  24. data/lib/zenlish/wclasses/determiner.rb +9 -0
  25. data/lib/zenlish/wclasses/indefinite_pronoun.rb +9 -0
  26. data/lib/zenlish/wclasses/irregular_verb.rb +9 -0
  27. data/lib/zenlish/wclasses/lexical_verb.rb +9 -0
  28. data/lib/zenlish/wclasses/noun.rb +11 -0
  29. data/lib/zenlish/wclasses/pronoun.rb +9 -0
  30. data/lib/zenlish/wclasses/proper_noun.rb +10 -0
  31. data/lib/zenlish/wclasses/test_hierarchy.rb +3 -0
  32. data/lib/zenlish/wclasses/verb.rb +9 -0
  33. data/lib/zenlish/wclasses/word_class.rb +20 -0
  34. data/spec/spec_helper.rb +12 -0
  35. data/spec/zenlish/lex/empty_lexicon_factory_spec.rb +35 -0
  36. data/spec/zenlish/lex/lexeme_spec.rb +39 -0
  37. data/spec/zenlish/lex/lexical_entry_spec.rb +46 -0
  38. data/spec/zenlish/lex/lexicon_spec.rb +104 -0
  39. data/spec/zenlish/lex/literal_spec.rb +41 -0
  40. data/spec/zenlish/parser/zenlish_grammar_spec.rb +21 -0
  41. data/spec/zenlish/parser/zparser_spec.rb +86 -0
  42. data/spec/zenlish/support/minimal_lexicon.rb +30 -0
  43. data/spec/zenlish/wclasses/common_noun_spec.rb +22 -0
  44. data/spec/zenlish/wclasses/irregular_verb_spec.rb +21 -0
  45. data/spec/zenlish/wclasses/proper_noun_spec.rb +21 -0
  46. data/spec/zenlish_spec.rb +5 -0
  47. data/zenlish.gemspec +61 -0
  48. metadata +158 -0
@@ -0,0 +1,30 @@
1
+ require_relative '../../../lib/zenlish/lex/empty_lexicon'
2
+ require_relative '../../../lib/zenlish/lex/lexical_entry'
3
+ require_relative '../../../lib/zenlish/lex/lexeme'
4
+ require_relative '../../../lib/zenlish/lex/lexicon'
5
+
6
+ def add_entry(aLemma, aWordClass)
7
+ entry = Zenlish::Lex::LexicalEntry.new(aLemma)
8
+ lexeme = Zenlish::Lex::Lexeme.new(aWordClass, entry)
9
+ $ZenlishLexicon.add_entry(entry)
10
+ end
11
+
12
+ common_noun = $ZenlishLexicon.name2terminal['CommonNoun']
13
+ adjective = $ZenlishLexicon.name2terminal['Adjective']
14
+ proper_noun = $ZenlishLexicon.name2terminal['ProperNoun']
15
+ irregular_verb = $ZenlishLexicon.name2terminal['IrregularVerb']
16
+ indefinite_pronoun = $ZenlishLexicon.name2terminal['IndefinitePronoun']
17
+ demonstrative_determiner = $ZenlishLexicon.name2terminal['DemonstrativeDeterminer']
18
+ definite_article = $ZenlishLexicon.name2terminal['DefiniteArticle']
19
+ dot = $ZenlishLexicon.name2terminal['Period']
20
+
21
+ add_entry('Lisa', proper_noun)
22
+ add_entry('other', adjective)
23
+ add_entry('see', irregular_verb)
24
+ add_entry('something', indefinite_pronoun)
25
+ add_entry('the', definite_article)
26
+ add_entry('thing', common_noun)
27
+ add_entry('this', demonstrative_determiner)
28
+ add_entry('Tony', proper_noun)
29
+
30
+ add_entry('.', dot)
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../spec_helper' # Use the RSpec framework
4
+ require_relative '../../../lib/zenlish/wclasses/common_noun' # Load the class under test
5
+
6
+ module Zenlish
7
+ module WClasses
8
+ describe CommonNoun do
9
+ subject { CommonNoun.new }
10
+
11
+ context 'Initialization:' do
12
+ it 'should be initialized without argument' do
13
+ expect { CommonNoun.new }.not_to raise_error
14
+ end
15
+ end # context
16
+
17
+ # context 'Provided services:' do
18
+ # end # context
19
+ end # describe
20
+ end # module
21
+ end # module
22
+
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../spec_helper' # Use the RSpec framework
4
+ require_relative '../../../lib/zenlish/wclasses/irregular_verb' # Load the class under test
5
+
6
+ module Zenlish
7
+ module WClasses
8
+ describe IrregularVerb do
9
+ subject { IrregularVerb.new }
10
+
11
+ context 'Initialization:' do
12
+ it 'should be initialized without argument' do
13
+ expect { IrregularVerb.new }.not_to raise_error
14
+ end
15
+ end # context
16
+
17
+ # context 'Provided services:' do
18
+ # end # context
19
+ end # describe
20
+ end # module
21
+ end # module
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../spec_helper' # Use the RSpec framework
4
+ require_relative '../../../lib/zenlish/wclasses/proper_noun' # Load the class under test
5
+
6
+ module Zenlish
7
+ module WClasses
8
+ describe ProperNoun do
9
+ subject { ProperNoun.new }
10
+
11
+ context 'Initialization:' do
12
+ it 'should be initialized without argument' do
13
+ expect { ProperNoun.new }.not_to raise_error
14
+ end
15
+ end # context
16
+
17
+ # context 'Provided services:' do
18
+ # end # context
19
+ end # describe
20
+ end # module
21
+ end # module
@@ -0,0 +1,5 @@
1
+ RSpec.describe Zenlish do
2
+ it "has a version number" do
3
+ expect(Zenlish::VERSION).not_to be nil
4
+ end
5
+ end
@@ -0,0 +1,61 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "zenlish/version"
4
+
5
+ # Implementation module
6
+ module PkgExtending
7
+ def self.pkg_files(aPackage)
8
+ file_list = Dir[
9
+ '.rubocop.yml',
10
+ '.rspec',
11
+ '.yardopts',
12
+ 'appveyor.yml',
13
+ 'cucumber.yml',
14
+ 'Gemfile',
15
+ 'Rakefile',
16
+ 'CHANGELOG.md',
17
+ 'LICENSE.txt',
18
+ 'README.md',
19
+ 'zenlish.gemspec',
20
+ 'bin/*.rb',
21
+ 'lib/*.*',
22
+ 'lib/**/*.rb',
23
+ 'spec/**/*.rb'
24
+ ]
25
+ aPackage.files = file_list
26
+ aPackage.test_files = Dir['spec/**/*_spec.rb']
27
+ aPackage.require_path = 'lib'
28
+ end
29
+
30
+ def self.pkg_documentation(aPackage)
31
+ aPackage.rdoc_options << '--charset=UTF-8 --exclude="examples|spec"'
32
+ aPackage.extra_rdoc_files = ['README.md']
33
+ end
34
+ end # module
35
+
36
+
37
+ Gem::Specification.new do |spec|
38
+ spec.name = 'zenlish'
39
+ spec.version = Zenlish::VERSION
40
+ spec.authors = ['Dimitri Geshef']
41
+ spec.email = ['famished.tiger@yahoo.com']
42
+
43
+ spec.summary = %q{A toolkit for the Zenlish language (a simplified English language).}
44
+ spec.description = %q{A toolkit for the Zenlish language (a simplified English language).}
45
+ spec.homepage = "https://github.com/famished-tiger/zenlish."
46
+ spec.license = 'MIT'
47
+
48
+ spec.bindir = 'exe'
49
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
50
+ spec.require_paths = ["lib"]
51
+
52
+ PkgExtending.pkg_files(spec)
53
+ PkgExtending.pkg_documentation(spec)
54
+
55
+ # Runtime dependencies
56
+ spec.add_dependency 'rley', '~> 0.7'
57
+
58
+ spec.add_development_dependency "bundler", "~> 2.0"
59
+ spec.add_development_dependency "rake", "~> 12.0"
60
+ spec.add_development_dependency "rspec", "~> 3.0"
61
+ end
metadata ADDED
@@ -0,0 +1,158 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zenlish
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Dimitri Geshef
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-10-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rley
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '12.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '12.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description: A toolkit for the Zenlish language (a simplified English language).
70
+ email:
71
+ - famished.tiger@yahoo.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files:
75
+ - README.md
76
+ files:
77
+ - ".rspec"
78
+ - ".yardopts"
79
+ - Gemfile
80
+ - LICENSE.txt
81
+ - README.md
82
+ - Rakefile
83
+ - lib/zenlish.rb
84
+ - lib/zenlish/lex/empty_lexicon.rb
85
+ - lib/zenlish/lex/empty_lexicon_factory.rb
86
+ - lib/zenlish/lex/lexeme.rb
87
+ - lib/zenlish/lex/lexical_entry.rb
88
+ - lib/zenlish/lex/lexicon.rb
89
+ - lib/zenlish/lex/literal.rb
90
+ - lib/zenlish/parser/zenlish_grammar.rb
91
+ - lib/zenlish/parser/zparser.rb
92
+ - lib/zenlish/version.rb
93
+ - lib/zenlish/wclasses/adjective.rb
94
+ - lib/zenlish/wclasses/all_word_classes.rb
95
+ - lib/zenlish/wclasses/article.rb
96
+ - lib/zenlish/wclasses/common_noun.rb
97
+ - lib/zenlish/wclasses/definite_article.rb
98
+ - lib/zenlish/wclasses/demonstrative_determiner.rb
99
+ - lib/zenlish/wclasses/determiner.rb
100
+ - lib/zenlish/wclasses/indefinite_pronoun.rb
101
+ - lib/zenlish/wclasses/irregular_verb.rb
102
+ - lib/zenlish/wclasses/lexical_verb.rb
103
+ - lib/zenlish/wclasses/noun.rb
104
+ - lib/zenlish/wclasses/pronoun.rb
105
+ - lib/zenlish/wclasses/proper_noun.rb
106
+ - lib/zenlish/wclasses/test_hierarchy.rb
107
+ - lib/zenlish/wclasses/verb.rb
108
+ - lib/zenlish/wclasses/word_class.rb
109
+ - spec/spec_helper.rb
110
+ - spec/zenlish/lex/empty_lexicon_factory_spec.rb
111
+ - spec/zenlish/lex/lexeme_spec.rb
112
+ - spec/zenlish/lex/lexical_entry_spec.rb
113
+ - spec/zenlish/lex/lexicon_spec.rb
114
+ - spec/zenlish/lex/literal_spec.rb
115
+ - spec/zenlish/parser/zenlish_grammar_spec.rb
116
+ - spec/zenlish/parser/zparser_spec.rb
117
+ - spec/zenlish/support/minimal_lexicon.rb
118
+ - spec/zenlish/wclasses/common_noun_spec.rb
119
+ - spec/zenlish/wclasses/irregular_verb_spec.rb
120
+ - spec/zenlish/wclasses/proper_noun_spec.rb
121
+ - spec/zenlish_spec.rb
122
+ - zenlish.gemspec
123
+ homepage: https://github.com/famished-tiger/zenlish.
124
+ licenses:
125
+ - MIT
126
+ metadata: {}
127
+ post_install_message:
128
+ rdoc_options:
129
+ - --charset=UTF-8 --exclude="examples|spec"
130
+ require_paths:
131
+ - lib
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubygems_version: 3.0.3
144
+ signing_key:
145
+ specification_version: 4
146
+ summary: A toolkit for the Zenlish language (a simplified English language).
147
+ test_files:
148
+ - spec/zenlish/lex/empty_lexicon_factory_spec.rb
149
+ - spec/zenlish/lex/lexeme_spec.rb
150
+ - spec/zenlish/lex/lexical_entry_spec.rb
151
+ - spec/zenlish/lex/lexicon_spec.rb
152
+ - spec/zenlish/lex/literal_spec.rb
153
+ - spec/zenlish/parser/zenlish_grammar_spec.rb
154
+ - spec/zenlish/parser/zparser_spec.rb
155
+ - spec/zenlish/wclasses/common_noun_spec.rb
156
+ - spec/zenlish/wclasses/irregular_verb_spec.rb
157
+ - spec/zenlish/wclasses/proper_noun_spec.rb
158
+ - spec/zenlish_spec.rb