You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a test that I run on CoreMapExpressionExtractor which relies on caching the result of an annotation run so I don't have to run the parser each time. I use the ProtobufAnnotationSerializer. However, when I unserialize the cached data all of the new line tokens have been set to NULL. The result is that when I run the extractor a NullPointerException gets thrown at
if (cm.containsKey(CoreAnnotations.TokenBeginAnnotation.class) && cm.containsKey(CoreAnnotations.TokenEndAnnotation.class)) {
Obviously, calling containsKey on a null causes the exception to be thrown.
The workaround that I used was simply to iterate over the tokens prior to using them and inserting a default new line CoreLabel element, and it seems to work. Is there a better way to handle that?