Skip to content

Commit

Permalink
update demo.
Browse files Browse the repository at this point in the history
  • Loading branch information
shibing624 committed Apr 27, 2021
1 parent e853581 commit 217092b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions examples/bert_demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
"""
@author:XuMing([email protected])
@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))
2 changes: 1 addition & 1 deletion examples/macbert_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import sys

sys.path.append("..")
from pycorrector import MacBertCorrector
from pycorrector.macbert.macbert_corrector import MacBertCorrector

if __name__ == '__main__':

Expand Down

0 comments on commit 217092b

Please sign in to comment.