Difference between revisions of "Taxamatch Algorithm"
Line 1: | Line 1: | ||
− | + | = Defining of Terms and Functions = | |
− | + | == Taxamatch == | |
− | + | It is a library that is used to search for an exact match or a near match scientific names. It has one main function that implements the taxamatch algorithm. The function's parameters are: | |
− | + | * the user's input Genus, | |
− | :the | + | * the user's input Species, |
− | + | * Genus operator, | |
− | + | * Species operator, | |
− | + | * Genus fieldname, | |
+ | * and Species fieldname. | ||
− | == | + | ;The user's input Genus and/or Species |
+ | :It can be any string (e.g ''Rhincodon typus'', or ''Rhincodon'', or ''typus''). | ||
+ | |||
+ | ;Genus and Species operator | ||
+ | :The operator will only be used in searching for an exact match. The operator can be '''EQUAL''', '''NOT_EQUAL''', '''CONTAINS''', '''BEGINS_WITH''', or '''ENDS_WITH'''. | ||
+ | * EQUAL -> search for the Genus or Species that matches the user's input string | ||
+ | * NOT_EQUAL -> exclude the word in searching | ||
+ | * CONTAINS -> search for the Genus or Species that contains the string in the name | ||
+ | * BEGINS_WITH -> search for the Genus or Species that starts with the user's input string | ||
+ | * ENDS_WITH -> search for the Genus or Species that ends with the user's input string | ||
+ | |||
+ | ;Genus fieldname and Species fieldname | ||
+ | :It is the field name in the Dataset in where you compare the user's input. It is based on the query on searching for the exact match. It is used for creating the query, together with the operators and the user's input strings (e.g. SYNONYMS.syngenus and SYNONYMS.synspecies). Syngenus and synspecies are the field names from the SYNONYMS table in the dataset. | ||
+ | |||
+ | The output of the main function is a string composed of the concatenated scientific names that is believed to be a near match of the user's input string. | ||
+ | |||
+ | == Normalize == | ||
+ | It accepts a string. It simplifies the string by reducing double spaces, removing symbols or numbers, and transforming accented characters into normal character. It returns the normalized string. | ||
+ | |||
+ | == Root == | ||
+ | It accepts a string. It simplifies the string by removing double characters, and getting the root word of the string. It returns the root of the string. | ||
+ | |||
+ | ==Phonetic== | ||
+ | It accepts two strings to compare and returns their pronunciation similarity, 1 being the highest. 1 means they have the same pronunciation. | ||
+ | |||
+ | ==MDLD== | ||
+ | Acronym for Modified Damerau-Levenshtein Distance test. | ||
+ | The minimal number of characters you have to replace, insert, or delete to make two strings similar. If MDLD is equals to 0, it means the two strings are the same. | ||
+ | |||
+ | ==Similarity== | ||
+ | It returns percentage similarity of input and data. | ||
+ | |||
+ | = Algorithm = | ||
Here is the step by step procedures and cases used in running '''Taxamatch''': | Here is the step by step procedures and cases used in running '''Taxamatch''': | ||
Revision as of 10:53, 14 December 2012
Defining of Terms and Functions
Taxamatch
It is a library that is used to search for an exact match or a near match scientific names. It has one main function that implements the taxamatch algorithm. The function's parameters are:
- the user's input Genus,
- the user's input Species,
- Genus operator,
- Species operator,
- Genus fieldname,
- and Species fieldname.
- The user's input Genus and/or Species
- It can be any string (e.g Rhincodon typus, or Rhincodon, or typus).
- Genus and Species operator
- The operator will only be used in searching for an exact match. The operator can be EQUAL, NOT_EQUAL, CONTAINS, BEGINS_WITH, or ENDS_WITH.
- EQUAL -> search for the Genus or Species that matches the user's input string
- NOT_EQUAL -> exclude the word in searching
- CONTAINS -> search for the Genus or Species that contains the string in the name
- BEGINS_WITH -> search for the Genus or Species that starts with the user's input string
- ENDS_WITH -> search for the Genus or Species that ends with the user's input string
- Genus fieldname and Species fieldname
- It is the field name in the Dataset in where you compare the user's input. It is based on the query on searching for the exact match. It is used for creating the query, together with the operators and the user's input strings (e.g. SYNONYMS.syngenus and SYNONYMS.synspecies). Syngenus and synspecies are the field names from the SYNONYMS table in the dataset.
The output of the main function is a string composed of the concatenated scientific names that is believed to be a near match of the user's input string.
Normalize
It accepts a string. It simplifies the string by reducing double spaces, removing symbols or numbers, and transforming accented characters into normal character. It returns the normalized string.
Root
It accepts a string. It simplifies the string by removing double characters, and getting the root word of the string. It returns the root of the string.
Phonetic
It accepts two strings to compare and returns their pronunciation similarity, 1 being the highest. 1 means they have the same pronunciation.
MDLD
Acronym for Modified Damerau-Levenshtein Distance test. The minimal number of characters you have to replace, insert, or delete to make two strings similar. If MDLD is equals to 0, it means the two strings are the same.
Similarity
It returns percentage similarity of input and data.
Algorithm
Here is the step by step procedures and cases used in running Taxamatch:
- Get the user's input of species. (e.g. Genus, Species or Genus+Species)
- Search for the exact match in the database.
- If there is an exact match, print that species;
- Normalize the user's input:
- Transform any accented character to its non accented character.
- Strips out any html character and drop any character other than A-Z, a-z and space.
- Remove multiple double letters or multiple spaces.
- Get the normalized input and search it in the database.
- If there is a match, print that species.
- Get the root of the normalized input and search it in the database.
- If there is a match, print that species.
- Run last search without any filter of genus and species
- Filter the output using the functions: phonetic, mdld, and similarity.
It prints the species if it satisfy all the conditions below:
- the input is phonetic match with the data of greater than or equal to 0.4
- the mdld of input and data is less than or equal to 4
- the similarity of input and data is:
- equals to 100%. This is an exact match.
- between 50% and 100%. This is a near match.