Exemple #1
0
 def pinyin_2_hanzi(self, pinyinList):
     from Pinyin2Hanzi import DefaultDagParams
     dagParams = DefaultDagParams()
     result = None
     for pinyin in pinyinList:
         hanzi = [l[0] for l in dagParams.get_phrase([pinyin], 10000)]
         if result is None:
             result = hanzi
         else:
             result = [a + b for a in result for b in hanzi]
     return result
Exemple #2
0
# coding: utf-8
from __future__ import (print_function, unicode_literals)

import sys
sys.path.append('..')

from Pinyin2Hanzi import all_pinyin
from Pinyin2Hanzi import DefaultDagParams

dagparams = DefaultDagParams()

for py in all_pinyin():
    if len(dagparams.get_phrase([py]) ) == 0:
        print(py)


print( dagparams.get_phrase(['ju']) )
print( dagparams.get_phrase(['jve']) )