private String getNext() { try { return reader.readLine(); } catch (IOException ex) { throw new RuntimeIOException(ex); } }
public void display(boolean verbose, PrintWriter pw) { try { out.close(); } catch (IOException e) { throw new RuntimeIOException(e); } }
protected String getLine() { try { String result = this.reader.readLine(); if (result == null) { readerOpen = false; this.reader.close(); } return result; } catch (IOException e) { throw new RuntimeIOException(e); } }
public TreeRecorder(Mode mode, String filename) { this.mode = mode; try { out = new BufferedWriter(new FileWriter(filename)); } catch (IOException e) { throw new RuntimeIOException(e); } }
public void saveSerialized(String path) { try { IOUtils.writeObjectToFile(this, path); } catch (IOException e) { throw new RuntimeIOException(e); } }
public static SentimentModel loadSerialized(String path) { try { return IOUtils.readObjectFromURLOrClasspathOrFileSystem(path); } catch (IOException | ClassNotFoundException e) { throw new RuntimeIOException(e); } }
public void loadSegmenter(String filename, Properties p) { try { classifier = CRFClassifier.getClassifier(filename, p); } catch (ClassCastException | IOException | ClassNotFoundException e) { throw new RuntimeIOException("Failed to load segmenter " + filename, e); } }
public void saveModel(String path) { try { IOUtils.writeObjectToFile(this, path); } catch (IOException e) { throw new RuntimeIOException(e); } }
/** * Annotate for named entities -- note that this combines multiple NER tag sets, and some auxiliary things (like temporal tagging) */ public Annotator ner(Properties properties) { try { return new NERCombinerAnnotator(properties); } catch (IOException e) { throw new RuntimeIOException(e); } }
@Override public void annotate(Annotation annotation) { try { this.annotate((CoreMap)annotation); } catch (IOException e) { throw new RuntimeIOException(e); } } private static final Map<String, String> TRANSLATE = new HashMap<String, String>() {{
@Override public void annotate(Annotation annotation) { try { this.annotate((CoreMap)annotation); } catch (IOException e) { throw new RuntimeIOException(e); } }
public void annotate(Annotation annotation) { try { this.annotate((CoreMap)annotation); } catch (IOException e) { throw new RuntimeIOException(e); } }
private static Properties loadPropertiesOrException(String propsFileNamePrefix) { Properties props = loadProperties(propsFileNamePrefix); if (props == null) { throw new RuntimeIOException("ERROR: cannot find properties file \"" + propsFileNamePrefix + "\" in the classpath!"); } return props; }
public void readGrammar(String filename) { try { FileReader fin = new FileReader(filename); BufferedReader bin = new BufferedReader(fin); readGrammar(bin); bin.close(); fin.close(); } catch (IOException e) { throw new RuntimeIOException(e); } }
private void loadCountriesLists(String file) { try (BufferedReader reader = IOUtils.readerFromString(file)) { for (String line; (line = reader.readLine()) != null; ) { countries.add(line.split("\t")[1].toLowerCase()); } } catch (IOException e) { throw new RuntimeIOException(e); } }
public static PrintWriter getPrintWriterOrDie(String filename) { try { return getPrintWriter(filename, defaultEncoding); } catch (IOException ioe) { throw new RuntimeIOException(ioe); } }
private void loadStatesLists(String file) { try { getWordsFromFile(file, statesAndProvinces, true); } catch (IOException e) { throw new RuntimeIOException(e); } }
private void loadCountriesLists(String file) { try (BufferedReader reader = IOUtils.readerFromString(file)) { for (String line; (line = reader.readLine()) != null; ) { countries.add(line.split("\t")[1].toLowerCase()); } } catch (IOException e) { throw new RuntimeIOException(e); } }
public void loadClassifierNoExceptions(String loadPath, Properties props) { try { loadClassifier(loadPath, props); } catch (IOException e) { throw new RuntimeIOException(e); } catch (ClassCastException|ClassNotFoundException e) { throw new RuntimeException(e); } }
public static List<Pair<String, String>> readMacros(String filename, String encoding) { try { BufferedReader bin = new BufferedReader(new InputStreamReader(new FileInputStream(filename), encoding)); return readMacros(bin); } catch (IOException e) { throw new RuntimeIOException(e); } }