/* * name_context.jape * * Copyright (c) 1998-2004, 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, 10 Sep 2001 * * $Id: name_context.jape,v 1.13 2004/07/21 16:57:11 akshay Exp $ */ Phase: NameContext Input: Lookup Unknown Person Token Organization Options: control = appelt Rule: Jobtitle1 Priority: 50 ( {Lookup.majorType == jobtitle} ) ( {Unknown} ({Unknown})? ) :person --> { //removes old "Unknown" annotation and adds a "Person" one gate.AnnotationSet person = (gate.AnnotationSet) bindings.get("person"); gate.FeatureMap features = Factory.newFeatureMap(); features.put("rule", "JobTitle1"); annotations.add(person.firstNode(), person.lastNode(), "Person", features); annotations.removeAll(person); } Rule:PersonTitle1 Priority: 40 ( {Person.rule1 == PersonTitle} {Unknown} ):person --> { //removes old "Person" and "Unknown" annotations and adds a new "Person" one gate.AnnotationSet person = (gate.AnnotationSet) bindings.get("person"); gate.FeatureMap features = Factory.newFeatureMap(); features.put("rule", "PersonTitle1"); annotations.add(person.firstNode(), person.lastNode(), "Person", features); annotations.removeAll(person); } Rule: PersonContext1 Priority: 10 //note: this should really move to grammar following co-ref ( {Token.orth == upperInitial} ):person ( {Token.string == "from"} ({Organization} | {Location}) ) --> :person.Person = {rule = "PersonContext1"} Rule: NotPersonContext1 Priority: 20 //if the unknown thing is already an org or person, don't change it ( ({Organization}|{Person}) ):label ( {Token.string == "from"} ({Organization} | {Location}) ) --> {}