Presentation is loading. Please wait.

Presentation is loading. Please wait.

JAPE and Java Kalina Bontcheva, Department of Computer Science, University.

Similar presentations


Presentation on theme: "JAPE and Java Kalina Bontcheva, Department of Computer Science, University."— Presentation transcript:

1 JAPE and Java http://gate.ac.uk/http://gate.ac.uk/ http://nlp.shef.ac.uk/http://nlp.shef.ac.uk/ Kalina Bontcheva, Department of Computer Science, University of Sheffield March 2004 1.Overview 2.RHSAction.java 3.Accessing the matched annotations 4.Accessing the document 5.Transforming markup in corpora

2 2(9) Overview You can write any Java code on JAPE RHS Learn well the annotations and their features –By inspecting them in the GUI –Looking in the documentation Learn well the annotation API The better you know the API, the more you can do with JAPE

3 3(9) RHSAction.java Interface that is implemented by all RHS JAPE rules public void doit(Document doc, Map bindings, AnnotationSet annotations, AnnotationSet inputAS, AnnotationSet outputAS, Ontology ontology) throws JapeException;

4 4(9) Back to the example Rule: Entity ( {Gpe}| {Organization}| {Person}| {Location}| {Facility} ):entity --> { gate.AnnotationSet entityAS = (gate.AnnotationSet)bindings.get("entity"); gate.Annotation entityAnn = (gate.Annotation)entityAS.iterator().next(); gate.FeatureMap features = Factory.newFeatureMap(); features.put("type", entityAnn.getType()); outputAS.add(entityAnn.getStartNode(), entityAnn.getEndNode(), "Entity“, features); inputAS.removeAll(entityAS); }

5 5(9) Accessing the document Rule: Email Priority: 150 ( {message} ) --> { doc.getFeatures().put("genre", "email"); }

6 6(9) Transforming markup in corpora Example document: The European Commission said on Thursday it disagreed with German advice to consumers to shun British lamb …

7 7(9) Phase:foo Input: I-PER I-ORG I-LOC Options: control = first Rule: One ({I-PER}):iperx --> :iperx.Person={} Rule: Two ({I-ORG}):iorgx --> :iorgx.Organization={} Rule: Three ({I-LOC}):ilocx --> :ilocx.Location={}

8 8(9) Conclusion Have fun – there’s plenty you can do in JAPE, if you know the API well! Some advanced examples for Java and JAPE are in z:\gatecorpora\ace –Markup conversion, including using CREOLE registry –Collecting corpus statistics with JAPE This talk: http://gate.ac.uk/sale/talks/jape-java.ppthttp://gate.ac.uk/sale/talks/jape-java.ppt More information: http://gate.ac.uk/http://gate.ac.uk/


Download ppt "JAPE and Java Kalina Bontcheva, Department of Computer Science, University."

Similar presentations


Ads by Google