/// <exception cref="System.IO.IOException"/> public override void Print(Annotation doc, OutputStream target, AnnotationOutputter.Options options) { PrintWriter writer = new PrintWriter(IOUtils.EncodedOutputStreamWriter(target, options.encoding)); JSONOutputter.JSONWriter l0 = new JSONOutputter.JSONWriter(writer, options); if (doc.Get(typeof(CoreAnnotations.SentencesAnnotation)) != null) { doc.Get(typeof(CoreAnnotations.SentencesAnnotation)).Stream().ForEach(null); } }
/// <summary> /// <inheritDoc/> /// /// </summary> /// <exception cref="System.IO.IOException"/> public override void Print(Annotation doc, OutputStream target, AnnotationOutputter.Options options) { // It's lying; we need the "redundant" casts (as of 2014-09-08) PrintWriter writer = new PrintWriter(IOUtils.EncodedOutputStreamWriter(target, options.encoding)); JSONOutputter.JSONWriter l0 = new JSONOutputter.JSONWriter(writer, options); l0.Object(null); // Add annotations attached to a Document // Add sentences // Add a single sentence // (metadata) // (constituency tree) // note the '==' -- we're overwriting the default, but only if it was not explicitly set otherwise // strip the trailing newline // (dependency trees) // (sentiment) // (openie) // (kbp) // (entity mentions) //l3.set("originalText", m.get(CoreAnnotations.OriginalTextAnnotation.class)); //l3.set("lemma", m.get(CoreAnnotations.LemmaAnnotation.class)); //l3.set("pos", m.get(CoreAnnotations.PartOfSpeechAnnotation.class)); // Timex // (add tokens) // Add a single token // Timex // Add coref values // quotes // sections // Set char start // Set char end // Set author // Set date time // add the sentence indexes for the sentences in this section l0.Flush(); }