Tuesday, March 22, 2005

DHTML Hanyu Pinyin to Hanzi Converter

I needed a simple way to type a small amount of Chinese characters. I did a bit of looking around for a Chinese "input method" for Linux, and they all seemed very hard to install/configure. Many also only had documentation in Chinese for some reason.

Eventually I thought "why don't I build it myself?". After all, I know I can get the pinyin to hanzi conversion information from unicode.org. I just needed to build a UI around it. So that's what I did.

By the way, Hanyu pinyin (or just "pinyin" for short) is the standard romanization system for Mandarin Chinese in mainland China, and it mostly consists of characters that are relatively easy to type on a US keyboard. Hanzi is what Chinese characters are called in Chinese.

I first wrote a Python script which would extract the appropriate information from the Unihan database. That script's output is actually JavaScript for initializing a map (ie: an "associative array") from pinyin strings to hanzi characters.

With that I was then able to build a simple Hanyu Pinyin to Hanzi converter.

Note that this isn't meant to be a full substitute for a real Chinese input method, but it does the job if you only need a few characters, and it's a lot easier to install.

posted Tuesday, March 22, 2005 (10 comments)

Friday, March 18, 2005

Battlestar Galactica

I've become addicted to Sci Fi's new series Battlestar Galactica. I started watching the show with pretty low expectations -- after all, the original BSG wasn't exactly the highest qualiy TV series. The new series actually has very good stories and great special effects. The camera work for the battle scenes is pretty amazing too.

My only complaint so far has been that I wish they weren't so blatant about one of the main characters being a Cylon. I think it would've been more interesting if they'd kept us guessing for a few episodes rather than having the spoiler right at the end of the pilot (the miniseries). I suppose the parallel story line on Caprica would have given it away though, so I'll cut them some slack.

I also like the way they make the occasional tribute to the original series. Like the old-school Cylon ("chrome toaster" model) in the museum. The characters refer to it as being "from the Cylon war 40 years ago". When I first heard that I thought the new series was a sequel to the original series. It had been a long time since I'd seen the original series. I later went and watched a few episodes of the original series and saw that many of the characters have the same names, so the new series is a remake, not a sequel.

Anyway, if you're a science fiction junkie like me, you might want to check out the new Battlestar Galactica. I'd recommend watching the episodes in order. Hopefully Sci Fi will be smart and release each season on DVD well before the next season starts showing.

posted Friday, March 18, 2005 (1 comments)