TypeError in address_masker when processing addresses with lok abbreviation#2
Open
wysockigrzegorz wants to merge 1 commit intoNASK-NLP:masterfrom
Open
Conversation
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.
Bug description
This PR fixes a crash in the
address_maskercomponent ofpriv_masker, caused by incorrect usage of the Python list.append()method.Problematic line:
This causes
masked_tokensto becomeNone, sincelist.append()returnsNone. As a result, any later use ofmasked_tokens(likeif token in masked_tokens) crashes with:Reproduction
Minimal example (adapted from the official README):
This triggers a crash in
search_address_nums_with_key_words().Fix
The incorrect line was replaced with:
This keeps
masked_tokensas a valid list and prevents the crash.Why this matters
This fix restores correct functionality to address matching involving apartment indicators like
lok,lokal, etc., which are common in real-world Polish addresses.Pozdrowienia