Jump to content
Chinese-Forums
  • Sign Up

How do you convert Chinese characters into pinyin with tones?


Recommended Posts

  • 2 years later...
Posted

I needed to understand the algorithm. It is fairly easy to convert most of the characters using a dictionary. For example 她为什么要借钱? translated to pinyin should be tā wèishénme yào jièqián?

But in my code because I have more than one entry for 要 in the dictionary my translation of 要 is yao1(which is wrong). The problem is to know which translation is correct?

Does anyone know how that works? Or perhaps there is open source software that I can lookup?

Thanks in advance

Posted

You need to look at the surrounding context. If the following character is 求, your 要 will likely be yāo. Adsotrans includes rules for this, but I suspect it's the kind of thing where you always need a human eye.

Join the conversation

You can post now and select your username and password later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Click here to reply. Select text to quote.

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...