2

I'm creating a GATE app which used to find co-reference text. It works fine and I have created zipped file of the app by export option provided in GATE.

Now I'm trying to use the same in my Java code.

    Gate.runInSandbox(true);
    Gate.setGateHome(new File(gateHome));
    Gate.setPluginsHome(new File(gateHome, "plugins"));
    Gate.init();
    URL applicationURL = new URL("file:" + new Path(gateHome, "application.xgapp").toString());

    application = (CorpusController) PersistenceManager.loadObjectFromUrl(applicationURL);
    corpus = Factory.newCorpus("Megaki Corpus");
    application.setCorpus(corpus);

    Document document = Factory.newDocument(text);

    corpus.add(document);
    application.execute();
    corpus.clear();

Now how can I parse this document and get co-reference text?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Vaisakh
  • 1,088
  • 1
  • 8
  • 14
  • What about: `URL applicationURL = new File(gateHome, "application.xgapp").toURI().toURL()` – dedek Nov 21 '14 at 10:21

1 Answers1

3

I do not know about yours, but co-references created manually using the Co-reference Editor are stored in a document feature. The feature name seems to be "MatchesAnnots" and the type Map<String, List<List<Integer>>>.

In my case, following code prints as name: null (the default annotation set) followed by all co-reference chains present in it.

Object obj = document.getFeatures().get("MatchesAnnots");

@SuppressWarnings("unchecked")
Map<String, List<List<Integer>>> map = (Map<String, List<List<Integer>>>) obj;

for (Entry<String, List<List<Integer>>> e : map.entrySet()) {
    System.err.println("as name: "+  e.getKey());
    for (List<Integer> chain : e.getValue()) {
        System.err.println("chain : "+  chain);         
    }
}
dedek
  • 7,981
  • 3
  • 38
  • 68
  • Yes. This is correct. I got it yesterday. I forgot to update here. Anyways appreciate your help. Thanks a lot. – Vaisakh Nov 21 '14 at 10:50
  • Do you have any idea about sentiment analysis using GATE? Please share me. – Vaisakh Nov 21 '14 at 10:52
  • @Vaisakh Not much, there are some 3rd party plugins (e.g. https://github.com/gsi-upm/SAGA ) and the Training Course - Opinion Mining presentation, which includes also a machine learning approach https://gate.ac.uk/wiki/TrainingCourseJune2014/ – dedek Nov 21 '14 at 21:50