Permalink
Browse files

fixed a bug in netineti results interpretation

  • Loading branch information...
1 parent 20dd462 commit aa3b51712963a4614a2c98a46b1f9f4c4fc205a2 @dimus dimus committed Jun 5, 2012
@@ -8,9 +8,10 @@ def find(text)
# the form does not get sent if text is nil or empty
return [] if text.nil? || text.empty?
response = RestClient.post("http://#{@host}:#{@port}", data: text)
-
response.body.split("|").collect do |info|
- name, offset_start = info.split(',')
+ res = info.split(",")
+ name = res[0...-2].join(",")
+ offset_start = res[-2]
name.force_encoding('utf-8')
normalized_name = NameSpotter::ScientificName.normalize(name)
NameSpotter::ScientificName.new(name, :scientific_name => normalized_name, :start_position => offset_start.to_i)
@@ -3,7 +3,8 @@ class ScientificName
attr_reader :verbatim, :scientific, :start_pos, :end_pos, :score
def self.normalize(name)
- name.gsub(/\s+/, ' ')
+ name = name.gsub(",", " ")
+ name.gsub(/\s+/, " ")
end
def initialize(verbatim_name, options={})
@@ -0,0 +1,91 @@
+FLAT WORMS 45
+
+1898 The Regeneration of the Nervous System of Planaria torva and
+ the Anatomy of the Nervous System of Double-headed forms.
+ Jour. Morph. vol. 14, no. 2, pp. 337-344, pi. 28.
+
+Goto, S. , , , -..v T
+
+1895 Studies on the Ectoparasitic Trematodes of Japan. Ihe Jour,
+ of the Coll. Sc. Imp. Univ. Japan, vol. 8, pp. 1-273, pi. 1-27.
+
+Graff, L. v. , ^, ^ V. . rr.-
+
+191'^-1914 Turbellaria. Bearbeitet von Dr. L. v. Graff. Bronn s lier-
+ Reiehs. Vierter Bd. Wurmer, pp. 2601-2960, pi. 24-47, text figs.
+ 1-95. Nervous system, pi. 52-54.
+
+Haswell, W. A. a. . j r> t
+
+1887 On Temnocephala, an aberrant MonoKenttic Trematode. q. Jour.
+ Mic. Sc. n. s. v. 28, pp. 279-302, pi. 20-22.
+
+Hallez, P. ,. . 1 r, , r 4.
+
+1873 Observations sur le Prostmum hneare. Arch. Zool. txper. et
+ Gen. t. ii, pp. 559-585, pi. 20-22.
+
+Hamann, O. . ^ , ^ j- /-. i.
+
+1885. Taenia lineata Goeze, eine Taline mit flaschenstandigen Oesch.
+ lechtsoffnungen. Zeit. f. wiss. Zool, Bd. 34.
+
+Havert, J. „ ^ . r>- ^
+
+1900 Contribution a I'etude du Systeme des Trematodes. Distomum
+ hepaticum. La Cellule, vol. 17, pp. 353-380, pi, 1-4.
+
+Heath, H. /-> ir » e d ««
+
+1902. The Anatomy of Epidella squamula sp. nov. Calif. Ac. be. free.
+
+3d sec. Zool. vol. 3.
+
+Heath, H., and McGregor, E. A.
+
+1912. New Polyclads from Monterey Bay, Calif. Proc. Phila. .\c. be.
+ v. Ixiv, pp. 453-488, pi. 12-18, 12 text figs.
+
+Hesse, R. , , • , c j u •
+
+1897. Untersuchungen ueber die Organe der Lichtemsfindung bei
+
+niederen Thieren. Zeit. f. wiss. Zool. Bd. 62, pp. .527-582. Taf.
+ 27-38, 3 text figs.
+
+liiama, I. „ . , , ■.■ i_j. j
+
+1884. Untersuchungen uber den Bau und Entwicklungsgeschichte der
+ Susswasser Dendrocoelen (ticliden). Zeit. f. wjfs. Zool. Bd. 11,
+ pp. 359-464, Taf. 20-23, 3 wood cuts.
+
+Jiinichen, E. ,, . . r, ■. r ■
+
+1896 Beitrage ziir Kenntnis des Turbellarien Auges. Zeit. f. wiss.
+ Zool. Bd. 62, pp. 250-288.
+
+Joseph, V. AT
+
+1886. Uber Centialnervensystem der Bandwurmer. Auszug in tag-
+ bladt 59. Naturf. u. Arzte in Berlin.
+
+Kahne, Z. „ . t^ i ■ j
+
+1885. Anatomie von Taienia perfohata, als Beitrag zur Kenntniss der
+ Cestoden. Zeit. f. wiss. Zool. Bd. 34.
+
+Kepner. W. A. and Foshee. A. M. ,„,_■.
+
+1917. Effects of light and darkness on the eye of Prorhynchus ap-
+ planatus Kennel. Jour. Exp. Zool., vol. 30, pp. 465-473.
+
+Kepner. W. A. and Rich A. .,,■•,.• t i:-
+
+1918 Reactions of the probiscis of Planaria albissima vej. Jour. t>xp.
+ Zool., vol. 26, pp. 83-100, 10 figs.
+
+Kepner, W. A., and Lawrence, J. S. „ , , ^ „ . on
+
+1918. The eye of Polycystis geettei (Bresslau). Jour. Morph. v. M).
+ no. 2. ■
+
@@ -79,4 +79,12 @@
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}]}
end
+ it "should not make unsequential offsets on a page when using NetiNeti" do
+ text = open(File.join(File.dirname(__FILE__), 'files', 'journalofentomol13pomo_0063.txt'), 'r:utf-8').read
+ res = @neti.find(text)
+ offsets = res[:names].map {|n| n[:offsetStart]}
+ offsets.sort.should == offsets
+ offsets[0].should == 67
+ end
+
end

0 comments on commit aa3b517

Please sign in to comment.