Hi,
I am using KIM 2.3 RC1. I am extracting Object annotations by using KIM API.
Here is the code. Is there a way I can also extract the POS category of the
annotation. I suppose I have to do some changes in Jape but where I don't
know . For example I have a sentence
"laceration to right forearm"
for which two Object annotations are created, one is for 'laceration' and
other is for "forearm" . I also want to extract the Token.category features
which is normally created in POS tagger pipline in Gate.
apiSemAnn.execute(kdocFromText);
KIMAnnotationSet kimASet = kdocFromText.getAnnotations();
Set typesSet = kimASet.getAllTypes();
KIMAnnotationSet kimFilteredASet=*null*;
Iterator iterator = typesSet.iterator();
*while* (iterator.hasNext()){
Object key = iterator.next();
kimFilteredASet = kimASet.get(String.*valueOf*(key));
}
List <KIMAnnotation> annotations =
*new*ArrayList<KIMAnnotation>(kimFilteredASet);
Collections.*sort*(annotations, *new* Comparator<KIMAnnotation>(){
*public* *int* compare(KIMAnnotation o1, KIMAnnotation o2) {
*if* (o1.getStartOffset() > o2.getEndOffset()) *return* 1;
*else* *if* (o1.getStartOffset() < o2.getEndOffset())
*return* -1;
*else* *return* 0;
}
});
--
Mehnaz Adnan
Ph.D. Candidate,
Department of Computer Science-Tamaki
University of Auckland
Phone: 09-3737599 ext 83274
email: [email protected]
_______________________________________________
Kim-discussion mailing list
[email protected]
http://ontotext.com/mailman/listinfo/kim-discussion