bioasq
bioasq copied to clipboard
Bug: CoveringPhraseCavGenerator in generate function
This bug appear when some candidate answer variant don't have head tokens. After the first stream pipeline,
Set<Token> heads = TypeUtil.getCandidateAnswerVariants(jcas).stream() .map(TypeUtil::getCandidateAnswerOccurrences).flatMap(Collection::stream) .map(TypeUtil::getHeadTokenOfAnnotation).collect(toSet());
one token is null ( only one because is a Set Collection).
After that, when you call Token::getHead in this part of code:
Set<Token> parents = heads.stream().map(Token::getHead).filter(t -> t != null) .filter(t -> !heads.contains(t)).collect(toSet());
A NullPointerException occur.
For solve this, i think you need to put a non null filter.
regard.