2017-08-06 1 views
0

Comment puis-je récupérer les textes annotés du document de manière structurée comme ci-dessous. J'utilise une phrase comme une unité de traitement, ce qui signifie que je voudrais récupérer des textes spécifiques à partir des phrases et les mettre ensemble plus tard. J'ai donc déjà configuré mon annotation dans GATE et enregistré les résultats annotés comme xml en ligne.Extraction des annotations de GATE en xml

donc mon fichier xml d'entrée ressemble à ceci:

<Document> 
     <Paragraph> 
      <text id="100">30.03. Zeraua joins the Otjimbingwe and Omaruru Ovaherero at Samuel’s station at Ongandjira in the upper Swakop valley.</text> 
      <text id="101">01.04. Von Glasenapp’s unit proceeds in the direction of Otjikuoko without meeting the Tjetjo community.</text> 
      <text id="102">09.04. The battle of Ongandjira is fought with heavy losses on both sides. The Ovaherero have to give way before a sustained German artillery bombardment commences, and they escape in a northerly direction.</text> 
     </Paragraph> 
     <Paragraph> 
      <text id="200">30.03. Zeraua joins the Otjimbingwe and Omaruru Ovaherero at Samuel’s station at Ongandjira in the upper Swakop valley.</text> 
      <text id="201">01.04. Von Glasenapp’s unit proceeds in the direction of Otjikuoko without meeting the Tjetjo community.</text> 
      <text id="202">09.04. The battle of Ongandjira is fought with heavy losses on both sides. The Ovaherero have to give way before a sustained German artillery bombardment commences, and they escape in a northerly direction.</text> 
     </Paragraph> 
    </Document> 

Et ceci est ma structure de sortie désirée par phrase pour être:

<text id="100"> 
     <Event>Battle of Ongandjira</Event> 
     <Location>Ongandjira</Location> 
     <NumberDate>30.03</NumberDate> 
     <Person>Zeraua</Person> 
    </text> 

Et voici ma annotations dans GATE:

enter image description here

Mon fichier inline contient juste beaucoup de confusion annotations et je ne peux pas comprendre comment le structurer dans cet ordre. J'ai essayé le Format_Twitter JSON et c'est un gâchis aussi.

Merci beaucoup.

Répondre

1

Si j'ai bien compris vos exigences, vous devez utiliser l'approche suivante (description abstraite pour le code Java).

1) Chargez votre document annoté.

2) Dans votre outil de code Java, obtenez toutes les annotations avec le type Phrase dans l'ordre des documents.

3) Exécuter la boucle sur les annotations de phrase et obtenir Événement, Emplacement, NombreDate, Personne dans l'intervalle de phrase.

4) Pour chaque annotation (événement, Lieu, NumberDate, personne) obtenir un texte

5) Créer votre XML

+0

Oh oui je me suis dit cela. Mais le problème est que je ne peux même pas interpréter le xml de GATE. Il ne contient plus les phrases, il n'a que des nœuds. –