Esempio n. 1
0
 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);
 }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
 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);
 }
Esempio n. 4
0
 public Lemmatizer(LemmatizerModel model)
 {
     this.lemmatizer = new LemmatizerME(model);
 }