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

Add findnearest_partial and findall_partial #44

Closed
wants to merge 2 commits into from
Closed

Add findnearest_partial and findall_partial #44

wants to merge 2 commits into from

Conversation

ericphanson
Copy link

@ericphanson ericphanson commented Dec 8, 2020

This PR adds two functions that act like Partial except give indices of the match (or of all matches) in addition to the closest distance. I've found this useful for fuzzy matching keywords in long documents (via KeywordSearch.jl, which adds some types and more API on top of these functions). Having the indices in that context is important since it lets you quickly check if the match looks genuine or spurious (i.e. does it look like a typo, or is it a completely different word). To get the indices of the match, we need the collection to be indexable, not just iterable. That's more restrictive than the rest of StringDistances but I think it's necessary for this functionality to work.

Let me know what you think; this code can stay in KeywordSearch if you prefer, but I thought it might be more useful here.

Closes #29 which was an initial version of this.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 94.757% when pulling efa3553 on beacon-biosignals:eph/find_partial_match_indices into d650b62 on matthieugomez:master.

@ericphanson
Copy link
Author

Bump

@ericphanson
Copy link
Author

Any thoughts on this?

@ericphanson
Copy link
Author

Bump 🙂 . Found another use for this! Would be great to get it in here.

@matthieugomez
Copy link
Owner

Thanks for the PR. I think it would be better in another package, I’m not sure this is a very common operation.

@ericphanson
Copy link
Author

Ok, makes sense. It'll be in KeywordSearch.jl if anyone needs it 🙂.

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.

Base.findmin(s1, s2, dist::Partial)
3 participants