/* * firstname.jape * * Copyright (c) 1998-2001, The University of Sheffield. * * This file is part of GATE (see http://gate.ac.uk/), and is free * software, licenced under the GNU Library General Public License, * Version 2, June 1991 (in the distribution as file licence.html, * and also available at http://gate.ac.uk/gate/licence.html). * * Diana Maynard, 02 Aug 2001 * * $Id: firstname.jape,v 1.1 2004/09/10 13:33:24 akshay Exp $ */ Phase: FirstName Input: Token Lookup Control Options: control = appelt Rule: FirstName // Fred ( {Lookup.majorType == person_first} ({Token.string == "-"} {Lookup.majorType == person_first} )? ):person --> { gate.AnnotationSet person = (gate.AnnotationSet)bindings.get("person"); gate.Annotation personAnn = (gate.Annotation)person.iterator().next(); gate.FeatureMap features = Factory.newFeatureMap(); features.put("gender", personAnn.getFeatures().get("minorType")); features.put("rule", "FirstName"); annotations.add(person.firstNode(), person.lastNode(), "FirstPerson", features); } Rule: TitleGender Priority: 50 // Mr ( {Lookup.majorType == title, Lookup.minorType == male}| {Lookup.majorType == title, Lookup.minorType == female} ):person --> { gate.AnnotationSet person = (gate.AnnotationSet)bindings.get("person"); gate.Annotation personAnn = (gate.Annotation)person.iterator().next(); gate.FeatureMap features = Factory.newFeatureMap(); features.put("gender", personAnn.getFeatures().get("minorType")); features.put("rule", "TitleGender"); annotations.add(person.firstNode(), person.lastNode(), "Title", features); } Rule: Title // Dr ( {Lookup.majorType == title} ):person --> :person.Title = {rule = "Title"}