Return the DocumentContent corresponding to the annotation. Note: the DocumentContent object returned will also contain the original content which can be accessed using the getOriginalContent() method. @param doc the document from which to extract the content @param ann the annotation for which
(
SimpleDocument doc, SimpleAnnotation ann)
| 131 | * @return a DocumentContent representing the content spanned by the annotation. |
| 132 | */ |
| 133 | public static DocumentContent contentFor( |
| 134 | SimpleDocument doc, SimpleAnnotation ann) { |
| 135 | try { |
| 136 | return doc.getContent().getContent( |
| 137 | ann.getStartNode().getOffset(), |
| 138 | ann.getEndNode().getOffset()); |
| 139 | } catch(gate.util.InvalidOffsetException ex) { |
| 140 | throw new GateRuntimeException(ex.getMessage()); |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | /** |
| 145 | * Return the document text as a String corresponding to the annotation. |
nothing calls this directly
no test coverage detected