Appeal to techies - simple program needed!

Moderators: mabilis, Mick

Appeal to techies - simple program needed!

Postby Taffy » 08 Feb 2006, 10:58

I'm hoping someone can help out with this as I have absolutely no knowledge of programming. I need a program (web-based?) to convert Tonally Orthographic Pinyin to tone-marked pinyin and vice-versa. I imagine it wouldn't be very difficult for someone with the relevant skills and I am very happy to provide a list of all the equivalents in both standard Hanyu Pinyin and TOP.

Ex: tā hěn
Taffy
KTV Is My Life (jiùshì ài chàng KTV)
KTV Is My Life (jiùshì ài chàng KTV)
 
Posts: 2669
ORIGINAL POSTER
Joined: 20 Oct 2005, 15:11
Location: Hyderabad, India
45 Recommends(s)
18 Recognized(s)

Postby ironlady » 08 Feb 2006, 22:31

He has the download link for this .php script; I've downloaded it, and maybe I can modify it, but it would certainly be faster for someone who actually knew what s/he was doing to do the modifications. It seems to be a simple search and replace going on, and that's something I should be able to handle maybe later this weekend or next week if I get out from under this pile of work.

Anyone?
It's just a matter of controlling the case of the output based on the Hanyu Pinyin tone mark or number (let's go with numbers at present, that's easier).
Heck, we could add a color-coding option while we're at it, if it's for output on a Web page...

