From 9fe431b52c87157300eb60e282f1ecbf44826385 Mon Sep 17 00:00:00 2001 From: shibing624 Date: Tue, 16 Jan 2024 18:08:47 +0800 Subject: [PATCH] update model predict. --- examples/macbert/predict.py | 4 +++- examples/macbert/predict_ckpt.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/macbert/predict.py b/examples/macbert/predict.py index 07f204ad..6d0efb7f 100644 --- a/examples/macbert/predict.py +++ b/examples/macbert/predict.py @@ -19,7 +19,9 @@ def main(): m = MacBertCorrector(args.output_dir) inputs = [ + '它的本领是呼风唤雨,因此能灭火防灾。狎鱼后面是獬豸。獬豸通常头上长着独角,有时又被称为独角羊。它很聪彗,而且明辨是非,象征着大公无私,又能镇压斜恶。', '老是较书。', + '少先队 员因该 为老人让 坐', '感谢等五分以后,碰到一位很棒的奴生跟我可聊。', '遇到一位很棒的奴生跟我聊天。', '遇到一位很美的女生跟我疗天。', @@ -27,7 +29,7 @@ def main(): '王天华开心得一直说话。' ] for i in inputs: - output = m.correct(i) + output = m.correct(i, threshold=0.1) print('input :', i) print('predict:', output) print() diff --git a/examples/macbert/predict_ckpt.py b/examples/macbert/predict_ckpt.py index 12fa891a..0f36b7b3 100644 --- a/examples/macbert/predict_ckpt.py +++ b/examples/macbert/predict_ckpt.py @@ -77,6 +77,8 @@ def predict(self, sentences): '感谢等五分以后,碰到一位很棒的奴生跟我可聊。', '遇到一位很棒的奴生跟我聊天。', '遇到一位很美的女生跟我疗天。', + '他们只能有两个选择:接受降新或自动离职。', + '王天华开心得一直说话。' ] outputs = m.predict(inputs) for a, b in zip(inputs, outputs):