public final class IOUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
BUFFER_SIZE |
static String |
SPACE_DELIMITER |
static String |
TAB_DELIMITER |
| Modifier and Type | Method and Description |
|---|---|
static InputStream |
getDictionaryResource(String resource)
Get an input stream from a resource name.
|
static opennlp.tools.util.TrainingParameters |
loadTrainingParameters(String paramFile)
Load the parameters in the
TrainingParameters file. |
static String |
normalizeLexiconName(String resource)
Remove punctuation.
|
static InputStream |
openFromFile(File file)
Open file to an input stream.
|
static opennlp.tools.util.ObjectStream<String> |
readFileIntoMarkableStreamFactory(String infile)
Read the file into an
ObjectStream. |
static <T> T |
readGzipObjectFromInputStream(InputStream is) |
static <T> T |
readObjectFromInputStream(InputStream is) |
static <K,V> File |
writeClusterToFile(Map<K,V> tokenToClusterMap,
String fileName,
String delimiter) |
static File |
writeDictionaryLemmatizerToFile(Map<List<String>,String> dictMap,
String fileName,
String delimiter) |
static void |
writeGzipObjectToStream(Object o,
OutputStream out)
Serialized gzipped java object to an ObjectOutputStream.
|
static <K,V> File |
writeMultimapToFile(com.google.common.collect.ListMultimap<K,V> tokenToClusterMap,
String fileName,
String delimiter) |
static File |
writeObjectToFile(Object o,
String fileName)
Serialize java object to a file.
|
static void |
writeObjectToStream(Object o,
OutputStream out)
Serialize java object to an ObjectOutputStream.
|
public static final int BUFFER_SIZE
public static final String SPACE_DELIMITER
public static final String TAB_DELIMITER
public static final String normalizeLexiconName(String resource)
resource - the dictionary pathpublic static final InputStream getDictionaryResource(String resource)
resource - the name of the resource (absolute path with no starting /)public static opennlp.tools.util.TrainingParameters loadTrainingParameters(String paramFile)
TrainingParameters file.paramFile - the training parameters filepublic static opennlp.tools.util.ObjectStream<String> readFileIntoMarkableStreamFactory(String infile)
ObjectStream.infile - the string pointing to the filepublic static <K,V> File writeClusterToFile(Map<K,V> tokenToClusterMap, String fileName, String delimiter) throws IOException
IOExceptionpublic static <K,V> File writeMultimapToFile(com.google.common.collect.ListMultimap<K,V> tokenToClusterMap, String fileName, String delimiter) throws IOException
IOExceptionpublic static File writeDictionaryLemmatizerToFile(Map<List<String>,String> dictMap, String fileName, String delimiter) throws IOException
IOExceptionpublic static File writeObjectToFile(Object o, String fileName) throws IOException
o - the java objectfileName - the name of the fileIOException - if io problemspublic static void writeGzipObjectToStream(Object o, OutputStream out)
o - the java objectout - the output streampublic static void writeObjectToStream(Object o, OutputStream out)
o - the java objectout - the output streampublic static InputStream openFromFile(File file)
file - the filepublic static <T> T readObjectFromInputStream(InputStream is) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionpublic static <T> T readGzipObjectFromInputStream(InputStream is) throws IOException, ClassNotFoundException
IOExceptionClassNotFoundExceptionCopyright © 2016 IXA pipes. All rights reserved.