Example usage for opennlp.tools.dictionary Dictionary getMinTokenCount

List of usage examples for opennlp.tools.dictionary Dictionary getMinTokenCount

Introduction

In this page you can find the example usage for opennlp.tools.dictionary Dictionary getMinTokenCount.

Prototype

public int getMinTokenCount() 

Source Link

Usage

From source file:opennlp.tools.ngram.NGramModelTest.java

@Test
public void testToDictionary() throws Exception {
    NGramModel ngramModel = new NGramModel();
    StringList tokens = new StringList("the", "brown", "fox", "jumped");
    ngramModel.add(tokens, 1, 3);/*from   ww  w. j a va  2 s  . c  om*/
    tokens = new StringList("the", "brown", "Fox", "jumped");
    ngramModel.add(tokens, 1, 3);
    Dictionary dictionary = ngramModel.toDictionary();
    Assert.assertNotNull(dictionary);
    Assert.assertEquals(9, dictionary.size());
    Assert.assertEquals(1, dictionary.getMinTokenCount());
    Assert.assertEquals(3, dictionary.getMaxTokenCount());
}

From source file:opennlp.tools.ngram.NGramModelTest.java

@Test
public void testToDictionary1() throws Exception {
    NGramModel ngramModel = new NGramModel();
    StringList tokens = new StringList("the", "brown", "fox", "jumped");
    ngramModel.add(tokens, 1, 3);//from w  w  w .j  a v a2  s  .  co m
    tokens = new StringList("the", "brown", "Fox", "jumped");
    ngramModel.add(tokens, 1, 3);
    Dictionary dictionary = ngramModel.toDictionary(true);
    Assert.assertNotNull(dictionary);
    Assert.assertEquals(14, dictionary.size());
    Assert.assertEquals(1, dictionary.getMinTokenCount());
    Assert.assertEquals(3, dictionary.getMaxTokenCount());
}