Skip to content
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

[fix] prepare_dict support english and chinese in one lexicon.txt #1693

Merged
merged 5 commits into from
Feb 15, 2023

Conversation

keanucui
Copy link
Contributor

tools/fst/prepare_dict.py, it can't split chinese phrase into character when bpemodel given issus. Now It can process english and chinese in one lexicon.txt .

if word.encode('utf8').isalpha():
pieces = sp.EncodeAsPieces(word)
else:
pieces = word
if contain_oov(pieces):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx, could you add a brief comment on those changes? (i.e., PR link #1693 and Issue link #1653)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

em, where do you mean add comments?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# We assume that the lexicon does not contain code-switch, i.e., the word contains both English and Chinese.
# see PR https://github.com/wenet-e2e/wenet/pull/1693
# and Issue https://github.com/wenet-e2e/wenet/issues/1653
if word.encode('utf8').isalpha():
    pieces = sp.EncodeAsPieces(word)
else:
    pieces = word

@robin1001
Copy link
Collaborator

please fix the lint problem.

@robin1001
Copy link
Collaborator

./tools/fst/prepare_dict.py:44:125: B950 line too long (124 > 80 characters)

@robin1001 robin1001 merged commit a983da9 into wenet-e2e:main Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants