Reputation: 21
I have a C# class whose static constructor is as follows:
static MyClass()
{
var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
var modelsAssemblyPath = Path.Combine(baseDirectory, "edu.stanford.nlp.corenlp_english_models.dll");
Assembly.LoadFile(modelsAssemblyPath);
var props = new Properties();
props.setProperty("annotators", "tokenize, ssplit, pos, lemma, ner");
props.setProperty("ner.useSUTime", "false");
pipeline = new StanfordCoreNLP(props); # slow statement
}
The code works fine. The problem is that the last statement is slow, understandably because the model is being loaded.
In production, I'm fine with it but in development mode where I'm constantly running the app for debugging purposes, I cannot afford the wait.
What's the correct way to deal with it? Should I create a smaller dummy model dll that I can use in dev mode? If so, how?
Upvotes: 2
Views: 28