Skip to content

Wrong array size #1

Description

@petrux

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions