-
Notifications
You must be signed in to change notification settings - Fork 18
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
[FEATURE] Update tokenizers #158
Conversation
modified: setup.py modified: tests/test_tokenizer/test_tokenizer.py
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## dev #158 +/- ##
==========================================
- Coverage 97.33% 97.31% -0.03%
==========================================
Files 85 85
Lines 4693 4729 +36
==========================================
+ Hits 4568 4602 +34
- Misses 125 127 +2 ☔ View full report in Codecov by Sentry. |
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.
Also, please add your name to AUTHORS.md
'$', '4', '$', 'packs', 'left', '$', '25', '$', 'each', 'how', 'many', | ||
'are', 'sold' | ||
] | ||
for tok in ['nltk', 'spacy']: |
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.
add test for bpe
modified: tests/test_tokenizer/test_tokenizer.py
modified: tests/test_tokenizer/test_tokenizer.py
modified: tests/test_tokenizer/test_tokenizer.py
modified: tests/test_tokenizer/test_tokenizer.py
modified: tests/test_tokenizer/test_tokenizer.py
modified: tests/test_tokenizer/test_tokenizer.py
modified: tests/test_tokenizer/test_tokenizer.py
modified: tests/test_tokenizer/test_tokenizer.py
modified: tests/test_tokenizer/test_tokenizer.py
modified: tests/test_tokenizer/test_tokenizer.py
modified: tests/test_tokenizer/test_tokenizer.py
|
||
elif (tokenizer == 'bpe'): | ||
try: | ||
tokenizer = HGTokenizer.from_file('bpeTokenizer.json') |
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.
change this to a parameter instead of a hard-coded path. Or directly reuse tok_model
param
trainer = BpeTrainer( | ||
special_tokens=["[UNK]", "[CLS]", "[SEP]", "[PAD]", "[MASK]"]) | ||
tokenizer.train(files=[bpe_trainfile], trainer=trainer) | ||
tokenizer.save('bpeTokenizer.json', pretty=True) |
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.
same here
tokenizer = get_tokenizer("pure_text", text_params={"tokenizer": 'bpe', "stopwords": set(",?"), | ||
"bpe_trainfile": data_path}) | ||
tokens = tokenizer(items) | ||
ret = next(tokens) |
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.
是否支持中文?
Description
update tokenizer modules, allow tokenizing using nltk, spacy and bpe.
Pull request type
Changes
Essentials
Comments