public static LemmatizerModel GetLemmatizerModel(string modelName, IResourceLoader loader) { if (!lemmatizerModels.TryGetValue(modelName, out LemmatizerModel model) || model == null) { using (Stream resource = loader.OpenResource(modelName)) { model = new LemmatizerModel(new ikvm.io.InputStreamWrapper(resource)); } lemmatizerModels[modelName] = model; } return(model); }
public static NLPLemmatizerOp GetLemmatizer(string dictionaryFile, string lemmatizerModelFile) { Debug.Assert(dictionaryFile != null || lemmatizerModelFile != null, "At least one parameter must be non-null"); Stream dictionaryInputStream = null; if (dictionaryFile != null) { string dictionary = lemmaDictionaries[dictionaryFile]; dictionaryInputStream = new MemoryStream(Encoding.UTF8.GetBytes(dictionary)); } LemmatizerModel lemmatizerModel = lemmatizerModelFile == null ? null : lemmatizerModels[lemmatizerModelFile]; return(new NLPLemmatizerOp(dictionaryInputStream, lemmatizerModel)); }
public NLPLemmatizerOp(Stream dictionary, LemmatizerModel lemmatizerModel) { Debug.Assert(dictionary != null || lemmatizerModel != null, "At least one parameter must be non-null"); dictionaryLemmatizer = dictionary == null ? null : new DictionaryLemmatizer(new ikvm.io.InputStreamWrapper(dictionary)); lemmatizerME = lemmatizerModel == null ? null : new LemmatizerME(lemmatizerModel); }
public Lemmatizer(LemmatizerModel model) { this.lemmatizer = new LemmatizerME(model); }