为什么words是空列表,要怎么解决?
为什么不进行分词操作?
代码有错吗?请指导
code在我本地运行是没有问题的, 你把cws.model解压到一个没有中文的路径下试试。
import os
from pyltp import Segmentor
LTP_DATA_DIR = r"C:\EricCode\ltp_data_v3.4.0"
cws_model_path = os.path.join(LTP_DATA_DIR, "cws.model")
segmentor = Segmentor(cws_model_path)
words = segmentor.segment("元芳你怎么看")
print("|".join(words))
segmentor.release()