Class TaxonomyChecker

java.lang.Object
org.genesys.taxonomy.checker.TaxonomyChecker

public class TaxonomyChecker extends Object
Suggest fixes to scientific names based on an in-memory list of valid taxonomies.
  • Constructor Details

    • TaxonomyChecker

      public TaxonomyChecker()
  • Method Details

    • setTaxonomyDatabase

      public void setTaxonomyDatabase(TaxonomyDatabase database)
      Sets the taxonomy database.
      Parameters:
      database - the new taxonomy database
    • suggestGenus

      public List<String> suggestGenus(String genus, int maxSize)
      Find suggestions for GENUS.
      Parameters:
      genus - the genus
      maxSize - the max size
      Returns:
      suggested fixes for genus or empty list when genus is fine or when there are no suggestions.
    • suggestSpecies

      public List<String> suggestSpecies(String genus, String species, int maxSize)
      Find suggestions for SPECIES.
      Parameters:
      genus - the genus
      species - the species
      maxSize - maximum number of suggestions to return
      Returns:
      suggested fixes for genus or empty list if species is fine or when there are no suggestions.
    • suggestSpecies

      public List<String> suggestSpecies(String genus, String species, String spAuthor, int maxSize)
      Find suggestions for SPECIES.
      Parameters:
      genus - the genus
      species - the species
      spAuthor - species authority
      maxSize - maximum number of suggestions to return
      Returns:
      suggested fixes for genus or empty list if species is fine or when there are no suggestions.
    • getSpeciesAuthority

      public List<String> getSpeciesAuthority(String genus, String species)
      Return species authority for the genus + species.
      Parameters:
      genus - the genus
      species - the species
      Returns:
      species authority if there's one matching record in the database
    • getSpeciesAuthority

      public List<String> getSpeciesAuthority(String genus, String species, String spAuthor)
      Return species authority for the genus + species.
      Parameters:
      genus - the genus
      species - the species
      spAuthor - species authority
      Returns:
      species authority if there's one matching record in the database
    • suggestSubtaxa

      public List<String> suggestSubtaxa(String genus, String species, String subtaxa, int maxSize)
      Find suggestions for SUBTAXA.
      Parameters:
      genus - must be valid genus in the database
      species - species must be valid species within genus
      subtaxa - current subtaxa, must not be null or blank
      maxSize - maximum number of suggestions to return
      Returns:
      suggested fixes for subtaxa or empty list if there are no suggestions.
    • suggestSubtaxa

      public List<String> suggestSubtaxa(String genus, String species, String spAuthor, String subtaxa, String subtAuthor, int maxSize)
      Find suggestions for SUBTAXA.
      Parameters:
      genus - must be valid genus in the database
      species - species must be valid species within genus
      spAuthor - species authority
      subtaxa - current subtaxa, must not be null or blank
      subtAuthor - species authority at the lowest classification level
      maxSize - maximum number of suggestions to return
      Returns:
      suggested fixes for subtaxa or empty list if there are no suggestions.
    • getSubtaxaAuthority

      public List<String> getSubtaxaAuthority(String genus, String species, String spAuthor, String subtaxa, String subtAuthor)
      Return authority for the genus + species + subtaxa
      Parameters:
      genus - the genus
      species - the species
      spAuthor - species authority
      subtaxa - subtaxa to check
      subtAuthor - species authority at the lowest classification level
      Returns:
      species authority if there's one matching record in the database
    • findTaxa

      @Nonnull public List<TaxonomyChecker.Taxon> findTaxa(String genus, String species, String spAuthor, String subtaxa, String subtAuthor, int maxSize)
      Suggest a list of matches.
      Parameters:
      genus - valid genus
      species - valid species
      spAuthor - species authority
      subtaxa - subtaxa to check
      subtAuthor - species authority at the lowest classification level
      maxSize - maximum number of suggestions to return
      Returns:
      list of suggestions, ordered by preference, never null
      Since:
      3.10
    • getTaxon

      public TaxonomyChecker.Taxon getTaxon(String genus, String species, String spAuthor, String subtaxa, String subtAuthor)
      Get exact match.
      Parameters:
      genus - valid genus
      species - valid species
      spAuthor - species authority
      subtaxa - subtaxa to check
      subtAuthor - species authority at the lowest classification level
      Returns:
      One exactly matching record
      Since:
      3.10
    • findSimilar

      @Nonnull public List<TaxonomyChecker.Taxon> findSimilar(String genus, String species, String spAuthor, String subtaxa, String subtAuthor, int maxSize)
      Suggest a list of matches.
      Parameters:
      genus - valid genus
      species - valid species
      spAuthor - species authority
      subtaxa - subtaxa to check
      subtAuthor - species authority at the lowest classification level
      maxSize - maximum number of suggestions to return
      Returns:
      list of suggestions, ordered by preference, never null
      Since:
      3.10
    • similarityScore

      public double similarityScore(String string1, String string2)
      Get string similarity score.
      Parameters:
      string1 - string A
      string2 - string B
      Returns:
      the double