La Vita è Bella

Tuesday, May 22, 2007

Simple SQLite test C program, without callbacks

I need some efficient way for Miao for word database, and I guess SQLite is the solution. So I wrote this simple test program to get familiar with SQLite API. (read more for the program)

And there's something should be kept in mind: don't use "`"s.

As I used to use MySQL before, I always put "`" in SQL statements, for example:

create table `foo` (`bar` int)

It's OK in SQLite command line program, but not in the C library.

When I execute a SQL query with "`", I'll get this error message:

sql error #1: unrecognized token: "`"

So I deleted "`"s in the SQL statement, but still get this error message:

sql error #4: malformed database schema - unrecognized token: "`"

This really drive me crazy, as I don't know what's wrong. But finally I've got the reason: that's because there's "`" in the "create table" statement. So I recreated the table and rerun the program, it's finally OK now.

more...

00:38:33 by fishy - dev - Permanent Link

no comments yet - no trackbacks yet - karma: 529 [+/-]

Saturday, May 19, 2007

Add emacs mode line support to vim, and call for help

UPDATE: sfiera took this project over so please head to his github page for this project. Thank you for the awesome work, sfiera!

Different editor configurations, especially tabstops are always pain for co-work. So if everyone uses vim, you can specify some vim instruction to override one's vim configuration in your file, just like:

// vim:tabstop=4:

And if everyone uses emacs, you can also specify emacs mode line like:

// -*- tab-width: 2 -*-

But what about make vim to read emacs mode line? I've wrote a script to do so.

As I didn't use emacs at all, I don't know which instructions can be specified in the emacs mode line. I just wrote a handler for "tab-width" as an example. If you are familiar with both emacs and vim, please help me to add more handlers into this script.

After more handlers added, I'll submit this script to vim.org.



tags: , , , ,

02:25:41 by fishy - opensource - Permanent Link

3 comments - no trackbacks yet - karma: 121 [+/-]

Monday, May 14, 2007

Miao: (will be) a new smart pinyin input method for Mac OS X

Why another pinyin input method?

The answer is simple: the current pinyin input methods on Mac doesn't satisfy me. I'm going to scratch my own itch :P

ITABC (comes with Mac) and Pinyin Module in OpenVanilla isn't a smart input method; QIM is smart but it's a shareware, and a expensive shareware (USD 19.99 or RMB 69.00, but only for one major version free update); FIT is smarter than ITABC and free (for charge), but is not smart enough and I don't like some of its feature but can't turn them off.

Miao will be a smart pinyin input method, designed for people who likes to input a whole sentence once. It will learn user's accustoming and finally become a essential tool in inputing (after some training).

The idea and feature

I won't focus on pre-train dictionaries, just like Sogou Pinyin or Google Pinyin. My focus will be on "learning"

For each sentence you input, it will record the words within the sentence, including continuos words and non-continuos words, and calculated for probability.

Continuos word probability will be used to auto-learn new words, that is, if there's a high probability that two known words will comes together, they will be formed as a new word.

Non-continuos word probability will be used for candidate word sorting. The word with the highest probability will get ordered first. As a instance, for the pinyin word "yaoming", if the sentence comes with "huojian"(火箭/Rockets), "maidi"(麦迪/McGrady), it's more likely to be "姚明"(Yao Ming the NBA player); If the sentence comes with "can"(惨/misery), it's more likely to be "要命"(Kill me!).

The license

It may be licensed under GPL or BSD license, it's not decided yet. But I can assume that it will be certainly free, as freedom!

About the name

"Miao" is the pinyin of the Chinese character "", which just like "meow" in English, is "the characteristic crying sound of a cat" (from Oxford American Dictionaries).

It's a pinyin input method, so I choose a pinyin word as its name :P

Other informations

I should write it as a module for OpenVanilla, instead of stand-alone. The reason is that I'm not going to reinvent the wheel. I want to focus on the learning algorithm, but not the system interfaces. And this may make it easier to port into other platforms, for example Linux.

The project homepage will be http://oaim.yhsif.com. I'll start it soon, any contribution, e.g. codes, ideas or artworks, are appreciated.



tags: , , , , ,

16:30:55 by fishy - opensource - Permanent Link

8 comments - 1 trackback - karma: 18 [+/-]

May the Force be with you. RAmen