Closed QiuRoy closed 1 month ago
import os from pycorrector import Corrector
pwd_path = os.path.abspath(os.path.dirname(file)) lm_path = os.path.join(pwd_path, './zh_giga.no_cna_cmn.prune01244.klm') m = Corrector(lm_path) print(m.correct_batch(['少先队员因该为老人让坐', '你找到你最喜欢的工作,我也很高心。']))
重跑试试
不行,还是同样的报错
用macbert4csc模型
已经可以了: pwd_path = os.path.abspath(os.path.dirname(file)) lm_path = os.path.join(pwd_path, 'zh_giga.no_cna_cmn.prune01244.klm') model = Corrector(language_model_path=lm_path)参数传递问题引起的
请问使用ErnieCscCorrector是无法自定义模型路径吗? from pycorrector import ErnieCscCorrector import os
pwd_path = os.path.abspath(os.path.dirname(file)) lm_path = os.path.join(pwd_path, 'csc-ernie-1.0.pdparams') print(lm_path) m = ErnieCscCorrector(model_name_or_path=lm_path) print(m.correct_batch(['今天新情很好', '你找到你最喜欢的工作,我也很高心。']))
无法自定义模型路径