Skip to content

Commit

Permalink
update model predict.
Browse files Browse the repository at this point in the history
  • Loading branch information
shibing624 committed Jan 16, 2024
1 parent 1b7291a commit 9fe431b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/macbert/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@ def main():

m = MacBertCorrector(args.output_dir)
inputs = [
'它的本领是呼风唤雨,因此能灭火防灾。狎鱼后面是獬豸。獬豸通常头上长着独角,有时又被称为独角羊。它很聪彗,而且明辨是非,象征着大公无私,又能镇压斜恶。',
'老是较书。',
'少先队 员因该 为老人让 坐',
'感谢等五分以后,碰到一位很棒的奴生跟我可聊。',
'遇到一位很棒的奴生跟我聊天。',
'遇到一位很美的女生跟我疗天。',
'他们只能有两个选择:接受降新或自动离职。',
'王天华开心得一直说话。'
]
for i in inputs:
output = m.correct(i)
output = m.correct(i, threshold=0.1)
print('input :', i)
print('predict:', output)
print()
Expand Down
2 changes: 2 additions & 0 deletions examples/macbert/predict_ckpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def predict(self, sentences):
'感谢等五分以后,碰到一位很棒的奴生跟我可聊。',
'遇到一位很棒的奴生跟我聊天。',
'遇到一位很美的女生跟我疗天。',
'他们只能有两个选择:接受降新或自动离职。',
'王天华开心得一直说话。'
]
outputs = m.predict(inputs)
for a, b in zip(inputs, outputs):
Expand Down

0 comments on commit 9fe431b

Please sign in to comment.