biodiversity19 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/bin/nnparse +10 -4
  3. metadata +4 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.2
1
+ 0.6.3
data/bin/nnparse CHANGED
@@ -1,6 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
- require 'rubygems'
3
- gem_name = RUBY_VERSION.split('.')[0..1].join('').to_i > 18 ? 'biodiversity19' : 'biodiversity'
2
+ # encoding: utf-8
3
+ ruby_min_version = RUBY_VERSION.split(".")[0..1].join('').to_i
4
+ if ruby_min_version < 19
5
+ require 'rubygems'
6
+ gem_name = 'biodiversity'
7
+ else
8
+ gem_name = 'biodiversity19'
9
+ end
4
10
  gem gem_name rescue nil
5
11
 
6
12
  $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
@@ -19,13 +25,13 @@ end
19
25
  input = ARGV[0]
20
26
  output = ARGV[1] || 'parsed.json'
21
27
 
22
- ruby_min_version = RUBY_VERSION.split(".")[0..1].join('').to_i
23
28
 
24
29
  p = ScientificNameParser.new
25
30
  o = open(output, 'w')
26
31
  count = 0
27
32
  puts 'Parsing...'
28
- IO.foreach(input) do |line|
33
+ f = ruby_min_version < 19 ? open(input) : open(input, 'r:utf-8')
34
+ f.each do |line|
29
35
  count += 1
30
36
  puts("%s lines parsed" % count) if count % 10000 == 0
31
37
  name = line.gsub(/^[\d]*\s*/, '').strip
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biodiversity19
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 2
10
- version: 0.6.2
9
+ - 3
10
+ version: 0.6.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dmitry Mozzherin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-05-21 00:00:00 -04:00
18
+ date: 2010-05-26 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency