You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@opennlp.apache.org by "Koji Sekiguchi (JIRA)" <ji...@apache.org> on 2018/05/21 03:40:00 UTC

[jira] [Created] (OPENNLP-1198) add more tests to NGramGeneratorTest

Koji Sekiguchi created OPENNLP-1198:
---------------------------------------

             Summary: add more tests to NGramGeneratorTest
                 Key: OPENNLP-1198
                 URL: https://issues.apache.org/jira/browse/OPENNLP-1198
             Project: OpenNLP
          Issue Type: Test
          Components: Build, Packaging and Test
    Affects Versions: 1.8.4
            Reporter: Koji Sekiguchi


At present, NGramGeneratorTest has only 2-gram test against the example sentence "This is a sentence". I think we'd better to have 1-gram, 3-gram and 4-gram test cases for this example sentence.

In addition, it checks the return values by doing like this:

{code}
    Assert.assertEquals(3,  ngrams.size());
    Assert.assertTrue(ngrams.contains("This-is"));
    Assert.assertTrue(ngrams.contains("is-a"));
    Assert.assertTrue(ngrams.contains("a-sentence"));
{code}

but it cannot check the sequence. I think we should check it like this, instead:

{code}
    Assert.assertEquals(3,  ngrams.size());
    Assert.assertEquals("This-is", ngrams.get(0));
    Assert.assertEquals("is-a", ngrams.get(1));
    Assert.assertEquals("a-sentence", ngrams.get(2));
{code}




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)