List of usage examples for edu.stanford.nlp.pipeline Annotation remove
@Override @SuppressWarnings("unchecked") public <VALUE> VALUE remove(Class<? extends Key<VALUE>> key)
From source file:ims.cs.corenlp.PARCCoreNlpPipeline.java
License:Open Source License
/** * Stores CoreNlp output in a file// w w w . j av a 2 s. c o m * @param a * @param file * @throws IOException */ public static void serializeAnnotation(Annotation a, File file) throws IOException { File parentFile = file.getParentFile(); if (!parentFile.exists()) parentFile.mkdirs(); if (StaticConfig.verbose) System.out.println("(CAS) Writing to file " + file); // remove these to try to save memory a.remove(CollapsedDependenciesAnnotation.class); a.remove(BasicDependenciesAnnotation.class); if (StaticConfig.cacheParses) { OutputStream ret = ser.write(a, new FileOutputStream(file)); ret.close(); } }