public class ConvertModels
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ConvertModels.Model |
static class |
ConvertModels.Stage |
| Constructor and Description |
|---|
ConvertModels() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.List<java.util.List<java.lang.Double>> |
fromMatrix(org.ejml.simple.SimpleMatrix in) |
static java.util.List<java.util.List<java.util.List<java.lang.Double>>> |
fromTensor(SimpleTensor in) |
static void |
main(java.lang.String[] args)
This program converts a sentiment model or an RNN parser model
from EJML v23, used by CoreNLP 3.9.2, to a more recent version of
EJML, such as v38.
|
static NeuralCorefModel |
readCoref(java.io.ObjectInputStream in) |
static Embedding |
readEmbedding(java.io.ObjectInputStream in) |
static FastNeuralCorefModel |
readFastCoref(java.io.ObjectInputStream in) |
static LexicalizedParser |
readParser(java.io.ObjectInputStream in) |
static SentimentModel |
readSentiment(java.io.ObjectInputStream in) |
static org.ejml.simple.SimpleMatrix |
toMatrix(java.util.List<java.util.List<java.lang.Double>> in) |
static SimpleTensor |
toTensor(java.util.List<java.util.List<java.util.List<java.lang.Double>>> in) |
static <K1,K2,V,V2> |
transform2DMap(TwoDimensionalMap<K1,K2,V> in,
java.util.function.Function<V,V2> function)
Transform this map into a new map using the given function
|
static <K,V,V2> java.util.Map<K,V2> |
transformMap(java.util.Map<K,V> in,
java.util.function.Function<V,V2> function) |
static void |
writeCoref(NeuralCorefModel model,
java.io.ObjectOutputStream out) |
static void |
writeEmbedding(Embedding embedding,
java.io.ObjectOutputStream out) |
static void |
writeFastCoref(FastNeuralCorefModel model,
java.io.ObjectOutputStream out) |
static void |
writeParser(LexicalizedParser model,
DVModelReranker reranker,
java.io.ObjectOutputStream out) |
static void |
writeSentiment(SentimentModel model,
java.io.ObjectOutputStream out) |
public static <K1,K2,V,V2> TwoDimensionalMap<K1,K2,V2> transform2DMap(TwoDimensionalMap<K1,K2,V> in, java.util.function.Function<V,V2> function)
public static java.util.List<java.util.List<java.lang.Double>> fromMatrix(org.ejml.simple.SimpleMatrix in)
public static java.util.List<java.util.List<java.util.List<java.lang.Double>>> fromTensor(SimpleTensor in)
public static org.ejml.simple.SimpleMatrix toMatrix(java.util.List<java.util.List<java.lang.Double>> in)
public static SimpleTensor toTensor(java.util.List<java.util.List<java.util.List<java.lang.Double>>> in)
public static <K,V,V2> java.util.Map<K,V2> transformMap(java.util.Map<K,V> in,
java.util.function.Function<V,V2> function)
public static void writeSentiment(SentimentModel model, java.io.ObjectOutputStream out) throws java.io.IOException
java.io.IOExceptionpublic static SentimentModel readSentiment(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic static void writeParser(LexicalizedParser model, DVModelReranker reranker, java.io.ObjectOutputStream out) throws java.io.IOException
java.io.IOExceptionpublic static LexicalizedParser readParser(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic static void writeEmbedding(Embedding embedding, java.io.ObjectOutputStream out) throws java.io.IOException
java.io.IOExceptionpublic static Embedding readEmbedding(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic static void writeCoref(NeuralCorefModel model, java.io.ObjectOutputStream out) throws java.io.IOException
java.io.IOExceptionpublic static NeuralCorefModel readCoref(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic static void writeFastCoref(FastNeuralCorefModel model, java.io.ObjectOutputStream out) throws java.io.IOException
java.io.IOExceptionpublic static FastNeuralCorefModel readFastCoref(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic static void main(java.lang.String[] args)
throws java.io.IOException,
java.lang.ClassNotFoundException,
java.lang.InstantiationException,
java.lang.NoSuchMethodException
java edu.stanford.nlp.neural.ConvertModels -stage OLD -model SENTIMENT -input edu/stanford/nlp/models/sentiment/sentiment.ser.gz -output sentiment.INT.ser.gz
java edu.stanford.nlp.neural.ConvertModels -stage NEW -model SENTIMENT -input sentiment.INT.ser.gz -output sentiment.38.ser.gz
-model DVPARSER
java edu.stanford.nlp.neural.ConvertModels -stage OLD -model DVPARSER -input /u/nlp/data/lexparser/chineseRNN.e21.ser.gz -output /u/nlp/data/lexparser/chineseRNN.INT.ser.gz
java edu.stanford.nlp.neural.ConvertModels -stage NEW -model DVPARSER -input /u/nlp/data/lexparser/chineseRNN.INT.ser.gz -output /u/nlp/data/lexparser/chineseRNN.e38.ser.gz
-model COREF
java edu.stanford.nlp.neural.ConvertModels -stage OLD -model COREF -input /scr/nlp/data/coref/models/neural/english/english-model-default.ser.gz -output /scr/nlp/data/coref/models/neural/english/english-model-default.INT.ser.gz
java edu.stanford.nlp.neural.ConvertModels -stage NEW -model COREF -input /scr/nlp/data/coref/models/neural/english/english-model-default.INT.ser.gz -output /scr/nlp/data/coref/models/neural/english/english-model-default.e39.ser.gz
-model EMBEDDING
java edu.stanford.nlp.neural.ConvertModels -stage OLD -model EMBEDDING -input /scr/nlp/data/coref/models/neural/english/english-embeddings.e38.ser.gz -output /scr/nlp/data/coref/models/neural/english/english-embeddings.INT.ser.gz
java edu.stanford.nlp.neural.ConvertModels -stage NEW -model EMBEDDING -input /scr/nlp/data/coref/models/neural/english/english-embeddings.INT.ser.gz -output /scr/nlp/data/coref/models/neural/english/english-embeddings.e39.ser.gz
-model FASTCOREF
java edu.stanford.nlp.neural.ConvertModels -stage OLD -model FASTCOREF -input /scr/nlp/data/coref/models/fastneural/fast-english-model.e38.ser.gz -output /scr/nlp/data/coref/models/fastneural/fast-english-model.INT.ser.gz
java edu.stanford.nlp.neural.ConvertModels -stage NEW -model FASTCOREF -input /scr/nlp/data/coref/models/fastneural/fast-english-model.INT.ser.gz -output /scr/nlp/data/coref/models/fastneural/fast-english-model.e39.ser.gz
java.io.IOExceptionjava.lang.ClassNotFoundExceptionjava.lang.InstantiationExceptionjava.lang.NoSuchMethodException