문제

I'm trying to extract the individual text values of an annotation set which are generated by the default ANNIE processing resources.

When i iterate through the annotation set each entry only gives the start and end position which the annotation references but does not give a .value() method. Is there an easy way to get the value or do i need to use a FileWriter or some equivalent to extract the value directly from the Corpus I'm processing using the start and end positions of the annotation?

annotTypesRequired.add("Location");

Set<Annotation> organization = new HashSet<Annotation>(
                defaultAnnotSet.get(annotTypesRequired));
도움이 되었습니까?

해결책

If by "the value" you mean the text that the annotation covers, you can access that using

gate.Utils.stringFor(document, annotation)

For this you obviously need a reference to the gate.Document that the annotation belongs to, as well as the Annotation object itself - annotations do not routinely store their covered string directly, they just store offsets that point into the document's content.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top