/** * Converts the given annotation to an XML document using options taken from the StanfordCoreNLP pipeline */ public static Document annotationToDoc(Annotation annotation, StanfordCoreNLP pipeline) { Options options = getOptions(pipeline.getProperties()); return annotationToDoc(annotation, options); }
public void outputPretty(PrintWriter out, Annotation annotation) throws ServletException { try { Document input = XMLOutputter.annotationToDoc(annotation, pipeline); Nodes output = corenlpTransformer.transform(input); for (int i = 0; i < output.size(); i++) { out.print(output.get(i).toXML()); } } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new ServletException(e); } }
/** {@inheritDoc} */ @Override public void print(Annotation annotation, OutputStream os, Options options) throws IOException { Document xmlDoc = annotationToDoc(annotation, options); Serializer ser = new Serializer(os, options.encoding); if (options.pretty) { ser.setIndent(2); } else { ser.setIndent(0); } ser.setMaxLength(0); ser.write(xmlDoc); ser.flush(); }
/** * Converts the given annotation to an XML document using options taken from the StanfordCoreNLP pipeline */ public static Document annotationToDoc(Annotation annotation, StanfordCoreNLP pipeline) { Options options = getOptions(pipeline); return annotationToDoc(annotation, options); }
/** * Converts the given annotation to an XML document using options taken from the StanfordCoreNLP pipeline */ public static Document annotationToDoc(Annotation annotation, StanfordCoreNLP pipeline) { Options options = getOptions(pipeline.getProperties()); return annotationToDoc(annotation, options); }
public static void xmlPrint(Annotation annotation, OutputStream os, Options options) throws IOException { Document xmlDoc = annotationToDoc(annotation, options); Serializer ser = new Serializer(os, options.encoding); ser.setIndent(2); ser.setMaxLength(0); ser.write(xmlDoc); ser.flush(); }
/** {@inheritDoc} */ @Override public void print(Annotation annotation, OutputStream os, Options options) throws IOException { Document xmlDoc = annotationToDoc(annotation, options); Serializer ser = new Serializer(os, options.encoding); if (options.pretty) { ser.setIndent(2); } else { ser.setIndent(0); } ser.setMaxLength(0); ser.write(xmlDoc); ser.flush(); }