name-spotter 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -8,9 +8,10 @@ class NameSpotter
8
8
  # the form does not get sent if text is nil or empty
9
9
  return [] if text.nil? || text.empty?
10
10
  response = RestClient.post("http://#{@host}:#{@port}", data: text)
11
-
12
11
  response.body.split("|").collect do |info|
13
- name, offset_start = info.split(',')
12
+ res = info.split(",")
13
+ name = res[0...-2].join(",")
14
+ offset_start = res[-2]
14
15
  name.force_encoding('utf-8')
15
16
  normalized_name = NameSpotter::ScientificName.normalize(name)
16
17
  NameSpotter::ScientificName.new(name, :scientific_name => normalized_name, :start_position => offset_start.to_i)
@@ -3,7 +3,8 @@ class NameSpotter
3
3
  attr_reader :verbatim, :scientific, :start_pos, :end_pos, :score
4
4
 
5
5
  def self.normalize(name)
6
- name.gsub(/\s+/, ' ')
6
+ name = name.gsub(",", " ")
7
+ name.gsub(/\s+/, " ")
7
8
  end
8
9
 
9
10
  def initialize(verbatim_name, options={})
data/name-spotter.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "name-spotter"
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Anthony Goddard", "Chuck Ha", "Dmitry Mozzherin"]
12
- s.date = "2012-06-04"
12
+ s.date = "2012-06-05"
13
13
  s.description = "The gem searches for scientific names in texts using socket servers running TaxonFinder (by Patrick Leary) and NetiNeti (by Lakshmi Manohar Akella)"
14
14
  s.email = "dmozzherin@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -37,6 +37,7 @@ Gem::Specification.new do |s|
37
37
  "lib/name-spotter/taxon_finder_client.rb",
38
38
  "name-spotter.gemspec",
39
39
  "spec/files/journalofentomol13pomo_0018.txt",
40
+ "spec/files/journalofentomol13pomo_0063.txt",
40
41
  "spec/name-spotter_spec.rb",
41
42
  "spec/scientific_name_spec.rb",
42
43
  "spec/spec_helper.rb"
