dhl Posted March 13, 2005 at 09:22 PM Report Posted March 13, 2005 at 09:22 PM Does anyone here know of any program that instanstly marks the tone over av word. Now i use a macro i Office and i think its a bit of a hassle... for instance if you write "ni3" and instanstly when the 3-button i pressed the output changes to "nĭ". It seems like a fairly simple program to produce, if you know how to but i haven´t found any here on this forum or anywhere else that i looked either. P.S. I don´t want to hear of any NJstar Quote
imron Posted March 19, 2005 at 02:04 PM Report Posted March 19, 2005 at 02:04 PM Haha, yep a pretty simple program to write, I could write it for you pretty quickly... how much would you willing to pay for it though? :-) But why not just use something like http://pinyin.info/unicode/marks3.html.. unless for some reason you absolutely have to have the tone marks appear instantly.. Quote
Chappie Posted March 22, 2005 at 10:21 PM Report Posted March 22, 2005 at 10:21 PM No offence but writting such program takes no more then 1 hour... Quote
dhl Posted March 30, 2005 at 06:43 AM Author Report Posted March 30, 2005 at 06:43 AM I know its not a simple program to produce, the problem is that i am deaf, dumb, blind when it comes to computerprogramming... Quote
browny Posted March 31, 2005 at 03:14 PM Report Posted March 31, 2005 at 03:14 PM this is php code to translate a single sound+tone into proper pinyin. eg. hao3 -> hǎo /** * Take the pinyin sound and it's tone, and generate the proper piyin * * $sound String the raw pinyin sound * $tone int The mandarin tone. From 1 to 5. * returns String the full pinyin representation */ function doPinyin($sound, $tone) { $pinyin = ""; //to feed the pinyin chars in $toneinputted = false; //only change 1 vowel to pinyin! //Find the first vowel in $sound for ($counter = 0; $counter < strlen($sound); $counter++) { if (!$toneinputted && $sound{$counter} === "a") { if ($tone == "1") { $pinyin .= "ā"; } if ($tone == "2") { $pinyin .= "á"; } if ($tone == "3") { $pinyin .= "ǎ"; } if ($tone == "4") { $pinyin .= "à"; } if ($tone == "5") { $pinyin .= "a"; } $toneinputted = true; } else if (!$toneinputted && $sound{$counter} === "e") { if ($tone == "1") { $pinyin .= "ē"; } if ($tone == "2") { $pinyin .= "é"; } if ($tone == "3") { $pinyin .= "ě"; } if ($tone == "4") { $pinyin .= "è"; } if ($tone == "5") { $pinyin .= "e"; } $toneinputted = true; } else if (!$toneinputted && $sound{$counter} === "i") { if ($tone == "1") { $pinyin .= "ī"; } if ($tone == "2") { $pinyin .= "í"; } if ($tone == "3") { $pinyin .= "ǐ"; } if ($tone == "4") { $pinyin .= "ì"; } if ($tone == "5") { $pinyin .= "i"; } $toneinputted = true; } else if (!$toneinputted && $sound{$counter} === "o") { if ($tone == "1") { $pinyin .= "ō"; } if ($tone == "2") { $pinyin .= "ó"; } if ($tone == "3") { $pinyin .= "ǒ"; } if ($tone == "4") { $pinyin .= "ò"; } if ($tone == "5") { $pinyin .= "o"; } $toneinputted = true; } else if (!$toneinputted && $sound{$counter} === "u") { if ($tone == "1") { $pinyin .= "ū"; } if ($tone == "2") { $pinyin .= "ú"; } if ($tone == "3") { $pinyin .= "ǔ"; } if ($tone == "4") { $pinyin .= "ù"; } if ($tone == "5") { $pinyin .= "u"; } $toneinputted = true; } else { $pinyin .= $sound{$counter}; //No vowel found, just copy character } } return $pinyin; } Quote
Recommended Posts
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.