Examples of LatentSemanticIndex


Examples of ch.akuhn.hapax.index.LatentSemanticIndex

    public void corpusWithSmallDocuments() {
        TermDocumentMatrix tdm = new TermDocumentMatrix();
        tdm.putDocument("m1", new Terms("Lorem ipsum dolor."));
        tdm.putDocument("m2", new Terms("Lorem ipsum dolor."));
        tdm.putDocument("m3", new Terms("Lorem ipsum dolor."));
        LatentSemanticIndex lsi = tdm.rejectAndWeight().createIndex();
        assertEquals(3, lsi.documentCount());
        assertEquals(3, lsi.rankDocumentsByQuery("Lorem").size());
    }
View Full Code Here

Examples of ch.akuhn.hapax.index.LatentSemanticIndex

    }
   
    @Test
    public void corpusWithoutDocuments() {
        TermDocumentMatrix tdm = new TermDocumentMatrix();
        LatentSemanticIndex lsi = tdm.rejectAndWeight().createIndex();
        assertEquals(0, lsi.documentCount());
        assertEquals(0, lsi.rankDocumentsByQuery("Lorem").size());
    }
View Full Code Here

Examples of ch.akuhn.hapax.index.LatentSemanticIndex

   
    @Test
    public void corpusWithoutOneDocuments() {
        TermDocumentMatrix tdm = new TermDocumentMatrix();
        tdm.putDocument("m1", new Terms("Lorem ipsum dolor."));
        LatentSemanticIndex lsi = tdm.rejectAndWeight().createIndex();
        assertEquals(1, lsi.documentCount());
        assertEquals(1, lsi.rankDocumentsByQuery("Lorem").size());
    }
View Full Code Here

Examples of ch.akuhn.hapax.index.LatentSemanticIndex

        Out.puts(tdm.density());

        Out.puts(tdm.terms().sortedCounts());

        LatentSemanticIndex lsi = tdm.createIndex();

        Out.puts(first(10, lsi.rankDocumentsByTerm("bag")));
        Out.puts(first(10, lsi.rankTermsByTerm("bag")));
        Out.puts(first(10, lsi.rankDocumentsByTerm("codemap")));
        Out.puts(first(10, lsi.rankDocumentsByQuery("split string by lower- and upper-case")));
       
    }
View Full Code Here

Examples of ch.akuhn.hapax.index.LatentSemanticIndex

        .addDocument("m4", "Graph minors: A survey")
        .makeTDM();
       
    System.out.println(tdm);
    
    LatentSemanticIndex lsi = tdm.createIndex(2);
   
    Ranking<String> ranking = lsi.rankDocumentsByQuery("human computer interaction");
   
    System.out.println(ranking.top(10));
   
  }
View Full Code Here

Examples of ch.akuhn.hapax.index.LatentSemanticIndex

        this.previousConfiguration = new Configuration();
    }

    @Override
    protected Configuration computeValue(ProgressMonitor monitor, Arguments args) {
        LatentSemanticIndex index = args.nextOrFail();
        return previousConfiguration = new MapBuilder().addCorpus(index).makeMap(previousConfiguration);
    }
View Full Code Here

Examples of ch.akuhn.hapax.index.LatentSemanticIndex

    }

    @Override
    protected MapInstance computeValue(ProgressMonitor monitor, Arguments args) {
        int size = args.nextOrFail();
        final LatentSemanticIndex index = args.nextOrFail();
        Configuration configuration = args.nextOrFail();
        return configuration.withSize(size, new MapScheme<Double>() {
            @Override
            public Double forLocation(Point location) {
//                return Math.max(1, Math.log(index.getDocumentLength(location.getDocument())));
//                return Math.cbrt(index.getDocumentLength(location.getDocument()));
                return Math.sqrt(index.getDocumentLength(location.getDocument()));
            }
        });
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.