-
Notifications
You must be signed in to change notification settings - Fork 39
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 text quote matching #83
Comments
Update: @judell kindly informed us that Hypothesis now switched from the former to the latter. See hypothesis/client#2814 and hypothesis/client#2779 I’d be eager to see how they compare (at least it’s supposed to be much faster now!), what could still be improved, etc. Some observations from looking at how exactly approx-string-match-js is being used in H:
CC @robertknight (happy to hear if you have more research notes, experimental results or other relevant tips from your experience developing this!) |
Aside from taking ideas from Hypothesis's technical implementation, which you've already posted pointers to, the other resource I would suggest to make use of from Hypothesis are datasets of annotations in the "Public" channel. Here are some I found useful for testing quote matching performance and accuracy:
The new quote matching implementation in Hypothesis has a couple of areas where we've noticed matching quality can be improved:
Related to point (1), one of the goals of the new implementation was to try to make it easier for other Hypothesis developers and staff to understand how exactly the "fuzzy" aspect of "fuzzy matching" works. The thinking is that if it is imperfect, then there is value in at least being predictable. In terms of performance, the new implementation is indeed a lot faster in the worst case where there are many selectors that either do not match at all or match with significant edits. The actual approximate string matching code is pretty well optimized at this point. The next lowest-hanging fruit is optimizing the extraction of text from the document and mapping between text positions and DOM (node, offset) points. If we find that we need to make significant improvements from the current implementation in future then we'd likely need to do some offline processing of the document text before searching for matches. |
Many annotation tools want to match a quote also when it has been modified slightly, but we have yet to implement this.
Enabling approximate/fuzzy string matching could be an option to our existing implementation (perhaps a parameter that tells how fuzzy the match should be, where 0 means exact matching); alternatively it could be exposed as a separate implementation.
A second question is whether the matcher should return information about the quality of the match, and if so, how the API would look. I suppose a match object could have an extra attribute expressing the ‘match quality’; though in case of refined/range selectors we should figure out how to propagate this information.
Prior art we could borrow from:
The text was updated successfully, but these errors were encountered: