2 # -*- coding: UTF-8 -*-
4 from pyslm import Slm, SlmState
5 from pytrie import PinyinTrie, PinyinTrieNode, WordInfo
9 if not slm.load ("../data/lm_sc.t3g"):
12 pr, result = slm.transfer (SlmState(0,0), 58614)
13 print "pr =", pr, "\tresult = %s" % result
15 pr, result = slm.transfer (result, 75956)
16 print "pr =", pr, "\tresult = %s" % result
18 pr, result = slm.transfer (result, 84582)
19 print "pr =", pr, "\tresult = %s" % result
21 his = slm.history_state_of (result)
22 print "his = %s" % his
24 slm.historify (result)
25 print "result = %s" % result
27 print 'last_word_id =', slm.last_word_id (result)
33 if not trie.load ("../data/pydict_sc.bin"):
36 root = trie.get_root_node ()
37 node = trie.transfer (root, 0x1000)
38 for w in node.get_words ():
41 print trie.is_valid (node, False, 0)
44 print trie.get_symbol_id (u'。')