Fix: Unpack and store alignment parameters in Resolver#318
Conversation
This commit modifies `langextract/resolver.py` to properly unpack and store alignment parameters (e.g., `fuzzy_alignment_threshold`, `enable_fuzzy_alignment`) when they are passed to the `Resolver` constructor via `resolver_params` (or kwargs). Previously, these parameters were causing a `TypeError` in `Resolver.__init__` because they were not popped from `kwargs` and `Resolver` did not expect them. Additionally, instance-level configuration was not persisted for use in `align` and `resolve` methods. Changes: - Update `Resolver.__init__` to consume alignment parameters from `kwargs` and store them as instance attributes. - Update `Resolver.align` and `Resolver.resolve` to accept `None` for these parameters and fallback to instance attributes or default constants. - Update `AbstractResolver` signatures to match. - Add `tests/resolver_params_test.py` to verify the fix.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
No linked issues found. Please link an issue in your pull request description or title. Per our Contributing Guidelines, all PRs must:
You can also use cross-repo references like |
|
Your branch is 1 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
3 similar comments
|
Your branch is 1 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 1 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 1 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 7 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 8 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 11 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 15 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 22 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
|
Your branch is 29 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
1 similar comment
|
Your branch is 29 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
Address: #245
This commit modifies
langextract/resolver.pyto properly unpack and store alignment parameters (e.g.,fuzzy_alignment_threshold,enable_fuzzy_alignment) when they are passed to theResolverconstructor viaresolver_params(or kwargs).Previously, these parameters were causing a
TypeErrorinResolver.__init__because they were not popped fromkwargsandResolverdid not expect them. Additionally, instance-level configuration was not persisted for use inalignandresolvemethods.Changes:
Resolver.__init__to consume alignment parameters fromkwargsand store them as instance attributes.Resolver.alignandResolver.resolveto acceptNonefor these parameters and fallback to instance attributes or default constants.AbstractResolversignatures to match.tests/resolver_params_test.pyto verify the fix.