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

Wrong array size #1

Open
petrux opened this issue Jul 14, 2015 · 0 comments
Open

Wrong array size #1

petrux opened this issue Jul 14, 2015 · 0 comments
Assignees

Comments

@petrux
Copy link
Contributor

petrux commented Jul 14, 2015

Please check the eu.fbk.dkm.pikes.tintop.annotators.MateSrlAnnotator#createMateSentence method. As you can see, the length for the forms, poss,... arrays is set after the CoreMap.size() method

int size = stanfordSentence.size();
String[] forms = new String[size + 1];
String[] poss = new String[size + 1];
....

which doesn't tell the number of tokens but the number of annotations, so the later iteration over the tokens could lead to an ArrayOutOfBound exception:

java.util.List<CoreLabel> get = stanfordSentence.get(
                           CoreAnnotations.TokensAnnotation.class);
for (int i = 0; i < get.size(); i++) {
    ....
}

I assume that the arrays should be sized after the number of tokens (+1 for some of them). If yes, please let me know and I will branch-fix-pull request it ASAP.

@petrux petrux self-assigned this Jul 14, 2015
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

No branches or pull requests

1 participant