Anyone? :(
Terry Waltz, Ph.D
Click here to Finally Learn Mandarin!
YourLanguage™ webinars: Targeted Professional Development for Language Teachers
...although his father beat him every day, wishing him to learn the speech of Ts'e, it will be impossible for him [at least using current methods]...-Mencius
Forumosan avatar
ironlady
Thinking of Staging a Coup (xiǎng yào gǎo zhèng biàn)
Thinking of Staging a Coup (xiǎng yào gǎo zhèng biàn)
 
Posts: 6465
Joined: 13 Nov 2001, 17:01
Location: A place where people can't sleep or teach English in McDonald's
19 Recommends(s)
100 Recognized(s)

Postby ironlady » 08 Feb 2006, 22:39

Actually (darn you, now you've got me thinking about how to script this function rather than getting my work done!! :fume: ), it should be easy to write a pinyin-with-tone-numbers to TOP script, becuase .php comes with automatic functions to uppercase the whole string, just the first character, etc.
Give me a couple of days (but, experts, PLEASE feel free to script this faster and better...)
Terry Waltz, Ph.D
Click here to Finally Learn Mandarin!
YourLanguage™ webinars: Targeted Professional Development for Language Teachers
...although his father beat him every day, wishing him to learn the speech of Ts'e, it will be impossible for him [at least using current methods]...-Mencius
Forumosan avatar
ironlady
Thinking of Staging a Coup (xiǎng yào gǎo zhèng biàn)
Thinking of Staging a Coup (xiǎng yào gǎo zhèng biàn)
 
Posts: 6465
Joined: 13 Nov 2001, 17:01
Location: A place where people can't sleep or teach English in McDonald's
19 Recommends(s)
100 Recognized(s)

Postby hypermegaglobal » 09 Feb 2006, 02:56

Forumosan avatar
hypermegaglobal
Scooter Commuter (qí jī chē shàng xià bān)
Scooter Commuter (qí jī chē shàng xià bān)
 
Posts: 656
Joined: 09 Jun 2002, 16:01
Location: Luxembourg
1 Recommends(s)
1 Recognized(s)

Postby ironlady » 09 Feb 2006, 03:39

wow!!!!!!

Only two things: the tone number 5 (some people use it for neutral tone) remains after the * is added to denote neutral tone, and the second tone in TOP is last letter capitalized ,all others small (right now it's first small, others cap).

Can you share the source? I'd love to learn just how you did that (and so fast!!!) :D (I'm just learning basic .php for my own and my husband's Web sites, so most of what I do is read, imitate and modify.)
Terry Waltz, Ph.D
Click here to Finally Learn Mandarin!
YourLanguage™ webinars: Targeted Professional Development for Language Teachers
...although his father beat him every day, wishing him to learn the speech of Ts'e, it will be impossible for him [at least using current methods]...-Mencius
Forumosan avatar
ironlady
Thinking of Staging a Coup (xiǎng yào gǎo zhèng biàn)
Thinking of Staging a Coup (xiǎng yào gǎo zhèng biàn)
 
Posts: 6465
Joined: 13 Nov 2001, 17:01
Location: A place where people can't sleep or teach English in McDonald's
19 Recommends(s)
100 Recognized(s)

Postby hypermegaglobal » 09 Feb 2006, 07:27

ironlady wrote:wow!!!!!!


Thanks! :)

ironlady wrote:Only two things: the tone number 5 (some people use it for neutral tone) remains after the * is added to denote neutral tone, and the second tone in TOP is last letter capitalized ,all others small (right now it's first small, others cap).


I think I fixed this now.

ironlady wrote:Can you share the source? I'd love to learn just how you did that (and so fast!!!) :D


Of course! This should be downloadable (is that a word?):
http://www.hypermegaglobal.net/TOP/input.htm.txt
http://www.hypermegaglobal.net/TOP/makeTOP.php.txt

ironlady wrote: (I'm just learning basic .php for my own and my husband's Web sites, so most of what I do is read, imitate and modify.)


This sounds very efficient, but isn't the best thing about programming that you're free to find your own solution and implement it? I must warn you, once you've seen my apporach, you can't unsee it. It's so terribly simple! ;)

Please have a good look at the very beginning of function NumberedToTOP where I define the arrays. Due to my puny knowledge of Chinese, there might be some mistakes or superfluous entries.

Furthermore, it's probably more user-friendly to have the form call itself (the result of the conversion would be shown on the same page as the input field).

Finally, as an alternative to computing $AllSyllablesAndTones every time the time the function is called, you could also output it in a way that matches PHP's array defining syntax ("ba"=>"ba*","ba1"=>"BA", etc.) and then simply define the array instead of computing it. Then you could tell people you spent a year writing the list of equivalents by hand. ;)

Any questions, don't hesitate to ask.
Forumosan avatar
hypermegaglobal
Scooter Commuter (qí jī chē shàng xià bān)
Scooter Commuter (qí jī chē shàng xià bān)
 
Posts: 656
Joined: 09 Jun 2002, 16:01
Location: Luxembourg
1 Recommends(s)
1 Recognized(s)

Postby Taffy » 09 Feb 2006, 10:51

HMG, you are a :star:

Thank you, thank you.

As already stated above, I know absolutely nothing about programming in any form. I had a look at the source code and it's all Greek to me. However, in the fields at the beginning, a couple of things could do with being adjusted:

'
Taffy
KTV Is My Life (jiùshì ài chàng KTV)
KTV Is My Life (jiùshì ài chàng KTV)
 
Posts: 2669
ORIGINAL POSTER
Joined: 20 Oct 2005, 15:11
Location: Hyderabad, India
45 Recommends(s)
18 Recognized(s)

Postby ironlady » 09 Feb 2006, 22:54

Fabulous!!! :notworthy: :notworthy:

I can't wait to dissect your code and learn about arrays...that's something I haven't yet touched in .php, but probably a very useful thing to know about!

How do you want to handle this -- I can put the script up on my own Web site and give you a credit/link, or do you want to continue to have exclusive hosting rights to this (which will, given the hordes of people who love TOP, undoubtedly drive your traffic through the roof...)?
Terry Waltz, Ph.D
Click here to Finally Learn Mandarin!
YourLanguage™ webinars: Targeted Professional Development for Language Teachers
...although his father beat him every day, wishing him to learn the speech of Ts'e, it will be impossible for him [at least using current methods]...-Mencius
Forumosan avatar
ironlady
Thinking of Staging a Coup (xiǎng yào gǎo zhèng biàn)
Thinking of Staging a Coup (xiǎng yào gǎo zhèng biàn)
 
Posts: 6465
Joined: 13 Nov 2001, 17:01
Location: A place where people can't sleep or teach English in McDonald's
19 Recommends(s)
100 Recognized(s)

Postby hypermegaglobal » 10 Feb 2006, 00:16

Thank you, thank you, so much praise (also by PM), I'm not used to this! :oops: :notworthy: :lol:

Taifeitang, I'll modify the script later, thanks for the corrections and the beer/chocolate/pizza-offer! :)

Ironlady, you can just take the script and put it on your website or link to my site, whatever you want. I'll probably move the script to a more meaningful domain if I find the time this evening.

Anyhow, we still have to integrate the other romanization systems! Any good websites out there with lists of equivalents (sorry, I only know bopomofo myself)?
Forumosan avatar
hypermegaglobal
Scooter Commuter (qí jī chē shàng xià bān)
Scooter Commuter (qí jī chē shàng xià bān)
 
Posts: 656
Joined: 09 Jun 2002, 16:01
Location: Luxembourg
1 Recommends(s)
1 Recognized(s)

Postby hypermegaglobal » 10 Feb 2006, 08:17

OK, I uploaded the version with TFT's correction and also found this table:
http://en.wikipedia.org/wiki/Pinyin_table

So, the "initial+final+er combinations" are still missing, right? Or are they only needed for people speaking with Beijing accent? ;)
Forumosan avatar
hypermegaglobal
Scooter Commuter (qí jī chē shàng xià bān)
Scooter Commuter (qí jī chē shàng xià bān)
 
Posts: 656
Joined: 09 Jun 2002, 16:01
Location: Luxembourg
1 Recommends(s)
1 Recognized(s)

Next

Return to Technology



Who is online

Forumosans browsing this forum: Brendon and 2 visitors

When it comes time to die, make sure all you got to do is die -- ATTRIBUTED TO JIM ELLIOT