Example usage for opennlp.tools.ngram NGramModel numberOfGrams

List of usage examples for opennlp.tools.ngram NGramModel numberOfGrams

Introduction

In this page you can find the example usage for opennlp.tools.ngram NGramModel numberOfGrams.

Prototype

public int numberOfGrams() 

Source Link

Document

Retrieves the total count of all Ngrams.

Usage

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

@Test
public void testNumberOfGrams() throws Exception {
    NGramModel ngramModel = new NGramModel();
    StringList tokens = new StringList("the", "bro", "wn");
    ngramModel.add(tokens, 1, 3);//from  www  .  j  ava2s.c  om
    Assert.assertEquals(6, ngramModel.numberOfGrams());
}