Uploaded image for project: 'OpenNLP'
  1. OpenNLP
  2. OPENNLP-1198

add more tests to NGramGeneratorTest

    XMLWordPrintableJSON

Details

    • Test
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 1.8.4
    • None
    • None

    Description

      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:

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

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

          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));
      

      Attachments

        Issue Links

          Activity

            People

              koji Koji Sekiguchi
              koji Koji Sekiguchi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: