All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hankcs.hanlp.mining.word2vec.WordCluster Maven / Gradle / Ivy

There is a newer version: portable-1.8.5
Show newest version
package com.hankcs.hanlp.mining.word2vec;


public final class WordCluster
{

    static void usage()
    {
        System.err.printf("Usage: java %s   \n", WordCluster.class.getName());
        System.err.println("\t contains word projections in the text format\n");
        System.err.println("\t number of clustering\n");
        System.err.println("\t output file\n");
        System.exit(0);
    }

    public static void main(String[] args) throws Exception
    {
        if (args.length < 3) usage();

        final String vectorFile = args[0];
        final int k = Integer.parseInt(args[1]);
        final String outFile = args[2];
        final VectorsReader vectorsReader = new VectorsReader(vectorFile);
        vectorsReader.readVectorFile();

        KMeansClustering kmc = new KMeansClustering(vectorsReader, k, outFile);
        kmc.clustering();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy