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

Method stringFor

src/main/java/gate/Utils.java:150–159  ·  view source on GitHub ↗

Return the document text as a String corresponding to the annotation. @param doc the document from which to extract the document text @param ann the annotation for which to return the text. @return a String representing the text content spanned by the annotation.

(
          Document doc, SimpleAnnotation ann)

Source from the content-addressed store, hash-verified

148 * @return a String representing the text content spanned by the annotation.
149 */
150 public static String stringFor(
151 Document doc, SimpleAnnotation ann) {
152 try {
153 return doc.getContent().getContent(
154 ann.getStartNode().getOffset(),
155 ann.getEndNode().getOffset()).toString();
156 } catch(gate.util.InvalidOffsetException ex) {
157 throw new GateRuntimeException(ex.getMessage(),ex);
158 }
159 }
160
161
162 /**

Callers 4

cleanStringForMethod · 0.95
unpackMarkupMethod · 0.95
getSelectedFileMethod · 0.95
testEditMethod · 0.80

Calls 8

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

Tested by 1

testEditMethod · 0.64