All Downloads are FREE. Search and download functionalities are using the official Maven repository.

resources.NE.document_date.jape Maven / Gradle / Ivy

Go to download

ANNIE is a general purpose information extraction system that provides the building blocks of many other GATE applications.

The newest version!
Phase:	DateHeader
Input: DCT
Options: control = appelt

Rule: DCT
(
 {DCT}
):tag
-->
{
gate.AnnotationSet tagSet = (gate.AnnotationSet)bindings.get("tag");
gate.Annotation tagAnn = (gate.Annotation)tagSet.iterator().next();

gate.FeatureMap features = Factory.newFeatureMap();


String s = gate.Utils.stringFor(doc, tagAnn);
//String content = doc.getContent().getContent(tagAnn.getStartNode().getOffset(),
 //                tagAnn.getEndNode().getOffset()).toString();
 
 if (s.matches("^\\d{8}$") ) {
String s1 = s.substring(0,4) + "-" + s.substring(4,6) + "-" + s.substring(6,8);

doc.getFeatures().put("document-date", s1);
}

 }










© 2015 - 2024 Weber Informatics LLC | Privacy Policy