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

Add pinyin support #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add pinyin support #26

wants to merge 1 commit into from

Conversation

mwufi
Copy link

@mwufi mwufi commented Feb 28, 2021

What does this do?

  • Adds an include_pinyin option to the translation function, with pinyin returned in either format (numerical or diacritical)
['还', 'huán', ['to pay back', 'to return']]
['还是', 'hái shi', ['or', 'still', 'nevertheless', 'had better']]
['是', 'shì', ['variant of 是[shi4]', '(used in given names)']]
  • Minor: Adds a pronunciation dictionary, so you can pronounce_word in addition to translating it
>>> pronounce_word("还是")
"hai2 shi5"

Testing

  • Added a test for this behavior!

Why?

Got really disappointed when pinyin.get("还是") returned "huánshì"

It still does that... Although, with this updated all_phrase_translations function, you can pick out the right pronunciation..

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.

1 participant