package com.mooctest.util;

import com.hankcs.hanlp.mining.word2vec.DocVectorModel;
import com.hankcs.hanlp.mining.word2vec.WordVectorModel;

import java.io.IOException;

public class Doc2VecUtil {

    private static volatile DocVectorModel docVectorModel;



    public static DocVectorModel loadModel() {
        if (docVectorModel == null) {

            synchronized (Doc2VecUtil.class) {
                if (docVectorModel == null) {

                    try {
                        docVectorModel = new DocVectorModel(new WordVectorModel("/Users/insomnialee/Desktop/sgns.wiki.word"));
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }
        }

        return docVectorModel;
    }

}
