Search in sources :

Example 1 with LogisticClassifier

use of edu.stanford.nlp.classify.LogisticClassifier in project CoreNLP by stanfordnlp.

the class SieveCoreferenceSystem method getSingletonPredictorFromSerializedFile.

public static LogisticClassifier<String, String> getSingletonPredictorFromSerializedFile(String serializedFile) {
    try {
        ObjectInputStream ois = IOUtils.readStreamFromString(serializedFile);
        Object o = ois.readObject();
        if (o instanceof LogisticClassifier<?, ?>) {
            return (LogisticClassifier<String, String>) o;
        }
        throw new ClassCastException("Wanted SingletonPredictor, got " + o.getClass());
    } catch (IOException e) {
        throw new RuntimeIOException(e);
    } catch (ClassNotFoundException e) {
        throw new RuntimeException(e);
    }
}
Also used : RuntimeIOException(edu.stanford.nlp.io.RuntimeIOException) RuntimeIOException(edu.stanford.nlp.io.RuntimeIOException) IOException(java.io.IOException) ObjectInputStream(java.io.ObjectInputStream) LogisticClassifier(edu.stanford.nlp.classify.LogisticClassifier)

Aggregations

LogisticClassifier (edu.stanford.nlp.classify.LogisticClassifier)1 RuntimeIOException (edu.stanford.nlp.io.RuntimeIOException)1 IOException (java.io.IOException)1 ObjectInputStream (java.io.ObjectInputStream)1