@@ -0,0 +1,91 @@
1
+ FLAT WORMS 45
2
+
3
+ 1898 The Regeneration of the Nervous System of Planaria torva and
4
+ the Anatomy of the Nervous System of Double-headed forms.
5
+ Jour. Morph. vol. 14, no. 2, pp. 337-344, pi. 28.
6
+
7
+ Goto, S. , , , -..v T
8
+
9
+ 1895 Studies on the Ectoparasitic Trematodes of Japan. Ihe Jour,
10
+ of the Coll. Sc. Imp. Univ. Japan, vol. 8, pp. 1-273, pi. 1-27.
11
+
12
+ Graff, L. v. , ^, ^ V. . rr.-
13
+
14
+ 191'^-1914 Turbellaria. Bearbeitet von Dr. L. v. Graff. Bronn s lier-
15
+ Reiehs. Vierter Bd. Wurmer, pp. 2601-2960, pi. 24-47, text figs.
16
+ 1-95. Nervous system, pi. 52-54.
17
+
18
+ Haswell, W. A. a. . j r> t
19
+
20
+ 1887 On Temnocephala, an aberrant MonoKenttic Trematode. q. Jour.
21
+ Mic. Sc. n. s. v. 28, pp. 279-302, pi. 20-22.
22
+
23
+ Hallez, P. ,. . 1 r, , r 4.
24
+
25
+ 1873 Observations sur le Prostmum hneare. Arch. Zool. txper. et
26
+ Gen. t. ii, pp. 559-585, pi. 20-22.
27
+
28
+ Hamann, O. . ^ , ^ j- /-. i.
29
+
30
+ 1885. Taenia lineata Goeze, eine Taline mit flaschenstandigen Oesch.
31
+ lechtsoffnungen. Zeit. f. wiss. Zool, Bd. 34.
32
+
33
+ Havert, J. „ ^ . r>- ^
34
+
35
+ 1900 Contribution a I'etude du Systeme des Trematodes. Distomum
36
+ hepaticum. La Cellule, vol. 17, pp. 353-380, pi, 1-4.
37
+
38
+ Heath, H. /-> ir » e d ««
39
+
40
+ 1902. The Anatomy of Epidella squamula sp. nov. Calif. Ac. be. free.
41
+
42
+ 3d sec. Zool. vol. 3.
43
+
44
+ Heath, H., and McGregor, E. A.
45
+
46
+ 1912. New Polyclads from Monterey Bay, Calif. Proc. Phila. .\c. be.
47
+ v. Ixiv, pp. 453-488, pi. 12-18, 12 text figs.
48
+
49
+ Hesse, R. , , • , c j u •
50
+
51
+ 1897. Untersuchungen ueber die Organe der Lichtemsfindung bei
52
+
53
+ niederen Thieren. Zeit. f. wiss. Zool. Bd. 62, pp. .527-582. Taf.
54
+ 27-38, 3 text figs.
55
+
56
+ liiama, I. „ . , , ■.■ i_j. j
57
+
58
+ 1884. Untersuchungen uber den Bau und Entwicklungsgeschichte der
59
+ Susswasser Dendrocoelen (ticliden). Zeit. f. wjfs. Zool. Bd. 11,
60
+ pp. 359-464, Taf. 20-23, 3 wood cuts.
61
+
62
+ Jiinichen, E. ,, . . r, ■. r ■
63
+
64
+ 1896 Beitrage ziir Kenntnis des Turbellarien Auges. Zeit. f. wiss.
65
+ Zool. Bd. 62, pp. 250-288.
66
+
67
+ Joseph, V. AT
68
+
69
+ 1886. Uber Centialnervensystem der Bandwurmer. Auszug in tag-
70
+ bladt 59. Naturf. u. Arzte in Berlin.
71
+
72
+ Kahne, Z. „ . t^ i ■ j
73
+
74
+ 1885. Anatomie von Taienia perfohata, als Beitrag zur Kenntniss der
75
+ Cestoden. Zeit. f. wiss. Zool. Bd. 34.
76
+
77
+ Kepner. W. A. and Foshee. A. M. ,„,_■.
78
+
79
+ 1917. Effects of light and darkness on the eye of Prorhynchus ap-
80
+ planatus Kennel. Jour. Exp. Zool., vol. 30, pp. 465-473.
81
+
82
+ Kepner. W. A. and Rich A. .,,■•,.• t i:-
83
+
84
+ 1918 Reactions of the probiscis of Planaria albissima vej. Jour. t>xp.
85
+ Zool., vol. 26, pp. 83-100, 10 figs.
86
+
87
+ Kepner, W. A., and Lawrence, J. S. „ , , ^ „ . on
88
+
89
+ 1918. The eye of Polycystis geettei (Bresslau). Jour. Morph. v. M).
90
+ no. 2. ■
91
+
@@ -79,4 +79,12 @@ describe "NameSpotter" do
79
79
  tf_res.should == {:names=>[{:verbatim=>"Betula\n alba", :scientificName=>"Betula alba", :offsetStart=>24, :offsetEnd=>35}, {:verbatim=>"PSEUDOSCORPIONIDA", :scientificName=>"Pseudoscorpionida", :offsetStart=>41, :offsetEnd=>57}, {:verbatim=>"Aranea röselii", :scientificName=>"Aranea röselii", :offsetStart=>63, :offsetEnd=>76}, {:verbatim=>"ARANEA", :scientificName=>"Aranea", :offsetStart=>94, :offsetEnd=>99}, {:verbatim=>"Pardosa\n moesta f. moesta", :scientificName=>"Pardosa moesta f. moesta", :offsetStart=>113, :offsetEnd=>137}]}
80
80
  end
81
81
 
82
+ it "should not make unsequential offsets on a page when using NetiNeti" do
83
+ text = open(File.join(File.dirname(__FILE__), 'files', 'journalofentomol13pomo_0063.txt'), 'r:utf-8').read
84
+ res = @neti.find(text)
85
+ offsets = res[:names].map {|n| n[:offsetStart]}
86
+ offsets.sort.should == offsets
87
+ offsets[0].should == 67
88
+ end
89
+
82
90
  end
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.1.0
4
+ version: 0.1.1
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-06-04 00:00:00.000000000 Z
14
+ date: 2012-06-05 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -234,6 +234,7 @@ files:
234
234
  - lib/name-spotter/taxon_finder_client.rb
235
235
  - name-spotter.gemspec
236
236
  - spec/files/journalofentomol13pomo_0018.txt
237
+ - spec/files/journalofentomol13pomo_0063.txt
237
238
  - spec/name-spotter_spec.rb
238
239
  - spec/scientific_name_spec.rb
239
240
  - spec/spec_helper.rb
@@ -252,7 +253,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
252
253
  version: '0'
253
254
  segments:
254
255
  - 0
255
- hash: 4382720522777082124
256
+ hash: 4453341733111217314
256
257
  required_rubygems_version: !ruby/object:Gem::Requirement
257
258
  none: false
258
259
  requirements: