diff --git a/examples/bert_demo.py b/examples/bert_demo.py new file mode 100644 index 00000000..da212c30 --- /dev/null +++ b/examples/bert_demo.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +""" +@author:XuMing(xuming624@qq.com) +@description: +""" +import sys + +sys.path.append("..") +from pycorrector.bert.bert_corrector import BertCorrector +if __name__ == '__main__': + + error_sentences = [ + '真麻烦你了。希望你们好好的跳无', + '少先队员因该为老人让坐', + '机七学习是人工智能领遇最能体现智能的一个分知', + '一只小鱼船浮在平净的河面上', + '我的家乡是有明的渔米之乡', + ] + + m = BertCorrector() + for line in error_sentences: + correct_sent, err = m.bert_correct(line) + print("original sentence:{} => {}, err:{}".format(line, correct_sent, err)) diff --git a/examples/macbert_demo.py b/examples/macbert_demo.py index e2d8bb34..014257e8 100644 --- a/examples/macbert_demo.py +++ b/examples/macbert_demo.py @@ -6,7 +6,7 @@ import sys sys.path.append("..") -from pycorrector import MacBertCorrector +from pycorrector.macbert.macbert_corrector import MacBertCorrector if __name__ == '__main__':