Package ch.akuhn.hapax

Examples of ch.akuhn.hapax.Hapax


    private transient static boolean VIZ = true;

    public static void main(String[] args) throws IOException {

        Hapax hapax = Hapax.newCorpus()
                .useTFIDF()
                .useCamelCaseScanner()
                .addFiles("..", ".java")
                .build();

        System.out.println(hapax.getIndex());

        Viz viz = VIZ ? new Viz().open() : null;
        new MultidimensionalScaling()
                .similarities(hapax.getIndex().documentCorrelation().asArray())
                .verbose()
                .listener(viz)
                .iterations(Integer.MAX_VALUE)
                .run();
View Full Code Here


    private static final double THRESHOLD = -999;

    public static void main(String[] args) throws IOException {

        String folder = "..";
        Hapax hapax = Hapax.newCorpus()
        .useTFIDF()
        .useCamelCaseScanner()
        .addFiles(folder, ".java")
        .build();
        Matrix corr = hapax.getIndex().documentCorrelation();
        PrintWriter f = new PrintWriter("data.xml");
        f.println("<?xml version=\"1.0\"?>");
        f.println("<!DOCTYPE ggobidata SYSTEM \"ggobi.dtd\">");
        f.println("<ggobidata count=\"2\">");
        f.println("<data name=\"points\">");
        f.println("<variables count=\"1\">");
        f.println("  <realvariable name=\"x\" nickname=\"x\" />");
        f.println("</variables>");
        f.printf("<records count=\"%d\">\n", hapax.getIndex().documentCount());
        int n = 0;
        for (String doc: hapax.getIndex().documents()) {
            f.printf("<record id=\"%d\" label=\"%s\"> 0 </record>\n",
                    ++n,
                    new File(doc).getName());
        }
        f.print("</records>\n</data>\n\n");
View Full Code Here

TOP

Related Classes of ch.akuhn.hapax.Hapax

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.