Rahim Ullah Rudbari
Rahim Ullah Rudbari

Reputation: 13

GATE usage in java Netbeans

I am trying to write an application from extracting entities from a text and want to use GATE jar files. For which I have installed the GATE tool and have imported jar files, but it is giving errors. I can't understand from where to download more jar files and how to run the first simple program with this.

enter image description here

Upvotes: 1

Views: 326

Answers (2)

ashingel
ashingel

Reputation: 494

From your screenshot I can assume that you used an example provided by GitHub. This example looks good, except one part (from my point of view of course). I would suggest to replace output piece with the next more readable code:

    String text = "Steve works for Apple Inc in California.";
    Document gateDocument = Factory.newDocument(text);
    corpus.add(gateDocument);

    // tell the ANNIE application about the corpus and run it
    annie.setCorpus(corpus);
    annie.execute();

    List<Annotation> personAnnotations = gateDocument.getAnnotations().get(ANNIEConstants.PERSON_ANNOTATION_TYPE).inDocumentOrder();

    for (Annotation personAnnotation : personAnnotations) {
        System.out.println("Entity Text: " + gate.Utils.stringFor(gateDocument, personAnnotation) + " Features: " + personAnnotation.getFeatures());
    }

Similar things could be done for Location, Organisation and other Entity types defined in GATE. Also do not forget to release resources with Factory.deleteResource().

Upvotes: 0

ashingel
ashingel

Reputation: 494

Please make sure that you added gate.jar from YOUR_GATE_HOME/bin folder.

Upvotes: 1

Related Questions