# Typing PinYin with tones in Latin letters

## hiroki

你们好！

我要书写拼音。但，我不要书写汉字。

OK, let's continue in a language i can speak  :Wink: 

I want to write PinYin with tones but not convert it to Hanzi.

for example i'd like to write:

But as you can see my problem is that i cannot write the first or the third tone. How can I input them? As soon as I type "input linux pinyin" in google i get tons of pages about inputting hanzi. But actually it's that what i don't want. I just want to be able to type latin letters with (correct) pinyin-tones.

many thanks in advance!

谢谢！

----------

## EricHsu

 *hiroki wrote:*   

> 你们好！
> 
> 我要书写拼音。但，我不要书写汉字。
> 
> 

 

你好, hiroki! 你的中文很好呢! (You Chinese is good!)

 *Quote:*   

> 
> 
> I want to write PinYin with tones but not convert it to Hanzi.
> 
> for example i'd like to write:
> ...

 

I know what you mean, well, it's no so easy to input Pinyin with tones under linux, I've searched google with keywords like "输入 拼音 声调" (means: input Pinyin tones), the result is: there're some softwares that can input Pinyin with tones, however, it seems that all of them are windows software only... 

There is a workaround (and I believe it's the common way) for inputting Pinyin with tones, you can simply type "wo3 ai4 ni3" and I guess most of the people who speak Chinese and use Pinyin fully understand what you mean  :Wink: 

----------

## hiroki

 *EricHsu wrote:*   

>  *hiroki wrote:*   ... 
> 
> 你好, hiroki! 你的中文很好呢! (You Chinese is good!)
> 
> 

 

thank you  :Smile:  I started learning it this semester. As i already know japanese i thought it might be easier then to learn chinese as the characters (hanzi) are almost identical. at least it can help me with chinese. and indeed it does. and chinese is a nice compact language...  :Very Happy: 

 *EricHsu wrote:*   

> There is a workaround (and I believe it's the common way) for inputting Pinyin with tones, you can simply type "wo3 ai4 ni3" and I guess most of the people who speak Chinese and use Pinyin fully understand what you mean 

 

hm, yes, i see what you mean. well, then i'll have to do it that way. thank you very much then, i'll do it with 1234. although i thought the real accents would look nice and be easier to read. at least they are easier to read for me  :Wink:  hehe

i am making a list of kanji's (hanzi) for learning japanese and put it all together [ see : www.hiroki.de ]. it (will) contain all 1945 characters, that the japanese government decided to be the most used and neccessary ones. i wanted to add the chinese reading of those japanese characters, too. so i could learn japanese and chinese simultaniously.

anyway, thanks  :Smile: 

too bad, that there's no way of doing it.

非常谢谢你！

----------

## hiroki

 *EricHsu wrote:*   

>  *hiroki wrote:*   ... 
> 
> 你好, hiroki! 你的中文很好呢! (You Chinese is good!)
> 
> 

 

thank you  :Smile:  I started learning it this semester. As i already know japanese i thought it might be easier then to learn chinese as the characters (hanzi) are almost identical. at least it can help me with chinese. and indeed it does. and chinese is a nice compact language...  :Very Happy: 

 *EricHsu wrote:*   

> There is a workaround (and I believe it's the common way) for inputting Pinyin with tones, you can simply type "wo3 ai4 ni3" and I guess most of the people who speak Chinese and use Pinyin fully understand what you mean 

 

hm, yes, i see what you mean. well, then i'll have to do it that way. thank you very much then, i'll do it with 1234. although i thought the real accents would look nice and be easier to read. at least they are easier to read for me  :Wink:  hehe

i am making a list of kanji's (hanzi) for learning japanese and put it all together [ see : www.hiroki.de ]. it (will) contain all 1945 characters, that the japanese government decided to be the most used and neccessary ones. i wanted to add the chinese reading of those japanese characters, too. so i could learn japanese and chinese simultaniously.

anyway, thanks  :Smile: 

too bad, that there's no way of doing it.

非常谢谢你！

----------

## EricHsu

 *hiroki wrote:*   

> 
> 
> thank you  I started learning it this semester. As i already know japanese i thought it might be easier then to learn chinese as the characters (hanzi) are almost identical. at least it can help me with chinese. and indeed it does. and chinese is a nice compact language... 
> 
> 

 

My pleasure! And it's really a smart way to learn both of them! To know more about the relationship between Hanzi and Japanese, you may want to read this: "The Development of Chinese Characters in Japan's Written Language" (note: it's written in Chinese  :Wink:  )

 *Quote:*   

> 
> 
> hm, yes, i see what you mean. well, then i'll have to do it that way. thank you very much then, i'll do it with 1234. although i thought the real accents would look nice and be easier to read. at least they are easier to read for me  hehe
> 
> i am making a list of kanji's (hanzi) for learning japanese and put it all together [ see : www.hiroki.de ]. 
> ...

 

Agree, Pinyin with tones would looks better and easier for reading. If you don't mind using MS' Windows, I can help you to test and find a Windows input method which can input Pinyin with tones...  :Wink: 

I've visited your website, it's cool, great work! (Though I can only recognize the Hanzi part  :Twisted Evil:  )

 *Quote:*   

> 
> 
> 非常谢谢你！

 

不客气! 

需要帮助的时候, 就发贴吧 (If you need help, please feel free to post)  :Very Happy: 

----------

## akar

 *hiroki wrote:*   

> ... i wanted to add the chinese reading of those japanese characters, too. so i could learn japanese and chinese simultaniously.
> 
> anyway, thanks 
> 
> too bad, that there's no way of doing it.
> ...

 

hi, i found your site are informative.  :Smile: 

I just guess if you are editing the pages online, if yes, may you can find this is a way to get it done.

http://en.wiktionary.org/w/index.php?title=龍&action=edit&section=1

If you are using openoffice, there is a little applet developed for inputting symbols for Chinese user, may that worked too. But i never try it other than the Chinese environment.

----------

## akar

 :Cool:   A hacking the X server way.

Here you may follow this page   X, symbol and key mapping on Howto input the Euro Dollar Sign.

I think this trick should also support the Chinese Pin Yin.

Please follow the page to get the EuroSign done, after then, i will post my hacking of the "Modifier Key" + PinYin Symbols script here to you. 

 :Laughing:  I am not posting it now, because i am still working on it!! i need to find all the pinyin symbols's  Hex value.

----------

## hiroki

hi.

thanks for your replies.

actually, i think i'll go for Eric's solution. Because "hacking the X server"... makes me feel uncomfortable  :Wink: 

not only it's more work to write and set up such a script, when typing i would have to type quite weird shortcuts, wouldn't i?

i thought there might be a simple solution like: ^ + i =

----------

## EricHsu

 *hiroki wrote:*   

> anyway. maybe i can find a list of codes [unicode?] for those pinyin-characters and then write a small sript, that can convert my number-pinyin to "real" pinyin. any guess where i could find a list of the pinyin-characters' unicode-number?
> 
> 

 

hey, that's what've been thinking about! If we could get all the pinyin characters mapping, then, we could:

 write Pinyin in "wo3 ai4 ni3" way

 write a script run like this: (pyc = pinyin convertor  :Smile:  )

```

$ pyc original.txt realpinyin.txt

```

The pyc script reads the original.txt file, search through the pinyin characters mapping, replace "wo3 ai4 ni3" with "real" pinyin charaters one by one.

So, we could write pinyin in an easier way ("wo3 ai4 ni3"), when we've done, then just let the pyc script to do all the "dirty job"!

OK, I'm going to do some search work! I'll keep posting if I have any further information  :Very Happy: 

----------

## EricHsu

ok! I got things narrow down! I almost forgot that one of the rules of pinyin is: only mark tones on "yuan yin" (don't know how to express in English  :Embarassed:  ), so there're only five of them - a, e, i, o, u. 

Then, each one has four tones, so, we only need to find out: 5 x 4 = 20  pinyin charaters' mapping! I'm searching!

----------

## EricHsu

sorry, there're six "yuan yin", I've missed one: "u" with two dots above it...

here're all there tones.

1st tone: ā ē ī ō ū ǖ

2nd tone: á é í ó ú ǘ 

3rd tone: ǎ ě ǐ ǒ ǔ ǚ 

4th tone: à è ì ò ù ǜ 

I'm going to try to write the pyc script  :Smile: 

edit:

note, please set your browser's charater encoding to UTF-8 to display them correctly  :Smile: 

----------

## EricHsu

hey, I've finished the script in python!

All the needed functions have been implemented!

I'm going to do some polishing work and post it tomorrow!

Going to take a happy shower, wow!

----------

## EricHsu

OK, nkpyc v0.1 done  :Smile: 

download it here:

http://ghpct.3322.org/nktoolkit/nkpyc/nkpyc.py

test cases and result:

. original file (numeric tones)

http://ghpct.3322.org/nktoolkit/nkpyc/numeric-tone.txt

. converted file (real tones)

http://ghpct.3322.org/nktoolkit/nkpyc/real-tone.txt

command:

```

./nkpyc.py numeric-tone.txt real-tone.txt

```

edit: tell me if you find any bug  :Wink: 

edit2: after download, chmod +x nkpyc.py, and just run nkpyc.py for help

----------

## hiroki

just one question....

what encoding does the output file have? utf8?

and what encoding should the input file have? io-8859-1?

thank you very much for writing this script!

----------

## EricHsu

sorry, it's my problem, I save them in my native Chinese encoding... so I guess you couldn't view the test cases pages correctly, could you? (they only display correctly under zh_CN.gb2312 encoding...)

Everything is in utf-8 now

I've saved the nkpyc.py to utf-8 encoding and updated the 3 links, please re-download it, and see if the two test cases and the result pages display correctly with your browser's charater encoding sets to utf-8  :Smile: 

Then please do the following steps to test it yourself:

 write your pinyin with numeric tones in a file and save it with utf-8 encoding

 run nkpyc.py to convert it to a new file

 view the new file with utf-8 encoding

Whatever it works or not, please tell me so that I could try to figure out where is the problem  :Wink: 

----------

## hiroki

Thank you, Thank you very much!

This is perfect!

Muchas gratias, Merci beaucoup, Vielen Dank, Doumo arigatou,

非常謝謝!

I read, that coding an Input Method for SCIM isn't too difficult, so maybe [as soon as I have some time] I could try to write an input method on top of you script. So you could type "wo3" and it would be converted directly.

Wel, if it's not too complicated I'll try to code this in my next vacations  :Smile: 

[and will post the result here  :Wink: ]

----------

## EricHsu

 *hiroki wrote:*   

> Thank you, Thank you very much!
> 
> This is perfect!
> 
> 

 

That's great to know it actually works  :Very Happy: 

 *Quote:*   

> 
> 
> Muchas gratias, Merci beaucoup, Vielen Dank, Doumo arigatou,
> 
> 非常謝謝!
> ...

 

WoW, it must be German? At least I can read the Chinese part  :Cool: 

不用客气!

 *Quote:*   

> 
> 
> I read, that coding an Input Method for SCIM isn't too difficult, so maybe [as soon as I have some time] I could try to write an input method on top of you script. So you could type "wo3" and it would be converted directly.
> 
> Wel, if it's not too complicated I'll try to code this in my next vacations 
> ...

 

That would be really cool! Maybe you could write a "pinyin mode" input method for scim, seems that scim is written with gtk+, I'm not very familiar with gtk+/C programming, that's why I'm learning. Hope the day you start writing the scim input method, I'm familiar enough with gtk+/C programming so that I could probably do some help  :Smile: 

----------

## hiroki

 :Confused: 

 :Shocked: 

well... today...from today on.. I know it is not neccessary to write an input method fpr PinYin anymore! I don't know how, I don't know why... 

Just a few seconds ago I discovered that there already is an input method for PīnYīn! It is possible to write PinYin!!!! arghhhhhhh.

I recently updated scim & it's components. So maybe it's a new input method? It's called "M17N-zh-pinyin". And it's perfectly possible to write PinYin. dude.. so much trouble....and such a simple solution.. why wasn't it there two weeks ago??? argh!

----------

## EricHsu

I've done some search job:

http://www.h4.dion.ne.jp/~apricots/mandrake/m17n2.html

http://www.m17n.org/

So, to be able to input pinyin, just emerge scim-m17n?

Have you emerged it? How does it work?

----------

## Jeremy_Z

你好.

Just a test to check my input.

Bye the way, which input system are you using ? i use fcitx and blindly managed to configure it in a way i understand (typing pinyin and smart guess ..) but i don't really know what the options are/do.

我学中文。谢谢你们!

----------

## EricHsu

Hey, Jeremy_Z, welcome!

I've translated the fcitx' config options for you:

 *Quote:*   

> 
> 
> ##[Program]
> 
> [程序]
> ...

 

HTH, and sorry for my poor english  :Wink: 

and, you may want to give scim a try, I'm using the scim IM, feels good  :Smile:  (emerge scim-chinese)

----------

## shiao

 *EricHsu wrote:*   

> 
> 
> So, to be able to input pinyin, just emerge scim-m17n?
> 
> Have you emerged it? How does it work?

 

I am installing right now the following packages

```
emerge dev-libs/m17n-lib dev-db/m17n-db
```

I assume that scim-m17n are wrappers to the actual m17n libraries.

----------

## liuspider

to shiao:

you are definitely right.

----------

