FileInputStream sampleDataIn = CmdLineUtil.openInFile(testData);
ObjectStream<StringList> sampleStream = new NameFinderCensus90NameStream(sampleDataIn,
Charset.forName(params.getEncoding()));
Dictionary mDictionary;
try {
System.out.println("Creating Dictionary...");
mDictionary = createDictionary(sampleStream);
} catch (IOException e) {
throw new TerminateToolException(-1, "IO error while reading training data or indexing data: "
+ e.getMessage(), e);
} finally {
try {
sampleStream.close();
} catch(IOException e) {
// sorry this can fail..
}
}
System.out.println("Saving Dictionary...");
OutputStream out = null;
try {
out = new FileOutputStream(dictOutFile);
mDictionary.serialize(out);
} catch (IOException e) {
throw new TerminateToolException(-1, "IO error while writing dictionary file: "
+ e.getMessage(), e);
}
finally {