Beispiel #1
0
        public void TestInitialize()
        {
            var lemmatizer = new LemmatizerRussian();
            var morph      = new Morpher(lemmatizer);

            morph.Initialize();

            Assert.AreEqual(1, lemmatizer.UseStatistic);
        }
Beispiel #2
0
        public void TestGetAccent()
        {
            var lemmatizer = new LemmatizerRussian();
            var morph      = new Morpher(lemmatizer);

            morph.Initialize();

            var accent = morph.GetAccent("переплетено");

            Assert.AreEqual(10, accent);
        }
Beispiel #3
0
        public static void Main(string[] args)
        {
            var lemmatizer = new LemmatizerRussian();
            var morph      = new Morpher(lemmatizer);

            morph.Initialize();

            foreach (var word in args)
            {
                Console.WriteLine(morph.GetAccent(word));
            }
        }
Beispiel #4
0
        public WordList(string text)
        {
            GraphmatFile graphan = new GraphmatFile();

            graphan.Language = 1;
            graphan.LoadDicts();

            ILemmatizer lemmatizer = new LemmatizerRussian();

            lemmatizer.LoadDictionariesRegistry();

            IGramTab gramTab = new RusGramTab();

            gramTab.Load();

            PLMLineCollection beforeSyntaxPlmLines = new PLMLineCollection();
            PLMLineCollection afterMorphPlmLines   = new PLMLineCollection();

            IMAPost m_piMAPost = new MAPostClass();

            m_piMAPost.Init(1, lemmatizer, gramTab);

            //Load syntax module
            SentencesCollection sentCollection = new SentencesCollection();

            sentCollection.SyntaxLanguage = 1;
            sentCollection.SetLemmatizer(lemmatizer);
            sentCollection.KillHomonymsMode = 1;
            sentCollection.InitializeProcesser();
            //конец инициализации

            afterMorphPlmLines.AttachLemmatizer(lemmatizer);

            sentCollection.ClearSentences();
            graphan.LoadStringToGraphan(text);
            uint c = graphan.GetLineCount();

            words = new List <string>();

            for (uint i = 0; i < c; i++)
            {
                words.Add(graphan.GetWord(i));
            }
            //int j = 0;
        }