Package com.ansj.vec

Examples of com.ansj.vec.Word2VEC


*
*/
public class WordKmeans {

    public static void main(String[] args) throws IOException {
        Word2VEC vec = new Word2VEC();
        vec.loadGoogleModel("vectors.bin");
        System.out.println("load model ok!");
        WordKmeans wordKmeans = new WordKmeans(vec.getWordMap(), 50, 50);
        Classes[] explain = wordKmeans.explain();

        for (int i = 0; i < explain.length; i++) {
            System.out.println("--------" + i + "---------");
            System.out.println(explain[i].getTop(10));
View Full Code Here


import com.ansj.vec.Word2VEC;

public class Test {
    public static void main(String[] args) throws IOException {
        Word2VEC w1 = new Word2VEC() ;
        w1.loadGoogleModel("library/corpus.bin") ;
       
        System.out.println(w1.distance("奥尼尔"));
       
        System.out.println(w1.distance("毛泽东"));
       
        System.out.println(w1.distance("邓小平"));
       
       
        System.out.println(w1.distance("魔术队"));
       
        System.out.println(w1.distance("魔术"));
       
    }
View Full Code Here

TOP

Related Classes of com.ansj.vec.Word2VEC

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.