private ObjectStream<BratAnnotation> creatBratAnnotationStream( AnnotationConfiguration conf, String file) { InputStream in = BratAnnotationStreamTest.class.getResourceAsStream(file); return new BratAnnotationStream(conf, "testing", in); }
public static BratDocument parseDocument(AnnotationConfiguration config, String id, InputStream txtIn, InputStream annIn) throws IOException { Reader txtReader = new InputStreamReader(txtIn, StandardCharsets.UTF_8); StringBuilder text = new StringBuilder(); char[] cbuf = new char[1024]; int len; while ((len = txtReader.read(cbuf)) > 0) { text.append(cbuf, 0, len); } Collection<BratAnnotation> annotations = new ArrayList<>(); ObjectStream<BratAnnotation> annStream = new BratAnnotationStream(config, id, annIn); BratAnnotation ann; while ((ann = annStream.read()) != null) { annotations.add(ann); } annStream.close(); return new BratDocument(config, id, text.toString(), annotations); } }
public static BratDocument parseDocument(AnnotationConfiguration config, String id, InputStream txtIn, InputStream annIn) throws IOException { Reader txtReader = new InputStreamReader(txtIn, StandardCharsets.UTF_8); StringBuilder text = new StringBuilder(); char[] cbuf = new char[1024]; int len; while ((len = txtReader.read(cbuf)) > 0) { text.append(cbuf, 0, len); } Collection<BratAnnotation> annotations = new ArrayList<>(); ObjectStream<BratAnnotation> annStream = new BratAnnotationStream(config, id, annIn); BratAnnotation ann; while ((ann = annStream.read()) != null) { annotations.add(ann); } annStream.close(); return new BratDocument(config, id, text.toString(), annotations); } }
public static BratDocument parseDocument(AnnotationConfiguration config, String id, InputStream txtIn, InputStream annIn) throws IOException { Reader txtReader = new InputStreamReader(txtIn, StandardCharsets.UTF_8); StringBuilder text = new StringBuilder(); char[] cbuf = new char[1024]; int len; while ((len = txtReader.read(cbuf)) > 0) { text.append(cbuf, 0, len); } Collection<BratAnnotation> annotations = new ArrayList<>(); ObjectStream<BratAnnotation> annStream = new BratAnnotationStream(config, id, annIn); BratAnnotation ann; while ((ann = annStream.read()) != null) { annotations.add(ann); } annStream.close(); return new BratDocument(config, id, text.toString(), annotations); } }