summaryrefslogtreecommitdiff
path: root/bindings/python_swig/test_hanja.py
blob: 0c2a87b18910e8960f2e7f5be5b27a8ca1be702d (plain)
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)