Top Level Namespace

Defined Under Namespace

Modules: PreProcessor Classes: LsidResolver, ParallelParser, ScientificNameParser

Constant Summary collapse

BIODIVERSITY_ROOT =
File.join(dir, 'biodiversity')
DEFAULT_PORT =
4334
RUBY_VERSION_INT =
RUBY_VERSION.split('.')[0..1].join('').to_i
OPTIONS =
{
  output: 'json',
  canonical_with_rank: false, 
  port: DEFAULT_PORT
}

Instance Method Summary collapse

Instance Method Details

#get_output(name_string, parser) ⇒ Object



53
54
55
56
57
58
59
60
61
62
# File 'bin/parserver', line 53

def get_output(name_string, parser)
  begin
    parsed = parser.parse(name_string)
  rescue
    parsed = ScientificNameParser::FAILED_RESULT.(name_string)
  end
  output =  OPTIONS[:output]
  return parsed.to_json if output == 'json'
  parsed[:scientificName][:canonical].to_s
end

#parser_error(name) ⇒ Object



16
17
18
# File 'bin/nnparse', line 16

def parser_error(name)
  {'scientificName' => {'parsed' => false, 'verbatim' => name,  'error' => 'Parser error'}}.to_json
end