Revision: 17324
http://sourceforge.net/p/gate/code/17324
Author: dgmaynard
Date: 2014-02-17 15:07:12 +0000 (Mon, 17 Feb 2014)
Log Message:
-----------
twitter version of ANNIE
Modified Paths:
--------------
gate/trunk/plugins/ANNIE/resources/NE/name.jape
Added Paths:
-----------
gate/trunk/plugins/ANNIE/resources/NE/main-twitter.jape
gate/trunk/plugins/ANNIE/resources/NE/name-twitter.jape
Added: gate/trunk/plugins/ANNIE/resources/NE/main-twitter.jape
===================================================================
--- gate/trunk/plugins/ANNIE/resources/NE/main-twitter.jape
(rev 0)
+++ gate/trunk/plugins/ANNIE/resources/NE/main-twitter.jape 2014-02-17
15:07:12 UTC (rev 17324)
@@ -0,0 +1,37 @@
+/*
+* main.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, 02 Aug 2001
+*
+* $Id: main.jape 9233 2007-11-23 13:01:52Z dgmaynard $
+*/
+
+MultiPhase: TestTheGrammars
+Phases:
+first
+firstname
+name-twitter
+name_post
+date_pre
+date
+reldate
+number
+address
+url_pre
+url
+email
+identifier
+jobtitle
+final
+unknown
+name_context
+org_context
+loc_context
+clean
Added: gate/trunk/plugins/ANNIE/resources/NE/name-twitter.jape
===================================================================
--- gate/trunk/plugins/ANNIE/resources/NE/name-twitter.jape
(rev 0)
+++ gate/trunk/plugins/ANNIE/resources/NE/name-twitter.jape 2014-02-17
15:07:12 UTC (rev 17324)
@@ -0,0 +1,1408 @@
+/*
+* name.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.jape 17311 2014-02-14 18:49:50Z dgmaynard $
+*/
+
+
+Phase: Name
+Input: Token Lookup Title FirstPerson TempDate Split UserID
+Options: control = appelt debug = false
+
+///////////////////////////////////////////////////////////////
+
+// Person Rules
+
+/////////////////////////////////////////////////////////////////
+Macro: TITLE
+(
+ {Title}
+ ({Token.string == "."})?
+)
+
+Macro: INITIALS
+(
+ ({Token.orth == upperInitial, Token.length =="1"}
+ ({Token.string == "."})?
+ )+
+)
+
+Macro: INITIALS2
+
+(
+ {Token.orth == allCaps, Token.length == "2"} |
+ {Token.orth == allCaps, Token.length == "3"}
+)
+
+
+Macro: FIRSTNAME
+
+ ({FirstPerson.gender == male} |
+ {FirstPerson.gender == female})
+
+
+Macro: FIRSTNAMEAMBIG
+(
+ {Lookup.majorType == person_first, Lookup.minorType == ambig}
+)
+
+
+
+Macro: UPPER
+(
+ ({Token.category == NNP}|
+ {Token.orth == upperInitial}|
+ {Token.orth == mixedCaps}
+)
+ ({Token.string == "-"}
+ {Token.category == NNP}
+ )?
+)
+
+Macro: PERSONENDING
+(
+ {Lookup.majorType == person_ending}
+)
+
+Macro: PREFIX
+(
+ ({Lookup.majorType == surname, Lookup.minorType == prefix}
+ )|
+ (({Token.string == "O"}|{Token.string == "D"})
+ {Token.string == "'"}
+ )
+)
+
+
+
+
+///////////////////////////////////////////////////////////
+Rule: NotAnything
+Priority: 1000
+
+(
+ {Lookup.majorType == spur}
+)
+-->
+{}
+
+// Person Rules
+
+Rule: Pronoun
+Priority: 1000
+//stops personal pronouns being recognised as Initials
+(
+ {Token.category == PP}|
+ {Token.category == PRP}|
+ {Token.category == RB}
+):pro
+-->
+{}
+
+Rule: GazPerson
+Priority: 50
+(
+ {Lookup.majorType == person_full}
+)
+:person -->
+{
+gate.AnnotationSet person = (gate.AnnotationSet)bindings.get("person");
+gate.Annotation personAnn = (gate.Annotation)person.iterator().next();
+gate.FeatureMap features = Factory.newFeatureMap();
+features.put("kind", "personName");
+features.put("rule", "GazPerson");
+outputAS.add(person.firstNode(), person.lastNode(), "TempPerson",
+features);
+}
+
+Rule: TheGazPersonFirst
+Priority: 200
+(
+ {Token.category == DT}|
+ {Token.category == PRP}|
+ {Token.category == RB}
+)
+(
+ {FirstPerson}
+)
+:person
+(
+ {Token.orth == upperInitial, Token.length == "1"}
+)?
+-->
+{
+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("gender"));
+features.put("kind", "personName");
+features.put("rule", "GazPersonFirst");
+outputAS.add(person.firstNode(), person.lastNode(), "TempPerson",
+features);
+//outputAS.removeAll(person);
+}
+
+
+Rule: GazPersonFirst
+Priority: 70
+(
+ {FirstPerson}
+)
+:person
+(
+ {Token.orth == upperInitial, Token.length == "1"}
+)?
+-->
+{
+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("gender"));
+features.put("kind", "personName");
+features.put("rule", "GazPersonFirst");
+outputAS.add(person.firstNode(), person.lastNode(), "TempPerson",
+features);
+//outputAS.removeAll(person);
+}
+
+
+
+
+
+Rule: PersonFirstContext
+Priority: 30
+// Anne and Kenton
+
+(
+ {FirstPerson}
+):person1
+(
+ {Token.string == "and"}
+)
+({Token.orth == upperInitial})
+:person2
+ -->
+{
+//first deal with person1
+ gate.FeatureMap features1 = Factory.newFeatureMap();
+gate.AnnotationSet person1Set = (gate.AnnotationSet)bindings.get("person1");
+gate.AnnotationSet firstPerson =
(gate.AnnotationSet)person1Set.get("FirstPerson");
+if (firstPerson != null && firstPerson.size()>0)
+{
+ gate.Annotation personAnn = (gate.Annotation)firstPerson.iterator().next();
+ features1.put("gender", personAnn.getFeatures().get("gender"));
+}
+ features1.put("kind", "personName");
+ features1.put("rule", "PersonFirstContext");
+outputAS.add(person1Set.firstNode(), person1Set.lastNode(), "TempPerson",
+features1);
+//now deal with person2
+gate.FeatureMap features2 = Factory.newFeatureMap();
+gate.AnnotationSet person2Set = (gate.AnnotationSet)bindings.get("person2");
+ features2.put("kind", "personName");
+ features2.put("rule", "PersonFirstContext");
+outputAS.add(person2Set.firstNode(), person2Set.lastNode(), "TempPerson",
+features2);
+}
+
+
+Rule: PersonFirstContext2
+Priority: 40
+// Anne and I
+
+(
+ {FirstPerson}
+):person
+(
+ {Token.string == "and"}
+ {Token.length == "1"}
+)
+ -->
+{
+ gate.FeatureMap features = Factory.newFeatureMap();
+gate.AnnotationSet personSet = (gate.AnnotationSet)bindings.get("person");
+gate.AnnotationSet firstPerson =
(gate.AnnotationSet)personSet.get("FirstPerson");
+if (firstPerson != null && firstPerson.size()>0)
+{
+ gate.Annotation personAnn = (gate.Annotation)firstPerson.iterator().next();
+ features.put("gender", personAnn.getFeatures().get("gender"));
+}
+ features.put("kind", "personName");
+ features.put("rule", "PersonFirstContext2");
+outputAS.add(personSet.firstNode(), personSet.lastNode(), "TempPerson",
+features);
+}
+
+Rule: PersonTitle
+Priority: 35
+// Mr. Jones
+// Mr Fred Jones
+// note we only allow one first and surname,
+// but we can add more in a final phase if we find adjacent unknowns
+
+(
+ {Token.category == DT}|
+ {Token.category == PRP}|
+ {Token.category == RB}
+)?
+(
+ (TITLE)+
+ ((FIRSTNAME | FIRSTNAMEAMBIG | INITIALS2)
+ )?
+ (PREFIX)*
+ (UPPER)
+ (PERSONENDING)?
+)
+:person -->
+{
+ gate.FeatureMap features = Factory.newFeatureMap();
+gate.AnnotationSet personSet = (gate.AnnotationSet)bindings.get("person");
+
+ // get all Title annotations that have a gender feature
+ HashSet fNames = new HashSet();
+ fNames.add("gender");
+ gate.AnnotationSet personTitle = personSet.get("Title", fNames);
+
+// if the gender feature exists
+ if (personTitle != null && personTitle.size()>0)
+{
+ //Out.prln("Titles found " + personTitle);
+ gate.Annotation personAnn = (gate.Annotation)personTitle.iterator().next();
+ features.put("gender", personAnn.getFeatures().get("gender"));
+}
+else
+{
+ //get all firstPerson annotations that have a gender feature
+ // HashSet fNames = new HashSet();
+ // fNames.add("gender");
+ gate.AnnotationSet firstPerson = personSet.get("FirstPerson", fNames);
+
+ if (firstPerson != null && firstPerson.size()>0)
+ {
+ //Out.prln("First persons found " + firstPerson);
+ gate.Annotation personAnn = (gate.Annotation)firstPerson.iterator().next();
+ features.put("gender", personAnn.getFeatures().get("gender"));
+ }
+}
+ features.put("kind", "personName");
+ features.put("rule", "PersonTitle");
+outputAS.add(personSet.firstNode(), personSet.lastNode(), "TempPerson",
+features);
+}
+
+
+Rule: PersonFirstTitleGender
+Priority: 55
+// use this rule when we know what gender the title indicates
+// Mr Fred
+
+(
+ ({Title.gender == male} | {Title.gender == female})
+ ((FIRSTNAME | FIRSTNAMEAMBIG | INITIALS2)
+ )
+)
+:person -->
+{
+ gate.FeatureMap features = Factory.newFeatureMap();
+gate.AnnotationSet personSet = (gate.AnnotationSet)bindings.get("person");
+gate.AnnotationSet title = (gate.AnnotationSet)personSet.get("Title");
+if (title != null && title.size()>0)
+{
+ gate.Annotation personAnn = (gate.Annotation)title.iterator().next();
+ features.put("gender", personAnn.getFeatures().get("gender"));
+}
+ features.put("kind", "personName");
+ features.put("rule", "PersonFirstTitleGender");
+outputAS.add(personSet.firstNode(), personSet.lastNode(), "TempPerson",
+features);
+}
+
+
+Rule: PersonTitleGender
+Priority: 18
+// use this rule if the title has a feature gender
+// Miss F Smith
+(
+ ({Title.gender == male}|
+ {Title.gender == female}
+ )
+ ((FIRSTNAME | FIRSTNAMEAMBIG | INITIALS2)
+ )*
+ (UPPER)
+ (PERSONENDING)?
+)
+:person -->
+{
+ gate.FeatureMap features = Factory.newFeatureMap();
+gate.AnnotationSet personSet = (gate.AnnotationSet)bindings.get("person");
+gate.AnnotationSet title = (gate.AnnotationSet)personSet.get("Title");
+// if the annotation type title doesn't exist, do nothing
+if (title != null && title.size()>0)
+{
+// if it does exist, take the first element in the set
+ gate.Annotation personAnn = (gate.Annotation)title.iterator().next();
+//propagate gender feature (and value) from title
+ features.put("gender", personAnn.getFeatures().get("gender"));
+}
+// create some new features
+ features.put("kind", "personName");
+ features.put("rule", "PersonTitleGender");
+// create a TempPerson annotation and add the features we've created
+outputAS.add(personSet.firstNode(), personSet.lastNode(), "TempPerson",
+features);
+}
+
+
+Rule: PersonJobTitle
+Priority: 20
+// note we include titles but not jobtitles in markup
+
+(
+ {Lookup.majorType == jobtitle}
+):jobtitle
+(
+ (TITLE)?
+ ((FIRSTNAME | FIRSTNAMEAMBIG )
+ )
+ (PREFIX)*
+ (UPPER)
+ (PERSONENDING)?
+)
+:person
+-->
+ :person.TempPerson = {kind = "personName", rule = "PersonJobTitle"},
+ :jobtitle.JobTitle = {rule = "PersonJobTitle"}
+
+
+
+
+Rule: NotFirstPersonStop
+Priority: 50
+// ambig first name and surname is stop word
+// e.g. Will And
+
+(
+ ((FIRSTNAMEAMBIG)+ |
+ {Token.category == PRP}|
+ {Token.category == DT}
+ )
+ ({Lookup.majorType == stop}
+ )
+)
+:person -->
+ {}
+Rule: FirstPersonStop
+Priority: 50
+// John And
+
+(
+ {FirstPerson}
+):person
+(
+ {Token.category == DT}|
+ {Token.category == PRP}|
+ {Token.category == RB}|
+ {Token.category == IN}
+)
+-->
+{
+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("gender"));
+features.put("kind", "personName");
+features.put("rule", "GazPersonFirst");
+outputAS.add(person.firstNode(), person.lastNode(), "TempPerson",
+features);
+}
+
+
+
+
+
+Rule: NotPersonFull
+Priority: 50
+// do not allow Det + Surname
+(
+ {Token.category == DT}|
+ {Token.category == PRP}|
+ {Token.category == RB}
+)
+(
+ (PREFIX)*
+ (UPPER)
+ (PERSONENDING)?
+):foo
+-->
+{}
+
+//Rule: LocPersonAmbig3
+//Priority: 100
+// What if the first word is a Lookup for both person_first and Location, and
the second is an UPPER?
+// Probably a Person not Location
+//
+
+//(
+// {Lookup.majorType == person_first}
+//):loc
+//(
+// (UPPER)
+//):foo
+//-->
+//:loc.TempLocation = {kind = "locName", rule = LocPersonAmbig1}
+
+
+Rule: LocPersonAmbig1
+Priority: 50
+// Location + Surname
+(
+ {Lookup.majorType == location}
+):loc
+(
+ (PREFIX)*
+ (UPPER)
+ (PERSONENDING)
+):foo
+-->
+:loc.TempLocation = {kind = "locName", rule = LocPersonAmbig1}
+
+Rule: LocPersonAmbig2
+Priority: 50
+// Location + Surname
+(
+ {Lookup.majorType == location}
+):loc
+(
+ (PREFIX)
+ (UPPER)
+ (PERSONENDING)?
+):foo
+-->
+:loc.TempLocation = {kind = "locName", rule = LocPersonAmbig2}
+
+
+
+Rule: PersonFull
+Priority: 10
+// F.W. Jones
+// Fred Jones
+(
+ {Token.category == DT}
+)?
+(
+ ((FIRSTNAME | FIRSTNAMEAMBIG) )+
+ (PREFIX)*
+ (UPPER)
+ (PERSONENDING)?
+)
+:person -->
+{
+ gate.FeatureMap features = Factory.newFeatureMap();
+gate.AnnotationSet personSet = (gate.AnnotationSet)bindings.get("person");
+
+ //get all firstPerson annotations that have a gender feature
+ HashSet fNames = new HashSet();
+ fNames.add("gender");
+ gate.AnnotationSet firstPerson = personSet.get("FirstPerson", fNames);
+
+ if (firstPerson != null && firstPerson.size()>0)
+ {
+ //Out.prln("First persons found " + firstPerson);
+ gate.Annotation personAnn = (gate.Annotation)firstPerson.iterator().next();
+ features.put("gender", personAnn.getFeatures().get("gender"));
+}
+ features.put("kind", "personName");
+ features.put("rule", "PersonFull");
+outputAS.add(personSet.firstNode(), personSet.lastNode(), "TempPerson",
+features);
+}
+
+Rule: PersonFullStop
+Priority: 50
+// G.Wilson Fri
+
+(
+ ((FIRSTNAME | FIRSTNAMEAMBIG) )
+ (PREFIX)*
+ (UPPER)
+):person
+(
+ {Lookup.majorType == date}
+)
+-->
+ :person.TempPerson = {kind = "personName", rule = "PersonFullStop"}
+
+
+Rule: NotPersonFullReverse
+Priority: 20
+// XYZ, I
+(
+ (UPPER)
+ {Token.string == ","}
+ {Token.category == PRP}
+ (PERSONENDING)?
+)
+:unknown
+-->
+{}
+
+
+Rule: PersonSaint
+Priority: 50
+// Note: ensure that it's not a Saints Day first
+(
+ ({Token.string == "St"} ({Token.string == "."})? |
+ {Token.string == "Saint"})
+ (FIRSTNAME)
+ )
+:person -->
+{
+ gate.FeatureMap features = Factory.newFeatureMap();
+gate.AnnotationSet personSet = (gate.AnnotationSet)bindings.get("person");
+gate.AnnotationSet firstPerson =
(gate.AnnotationSet)personSet.get("FirstPerson");
+if (firstPerson != null && firstPerson.size()>0)
+{
+ gate.Annotation personAnn = (gate.Annotation)firstPerson.iterator().next();
+ features.put("gender", personAnn.getFeatures().get("gender"));
+}
+ features.put("kind", "personName");
+ features.put("rule", "PersonSaint");
+outputAS.add(personSet.firstNode(), personSet.lastNode(), "TempPerson",
+features);
+}
+
+
+Rule: PersonLocAmbig
+Priority: 40
+// Ken London
+// Susan Hampshire
+
+// Christian name + Location --> Person's Name
+(
+ {Lookup.majorType == person_first}
+ {Lookup.majorType == location}
+)
+:person -->
+{
+ gate.FeatureMap features = Factory.newFeatureMap();
+gate.AnnotationSet personSet = (gate.AnnotationSet)bindings.get("person");
+gate.AnnotationSet firstPerson =
(gate.AnnotationSet)inputAS.get("FirstPerson",
personSet.firstNode().getOffset(), personSet.lastNode().getOffset());
+if (firstPerson != null && firstPerson.size()>0)
+{
+ gate.Annotation personAnn = (gate.Annotation)firstPerson.iterator().next();
+ features.put("gender", personAnn.getFeatures().get("gender"));
+}
+ features.put("kind", "personName");
+ features.put("rule", "PersonLocAmbig");
+outputAS.add(personSet.firstNode(), personSet.lastNode(), "TempPerson",
+features);
+}
+
+
+Rule:PersonOrgAmbig
+Priority: 50
+// if the last name is an organisation ending, treat as an organisation not
person
+// e.g. A.B. Consulting
+
+(
+ {Token.category == DT}
+)?
+(
+ ((FIRSTNAME | FIRSTNAMEAMBIG) )+
+ ({Lookup.majorType == org_key}|
+ {Lookup.majorType == org_base}
+ )
+)
+:orgName -->
+ :orgName.TempOrganization = {kind = "unknown", rule = "PersonOrgAmbig"}
+
+
+
+
+///////////////////////////////////////////////////////////////////
+// Organisation Rules
+
+Macro: CDG
+// cdg is something like "Ltd."
+ (
+ ({Lookup.majorType == cdg})|
+ ({Token.string == ","}
+ {Lookup.majorType == cdg})
+ )
+
+
+Macro: SAINT
+(
+ ({Token.string == "St"} ({Token.string == "."})? |
+ {Token.string == "Saint"})
+)
+
+Macro: CHURCH
+(
+{Token.string == "Church"}|{Token.string == "church"}|
+{Token.string == "Cathedral"}|{Token.string == "cathedral"}|
+{Token.string == "Chapel"}|{Token.string == "chapel"}
+)
+
+/////////////////////////////////////////////////////////////
+Rule: TheGazOrganization
+Priority: 245
+(
+ {Token.category == DT}|
+ {Token.category == RB}
+)
+(
+{Lookup.majorType == organization}
+)
+:orgName -->
+ {
+ gate.FeatureMap features = Factory.newFeatureMap();
+// create an annotation set consisting of all the annotations for org
+gate.AnnotationSet orgSet = (gate.AnnotationSet)bindings.get("orgName");
+// create an annotation set consisting of the annotation matching Lookup
+gate.AnnotationSet org = (gate.AnnotationSet)orgSet.get("Lookup");
+// if the annotation type Lookup doesn't exist, do nothing
+if (org != null && org.size()>0)
+{
+// if it does exist, take the first element in the set
+ gate.Annotation orgAnn = (gate.Annotation)org.iterator().next();
+//propagate minorType feature (and value) from org
+ features.put("orgType", orgAnn.getFeatures().get("minorType"));
+}
+// create some new features
+ features.put("rule", "GazOrganization");
+// create a TempOrg annotation and add the features we've created
+outputAS.add(orgSet.firstNode(), orgSet.lastNode(), "TempOrganization",
+features);
+}
+
+
+Rule: GazOrganization
+Priority: 145
+(
+{Lookup.majorType == organization}
+)
+:orgName -->
+ {
+ gate.FeatureMap features = Factory.newFeatureMap();
+// create an annotation set consisting of all the annotations for org
+gate.AnnotationSet orgSet = (gate.AnnotationSet)bindings.get("orgName");
+// create an annotation set consisting of the annotation matching Lookup
+gate.AnnotationSet org = (gate.AnnotationSet)orgSet.get("Lookup");
+// if the annotation type Lookup doesn't exist, do nothing
+if (org != null && org.size()>0)
+{
+// if it does exist, take the first element in the set
+ gate.Annotation orgAnn = (gate.Annotation)org.iterator().next();
+//propagate minorType feature (and value) from org
+ features.put("orgType", orgAnn.getFeatures().get("minorType"));
+}
+// create some new features
+ features.put("rule", "GazOrganization");
+// create a TempOrg annotation and add the features we've created
+outputAS.add(orgSet.firstNode(), orgSet.lastNode(), "TempOrganization",
+features);
+}
+
+Rule: LocOrganization
+Priority: 50
+// Ealing Police
+(
+ ({Lookup.majorType == location} |
+ {Lookup.majorType == country_adj})
+{Lookup.majorType == organization}
+({Lookup.majorType == organization})?
+)
+:orgName -->
+ :orgName.TempOrganization = {kind = "orgName", rule=LocOrganization}
+
+
+Rule: INOrgXandY
+Priority: 200
+
+// Bradford & Bingley
+// Bradford & Bingley Ltd
+(
+ {Token.category == IN}
+)
+
+(
+ ({Token.category == NNP}
+ )+
+
+ {Token.string == "&"}
+
+ (
+ {Token.orth == upperInitial}
+ )+
+
+ (CDG)?
+
+)
+:orgName -->
+ :orgName.TempOrganization = {orgType = "unknown", rule = "OrgXandY"}
+
+Rule: OrgXandY
+Priority: 20
+
+// Bradford & Bingley
+// Bradford & Bingley Ltd
+
+
+(
+ ({Token.category == NNP}
+ )+
+
+ {Token.string == "&"}
+
+ (
+ {Token.orth == upperInitial}
+ )+
+
+ (CDG)?
+
+)
+:orgName -->
+ :orgName.TempOrganization = {orgType = "unknown", rule = "OrgXandY"}
+
+
+Rule:OrgUni
+Priority: 25
+// University of Sheffield
+// Sheffield University
+// A Sheffield University
+(
+ {Token.string == "University"}
+ {Token.string == "of"}
+ (
+ {Token.category == NNP})+
+)
+:orgName -->
+ :orgName.TempOrganization = {orgType = "other", rule = "OrgDept"}
+
+
+
+Rule: OrgDept
+Priority: 25
+// Department of Pure Mathematics and Physics
+
+(
+ {Token.string == "Department"}
+
+ {Token.string == "of"}
+ (
+ {Token.orth == upperInitial})+
+ (
+ {Token.string == "and"}
+ (
+ {Token.orth == upperInitial})+
+ )?
+)
+:orgName -->
+ :orgName.TempOrganization = {orgType = "department", rule = "OrgDept"}
+
+Rule: TheOrgXKey
+Priority: 500
+
+// The Aaaa Ltd.
+(
+ {Token.category == DT}
+)
+(
+ (UPPER)
+ (UPPER)?
+ (UPPER)?
+ (UPPER)?
+ (UPPER)?
+ {Lookup.majorType == org_key}
+ ({Lookup.majorType == org_ending})?
+)
+:org
+-->
+:org.TempOrganization = {orgType = "unknown", rule = "TheOrgXKey"}
+
+Rule: NotOrgXKey
+Priority: 150
+// if all the names are org_base or org_key, it's not an organisation
+// e.g. Business Consulting
+
+(
+ ({Lookup.majorType == org_key}|
+ {Lookup.majorType == org_base}
+ )+
+ ({Lookup.majorType == org_ending})?
+)
+:org
+-->
+{}
+
+
+
+Rule: NotTheKey
+Priority: 200
+
+(
+ {Token.category == DT}
+ {Lookup.majorType == org_key}
+ ({Lookup.majorType == org_ending})?
+)
+:org
+-->
+{}
+
+
+Rule: OrgXKey
+Priority: 125
+
+// Aaaa Ltd.
+({Token.category == DT})?
+(
+ (UPPER)
+ (UPPER)?
+ (UPPER)?
+ (UPPER)?
+ (UPPER)?
+ {Lookup.majorType == org_key}
+ ({Lookup.majorType == org_ending})?
+)
+:org
+-->
+:org.TempOrganization = {orgType = "unknown", rule = "OrgXKey"}
+
+
+Rule: NotOrgXEnding
+Priority: 500
+// Very Limited
+
+(
+ {Token.category == DT}
+)?
+(
+ {Token.category == RB}
+ {Lookup.majorType == cdg}
+)
+:label
+-->
+{}
+
+ Rule: NotOrgXEnding2
+Priority: 500
+
+// The Coca Cola Co.
+
+(
+ {Token.category == DT}
+)
+(
+ (UPPER)
+ (UPPER)?
+ {Lookup.majorType == cdg}
+)
+:orgName -->
+ :orgName.TempOrganization = {orgType = "company", rule = "OrgXEnding"}
+
+
+
+Rule: OrgXEnding
+Priority: 120
+
+// Coca Cola Co.
+
+(
+ (UPPER)
+ (UPPER)?
+ {Lookup.majorType == cdg}
+)
+:orgName -->
+ :orgName.TempOrganization = {orgType = "unknown", rule = "OrgXEnding"}
+
+Rule: TheOrgXandYKey
+Priority: 220
+
+(
+ {Token.category == DT}
+)
+(
+ (UPPER)
+ (UPPER)?
+ (({Token.string == "and"} |
+ {Token.string == "&"})
+ (UPPER)?
+ (UPPER)?
+ (UPPER)?
+ )
+ {Lookup.majorType == org_key}
+ ({Lookup.majorType == org_ending})?
+)
+:orgName -->
+ :orgName.TempOrganization = {orgType = "unknown", rule = "OrgXandYKey"}
+
+
+
+Rule: OrgXandYKey
+Priority: 120
+
+// Aaaa Ltd.
+// Xxx Services Ltd.
+// AA and BB Services Ltd.
+// but NOT A XXX Services Ltd.
+
+(
+ (UPPER)
+ (UPPER)?
+ (({Token.string == "and"} |
+ {Token.string == "&"})
+ (UPPER)?
+ (UPPER)?
+ (UPPER)?
+ )
+ {Lookup.majorType == org_key}
+ ({Lookup.majorType == org_ending})?
+)
+:orgName -->
+ :orgName.TempOrganization = {orgType = "unknown", rule = "OrgXandYKey"}
+
+
+Rule: OrgXsKeyBase
+Priority: 120
+
+// Gandy's Circus
+// Queen's Ware
+
+(
+ (UPPER)?
+ (UPPER)?
+ ({Token.orth == upperInitial}
+ {Token.string == "'"}
+ ({Token.string == "s"})?
+ )
+ ({Lookup.majorType == org_key}|
+ {Lookup.majorType == org_base})
+)
+:orgName -->
+ :orgName.TempOrganization = {orgType = "unknown", rule = "OrgXsKeybase"}
+
+
+
+Rule: NotOrgXBase
+Priority: 1000
+// not things like British National
+// or The University
+
+
+(
+ ({Token.category == DT}
+ )?
+)
+(
+ ({Lookup.majorType == country_adj}|
+ {Token.orth == lowercase})
+ ({Lookup.majorType == org_base}|
+ {Lookup.majorType == govern_key})
+)
+:orgName -->
+ :orgName.Temp = {kind = "notorgName", rule = "NotOrgXBase"}
+
+
+Rule: TheOrgXBase
+Priority: 230
+
+(
+ ({Token.category == DT}
+ )
+)
+(
+ (
+ (UPPER)|
+ {Lookup.majorType == organization}
+ )
+ (UPPER)?
+ (UPPER)?
+ ({Lookup.majorType == org_base}|
+ {Lookup.majorType == govern_key}
+ )
+ (
+ {Token.string == "of"}
+ (UPPER)
+ (UPPER)?
+ (UPPER)?
+ )?
+)
+:orgName -->
+ :orgName.TempOrganization = {orgType = "unknown", rule = "TheOrgXBase"}
+
+
+Rule: OrgXBase
+Priority: 130
+
+// same as OrgXKey but uses base instead of key
+// includes govern_key e.g. academy
+// Barclays Bank
+// Royal Academy of Art
+
+(
+ (
+ (UPPER)|
+ {Lookup.majorType == organization}
+ )
+ (UPPER)?
+ (UPPER)?
+ ({Lookup.majorType == org_base}|
+ {Lookup.majorType == govern_key}
+ )
+ (
+ {Token.string == "of"}
+ (UPPER)
+ (UPPER)?
+ (UPPER)?
+ )?
+)
+:orgName -->
+ :orgName.TempOrganization = {orgType = "unknown", rule = "OrgXBase"}
+
+Rule: TheBaseofOrg
+Priority: 230
+
+(
+ {Token.category == DT}
+)
+(
+ ({Lookup.majorType == org_base}|
+ {Lookup.majorType == govern_key}
+ )
+
+ {Token.string == "of"}
+ (
+ {Token.category == DT}
+ )?
+ (UPPER)
+ (UPPER)?
+)
+:orgName -->
+ :orgName.TempOrganization = {orgType = "unknown", rule = "BaseofOrg"}
+
+
+
+
+Rule: BaseofOrg
+Priority: 130
+
+(
+ ({Lookup.majorType == org_base}|
+ {Lookup.majorType == govern_key}
+ )
+
+ {Token.string == "of"}
+ (
+ {Token.category == DT}
+ )?
+ (UPPER)
+ (UPPER)?
+)
+:orgName -->
+ :orgName.TempOrganization = {orgType = "unknown", rule = "BaseofOrg"}
+
+
+
+Rule: OrgPreX
+Priority: 130
+
+// Royal Tuscan
+
+(
+ {Lookup.majorType == org_pre}
+ (
+ {Token.orth == upperInitial})+
+ ({Lookup.majorType == org_ending})?
+)
+:orgName -->
+ :orgName.TempOrganization = {orgType = "unknown", rule = "OrgPreX"}
+
+
+
+
+Rule: OrgChurch
+Priority: 150
+// St. Andrew's Church
+
+(
+ (SAINT)
+ {Token.orth == upperInitial}
+ {Token.string == "'"}({Token.string == "s"})?
+ (CHURCH)
+)
+:orgName -->
+ :orgName.TempOrganization = {orgType = "other", rule = "OrgChurch"}
+
+
+Rule:OrgPersonAmbig
+Priority: 130
+// Alexandra Pottery should be org not person
+// overrides PersonFull
+
+(
+ (FIRSTNAME)
+ ({Lookup.majorType == org_key}|
+ {Lookup.majorType == org_base})
+ ({Lookup.majorType == org_ending})?
+)
+:org
+-->
+ :org.TempOrganization= {orgType = "unknown", rule = "OrgPersonAmbig"}
+
+
+
+/////////////////////////////////////////////////////////////////
+// Location rules
+
+
+Rule: Location1
+Priority: 75
+// Lookup = city, country, province, region, water
+
+// Western Europe
+// South China sea
+
+(
+ {Token.category == DT}
+)?
+(
+ ({Lookup.majorType == loc_key, Lookup.minorType == pre}
+ )?
+ {Lookup.majorType == location}
+ (
+ {Lookup.majorType == loc_key, Lookup.minorType == post})?
+)
+:locName -->
+{
+ gate.FeatureMap features = Factory.newFeatureMap();
+// create an annotation set consisting of all the annotations for org
+gate.AnnotationSet locSet = (gate.AnnotationSet)bindings.get("locName");
+// create an annotation set consisting of the annotation matching Lookup
+gate.AnnotationSet loc = (gate.AnnotationSet)locSet.get("Lookup");
+// if the annotation type Lookup doesn't exist, do nothing
+if (loc != null && loc.size()>0)
+{
+// if it does exist, take the first element in the set
+ gate.Annotation locAnn = (gate.Annotation)loc.iterator().next();
+//propagate minorType feature (and value) from loc
+ features.put("locType", locAnn.getFeatures().get("minorType"));
+}
+// create some new features
+ features.put("rule", "Location1");
+// create a TempLoc annotation and add the features we've created
+outputAS.add(locSet.firstNode(), locSet.lastNode(), "TempLocation",
+features);
+}
+
+Rule: GazLocation
+Priority: 70
+(
+ {Token.category == DT}
+)?
+(
+ {Lookup.majorType == location}
+)
+:locName
+ -->
+{
+ gate.FeatureMap features = Factory.newFeatureMap();
+// create an annotation set consisting of all the annotations for org
+gate.AnnotationSet locSet = (gate.AnnotationSet)bindings.get("locName");
+// create an annotation set consisting of the annotation matching Lookup
+gate.AnnotationSet loc = (gate.AnnotationSet)locSet.get("Lookup");
+// if the annotation type Lookup doesn't exist, do nothing
+if (loc != null && loc.size()>0)
+{
+// if it does exist, take the first element in the set
+ gate.Annotation locAnn = (gate.Annotation)loc.iterator().next();
+//propagate minorType feature (and value) from loc
+ features.put("locType", locAnn.getFeatures().get("minorType"));
+}
+// create some new features
+ features.put("rule", "GazLocation");
+// create a TempLoc annotation and add the features we've created
+outputAS.add(locSet.firstNode(), locSet.lastNode(), "TempLocation",
+features);
+}
+
+Rule: GazLocationLocation
+Priority: 100
+
+(
+ ({Lookup.majorType == location}):locName1
+ {Token.string == ","}
+ ({Lookup.majorType == location}):locName2
+)
+-->
+
+{
+ gate.FeatureMap features = Factory.newFeatureMap();
+ gate.FeatureMap morefeatures = Factory.newFeatureMap();
+gate.AnnotationSet loc1Set = (gate.AnnotationSet)bindings.get("locName1");
+gate.AnnotationSet loc1 = (gate.AnnotationSet)loc1Set.get("Lookup");
+
+gate.AnnotationSet loc2Set = (gate.AnnotationSet)bindings.get("locName2");
+gate.AnnotationSet loc2 = (gate.AnnotationSet)loc2Set.get("Lookup");
+
+// if the annotation type Lookup doesn't exist, do nothing
+if (loc1 != null && loc1.size()>0)
+{
+ gate.Annotation loc1Ann = (gate.Annotation)loc1.iterator().next();
+ features.put("locType", loc1Ann.getFeatures().get("minorType"));
+}
+
+if (loc2 != null && loc2.size()>0)
+{
+ gate.Annotation loc2Ann = (gate.Annotation)loc2.iterator().next();
+ morefeatures.put("locType", loc2Ann.getFeatures().get("minorType"));
+}
+
+features.put("rule", "GazLocation");
+outputAS.add(loc1Set.firstNode(), loc1Set.lastNode(), "TempLocation",
features);
+
+morefeatures.put("rule", "GazLocation");
+outputAS.add(loc2Set.firstNode(), loc2Set.lastNode(), "TempLocation",
morefeatures);
+}
+
+
+
+
+
+Rule: LocationPost
+Priority: 50
+(
+ {Token.category == DT}
+)?
+(
+ {Token.category == NNP}
+ {Lookup.majorType == loc_key, Lookup.minorType == post}
+)
+:locName
+-->
+ :locName.TempLocation = {kind = "locName", rule = LocationPost}
+
+Rule:LocKey
+(
+ {Token.category == DT}
+)?
+(
+ ({Lookup.majorType == loc_key, Lookup.minorType == pre}
+ )
+ (UPPER)
+ (
+ {Lookup.majorType == loc_key, Lookup.minorType == post})?
+)
+:locName -->
+:locName.TempLocation = {kind = "locName", rule = LocKey}
+/////////////////////////////////////////////////////////////////
+
+// Context-based Rules
+
+
+Rule:InLoc1
+(
+ {Token.string == "in"}|
+ {Token.string == "to"}
+)
+(
+ {Lookup.majorType == location}
+)
+:locName
+-->
+ :locName.TempLocation = {kind = "locName", rule = InLoc1, locType =
:locName.Lookup.minorType}
+
+Rule:LocGeneralKey
+Priority: 30
+(
+ {Lookup.majorType == loc_general_key}
+ {Token.string == "of"}
+)
+(
+ (UPPER)
+)
+:loc
+-->
+ :loc.TempLocation = {kind = "locName", rule = LocGeneralKey}
+
+
+Rule:OrgContext1
+Priority: 1
+// company X
+
+(
+ {Token.string == "company"}
+)
+(
+ (UPPER)
+ (UPPER)?
+ (UPPER)?
+)
+:org
+-->
+ :org.TempOrganization= {orgType = "company", rule = "OrgContext1"}
+
+Rule: OrgContext2
+Priority: 5
+
+// Telstar laboratory
+// Medici offices
+
+(
+ (UPPER)
+ (UPPER)?
+ (UPPER)?
+)
+: org
+(
+ ({Token.string == "offices"} |
+ {Token.string == "Offices"} |
+ {Token.string == "laboratory"} |
+ {Token.string == "Laboratory"} |
+ {Token.string == "laboratories"} |
+ {Token.string == "Laboratories"})
+)
+-->
+ :org.TempOrganization= {orgType = "other", rule = "OrgContext2"}
+
+
+
+Rule:JoinOrg
+Priority: 50
+// Smith joined Energis
+
+(
+ ({Token.string == "joined"}|
+ {Token.string == "joining"}|
+ {Token.string == "joins"}|
+ {Token.string == "join"}
+ )
+)
+(
+ (UPPER)
+ (UPPER)?
+ (UPPER)?
+)
+:org
+-->
+ :org.TempOrganization= {orgType = "company", rule = "joinOrg"}
+
+
+
+
+
+
+
+
+
+
+
Property changes on: gate/trunk/plugins/ANNIE/resources/NE/name-twitter.jape
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Modified: gate/trunk/plugins/ANNIE/resources/NE/name.jape
===================================================================
--- gate/trunk/plugins/ANNIE/resources/NE/name.jape 2014-02-17 14:54:55 UTC
(rev 17323)
+++ gate/trunk/plugins/ANNIE/resources/NE/name.jape 2014-02-17 15:07:12 UTC
(rev 17324)
@@ -15,7 +15,7 @@
Phase: Name
-Input: Token Lookup Title FirstPerson TempDate Split UserID Hashtag
+Input: Token Lookup Title FirstPerson TempDate Split
Options: control = appelt debug = false
///////////////////////////////////////////////////////////////
@@ -101,16 +101,6 @@
-->
{}
-
-
-Rule:NotPerson
-Priority: 1000
-(
- {Hashtag}|{UserID}
-)
--->
-{}
-
Rule: GazPerson
Priority: 50
(
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience. Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs