HIT-SCIR / pyltp

pyltp: the python extension for LTP
1.53k stars 353 forks source link

分词后返回一个list的接口? #163

Closed guotong1988 closed 6 years ago

guotong1988 commented 6 years ago

问题使用问题

代码片段

cws_model_path = 'data/cws.model'

from pyltp import Segmentor
segmentor = Segmentor()  # 初始化实例
segmentor.load(cws_model_path)  # 加载模型
words = segmentor.segment('元芳你怎么看')  # 分词
print(words)
segmentor.release()

其中words就是一个list的接口? 而不是<pyltp.VectorOfString object at 0x7f8577bc09f0>

liu946 commented 6 years ago

请您按照issue模板详细描述一下您的问题。

guotong1988 commented 6 years ago

改了下,我想没有版本问题,就是提个建议吧可能

guotong1988 commented 6 years ago

希望提供一个分词返回一个list而不是<pyltp.VectorOfString object at 0x7f8577bc09f0> 的接口

Cantoria commented 6 years ago
cws_model_path = 'data/cws.model'
from pyltp import Segmentor
segmentor = Segmentor()  # 初始化实例

segmentor.load(cws_model_path)  # 加载模型
words = segmentor.segment('元芳你怎么看')  # 分词
words = list(words)
print(words)
segmentor.release()