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

gate.plugins.ANNIE.resources.NE.name_context.jape Maven / Gradle / Ivy

Go to download

Gate based component, that can process the Text units to extract informations using Gate's tools (such as grammars, gazetteers, tokenizer or POS Taggers). This project contains two versions, a simple component and webservice one.

There is a newer version: 2.0
Show newest version
/*
*  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 11879 2009-11-03 13:24:55Z markagreenwood $
*/

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");
outputAS.add(person.firstNode(), person.lastNode(), "Person",
features);
outputAS.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");
outputAS.add(person.firstNode(), person.lastNode(), "Person",
features);
outputAS.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}
 )
)
-->
  {}



















© 2015 - 2024 Weber Informatics LLC | Privacy Policy