219220221222223224225226227228229
messageInc("Initializing NLP tools..."); DefaultObjects.initializeNlpTools(); message("Done."); } catch (ConfidenceFunctionException e) { throw new ExtractorException(e); } catch (IOException e) { throw new ExtractorException(e); } }
117118119120121122123124
try { FileUtils.pipe(reader, writer); return readDocument(writer.toString(), id); } catch (IOException e) { String msg = String.format("Could not read document %s", id); throw new ExtractorException(msg, e); } }
135136137138139140141142
try { return readDocument(new FileInputStream(file), file.getAbsolutePath()); } catch (IOException e) { String msg = String.format("Could not extract from %s", file); throw new ExtractorException(msg, e); } }
164165166167168169170171172173
sentNum++; } catch (ChunkerException e) { String msg = String.format( "Could not chunk sentence %s in document %s", sentNum, id); throw new ExtractorException(msg); } } return new ChunkedDocument(id, chunkedSents); }