-
Notifications
You must be signed in to change notification settings - Fork 9
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
Tokenizer lexicons #14
base: master
Are you sure you want to change the base?
Conversation
8e0c442
to
e9bd355
Compare
deltas/tokenizers/wikitext_split.py
Outdated
@@ -97,4 +72,10 @@ | |||
("etc", r"."), | |||
] | |||
|
|||
wikitext_split = RegexTokenizer(LEXICON) | |||
LEXICON_LATIN = LEXICON.copy() | |||
LEXICON_LATIN.insert(-2, ('cjk', cjk)) |
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.
Why not insert this right after "word"?
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 can do that. My thought process was since we won't have lots of cjk in a regular latin-dominant text, we don't need to handle them before the tab_open, tab_close, etc.
|
||
word = r'(?:[^\W\d]|[' + combined_word + r'])' + \ | ||
cjk_re = r'\u3040-\u30ff' + r'\u4e00-\u9FFF' |
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.
Does this still cover the full range?
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.
Yes. It does.
|
||
cjk = r'[' + cjk_re + ']' | ||
|
||
word = r'(?:[^\W\d' + cjk_re + r']|[' + combined_word + r'])' + \ |
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.
Do we need to explicitly exclude CJK here?
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.
Without doing that, some cjk values get captured as word.
f3489da
to
1d59026
Compare
1d59026
to
df6225b
Compare
Created lexicons for cjk and non-cjk texts