Hi Mehnaz,
Bobi asked me to carry some additional compartibility tests and I found that
the GATE 5.0 syntax that he uses in his example will not work on you version of
KIM.
It will be available with the KIM3.0 which we are working on now.
For your version of GATE you should use the following form of the JAPE Rule:
//=====================================
Rule: OnlyNouns
(
({Lookup.class=="http://proton.semanticweb.org/2006/05/protont#MedicalAbbreviation"})
)
:lookup -->
{
// Retrieves annotation-set containing only the matched "Lookup" annotation
gate.AnnotationSet lookupSet = (gate.AnnotationSet) bindings.get("lookup");
// Gets the offsets of the matched "Lookup" annotation
java.lang.Long _start = lookupSet.firstNode().getOffset();
java.lang.Long _end = lookupSet.lastNode().getOffset();
/* Set of Noun categories supported by the POS tagger:
NN - noun - singular or mass
NNP - proper noun - singular: All words in names usually are capitalized
but titles might not be.
NNPS - proper noun - plural: All words in names usually are capitalized
but titles might not be.
NNS - noun - plural
NP - proper noun - singular
NPS - proper noun - plural
*/
java.util.ArrayList nounCat = new java.util.ArrayList();
// Here add only categories that are of interest
nounCat.addAll(java.util.Arrays.asList("NN", "NNP", "NNPS", "NNS", "NP",
"NPS"));
boolean isNoun = false;
// Extract the set of Tokens located at the place of the Medical Abbreviation
gate.AnnotationSet contained = (gate.AnnotationSet) inputAS.get("Token",
_start, _end);
java.util.Iterator tokIt = contained.iterator();
// The loop is to skip some symbols, if such exist in the abbreviation
while (!isNoun && tokIt.hasNext()) {
gate.Annotation tok = (gate.Annotation) tokIt.next();
// Check the category of the token
isNoun = nounCat.contains(tok.getFeatures().get("category"));
}
if (!isNoun)
annotations.removeAll(lookupSet);
}
//============================
Also check again if the namespace of your class is:
"http://proton.semanticweb.org/2006/05/protont ..."
or
"http://proton.semanticweb.org/2005/04/protont ..."
Successful work!
DanKo
----- Original Message -----
From: borislav popov
To: Mehnaz Adnan
Cc: [email protected]
Sent: Monday, July 20, 2009 11:03 AM
Subject: Re: [Kim-discussion] how to do some changes in kim client PR
Hi Mehnaz,
How familiar you are with JAPE development? If you know how to do write JAPE
rules, i would suggest the following:
1. create a new jape grammar phase (as the example below)
2. edit the main.jape of your KIM deployment and insert the name of the phase
there (e.g. in the end)
Note: please have in mind i've considered that you have the annotations of
your instances initially as Lookups (generated by the gazetteer). If you
transform them to another annotation type - it is even simpler.
Description of the example: get all lookups of abbreviation which contain a
token of Part of Speech category different from NNP - for all such delete the
lookup annotation.
Example:
Phase: NounAbreviationsOnly
Input: Token Lookup
Options: control = Appelt
Rule: OnlyNouns
(
{
Lookup.class=="http://proton.semanticweb.org/2006/05/protont#MedicalAbbreviation"
, Lookup contains {Token.category!=NNP}
}
): lookup
-->
{
gate.AnnotationSet lookupSet = (gate.AnnotationSet)bindings.get("lookup");
annotations.removeAll(lookupSet);
}
take care
borislav
On Jul 20, 2009, at 1:46 AM, Mehnaz Adnan wrote:
Hi
I have extended protont.owl and added two classes with the following
namspaces.
<http://proton.semanticweb.org/2006/05/protont#MedicalAbbreviation>
<http://proton.semanticweb.org/2006/05/protont#CHVTerm>
I have also populated wkb.nt with their instances. Now it is annotating
perfectly instances of "MedicalAbbreviation" and "CHVTerm". Now I want to
annotate instances of "MedicalAbbreviation" in Nouns only but instances of
"CHVTerm" from all of the text.Can I do some thing by changing in default jape
or extending KIM Client PR ?? I am stuck on this please help. Any clue please
.....
I am using KIM-2.3-RC1 on wondows vista and using KIM WebUI as well as
Gate GUI for viewing annotations.
Thanks
--
Mehnaz
_______________________________________________
Kim-discussion mailing list
[email protected]
http://ontotext.com/mailman/listinfo/kim-discussion
------------------------------------------------------------------------------
_______________________________________________
Kim-discussion mailing list
[email protected]
http://ontotext.com/mailman/listinfo/kim-discussion
_______________________________________________
Kim-discussion mailing list
[email protected]
http://ontotext.com/mailman/listinfo/kim-discussion