Exemplo n.º 1
0
 /// <summary>
 /// Инициализация внутренних словарей.
 /// Можно не вызывать, но тогда будет автоматически вызвано при первом обращении,
 /// и соответственно первое обращение отработает на несколько секунд дольше.
 /// Если инициализация идёт через Sdk.Initialize или ProcessorService.Initialize, то эту функцию вызывать не надо.
 /// </summary>
 /// <param name="langs">по умолчанию, русский с украинским</param>
 public static void Initialize(Pullenti.Morph.MorphLang langs = null)
 {
     if (langs == null || langs.IsUndefined)
     {
         langs = Pullenti.Morph.MorphLang.RU;
     }
     Pullenti.Semantic.Internal.NextModelHelper.Initialize();
     ControlModelQuestion.Initialize();
     LoadLanguages(langs);
 }
Exemplo n.º 2
0
        int CompareTo(ControlModelQuestion other)
        {
            int i = string.Compare(Preposition, other.Preposition);

            if (i != 0)
            {
                return(i);
            }
            if (this._casRank() < other._casRank())
            {
                return(-1);
            }
            if (this._casRank() > other._casRank())
            {
                return(1);
            }
            return(0);
        }
Exemplo n.º 3
0
 public static void Initialize()
 {
     if (Items != null)
     {
         return;
     }
     Items = new List <ControlModelQuestion>();
     foreach (string s in new string[] { "ИЗ", "ОТ", "С", "ИЗНУТРИ" })
     {
         Items.Add(new ControlModelQuestion(s, Pullenti.Morph.MorphCase.Genitive, QuestionType.WhereFrom));
     }
     Items.Add(new ControlModelQuestion("В", Pullenti.Morph.MorphCase.Accusative, QuestionType.WhereTo));
     Items.Add(new ControlModelQuestion("НА", Pullenti.Morph.MorphCase.Accusative, QuestionType.WhereTo));
     Items.Add(new ControlModelQuestion("ПО", Pullenti.Morph.MorphCase.Accusative, QuestionType.WhereTo));
     Items.Add(new ControlModelQuestion("К", Pullenti.Morph.MorphCase.Dative, QuestionType.WhereTo));
     Items.Add(new ControlModelQuestion("НАВСТРЕЧУ", Pullenti.Morph.MorphCase.Dative, QuestionType.WhereTo));
     Items.Add(new ControlModelQuestion("ДО", Pullenti.Morph.MorphCase.Genitive, QuestionType.WhereTo));
     foreach (string s in new string[] { "У", "ОКОЛО", "ВОКРУГ", "ВОЗЛЕ", "ВБЛИЗИ", "МИМО", "ПОЗАДИ", "ВПЕРЕДИ", "ВГЛУБЬ", "ВДОЛЬ", "ВНЕ", "КРОМЕ", "МЕЖДУ", "НАПРОТИВ", "ПОВЕРХ", "ПОДЛЕ", "ПОПЕРЕК", "ПОСЕРЕДИНЕ", "СВЕРХ", "СРЕДИ", "СНАРУЖИ", "ВНУТРИ" })
     {
         Items.Add(new ControlModelQuestion(s, Pullenti.Morph.MorphCase.Genitive, QuestionType.Where));
     }
     foreach (string s in new string[] { "ПАРАЛЛЕЛЬНО" })
     {
         Items.Add(new ControlModelQuestion(s, Pullenti.Morph.MorphCase.Dative, QuestionType.Where));
     }
     foreach (string s in new string[] { "СКВОЗЬ", "ЧЕРЕЗ", "ПОД" })
     {
         Items.Add(new ControlModelQuestion(s, Pullenti.Morph.MorphCase.Accusative, QuestionType.Where));
     }
     foreach (string s in new string[] { "МЕЖДУ", "НАД", "ПОД", "ПЕРЕД", "ЗА" })
     {
         Items.Add(new ControlModelQuestion(s, Pullenti.Morph.MorphCase.Instrumental, QuestionType.Where));
     }
     foreach (string s in new string[] { "В", "НА", "ПРИ" })
     {
         Items.Add(new ControlModelQuestion(s, Pullenti.Morph.MorphCase.Prepositional, QuestionType.Where));
     }
     Items.Add(new ControlModelQuestion("ПРЕЖДЕ", Pullenti.Morph.MorphCase.Genitive, QuestionType.When));
     Items.Add(new ControlModelQuestion("ПОСЛЕ", Pullenti.Morph.MorphCase.Genitive, QuestionType.When));
     Items.Add(new ControlModelQuestion("НАКАНУНЕ", Pullenti.Morph.MorphCase.Genitive, QuestionType.When));
     Items.Add(new ControlModelQuestion("СПУСТЯ", Pullenti.Morph.MorphCase.Accusative, QuestionType.When));
     foreach (string s in new string[] { "БЕЗ", "ДЛЯ", "РАДИ", "ИЗЗА", "ВВИДУ", "ВЗАМЕН", "ВМЕСТО", "ПРОТИВ", "СВЫШЕ", "ВСЛЕДСТВИЕ", "ПОМИМО", "ПОСРЕДСТВОМ", "ПУТЕМ" })
     {
         Items.Add(new ControlModelQuestion(s, Pullenti.Morph.MorphCase.Genitive));
     }
     foreach (string s in new string[] { "ПО", "ПОДОБНО", "СОГЛАСНО", "СООТВЕТСТВЕННО", "СОРАЗМЕРНО", "ВОПРЕКИ" })
     {
         Items.Add(new ControlModelQuestion(s, Pullenti.Morph.MorphCase.Dative));
     }
     foreach (string s in new string[] { "ПРО", "О", "ЗА", "ВКЛЮЧАЯ", "С" })
     {
         Items.Add(new ControlModelQuestion(s, Pullenti.Morph.MorphCase.Accusative));
     }
     foreach (string s in new string[] { "С" })
     {
         Items.Add(new ControlModelQuestion(s, Pullenti.Morph.MorphCase.Instrumental));
     }
     foreach (string s in new string[] { "О", "ПО" })
     {
         Items.Add(new ControlModelQuestion(s, Pullenti.Morph.MorphCase.Prepositional));
     }
     for (int i = 0; i < Items.Count; i++)
     {
         for (int j = 0; j < (Items.Count - 1); j++)
         {
             if (Items[j].CompareTo(Items[j + 1]) > 0)
             {
                 ControlModelQuestion it = Items[j];
                 Items[j]     = Items[j + 1];
                 Items[j + 1] = it;
             }
         }
     }
     Items.Insert((m_BaseNominativeInd = 0), new ControlModelQuestion(null, Pullenti.Morph.MorphCase.Nominative)
     {
         IsBase = true
     });
     Items.Insert((m_BaseGenetiveInd = 1), new ControlModelQuestion(null, Pullenti.Morph.MorphCase.Genitive)
     {
         IsBase = true
     });
     Items.Insert((m_BaseAccusativeInd = 2), new ControlModelQuestion(null, Pullenti.Morph.MorphCase.Accusative)
     {
         IsBase = true
     });
     Items.Insert((m_BaseInstrumentalInd = 3), new ControlModelQuestion(null, Pullenti.Morph.MorphCase.Instrumental)
     {
         IsBase = true
     });
     Items.Insert((m_BaseDativeInd = 4), new ControlModelQuestion(null, Pullenti.Morph.MorphCase.Dative)
     {
         IsBase = true
     });
     Items.Insert((m_BaseToDoInd = 5), new ControlModelQuestion(null, null, QuestionType.WhatToDo));
     Items.Insert(6, new ControlModelQuestion(null, null, QuestionType.Where)
     {
         IsAbstract = true
     });
     Items.Insert(7, new ControlModelQuestion(null, null, QuestionType.WhereTo)
     {
         IsAbstract = true
     });
     Items.Insert(8, new ControlModelQuestion(null, null, QuestionType.WhereFrom)
     {
         IsAbstract = true
     });
     Items.Insert(9, new ControlModelQuestion(null, null, QuestionType.When)
     {
         IsAbstract = true
     });
     m_HashBySpel = new Dictionary <string, int>();
     for (int i = 0; i < Items.Count; i++)
     {
         ControlModelQuestion it = Items[i];
         it.Id = i + 1;
         m_HashBySpel.Add(it.Spelling, i);
     }
 }