使用句子创建向量

问题描述 投票:0回答:1

我想进行情感分析并在python中创建SVM模型,该模型使用点(坐标)绘制矢量,但仅适用于数值。我想将一个句子映射到一个向量。示例:“食物非常美味”转换为(a,b)坐标,表示句子是+ ve还是-ve。有没有一种方法可以将句子转换为向量。

python machine-learning project sentiment-analysis
1个回答
0
投票

看看gensim


from gensim.models import Word2Vec
sentences_list=[
'the quick brown fox jumps over the lazy dog',
'This is a sample sentence'
'... more ...'
]

tokens = Word2Vec(sentences_list)

© www.soinside.com 2019 - 2024. All rights reserved.