-
Notifications
You must be signed in to change notification settings - Fork 958
Implement Append normalizer #1755
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind adding a new normalizers, but do you have example of real usecases? Like papers or blogs or something?
This normalizer is very useful when used in conjunction with the
@ArthurZucker Yes—this feature comes directly from my PhD research. I use the To address this, I developed a tokenization scheme that encodes the whitespace following each move as a sort of non-promotion token. The promotion-related token set becomes Publications for reference:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow sorry for the delay! just missing a .py
test and good for me
Implement Append Normalizer
Description
This pull request introduces a new
Append
normalizer to the HuggingFace Tokenizers library. TheAppend
normalizer adds a specified string to the end of input sequences. Its functionality mirrors the existingPrepend
normalizer, except that it appends text rather than prepending it.Motivation
There are use-cases where appending a token or specific character to the end of token sequences is beneficial, particularly when working with special formatting or language modeling tasks. This addition complements the existing functionality and extends the flexibility of the normalization utilities.
Changes Implemented
Append
analogous to the existingPrepend
.normalize
method to append text to the end of the input.Testing
Unit tests have been added, verifying:
Example Usage
Please let me know if there are additional requirements or improvements needed!