name-spotter 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/VERSION +1 -1
- data/lib/name-spotter.rb +19 -0
- data/name-spotter.gemspec +8 -2
- data/spec/files/english.txt +999 -0
- data/spec/files/not_english.txt +1000 -0
- data/spec/name-spotter_spec.rb +18 -1
- metadata +22 -3
data/spec/name-spotter_spec.rb
CHANGED
@@ -10,6 +10,21 @@ describe "NameSpotter" do
|
|
10
10
|
@clients = [@neti, @tf]
|
11
11
|
end
|
12
12
|
|
13
|
+
it "should find if a text is in english" do
|
14
|
+
eng = open(File.join(File.dirname(__FILE__), 'files', 'english.txt'), 'r:utf-8').read
|
15
|
+
eng2 = open(File.join(File.dirname(__FILE__), 'files', 'english.txt'), 'r:utf-8').read
|
16
|
+
eng3 = open(File.join(File.dirname(__FILE__), 'files', 'journalofentomol13pomo_0018.txt'), 'r:utf-8').read
|
17
|
+
eng3 = open(File.join(File.dirname(__FILE__), 'files', 'journalofentomol13pomo_0063.txt'), 'r:utf-8').read
|
18
|
+
|
19
|
+
not_eng = open(File.join(File.dirname(__FILE__), 'files', 'not_english.txt'), 'r:utf-8').read
|
20
|
+
100.times do
|
21
|
+
NameSpotter.english?(eng).should be_true
|
22
|
+
NameSpotter.english?(eng2).should be_true
|
23
|
+
NameSpotter.english?(eng3).should be_false
|
24
|
+
NameSpotter.english?(not_eng).should be_false
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
13
28
|
it "should exist" do
|
14
29
|
@neti.is_a?(NameSpotter).should be_true
|
15
30
|
@tf.is_a?(NameSpotter).should be_true
|
@@ -62,7 +77,9 @@ describe "NameSpotter" do
|
|
62
77
|
end
|
63
78
|
|
64
79
|
it "should get back correct names using offsets in utf-8 based text" do
|
65
|
-
|
80
|
+
# this test depends on netineti tornado server, not on namespotter itself. Go and fix that!
|
81
|
+
# the issue and the fix: https://github.com/mbl-cli/NetiNeti/pull/1
|
82
|
+
text = "\r\r\n>':¥/. \r\nA text with multibyte characters नेति नेति: Some text that has Betula\n alba and Mus musculus and \neven B. alba and even M. mus-\nculus. Also it has name unknown before: Varanus bitatawa species"
|
66
83
|
res = @neti.find(text)[:names]
|
67
84
|
res.map do |name|
|
68
85
|
verbatim = name[:verbatim]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: name-spotter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-07-
|
14
|
+
date: 2012-07-24 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake
|
@@ -93,6 +93,22 @@ dependencies:
|
|
93
93
|
- - ! '>='
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: unsupervised-language-detection
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
96
112
|
- !ruby/object:Gem::Dependency
|
97
113
|
name: rspec
|
98
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -233,6 +249,7 @@ files:
|
|
233
249
|
- .document
|
234
250
|
- .rspec
|
235
251
|
- .rvmrc
|
252
|
+
- CHANGELOG
|
236
253
|
- Gemfile
|
237
254
|
- Gemfile.lock
|
238
255
|
- LICENSE.txt
|
@@ -249,8 +266,10 @@ files:
|
|
249
266
|
- lib/name-spotter/scientific_name.rb
|
250
267
|
- lib/name-spotter/taxon_finder_client.rb
|
251
268
|
- name-spotter.gemspec
|
269
|
+
- spec/files/english.txt
|
252
270
|
- spec/files/journalofentomol13pomo_0018.txt
|
253
271
|
- spec/files/journalofentomol13pomo_0063.txt
|
272
|
+
- spec/files/not_english.txt
|
254
273
|
- spec/name-spotter_spec.rb
|
255
274
|
- spec/scientific_name_spec.rb
|
256
275
|
- spec/spec_helper.rb
|
@@ -270,7 +289,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
270
289
|
version: '0'
|
271
290
|
segments:
|
272
291
|
- 0
|
273
|
-
hash:
|
292
|
+
hash: -2884343420129589551
|
274
293
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
275
294
|
none: false
|
276
295
|
requirements:
|