如何从句子中标记的 word2vec 中获取句子的向量 [英] How to get vector for a sentence from the word2vec of tokens in sentence

查看:50
本文介绍了如何从句子中标记的 word2vec 中获取句子的向量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 word2vec 为一个大文档中的标记列表生成了向量.给定一个句子,是否可以从句子中的标记向量中得到该句子的向量.

I have generated the vectors for a list of tokens from a large document using word2vec. Given a sentence, is it possible to get the vector of the sentence from the vector of the tokens in the sentence.

推荐答案

获取句子向量的方法有多种:

There are differet methods to get the sentence vectors :

  1. Doc2Vec:您可以使用 Doc2Vec 训练数据集,然后使用句子向量.
  2. Word2Vec 向量的平均值:您可以取一个句子中所有词向量的平均值.这个平均向量将代表你的句子向量.
  3. 使用 TF-IDF 计算 Word2Vec 向量的平均值:这是我推荐的最佳方法之一.只需将词向量乘以它们的 TF-IDF 分数即可.只需取平均值,它将代表您的句子向量.
  1. Doc2Vec : you can train your dataset using Doc2Vec and then use the sentence vectors.
  2. Average of Word2Vec vectors : You can just take the average of all the word vectors in a sentence. This average vector will represent your sentence vector.
  3. Average of Word2Vec vectors with TF-IDF : this is one of the best approach which I will recommend. Just take the word vectors and multiply it with their TF-IDF scores. Just take the average and it will represent your sentence vector.

这篇关于如何从句子中标记的 word2vec 中获取句子的向量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