Permalink
Browse files

added badges

  • Loading branch information...
1 parent 2f05401 commit f6a91e7b91f052e6d0b589fe12c8a7d0f1d6a232 @dimus dimus committed Mar 12, 2013
Showing with 49 additions and 41 deletions.
  1. +6 −0 .travis.yml
  2. +1 −1 Gemfile
  3. +42 −40 README.rdoc
View
@@ -0,0 +1,6 @@
+rvm:
+ - 1.9.3
+bundler_args: --without development
+branches:
+ only:
+ - master
View
@@ -5,10 +5,10 @@ gem "parallel"
gem "unicode_utils"
group :development do
+ gem "debugger"
gem "jeweler"
end
group :test do
- gem "debugger"
gem "rspec"
end
View
@@ -1,100 +1,102 @@
= Biodiversity
{<img src="https://badge.fury.io/rb/biodiversity19.png" alt="Gem Version" />}[http://badge.fury.io/rb/biodiversity19]
-{<img src="https://codeclimate.com/badge.png" />}[https://codeclimate.com/github/GlobalNamesArchitecture/biodiversity]
+{<img src="https://secure.travis-ci.org/GlobalNamesArchitecture/biodiversity.png" />}[http://travis-ci.org/GlobalNamesArchitecture/biodiversity]
+{<img src="https://codeclimate.com/github/GlobalNamesArchitecture/biodiversity.png" />}[https://codeclimate.com/github/GlobalNamesArchitecture/biodiversity]
+{<img src="https://gemnasium.com/GlobalNamesArchitecture/biodiversity.png" alt="Dependency Status" />}[https://gemnasium.com/GlobalNamesArchitecture/biodiversity]
Parses taxonomic scientific name and breaks it into semantic elements.
== Installation
To install gem you need RubyGems >= 1.3.6
- $ sudo gem install biodiversity #for ruby 1.8.x
- $ sudo gem install biodiversity19 #for ruby 1.9.x
+$ sudo gem install biodiversity #for ruby 1.8.x
+$ sudo gem install biodiversity19 #for ruby 1.9.x
== Example usage
=== As a command line script
You can parse file with taxonomic names from command line. File should contain one scientific name per line
- nnparser file_with_names
+nnparser file_with_names
=== As a socket server
If you do not use ruby and need a fast access to the parser functionality you can use a socket server
- parserver
+parserver
options:
- parserver --output=canonical
+parserver --output=canonical
to return a canonical form of the name string
- parserver --port 5555
+parserver --port 5555
run socket server on a different port
- parserver --canonical_with_rank
+parserver --canonical_with_rank
to add rank to canonical forms with infraspecific epithet, if it is given
Then you can access it via 4334 port using a socket client library of your programming language. You can find socket client script example in the examples directory of the gem.
If you want to check if socket server works for you:
- #run server in one terminal
- parserver
+#run server in one terminal
+parserver
- #in another terminal window type
- telnet localhost 4334
+#in another terminal window type
+telnet localhost 4334
If you enter a line with a scientific name server will send you back parsed information in json format.
To stop telnet client type any of 'end','exit','q', '.' (without quotes) instead of scientific name
- $ telnet localhost 4334
- Trying ::1...
- Connected to localhost.
- Escape character is '^]'.
- Acacia abyssinica Hochst. ex Benth. ssp. calophylla Brenan
- {"scientificName":{"canonical":"Acacia abyssinica calophylla","parsed":true,"parser_run":1,"verbatim":"Acacia abyssinica Hochst. ex Benth. ssp. calophylla Brenan\r\n","positions":{"0":["genus",6],"18":["author_word",25],"29":["author_word",35],"7":["species",17],"41":["infraspecies",51],"52":["author_word",58]},"hybrid":false,"normalized":"Acacia abyssinica Hochst. ex Benth. ssp. calophylla Brenan","details":[{"species":{"basionymAuthorTeam":{"exAuthorTeam":{"author":["Benth."],"authorTeam":"Benth."},"author":["Hochst."],"authorTeam":"Hochst."},"string":"abyssinica","authorship":"Hochst. ex Benth."},"infraspecies":[{"basionymAuthorTeam":{"author":["Brenan"],"authorTeam":"Brenan"},"string":"calophylla","rank":"ssp.","authorship":"Brenan"}],"genus":{"string":"Acacia"}}]}}
+$ telnet localhost 4334
+Trying ::1...
+Connected to localhost.
+Escape character is '^]'.
+Acacia abyssinica Hochst. ex Benth. ssp. calophylla Brenan
+{"scientificName":{"canonical":"Acacia abyssinica calophylla","parsed":true,"parser_run":1,"verbatim":"Acacia abyssinica Hochst. ex Benth. ssp. calophylla Brenan\r\n","positions":{"0":["genus",6],"18":["author_word",25],"29":["author_word",35],"7":["species",17],"41":["infraspecies",51],"52":["author_word",58]},"hybrid":false,"normalized":"Acacia abyssinica Hochst. ex Benth. ssp. calophylla Brenan","details":[{"species":{"basionymAuthorTeam":{"exAuthorTeam":{"author":["Benth."],"authorTeam":"Benth."},"author":["Hochst."],"authorTeam":"Hochst."},"string":"abyssinica","authorship":"Hochst. ex Benth."},"infraspecies":[{"basionymAuthorTeam":{"author":["Brenan"],"authorTeam":"Brenan"},"string":"calophylla","rank":"ssp.","authorship":"Brenan"}],"genus":{"string":"Acacia"}}]}}
=== As a library
You can use it as a library
- require 'biodiversity'
+require 'biodiversity'
- parser = ScientificNameParser.new
+parser = ScientificNameParser.new
- # to fix capitalization in canonicals
- ScientificNameParser.fix_case("QUERCUS (QUERCUS) ALBA") # Quercus (Quercus) alba
+# to fix capitalization in canonicals
+ScientificNameParser.fix_case("QUERCUS (QUERCUS) ALBA") # Quercus (Quercus) alba
- # to parse a scientific name into a ruby hash
- parser.parse("Plantago major")
+# to parse a scientific name into a ruby hash
+parser.parse("Plantago major")
- #to get json representation
- parser.parse("Plantago").to_json
- #or
- parser.parse("Plantago")
- parser.all_json
+#to get json representation
+parser.parse("Plantago").to_json
+#or
+parser.parse("Plantago")
+parser.all_json
- # to clean name up
- parser.parse(" Plantago major ")[:scientificName][:normalized]
+# to clean name up
+parser.parse(" Plantago major ")[:scientificName][:normalized]
- # to get only cleaned up latin part of the name
- parser.parse("Pseudocercospora dendrobii (H.C. Burnett) U. Braun & Crous 2003")[:scientificName][:canonical]
+# to get only cleaned up latin part of the name
+parser.parse("Pseudocercospora dendrobii (H.C. Burnett) U. Braun & Crous 2003")[:scientificName][:canonical]
- # to get detailed information about elements of the name
- parser.parse("Pseudocercospora dendrobii (H.C. Burnett 1883) U. Braun & Crous 2003")[:scientificName][:details]
+# to get detailed information about elements of the name
+parser.parse("Pseudocercospora dendrobii (H.C. Burnett 1883) U. Braun & Crous 2003")[:scientificName][:details]
- # to parse using several CPUs (4 seem to be optimal)
- parser = ParallelParser.new # ParallelParser.new(4) will try to run 4 processes if hardware allows
- array_of_names = ["Betula alba", "Homo sapiens"....]
- parser.parse(array_of_names) # -> {"Betula alba" => {:scientificName...}, "Homo sapiens" => {:scientificName...}, ...}
+# to parse using several CPUs (4 seem to be optimal)
+parser = ParallelParser.new # ParallelParser.new(4) will try to run 4 processes if hardware allows
+array_of_names = ["Betula alba", "Homo sapiens"....]
+parser.parse(array_of_names) # -> {"Betula alba" => {:scientificName...}, "Homo sapiens" => {:scientificName...}, ...}
parallel parser takes list of names and returns back a hash with names as keys and parsed data as values
@@ -106,5 +108,5 @@ You can use it as a library
parser.parse('Cola cordifolia var. puberula A. Chev.')[:scientificName][:canonical]
# should get 'Cola cordifolia var. puberula'
-Copyright (c) 2009-2011 Marine Biological Laboratory. See LICENSE.txt for
+Copyright (c) 2009-2013 Marine Biological Laboratory. See LICENSE.txt for
further details.

0 comments on commit f6a91e7

Please sign in to comment.