MCPcopy Create free account
hub / github.com/GateNLP/gate-core / contentFor

Method contentFor

src/main/java/gate/Utils.java:133–142  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 7

getContentMethod · 0.65
getOffsetMethod · 0.65
getStartNodeMethod · 0.65
getEndNodeMethod · 0.65
firstNodeMethod · 0.65
lastNodeMethod · 0.65
getMessageMethod · 0.45

Tested by

no test coverage detected