Examples of addPhrases()


Examples of edu.stanford.nlp.ling.tokensregex.PhraseTable.addPhrases()

  public void testPhraseTable() throws Exception {
    PhraseTable phraseTable = new PhraseTable();
    phraseTable.normalize = true;
    phraseTable.caseInsensitive = true;
    phraseTable.addPhrases(phrases);
    List<PhraseTable.PhraseMatch> matched = phraseTable.findAllMatches(testText);
    assertTrue(matched != null);
    assertEquals(12, matched.size());
    // Test lookup
    PhraseTable.Phrase p = phraseTable.lookupNormalized("COL.");
View Full Code Here

Examples of edu.stanford.nlp.ling.tokensregex.PhraseTable.addPhrases()

  }

  public void testIterator() throws Exception {
    PhraseTable phraseTable = new PhraseTable();
    phraseTable.caseInsensitive = true;
    phraseTable.addPhrases(phrases);

    Set<String> origPhrases = new HashSet<String>();
    origPhrases.addAll(phrases);
    Set<String> iteratedPhrases = new HashSet<String>();
    Iterator<PhraseTable.Phrase> iterator = phraseTable.iterator();
View Full Code Here

Examples of edu.stanford.nlp.ling.tokensregex.PhraseTable.addPhrases()

  public void testFindMatches() throws Exception {
    String text = "Who is Col. Jibril Rajoub";
    PhraseTable phraseTable = new PhraseTable();
    phraseTable.caseInsensitive = true;
    phraseTable.addPhrases(phrases);
    List<PhraseTable.PhraseMatch> matched = phraseTable.findMatches(text, 2, 5, true);
    assertTrue(matched != null);
    assertEquals(2, matched.size());
  }
View Full Code Here

Examples of org.carrot2.core.Cluster.addPhrases()

    private static List<Cluster> sanityCheck(List<Cluster> in, Predicate<Document> docFilter)
    {
        List<Cluster> cloned = Lists.newArrayListWithCapacity(in.size());
        for (Cluster c : in) {
            Cluster c2 = new Cluster();
            c2.addPhrases(c.getPhrases());
            c2.addDocuments(
                Iterables.filter(c.getDocuments(), docFilter));
            c2.addSubclusters(sanityCheck(c.getSubclusters(), docFilter));
            cloned.add(c2);
        }
View Full Code Here

Examples of org.carrot2.core.Cluster.addPhrases()

        final ArrayList<Document> docs = Lists.newArrayListWithCapacity(documents.size());
        final ArrayList<String> phrases = Lists.newArrayListWithCapacity(3);
        for (ClusterCandidate c : clusters)
        {
            final Cluster c2 = new Cluster();
            c2.addPhrases(collectPhrases(phrases, c));
            c2.addDocuments(collectDocuments(docs, c.documents));
            c2.setScore((double) c.score);
            this.clusters.add(c2);

            all.or(c.documents);
View Full Code Here

Examples of org.carrot2.core.Cluster.addPhrases()

                final Cluster cluster = new Cluster();

                final IntArrayList rawCluster = rawClusters.get(i);
                if (rawCluster.size() > 1)
                {
                    cluster.addPhrases(getLabels(rawCluster,
                        vsmContext.termDocumentMatrix, rowToStemIndex,
                        preprocessingContext.allStems.mostFrequentOriginalWordIndex,
                        preprocessingContext.allWords.image));
                    for (int j = 0; j < rawCluster.size(); j++)
                    {
View Full Code Here

Examples of org.carrot2.core.Cluster.addPhrases()

                    // Cluster removed during merging
                    continue;
                }

                // Add label and score
                cluster.addPhrases(labelFormatter.format(context, labelFeature));
                cluster.setAttribute(Cluster.SCORE, clusterLabelScore[i]);

                // Add documents
                final BitSet bs = clusterDocuments[i];
                for (int bit = bs.nextSetBit(0); bit >= 0; bit = bs.nextSetBit(bit + 1))
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.