On Mon, Mar 16, 2009 at 09:23:50PM +0100, Wolfgang Schuster wrote:
>
> Am 16.03.2009 um 17:17 schrieb Bill Long:
>
>> The pinyin has 5 kind of tone for one pronunciation. As it's hard to
>> input, and in CJK  1,2,3,4 are use to represent the tone, (the fifth
>> is no special tone mark).
>>
>> In the book for children, the pinyin always show above the Chinese
>> like the picture I upload.
>
> A solution like can be easy integrated in a ruby command because
> you need only a command parameter for the ruby text,
> e.g. \setupruby[command=\pinyin] but you're looking for something
> like the translate module.

In fact, 2 features I need, 
  1. the easy way to support PinYin, both input and the format, As I
   mentioned, I hope the pinyin can be placed over the Chinese
   character  it represented automatically with some environment or
   so.
  2. automatic convert/add pinyin to  Chinese Character , now I use
  sed to make, but I still hope there are some more easy way.
>
>> To make it show correctly is an good start, but if there are some
>> tools to automatic add PinYin , it will be more attractive. In Chinese
>> they do have the character which have multi pronunciation, but most of
>> them only has single pronunciation, I can try to find out some dict to
>> translate Chinese Character into PinYin if anyone can help integrate
>> this convert tool into context.
>
> If you can provide such a list Hans can add the information to char- 
> def.lua,
> for the moment you have to rely on my \pinyin command, I have now  
> written
> a new version on a word macro I found.
>
> Wolfgang
>
> \startluacode
>
> function commands.pinyin(str)
>     str = string.gsub(str,"r1","1r")
>     str = string.gsub(str,"r2","2r")
>     str = string.gsub(str,"r3","3r")
>     str = string.gsub(str,"r4","4r")
>     str = string.gsub(str,"r5","5r")
>     str = string.gsub(str,"ng1","1ng")
>     str = string.gsub(str,"ng2","2ng")
>     str = string.gsub(str,"ng3","3ng")
>     str = string.gsub(str,"ng4","4ng")
>     str = string.gsub(str,"ng5","5ng")
>     str = string.gsub(str,"n1","1n")
>     str = string.gsub(str,"n2","2n")
>     str = string.gsub(str,"n3","3n")
>     str = string.gsub(str,"n4","4n")
>     str = string.gsub(str,"n1","5n")
>     str = string.gsub(str,"ai1","a1i")
>     str = string.gsub(str,"ai2","a2i")
>     str = string.gsub(str,"ai3","a3i")
>     str = string.gsub(str,"ai4","a4i")
>     str = string.gsub(str,"ai5","a5i")
>     str = string.gsub(str,"ei1","e1i")
>     str = string.gsub(str,"ei2","e2i")
>     str = string.gsub(str,"ei3","e3i")
>     str = string.gsub(str,"ei4","e4i")
>     str = string.gsub(str,"ei5","e5i")
>     str = string.gsub(str,"ao1","a1o")
>     str = string.gsub(str,"ao2","a2o")
>     str = string.gsub(str,"ao3","a3o")
>     str = string.gsub(str,"ao4","a4o")
>     str = string.gsub(str,"ao5","a5o")
>     str = string.gsub(str,"ou1","o1u")
>     str = string.gsub(str,"ou2","o2u")
>     str = string.gsub(str,"ou3","o3u")
>     str = string.gsub(str,"ou4","o4u")
>     str = string.gsub(str,"ou5","o5u")
>     str = string.gsub(str,"uu1","v1")
>     str = string.gsub(str,"uu2","v2")
>     str = string.gsub(str,"uu3","v3")
>     str = string.gsub(str,"uu4","v4")
>     str = string.gsub(str,"uu","ü") -- is this correct?
it's correct, although this character maybe rarely/never been used
with this tone.
>     str = string.gsub(str,"o1","ō")
>     str = string.gsub(str,"o2","ó")
>     str = string.gsub(str,"o3","ǒ")
>     str = string.gsub(str,"o4","ò")
>     str = string.gsub(str,"e1","ē")
>     str = string.gsub(str,"e2","é")
>     str = string.gsub(str,"e3","ě")
>     str = string.gsub(str,"e4","è")
>     str = string.gsub(str,"i1","ī")
>     str = string.gsub(str,"i2","í")
>     str = string.gsub(str,"i3","ǐ")
>     str = string.gsub(str,"i4","ì")
>     str = string.gsub(str,"u1","ū")
>     str = string.gsub(str,"u2","ú")
>     str = string.gsub(str,"u3","ǔ")
>     str = string.gsub(str,"u4","ù")
>     str = string.gsub(str,"v1","ǖ")
>     str = string.gsub(str,"v2","ǘ")
>     str = string.gsub(str,"v3","ǚ")
>     str = string.gsub(str,"v4","ǜ")
>     str = string.gsub(str,"a1","ā")
>     str = string.gsub(str,"a2","á")
>     str = string.gsub(str,"a3","ǎ")
>     str = string.gsub(str,"a4","à")
>     tex.sprint(tex.ctxcatcodes,str)
> end
>
> \stopluacode
>
> \def\pinyin#1{\ctxlua{commands.pinyin([[#1]])}}
>
> \starttext
>
> \definedfont[name:arialunicodems*default]
>
> \pinyin{ni2hao3}
> \pinyin{huai4}
>
> \stoptext
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to