How to use the pycorrector.detect function in pycorrector

To help you get started, we’ve selected a few pycorrector examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shibing624 / pycorrector / tests / long_text_error.py View on Github external
def demo1():
    for i in text:
        print(i, pycorrector.detect(i))
        print(i, pycorrector.correct(i))
github shibing624 / pycorrector / tests / fix_bug.py View on Github external
' ',
             '这是人工智能的一个分知',
             '我的家乡是有名的玉米之乡',
             '老师工作非常幸苦,我们要遵敬老师',
             'nihao, 耐得住欲妄',
             '一阙词牌名',
             '我兴高彩列地去公园游玩',
             '吹唐人记忆',
             ' 耐得住欲妄',
             '母子平爱',
             '不由的感叹道',
             ]

error_sentences.extend(text_list)
for line in error_sentences:
    print(pycorrector.detect(line))
    correct_sent = pycorrector.correct(line)
    print("original sentence:{} => correct sentence:{}".format(line, correct_sent))
github shibing624 / pycorrector / tests / single_char_error.py View on Github external
def test1():
    for i in text:
        print(i, pycorrector.detect(i))
        print(i, pycorrector.correct(i))
github shibing624 / pycorrector / tests / single_char_error.py View on Github external
def test2():
    for i in x:
        print(i, pycorrector.detect(i))
        print(i, pycorrector.correct(i))
github shibing624 / pycorrector / tests / long_text_error.py View on Github external
def demo2():
    for i in x:
        print(i, pycorrector.detect(i))
        print(i, pycorrector.correct(i))
github shibing624 / pycorrector / examples / use_custom_confusion.py View on Github external
'天地无垠大,我们的舞台无线大',
    '交通先行了怎么过去啊?',

]
for line in error_sentences:
    idx_errors = pycorrector.detect(line)
    print(idx_errors)

    correct_sent = pycorrector.correct(line)
    print("original sentence:{} => correct sentence:{}".format(line, correct_sent))

print('*' * 53)
pycorrector.set_custom_confusion_dict(path='./my_confusion.txt')
pycorrector.set_custom_word(path='./my_custom_word.txt')
for line in error_sentences:
    idx_errors = pycorrector.detect(line)
    print(idx_errors)
    correct_sent = pycorrector.correct(line)
    print("original sentence:{} => correct sentence:{}".format(line, correct_sent))
github shibing624 / pycorrector / examples / detect_demo.py View on Github external
# -*- coding: utf-8 -*-
"""
@author:XuMing(xuming624@qq.com)
@description: 
"""

import sys

sys.path.append("../")

import pycorrector

idx_errors = pycorrector.detect('少先队员因该为老人让坐')
print(idx_errors)