Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuzzy matching #209

Closed
wants to merge 16 commits into from
Closed

Fuzzy matching #209

wants to merge 16 commits into from

Conversation

ehwenk
Copy link
Collaborator

@ehwenk ehwenk commented Apr 30, 2024

Amending fuzzy matching algorithm to only consider subset of accepted list with same first letter
Greatly speeds up fuzzy matching

fontikar and others added 16 commits March 14, 2024 10:16
* update fuzzy match algorithm to cycle through multiple "same distance" matches until one passes the "first letter" rules. This was includes, because found an instance where there was an equal closest match that was a completely different genus and because multiple matches the fuzzy matches all returned NA. This will also mean that if there are multiple equally good matches it will align with the first.
further edits to fuzzy match - distances only calculated for names where the first letter of the first  and second words in the input text matches names in the reference list with identical first letters for those words - this greatly sped up running the test dataset.
# Conflicts:
#	R/fuzzy_match.R
Reinstate new fuzzy match option

This causes problems if input doesn't start with a letter -- which should be fixed during name standardising
Follow up changes to get tests passing with new fuzzy-matching algorithm that requires that the first letter of the input name is a-z.

Still to consider:
- In the fuzzy match, so matches where there are multiple equally-close distances, the first match is now being used. An additional column should be added with other possible matches. In our tests there were a number of genus-level matches that were returning NA's instead of the closest match, because of this (shorter strings are more likely to have multiple best matches).
Part of previous commit
I've gone back to requiring that `length(i) <= n_allowed`. The rest of the code I added (loop that starts with `for (j in 1:length(i)) {`) is required if a user ever manually set n_allowed > 1 - the old code would have broken. So for the main APCalign functions (`align_taxa` and `create_taxonomic_update_lookup` n_allowed is already set to 1, but now the fuzzy matching algorithm can be used on its own with a higher limit set.

Tests tweaked again to accommodate this.
@ehwenk ehwenk closed this Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants