-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
代码:
from ltp import StnSplit,LTP
sents = StnSplit().split("汤姆生病了。他去了医院。")
sents = StnSplit().batch_split(["他叫汤姆去拿外衣。", "汤姆生病了。他去了医院。"])
print(sents)
ltp = LTP("./LTP_model/base/")
cws, pos, ner = ltp.pipeline(["他叫汤姆去拿外衣。"], tasks=["cws", "pos", "ner"]).to_tuple() # to tuple 可以自动转换为元组格式
# 使用元组格式作为返回结果
print(cws, pos, ner)
输出:
['他叫汤姆去拿外衣。', '汤姆生病了。', '他去了医院。']
Loading weights from local directory
[['他', '叫', '汤姆', '去', '拿', '外衣', '。']] [['r', 'v', 'nh', 'v', 'v', 'n', 'wp']] [[('Nh', '汤姆', 2, 2)]]
Metadata
Metadata
Assignees
Labels
No labels