parsley-store 0.3.2 → 0.3.3
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 +24 -0
- data/.ruby-version +1 -0
- data/CHANGELOG +1 -0
- data/Gemfile +1 -2
- data/Gemfile.lock +22 -30
- data/README.dm +41 -0
- data/Rakefile +15 -45
- data/lib/parsley-store.rb +18 -6
- data/lib/parsley-store/version.rb +3 -0
- metadata +30 -77
- data/.rvmrc +0 -2
- data/README.rdoc +0 -36
- data/VERSION +0 -1
- data/bin/parsley-store +0 -3
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 127205fef9e3d4fc643b63e7952ba9f80069a369
|
4
|
+
data.tar.gz: 878294e658908172539d099855d9897d9717908b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6812a3886b8ca8f2a60e579be49b5e453e577e862e6f834fd2949cf883c2f8fb9fa9097e164dfc8f361eab99895c881c1c0030b0fa0fabb09a48c7c91306e07b
|
7
|
+
data.tar.gz: 6d4f5fd32bb151f9e159c3f12855056d69dfed9f21809825c7a6e82605f2e73b27da109125db2d97900036c442227b62f5b6e23c8a47236b73f8a94650e63e30
|
data/.gitignore
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
## MAC OS
|
2
|
+
.DS_Store
|
3
|
+
|
4
|
+
## TEXTMATE
|
5
|
+
*.tmproj
|
6
|
+
tmtags
|
7
|
+
|
8
|
+
## EMACS
|
9
|
+
*~
|
10
|
+
\#*
|
11
|
+
.\#*
|
12
|
+
|
13
|
+
## VIM
|
14
|
+
*.swp
|
15
|
+
|
16
|
+
## PROJECT::GENERAL
|
17
|
+
coverage
|
18
|
+
rdoc
|
19
|
+
pkg
|
20
|
+
parsley-store.gemspec
|
21
|
+
|
22
|
+
## PROJECT::SPECIFIC
|
23
|
+
.bundle
|
24
|
+
bundle_bin
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.0.0-p353
|
data/CHANGELOG
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,45 +1,38 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
biodiversity (3.1.
|
4
|
+
biodiversity (3.1.2)
|
5
5
|
parallel
|
6
6
|
parallel (~> 0.6)
|
7
7
|
rake (~> 10.0)
|
8
8
|
treetop
|
9
9
|
treetop (~> 1.4)
|
10
10
|
unicode_utils (~> 1.4)
|
11
|
-
builder (3.2.
|
12
|
-
cucumber (1.3.
|
11
|
+
builder (3.2.2)
|
12
|
+
cucumber (1.3.10)
|
13
13
|
builder (>= 2.1.2)
|
14
14
|
diff-lcs (>= 1.1.3)
|
15
|
-
gherkin (~> 2.12
|
15
|
+
gherkin (~> 2.12)
|
16
|
+
multi_json (>= 1.7.5, < 2.0)
|
17
|
+
multi_test (>= 0.0.2)
|
18
|
+
diff-lcs (1.2.5)
|
19
|
+
gherkin (2.12.2)
|
16
20
|
multi_json (~> 1.3)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
git (1.2.5)
|
21
|
-
jeweler (1.8.4)
|
22
|
-
bundler (~> 1.0)
|
23
|
-
git (>= 1.2.5)
|
24
|
-
rake
|
25
|
-
rdoc
|
26
|
-
json (1.7.7)
|
27
|
-
multi_json (1.7.3)
|
28
|
-
parallel (0.7.0)
|
21
|
+
multi_json (1.8.2)
|
22
|
+
multi_test (0.0.2)
|
23
|
+
parallel (0.9.1)
|
29
24
|
polyglot (0.3.3)
|
30
|
-
rake (10.0
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
rspec-
|
36
|
-
|
37
|
-
|
38
|
-
rspec-core (2.13.1)
|
39
|
-
rspec-expectations (2.13.0)
|
25
|
+
rake (10.1.0)
|
26
|
+
redis (3.0.6)
|
27
|
+
rspec (2.14.1)
|
28
|
+
rspec-core (~> 2.14.0)
|
29
|
+
rspec-expectations (~> 2.14.0)
|
30
|
+
rspec-mocks (~> 2.14.0)
|
31
|
+
rspec-core (2.14.7)
|
32
|
+
rspec-expectations (2.14.4)
|
40
33
|
diff-lcs (>= 1.1.3, < 2.0)
|
41
|
-
rspec-mocks (2.
|
42
|
-
treetop (1.4.
|
34
|
+
rspec-mocks (2.14.4)
|
35
|
+
treetop (1.4.15)
|
43
36
|
polyglot
|
44
37
|
polyglot (>= 0.3.1)
|
45
38
|
unicode_utils (1.4.0)
|
@@ -48,8 +41,7 @@ PLATFORMS
|
|
48
41
|
ruby
|
49
42
|
|
50
43
|
DEPENDENCIES
|
51
|
-
biodiversity (~> 3.1
|
44
|
+
biodiversity (~> 3.1)
|
52
45
|
cucumber (~> 1.3)
|
53
|
-
jeweler (~> 1.8)
|
54
46
|
redis (~> 3.0)
|
55
47
|
rspec (~> 2.13)
|
data/README.dm
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
parsley-store
|
2
|
+
=============
|
3
|
+
|
4
|
+
This gem allows to dramatically increase speed of 'parsing' scientific names.
|
5
|
+
It stores parsed strings in Redis database and does not repeat work already done
|
6
|
+
|
7
|
+
Installation
|
8
|
+
------------
|
9
|
+
|
10
|
+
Make sure you have Redis installed on your localhost
|
11
|
+
|
12
|
+
gem install parsley-store
|
13
|
+
|
14
|
+
Usage
|
15
|
+
-----
|
16
|
+
|
17
|
+
parser = ParsleyStore.new
|
18
|
+
parser.parse('Homo sapiens sapiens Linn. 1758')
|
19
|
+
parser.parse('Homo sapiens sapiens Linn. 1758')
|
20
|
+
|
21
|
+
The second parse must be much faster!
|
22
|
+
|
23
|
+
To get only canonical name:
|
24
|
+
|
25
|
+
parser.parse('Homo sapiens sapiens Linn. 1758', :canonical_only => true)
|
26
|
+
|
27
|
+
Contributing
|
28
|
+
------------
|
29
|
+
|
30
|
+
1. Fork it
|
31
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
32
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
33
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
34
|
+
5. Create new Pull Request
|
35
|
+
|
36
|
+
Copyright
|
37
|
+
---------
|
38
|
+
|
39
|
+
Authors: [Dmitry Mozzherin][12]
|
40
|
+
|
41
|
+
Copyright (c) 2010-2014 Marine Biological Laboratory. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -1,56 +1,26 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'jeweler'
|
5
|
-
Jeweler::Tasks.new do |gem|
|
6
|
-
gem.name = "parsley-store"
|
7
|
-
gem.summary = %Q{Scientific Names Parser with Cached Results}
|
8
|
-
gem.description = %Q{Scientific names parser/atomizer with cached distributed storage of atomized data}
|
9
|
-
gem.email = "dmozzherin@gmail.com"
|
10
|
-
gem.homepage = "http://github.com/GlobalNamesArchitecture/parsley-store"
|
11
|
-
gem.authors = ["Dmitry Mozzherin"]
|
12
|
-
# gem.add_development_dependency "rspec", ">= 1.2.9"
|
13
|
-
# gem.add_development_dependency "cucumber", ">= 0"
|
14
|
-
# gem.add_dependency "biodiversity", "~> 3.0.1"
|
15
|
-
# gem.add_dependency "redis"
|
16
|
-
# gem.add_dependency "SystemTimer"
|
17
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
18
|
-
end
|
19
|
-
Jeweler::GemcutterTasks.new
|
20
|
-
rescue LoadError
|
21
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
22
|
-
end
|
23
|
-
|
1
|
+
require 'bundler'
|
2
|
+
require 'bundler/gem_tasks'
|
24
3
|
require 'rspec/core'
|
25
4
|
require 'rspec/core/rake_task'
|
26
|
-
|
27
|
-
|
28
|
-
end
|
5
|
+
require 'cucumber'
|
6
|
+
require 'cucumber/rake/task'
|
29
7
|
|
30
|
-
|
31
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
32
|
-
spec.rcov = true
|
33
|
-
end
|
8
|
+
Bundler::GemHelper.install_tasks
|
34
9
|
|
35
10
|
begin
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
task :features do
|
42
|
-
abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
|
43
|
-
end
|
11
|
+
Bundler.setup(:default, :development)
|
12
|
+
rescue Bundler::BundlerError => e
|
13
|
+
$stderr.puts e.message
|
14
|
+
$stderr.puts 'Run `bundle install` to install missing gems'
|
15
|
+
exit e.status_code
|
44
16
|
end
|
45
17
|
|
46
18
|
task :default => :spec
|
47
19
|
|
48
|
-
|
49
|
-
|
50
|
-
|
20
|
+
RSpec::Core::RakeTask.new do |t|
|
21
|
+
t.pattern = 'spec/**/*spec.rb'
|
22
|
+
end
|
51
23
|
|
52
|
-
|
53
|
-
|
54
|
-
rdoc.rdoc_files.include('README*')
|
55
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
24
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
25
|
+
t.cucumber_opts = "features --format pretty"
|
56
26
|
end
|
data/lib/parsley-store.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
require 'redis'
|
2
2
|
require 'biodiversity'
|
3
|
+
require_relative 'parsley-store/version'
|
3
4
|
|
4
|
-
|
5
|
+
if RUBY_VERSION < '1.9.1'
|
6
|
+
raise 'IMPORTANT: Parsley-store gem requires ruby >= 1.9.1'
|
7
|
+
end
|
5
8
|
|
6
9
|
class ParsleyStore
|
7
10
|
#database numbers for Redis
|
@@ -37,7 +40,7 @@ class ParsleyStore
|
|
37
40
|
return stored if stored
|
38
41
|
else
|
39
42
|
stored = @local.get(@scientific_name)
|
40
|
-
return JSON.parse(stored, :
|
43
|
+
return JSON.parse(stored, symbolize_names: true) if stored
|
41
44
|
end
|
42
45
|
end
|
43
46
|
|
@@ -46,15 +49,24 @@ class ParsleyStore
|
|
46
49
|
@parser.parse(@scientific_name)
|
47
50
|
rescue
|
48
51
|
@parser = ScientificNameParser.new
|
49
|
-
@parser.parse(@scientific_name) rescue {
|
52
|
+
@parser.parse(@scientific_name) rescue {
|
53
|
+
scientificName: {parsed: false,
|
54
|
+
parser_version: ScientificNameParser::VERSION,
|
55
|
+
anonical: nil,
|
56
|
+
verbatim: @scientific_name}}
|
50
57
|
end
|
51
58
|
end
|
52
59
|
|
53
60
|
def cache_parsed_data(parsed_data)
|
54
61
|
if @canonical_only
|
55
|
-
@local.hset
|
56
|
-
|
57
|
-
|
62
|
+
@local.hset(@scientific_name,
|
63
|
+
'parsed',
|
64
|
+
parsed_data[:scientificName][:parsed])
|
65
|
+
@local.hset(@scientific_name,
|
66
|
+
'parser_version',
|
67
|
+
parsed_data[:scientificName][:parser_version])
|
68
|
+
@local.hset(@scientific_name,
|
69
|
+
'canonical', parsed_data[:scientificName][:canonical])
|
58
70
|
parsed_data[:scientificName][:canonical]
|
59
71
|
else
|
60
72
|
serialized = parsed_data.to_json
|
metadata
CHANGED
@@ -1,117 +1,70 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parsley-store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Dmitry Mozzherin
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
13
|
-
dependencies:
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
requirements:
|
19
|
-
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 3.1.0
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 3.1.0
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: redis
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '3.0'
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '3.0'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: jeweler
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ~>
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '1.8'
|
54
|
-
type: :runtime
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.8'
|
62
|
-
description: Scientific names parser/atomizer with cached distributed storage of atomized
|
63
|
-
data
|
64
|
-
email: dmozzherin@gmail.com
|
65
|
-
executables:
|
66
|
-
- parsley-store
|
11
|
+
date: 2013-12-18 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Scientific Names Parser with Cached Results
|
14
|
+
email:
|
15
|
+
- dmozzherin@gmail.com
|
16
|
+
executables: []
|
67
17
|
extensions: []
|
68
|
-
extra_rdoc_files:
|
69
|
-
- LICENSE
|
70
|
-
- README.rdoc
|
18
|
+
extra_rdoc_files: []
|
71
19
|
files:
|
72
20
|
- .document
|
73
|
-
- .
|
21
|
+
- .gitignore
|
22
|
+
- .ruby-version
|
74
23
|
- CHANGELOG
|
75
24
|
- Gemfile
|
76
25
|
- Gemfile.lock
|
77
26
|
- LICENSE
|
78
|
-
- README.
|
27
|
+
- README.dm
|
79
28
|
- Rakefile
|
80
|
-
- VERSION
|
81
|
-
- bin/parsley-store
|
82
29
|
- features/parsley-store.feature
|
83
30
|
- features/step_definitions/parsley-store_steps.rb
|
84
31
|
- features/support/env.rb
|
85
32
|
- features/support/helper.rb
|
86
33
|
- lib/parsley-store.rb
|
34
|
+
- lib/parsley-store/version.rb
|
87
35
|
- spec/parsley-store_spec.rb
|
88
36
|
- spec/spec.opts
|
89
37
|
- spec/spec_helper.rb
|
90
|
-
homepage:
|
91
|
-
licenses:
|
38
|
+
homepage: https://github.com/GlobalNamesArchitecture/parsley-store
|
39
|
+
licenses:
|
40
|
+
- MIT
|
41
|
+
metadata: {}
|
92
42
|
post_install_message:
|
93
43
|
rdoc_options: []
|
94
44
|
require_paths:
|
95
45
|
- lib
|
96
46
|
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
47
|
requirements:
|
99
|
-
- -
|
48
|
+
- - '>='
|
100
49
|
- !ruby/object:Gem::Version
|
101
50
|
version: '0'
|
102
|
-
segments:
|
103
|
-
- 0
|
104
|
-
hash: -627591492272483572
|
105
51
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
52
|
requirements:
|
108
|
-
- -
|
53
|
+
- - '>='
|
109
54
|
- !ruby/object:Gem::Version
|
110
55
|
version: '0'
|
111
56
|
requirements: []
|
112
57
|
rubyforge_project:
|
113
|
-
rubygems_version:
|
58
|
+
rubygems_version: 2.0.14
|
114
59
|
signing_key:
|
115
|
-
specification_version:
|
116
|
-
summary: Scientific
|
117
|
-
|
60
|
+
specification_version: 4
|
61
|
+
summary: Scientific names parser/atomizer with cached distributed storage of atomized
|
62
|
+
data
|
63
|
+
test_files:
|
64
|
+
- features/parsley-store.feature
|
65
|
+
- features/step_definitions/parsley-store_steps.rb
|
66
|
+
- features/support/env.rb
|
67
|
+
- features/support/helper.rb
|
68
|
+
- spec/parsley-store_spec.rb
|
69
|
+
- spec/spec.opts
|
70
|
+
- spec/spec_helper.rb
|
data/.rvmrc
DELETED
data/README.rdoc
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
= parsley-store
|
2
|
-
|
3
|
-
This gem allows to dramatically increase speed of 'parsing' scientific names.
|
4
|
-
It stores parsed strings in Redis database and does not repeat work already done
|
5
|
-
|
6
|
-
== Installation
|
7
|
-
|
8
|
-
Make sure you have Redis installed on your localhost
|
9
|
-
|
10
|
-
gem install parsley-store
|
11
|
-
|
12
|
-
== Usage
|
13
|
-
|
14
|
-
parser = ParsleyStore.new
|
15
|
-
parser.parse('Homo sapiens sapiens Linn. 1758')
|
16
|
-
parser.parse('Homo sapiens sapiens Linn. 1758')
|
17
|
-
|
18
|
-
The second parse must be much faster!
|
19
|
-
|
20
|
-
To get only canonical name:
|
21
|
-
|
22
|
-
parser.parse('Homo sapiens sapiens Linn. 1758', :canonical_only => true)
|
23
|
-
|
24
|
-
== Note on Patches/Pull Requests
|
25
|
-
|
26
|
-
* Fork the project.
|
27
|
-
* Make your feature addition or bug fix.
|
28
|
-
* Add tests for it. This is important so I don't break it in a
|
29
|
-
future version unintentionally.
|
30
|
-
* Commit, do not mess with rakefile, version, or history.
|
31
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
32
|
-
* Send me a pull request. Bonus points for topic branches.
|
33
|
-
|
34
|
-
== Copyright
|
35
|
-
|
36
|
-
Copyright (c) 2010 Dmitry Mozzherin. See LICENSE for details.
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.3.2
|
data/bin/parsley-store
DELETED