summaryrefslogtreecommitdiff
path: root/engine/test.py
blob: cd67997982b2fdf03f8a12a0ed77267cc333f97c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import anthy
import sys

ctx = anthy.anthy_context ()
ctx._set_encoding (2)
if len(sys.argv) >= 2:
    ctx.set_string (sys.argv[1])
else:
    ctx.set_string ("かまぁく")
conv_stat = anthy.anthy_conv_stat ()
seg_stat = anthy.anthy_segment_stat ()
ctx.get_stat (conv_stat)
for i in range (0, conv_stat.nr_segment):
    ctx.get_segment_stat (i, seg_stat)
    buf = "          "
    i = ctx.get_segment (i, 0, buf, 10)
    print buf[:i]
# anthy.anthy_release_context (ctx)
ctx = None