想法是通过词向量相加求和再求平均得到句子向量,但没办法实现,因为我是这样得到词向量的public class test5 { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub String path1 = "C:\\Users\\BG\\Desktop\\result1.txt";//语料路径 int length = 100; int sum = 0; Map<String,float[]> w2vMap = W2Vmodel.word2Vector(path1, length, 0); for ( Map.Entry<String,float[]>MyWord2Vector: w2vMap.entrySet()){ String word=MyWord2Vector.getKey(); float[ ] Vector=MyWord2Vector.getValue(); System.out.print(word); for(int i=0;i<Vector.length;i++){ System.out.print(Vector[i]+" "); } System.out.println(' '); }}}W2C处理的是TXT文件
添加回答
举报
0/150
提交
取消