Draft
Conversation
BinaryFiddler
approved these changes
Jan 21, 2026
|
|
||
|
|
||
| def tokenize_text(s: str) -> list[str]: | ||
| s = s.replace("'", "'").replace('ʼ', "'") |
Collaborator
There was a problem hiding this comment.
Actually, what does first replace do?
Collaborator
Author
There was a problem hiding this comment.
ah nice catch. there are two different apostrophes we want to replace with a "normal" apostrophe, and it looks like that first one actually might have gotten replaced with a normal apostrophe maybe through copy/paste or something. switched it to just use unicode escapes so its more obvious what it's doing
Draft
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.
I originally wrote this without a translation table, but decided that because the produced regex were so large that it would be best to just create that table instead. The functionality of this PR and the previous one is the same, though
with fairly reduced complexity. It adds two new string UDFs:
There's some existing functionality for lookalikes in
string.py, specifically theStringCleanUDF. There's a variety of additional things that I've added in this new UDF though (that have also come up quite a bit in the wild)There's likely still a bit of overhead from using regex here to achieve some more useful results from the current implementation of this, but we get some additional info/control by using them.