Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPENNLP-1014: Add more tests for featuregen #151

Closed
wants to merge 1 commit into from

Conversation

kojisekig
Copy link
Member

Thank you for contributing to Apache OpenNLP.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • [Y] Is there a JIRA ticket associated with this PR? Is it referenced
    in the commit message?

  • [Y] Does your PR title start with OPENNLP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.

  • [Y] Has your PR been rebased against the latest commit within the target branch (typically master)?

  • [Y] Is your initial contribution a single, squashed commit?

For code changes:

  • [Y] Have you ensured that the full suite of tests is executed via mvn clean install at the root opennlp folder?
  • [Y] Have you written or updated unit tests to verify your changes?
  • [N/A] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • [N/A] If applicable, have you updated the LICENSE file, including the main LICENSE file in opennlp folder?
  • [N/A] If applicable, have you updated the NOTICE file, including the main NOTICE file found in opennlp folder?

For documentation related changes:

  • [N/A] Have you ensured that format looks appropriate for the output in which it is rendered?

Note:

Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 55.815% when pulling b1c2545 on kojisekig:featuregen-more-test into cb52b27 on apache:master.

Assert.assertEquals(elements.length, features.size());
for (String e: elements) {
Assert.assertTrue(features.contains("ng=" + e));
}
Copy link
Member

@smarthi smarthi Apr 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do away with this method and instead use Assert.assertArrayEquals() ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment.

Of course I thought I should use Assert.assertArrayEquals() for the first time, but when I saw the result, I couldn't see any rule of the order of the set of ngrams. That's why I used contains.

I've not seen NGramModel in detail, which is used in CharacterNgramFeatureGenerator to generate the ngrams, but it seems that it uses Set (via Map.entrySet) to manage the set of ngrams and it causes that we cannot see any rule for the order of ngrams.

In order to use Assert.assertArrayEquals(), I should sort the result first, but I think it cannot be useful for the readability.

@smarthi
Copy link
Member

smarthi commented Apr 10, 2017

+1 to merge

@asfgit asfgit closed this in 3e40807 Apr 11, 2017
asfgit pushed a commit that referenced this pull request Apr 16, 2017
@kojisekig kojisekig deleted the featuregen-more-test branch April 19, 2017 01:40
asfgit pushed a commit that referenced this pull request Apr 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants