Synonym finder is a biodiversity tool for finding homotypic nomenclatural synonyms in taxonomic hierarchies.‘
Please note that this gem is not tested or inteded to be used with ruby versions 1.8.x or less
gem install synonym-finder
#prepare intput for the gem. The gem takes an array of hashes as input: input = [ {id: 001, path: "Animalia|Athropoda|Insecta|Hymenoptera|Formicidae|Gnamptogenys", name: "Gnamptogenys porcata (Emery, 1896)"}, {id: 003, path: "Animalia|Athropoda|Insecta|Hymenoptera|Formicidae|Gnamptogenys", name: "Gnamptogenys triangularis (Mayr, 1887)"}, {id: 004, path: "Animalia|Athropoda|Insecta|Hymenoptera|Formicidae|Gnamptogenys", name: "Gnamptogenys triangularis var. alba Brown 1992"}, {id: 005, path: "Animalia|Athropoda|Insecta|Hymenoptera|Formicidae|Gnamptogenys", name: "Gnamptogenys triangularis var. borealis Brown 1992"}, {id: 100, path: "Animalia|Athropoda|Insecta|Hymenoptera|Formicidae|Nylanderia", name: "Nylanderia porcata"}, #match 001, no authorhsip {id: 101, path: "Animalia|Athropoda|Insecta|Hymenoptera|Formicidae|Nylanderia", name: "Nylanderia porcatum Emery, 1896"}, {id: 102, path: "Animalia|Athropoda|Insecta|Hymenoptera|Formicidae|Nylanderia", name: "Nylanderia porcatum"}...] # please note that id can be a number or a string requre 'synonym-finder' sf = SynonymFinder.new(input) output = sf.find_synonyms # output has a following format -- # matched putative synonyms are collected into groups of different types # # [ {:type=>"chresonym", :name_ids=>[203, 204]}, # {:type=>"alt_placement", :name_ids=>[400, 600]}, # {:type=>"chresonym", :name_ids=>[101, 102]}, # {:type=>"homotypic", :name_ids=>[203, 303]}, # {:type=>"lexical_variant", :name_ids=>[800, 803]}, # {:type=>"lexical_variant", :name_ids=>[801, 802]}, # {:type=>"homotypic", :name_ids=>[202, 302]}, # {:type=>"homotypic", :name_ids=>[1, 101]}, # {:type=>"misplaced_synonym", :name_ids=>[801, 803, 802, 800]}] # you can also see 'atomical' matches of one name with another: matches = sf.matches # matches have a following format: # {[203, 204]=>{:total_distance=>0, :type=>:chresonym, :auth_match=>0}, # [400, 600]=>{:total_distance=>4, :type=>:alt_placement, :auth_match=>100}, # [101, 102]=>{:total_distance=>0, :type=>:chresonym, :auth_match=>20}, # [203, 303]=>{:total_distance=>2, :type=>:homotypic, :auth_match=>100}, # [400, 803]=>{:total_distance=>4, :type=>:homotypic, :auth_match=>100}, # [500, 803]=>{:total_distance=>2, :type=>:homotypic, :auth_match=>100}, # [600, 803]=>{:total_distance=>2, :type=>:homotypic, :auth_match=>100}, # [800, 803]=>{:total_distance=>0, :type=>:lexical_variant, :auth_match=>100}, # [801, 803]=>{:total_distance=>0, :type=>:misplaced_synonym, :auth_match=>100}, # [802, 803]=>{:total_distance=>0, :type=>:misplaced_synonym, :auth_match=>100}, # [400, 802]=>{:total_distance=>4, :type=>:homotypic, :auth_match=>100}, # [500, 802]=>{:total_distance=>2, :type=>:homotypic, :auth_match=>100}, # [600, 802]=>{:total_distance=>2, :type=>:homotypic, :auth_match=>100}, # ...} # the hash keys are 2 element arrays where elements are name ids. # total distance - is how far two putative synonyms are from each other on the tree # type - is the same as for the grouped output # auth_match - shows if authorship matched between two names: # 0 - authorships did not match, # 20 - one of the names has no authorship data, # 100 - authorship matched.
-
homotypic – possible placement of species to a different genus
-
alt_placement – possibly the same name (i.e. genus moved to a different family
-
chresonym – different authorship with for the same canonical form, both having the same parent
-
lexical_variant – The same parent and genus, but species epithet suffix is different (for example change of the epithet gender)
-
misplaced_synonym – The same parent, matching species epithet, but genus varies, usually happens if a synonyn located at the same level as species.
-
Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet
-
Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it
-
Fork the project
-
Start a feature/bugfix branch
-
Commit and push until you are happy with your contribution
-
Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Copyright © 2011 Dmitry Mozzherin. See LICENSE.txt for further details.