latinverb_irregular_verb_definition_consumer 0.0.1
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 +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +12 -0
- data/latinverb_irregular_verb_definition_consumer.gemspec +24 -0
- data/lib/latinverb_irregular_verb_definition_consumer.rb +27 -0
- data/lib/latinverb_irregular_verb_definition_consumer/irregular_verb_serialization_retriever.rb +40 -0
- data/lib/latinverb_irregular_verb_definition_consumer/json_deserializer.rb +37 -0
- data/lib/latinverb_irregular_verb_definition_consumer/version.rb +3 -0
- data/test/irregular_lookup_test.rb +6 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 780690ec259b1ab4b82a111bb2e20fe7e7f9a74b
|
4
|
+
data.tar.gz: 44b686bea78d05072130a100b5da049e31f22491
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f67a08f0f9cea2e03c9725124d604fd15924a666aa6d205eb3dadda1216d5b1a2fabad503d94745f0767b7b18c64e2ea105768d41f5c7ecdb6e765ef5f9ef156
|
7
|
+
data.tar.gz: 2cba4f3a6136242cf06fb60f50a2a6f9cc94f5596e7287f96363a682846232b4b12b8037a7e544c0cf672aee6e0712e78c8228c9210007fc60416868f25fc30f
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Steven G. Harms
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# LatinverbIrregularVerbDefinitionConsumer
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'latinverb_irregular_verb_definition_consumer'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install latinverb_irregular_verb_definition_consumer
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( https://github.com/[my-github-username]/latinverb_irregular_verb_definition_consumer/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require "rake/testtask"
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
|
4
|
+
task :default => :test
|
5
|
+
|
6
|
+
Rake::TestTask.new do |t|
|
7
|
+
t.ruby_opts = [ '-rminitest/autorun', '-rminitest/pride', '-rlatinverb_irregular_verb_definition_consumer' ]
|
8
|
+
t.libs << "test"
|
9
|
+
t.test_files = FileList['test/*test*.rb']
|
10
|
+
t.verbose = true
|
11
|
+
end
|
12
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'latinverb_irregular_verb_definition_consumer/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "latinverb_irregular_verb_definition_consumer"
|
8
|
+
spec.version = LatinverbIrregularVerbDefinitionConsumer::VERSION
|
9
|
+
spec.authors = ["Steven G. Harms"]
|
10
|
+
spec.email = ["steven.harms@gmail.com"]
|
11
|
+
spec.summary = %q{Abstraction for retrieving raw serializations of irregualr verb definitions}
|
12
|
+
spec.homepage = ""
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_runtime_dependency "linguistics_latin"
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "forwardable"
|
2
|
+
require "json"
|
3
|
+
|
4
|
+
require "linguistics_latin"
|
5
|
+
|
6
|
+
require "latinverb_irregular_verb_definition_consumer/version"
|
7
|
+
require "latinverb_irregular_verb_definition_consumer/json_deserializer"
|
8
|
+
require "latinverb_irregular_verb_definition_consumer/irregular_verb_serialization_retriever"
|
9
|
+
|
10
|
+
|
11
|
+
module Linguistics
|
12
|
+
module Latin
|
13
|
+
module Verb
|
14
|
+
class LatinVerb
|
15
|
+
class IrregularVerbDefinitionConsumer
|
16
|
+
def initialize(lookup_string)
|
17
|
+
@lookup_string = lookup_string
|
18
|
+
end
|
19
|
+
|
20
|
+
def structure
|
21
|
+
@structure ||= JsonDeserializer.new(@lookup_string).revivified_data_structure
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/latinverb_irregular_verb_definition_consumer/irregular_verb_serialization_retriever.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#encoding: UTF-8
|
2
|
+
|
3
|
+
module Linguistics
|
4
|
+
module Latin
|
5
|
+
module Verb
|
6
|
+
class LatinVerb
|
7
|
+
class IrregularVerbSerializationRetriever
|
8
|
+
MAPPING = {
|
9
|
+
"aiō" => Linguistics::Latin::Verb::AIŌ,
|
10
|
+
"coepī coepisse coeptum" => Linguistics::Latin::Verb::COEPĪ_COEPISSE_COEPTUM,
|
11
|
+
"dō dāre dedī datum" => Linguistics::Latin::Verb::DŌ_DĀRE_DEDĪ_DATUM,
|
12
|
+
"edō ēsse ēdī ēsum" => Linguistics::Latin::Verb::EDŌ_ĒSSE_ĒDĪ_ĒSUM,
|
13
|
+
"eō īre ivī itum" => Linguistics::Latin::Verb::EŌ_ĪRE_IVĪ_ITUM,
|
14
|
+
"ferō ferre tulī lātum" => Linguistics::Latin::Verb::FERŌ_FERRE_TULĪ_LĀTUM,
|
15
|
+
"fiō fiērī factus" => Linguistics::Latin::Verb::FIŌ_FIĒRĪ_FACTUS,
|
16
|
+
"mālō mālle māluī" => Linguistics::Latin::Verb::MĀLŌ_MĀLLE_MĀLUĪ,
|
17
|
+
"meminī meminisse" => Linguistics::Latin::Verb::MEMINĪ_MEMINISSE,
|
18
|
+
"nōlō nōlle nōluī" => Linguistics::Latin::Verb::NŌLŌ_NŌLLE_NŌLUĪ,
|
19
|
+
"ōdī ōdisse" => Linguistics::Latin::Verb::ODĪ_ŌDISSE,
|
20
|
+
"ovāre" => Linguistics::Latin::Verb::OVĀRE,
|
21
|
+
"possum posse potuī" => Linguistics::Latin::Verb::POSSUM_POSSE_POTUĪ,
|
22
|
+
"prōsum prōdesse prōfuī prōfutūrus" => Linguistics::Latin::Verb::PRŌSUM_PRŌDESSE_PRŌFUĪ_PRŌFUTŪRUS,
|
23
|
+
"quaesō" => Linguistics::Latin::Verb::QUAESŌ,
|
24
|
+
"queō quīre quīvī" => Linguistics::Latin::Verb::QUEŌ_QUĪRE_QUĪVĪ,
|
25
|
+
"sum esse fuī futūrus" => Linguistics::Latin::Verb::SUM_ESSE_FUĪ_FUTŪRUS,
|
26
|
+
"volō velle voluī" => Linguistics::Latin::Verb::VOLŌ_VELLE_VOLUĪ,
|
27
|
+
}
|
28
|
+
|
29
|
+
def initialize(lookup_string)
|
30
|
+
@lookup_string = lookup_string
|
31
|
+
end
|
32
|
+
|
33
|
+
def serialized_verb
|
34
|
+
MAPPING[@lookup_string]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Linguistics
|
2
|
+
require "latinverb_irregular_verb_definition_consumer"
|
3
|
+
module Latin
|
4
|
+
module Verb
|
5
|
+
class LatinVerb
|
6
|
+
class IrregularVerbDefinitionConsumer
|
7
|
+
class JsonDeserializer
|
8
|
+
extend Forwardable
|
9
|
+
def_delegators :@retriver, :serialized_verb
|
10
|
+
attr_reader :revivified_data_structure
|
11
|
+
|
12
|
+
def initialize(lookup_string)
|
13
|
+
@lookup_string = lookup_string
|
14
|
+
@retriver = Linguistics::Latin::Verb::LatinVerb::IrregularVerbSerializationRetriever.new(@lookup_string)
|
15
|
+
@revivified_data_structure = eager_load_serialized_object
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def eager_load_serialized_object
|
21
|
+
JSON.parse(serialized_verb || '{ "error": true }')
|
22
|
+
rescue JSON::ParserError => e
|
23
|
+
puts "We were unable to parse JSON for #{@lookup_string}. Please verify your syntax."
|
24
|
+
raise e
|
25
|
+
rescue NameError => e
|
26
|
+
puts "We were unable to find a definition for #{@lookup_string}"
|
27
|
+
raise e
|
28
|
+
rescue => e
|
29
|
+
warn "#{@lookup_string} was identified as irregular but did not have a definition provided."
|
30
|
+
raise e
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
class IrregularLookupTest < Minitest::Test
|
2
|
+
def test_succesful_lookup
|
3
|
+
consumer = Linguistics::Latin::Verb::LatinVerb::IrregularVerbDefinitionConsumer.new("sum esse fuī futūrus")
|
4
|
+
assert_equal "esse", consumer.structure["infinitives"]["data"]["present_active_infinitive"]
|
5
|
+
end
|
6
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: latinverb_irregular_verb_definition_consumer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Steven G. Harms
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: linguistics_latin
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- steven.harms@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- latinverb_irregular_verb_definition_consumer.gemspec
|
68
|
+
- lib/latinverb_irregular_verb_definition_consumer.rb
|
69
|
+
- lib/latinverb_irregular_verb_definition_consumer/irregular_verb_serialization_retriever.rb
|
70
|
+
- lib/latinverb_irregular_verb_definition_consumer/json_deserializer.rb
|
71
|
+
- lib/latinverb_irregular_verb_definition_consumer/version.rb
|
72
|
+
- test/irregular_lookup_test.rb
|
73
|
+
homepage: ''
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.2.2
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: Abstraction for retrieving raw serializations of irregualr verb definitions
|
97
|
+
test_files:
|
98
|
+
- test/irregular_lookup_test.rb
|