class Taxonifi::Splitter::Tokens::Quadrinomial

A token to match quadrinomial.s Matches: Foo Foo (Bar) Foo (Bar) stuff Foo (Bar) stuff things Foo stuff Foo stuff things TODO: This will likley erroroneously match on authors names that are uncapitalized, e.g.:

Foo stuff von Helsing, 1920

Attributes

genus[R]
species[R]
subgenus[R]
subspecies[R]

Public Class Methods

new(str) click to toggle source
# File lib/splitter/tokens.rb, line 262
def initialize(str)
  str.strip 
  str =~ %r\A\s*([A-Z][^\s]+)\s*(\([A-Z][a-z]+\))?\s?([a-z][^\s]+)?\s?([a-z][^\s]+)?\s*/
  @genus = $1 
  @subgenus = $2
  @species = $3
  @subspecies = $4

  if @subgenus =~ %r\((.*)\)/
    @subgenus = $1
  end
end