Bonsoir à tous,
j'utilise une api pour segmenter le texte en phrases je veux
par la suite je veux récupérer chaque phrase dans une case
d'un tableau de chaine de caractères
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 
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();
 
}
ce code ne marche pas il me génère une exception:Exception in thread "main" java.lang.NullPointerException.
Notez bien que ce même code marche bien en mettant
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
System.out.println(i+":"+content.getContent( start, end ).toString());
S'il vous plaît aidez moi
Je vous attends.
Cordialement