File: test_hanja.py

package info (click to toggle)
libhangul 0.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,468 kB
  • sloc: ansic: 8,619; python: 631; xml: 402; makefile: 211; ruby: 26; sh: 14
file content (21 lines) | stat: -rw-r--r-- 573 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from hangul import *
import sys

hanja_table_file = None
if len(sys.argv)>2:
    hanja_table_file = sys.argv[1]

table = hanja_table_load(hanja_table_file);
while True:
    buf = sys.stdin.read(1024)
    if len(buf)==0:
        break
    list = hanja_table_match_prefix(table, buf);
    n = hanja_list_get_size(list);
    for i in range(n):
        key     = hanja_list_get_nth_key(list, i)
        value   = hanja_list_get_nth_value(list, i)
        comment = hanja_list_get_nth_comment(list, i)
        print "%s:%s:%s" % (key, value, comment)

hanja_table_delete(table)