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
ce code ne marche pas il me génère une exception:Exception in thread "main" java.lang.NullPointerException.
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(); }
Notez bien que ce même code marche bien en mettant
S'il vous plaît aidez moi
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 System.out.println(i+":"+content.getContent( start, end ).toString());![]()
Je vous attends.
Cordialement
Partager