Example usage for opennlp.tools.ngram NGramModel contains

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

Introduction

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

Prototype

public boolean contains(StringList tokens) 

Source Link

Document

Checks fit he given tokens are contained by the current instance.

Usage

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

@Test
public void testContains() throws Exception {
    NGramModel ngramModel = new NGramModel();
    StringList tokens = new StringList("the", "bro", "wn");
    ngramModel.add(tokens);/*from   w  w  w.  j  av  a  2  s . c  om*/
    Assert.assertFalse(ngramModel.contains(new StringList("the")));
}

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

@Test
public void testContains2() throws Exception {
    NGramModel ngramModel = new NGramModel();
    StringList tokens = new StringList("the", "bro", "wn");
    ngramModel.add(tokens, 1, 3);//from   www  .j  a  v a 2 s.  c o  m
    Assert.assertTrue(ngramModel.contains(new StringList("the")));
}