refactor: implement rapidfuzz#3
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements rapidfuzz fuzzy string matching functionality to the RDF transformer, enabling approximate matching when exact matches are not found. The changes add configurable fuzzy matching with a threshold-based scoring system to improve string-to-IRI mapping capabilities.
Key changes:
- Added rapidfuzz dependency and fuzzy matching logic to RDFTransformer
- Enhanced API endpoint to accept fuzzy matching parameters (fuzzy flag and threshold)
- Updated tests to validate both exact and fuzzy matching scenarios
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pyproject.toml | Adds rapidfuzz>=3.0.0 dependency |
| src/strings2things/app/core/rdf_transformer.py | Implements fuzzy matching with configurable threshold and refactors matching logic |
| src/strings2things/app/api/endpoints.py | Updates API to accept fuzzy matching parameters and creates transformer instances per request |
| tests/test_rdf_transformer.py | Adds comprehensive test coverage for exact, fuzzy, and no-match scenarios |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
Implementing rapidfuzz matcher (return only 1 IRI for a string, if rapidfuzz finds a match above score 90).
Add tests.
Add logging so you can see in the terminal which labels were IRIfied, which can help you pick a better match threshold.
Types of Changes
What types of changes does your contribution introduce? Put an
xin the boxesthat apply
bugfix.tag
feature.functionality to not work as expected). Use MR tag
feature.other choices apply). Use MR tag
chore.Checklist
Put an
xin the boxes that apply. You can also fill these out after creatingthe PR. If you're unsure about any of them, don't hesitate to ask. We're here to
help! This is simply a reminder of what we are going to look for before merging
your code.
CONTRIBUTING
guidelines.
Further Comments