После установки библиотеки при помощи Setup.exe, загрузите Lemmatizer.dll в C# проект. Скопируйте следующий метод или его тело, например, в main-class:
- private static void initAOTMorphoanalyzer()
- {
- LEMMATIZERLib.ILemmatizer lemmatizerRu = new LEMMATIZERLib.LemmatizerRussian();
- lemmatizerRu.LoadDictionariesRegistry();
- LEMMATIZERLib.IParadigmCollection piParadigmCollection = lemmatizerRu.CreateParadigmCollectionFromForm("мыла", 0, 0);
- Console.Out.WriteLine(piParadigmCollection.Count);
- for (int j=0; j < piParadigmCollection.Count; j++)
- {
- object[] args = { j };
- Type paradigmCollectionType = piParadigmCollection.GetType();
- if (paradigmCollectionType != null)
- {
- object Item = paradigmCollectionType.InvokeMember("Item", BindingFlags.GetProperty, null, piParadigmCollection, args);
- Type itemType = Item.GetType();
- if (itemType != null)
- {
- object Norm = itemType.InvokeMember("Norm", BindingFlags.GetProperty, null, Item, null);
- Console.Out.WriteLine(Norm);
- }
- else
- Console.Out.WriteLine("itemType is null");
- }
- else
- Console.Out.WriteLine("paradigmCollectionType is null");
- }
- }
Результат:
2
МЫЛО
МЫТЬ
No comments:
Post a Comment