代码
from wordsegment import load, segment
# 加载模型
load()
# 示例
actions = [
"seeyoulater",
"turnleft",
"turnr"
]
segmented_actions = [segment(action) for action in actions]
segmented_actions = [" ".join(action) for action in segmented_actions]
print(segmented_actions)
输出结果
一步调用:segment("seeyoulater")