想法是通過詞向量相加求和再求平均得到句子向量,但沒辦法實現(xiàn),因為我是這樣得到詞向量的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
提交
取消