예제 #1
0
 def stroke():
     print(get_same_stroke('蓝'))
예제 #2
0
# -*- coding: utf-8 -*-
# Author: XuMing <*****@*****.**>
# Brief:
import pycorrector
from pycorrector.tokenizer import segment

c = pycorrector.get_same_pinyin('长')
print('get_same_pinyin:', c)

c = pycorrector.get_same_stroke('长')
print('get_same_stroke:', c)

freq = pycorrector.word_frequency('龟龙麟凤')
print('freq:', freq)

sent = '少先队员应该为老人让座'
sent_seg = segment(sent)
ppl = pycorrector.ppl_score(sent_seg)
print('ppl_score:', ppl)

sent = '少先队员因该为老人让坐'
sent_seg = segment(sent)
ppl = pycorrector.ppl_score(sent_seg)
print('ppl_score:', ppl)

print(pycorrector.detect(sent))

corrected_sent, detail = pycorrector.correct('少先队员因该为老人让坐')
print(corrected_sent, detail)