I use an API to segment the text into sentences. In the future I want to retrieve each sentence in a case of an array of string.
Code:
String [] tab = null;
for (int i=0; i<annotations.size() i++) {
Annotation annotation = annotations. Get (i);
if (annotation!= null && (annotation.getType().equals ("Sentence"))) {
DocumentContent content = currDoc.GetContent();
Node = startNode annotation.GetStartNode();
Node = endNode annotation.GetEndNode();
long start = startNode.getOffset();
long end = endNode.getOffset();
tab [i] = content. getContent (start, end). toString ();
}
This Code generates an exception: Exception in thread "main" java.lang.NullPointerException.
Note that this same code works fine by putting
Code:
System. Out. Println (i + ":" + content. GetContent (start, end). ToString ());
Bookmarks