Пример #1
0
 public FullLemmaInfo(LemmaInfo lemmaInfo,
                      string commonLemma,
                      MorphologicForm commonMF,
                      MorphologicForm currentMF)
     : base(lemmaInfo)
 {
     CommonLemma = commonLemma;
     CommonMF    = commonMF;
     CurrentMF   = currentMF;
 }
Пример #2
0
 /// <summary>
 /// Appends information about lemma to tree.
 /// </summary>
 /// <param name="lemma"></param>
 /// <param name="li"></param>
 public void AppendLemmaInfo(string lemma, LemmaInfo li)
 {
     if (lemma != string.Empty && lemma[0] == '-')
     {
         return;
     }
     foreach (string prefix in PrefixCache.GetItem(li.FlexiaModelNo))
     {
         Root.ProcessString(string.Format("{0}{1}", prefix, lemma), 0, li);
     }
 }
Пример #3
0
 /// <summary>
 /// Adds information about specified string to Leaf.
 /// </summary>
 /// <param name="str"></param>
 /// <param name="index"></param>
 /// <param name="info"></param>
 public void ProcessString(string str, int index, LemmaInfo info)
 {
     if (index == str.Length)
     {
         AddInfo(info);
     }
     else
     {
         GetOrAppendSubLeaf(str[index]).ProcessString(str, index + 1, info);
     }
 }
Пример #4
0
 public bool Equals(LemmaInfo li)
 {
     // Return true if the fields match:
     return(this == li);
 }
Пример #5
0
 public LemmaInfo(LemmaInfo initializator)
     : this(initializator.FlexiaModelNo, initializator.AccentModelNo, initializator.CommonAncode)
 {
 }
Пример #6
0
 /// <summary>
 /// Adds information to current leaf.
 /// </summary>
 /// <param name="info"></param>
 private void AddInfo(LemmaInfo info)
 {
     OnceLinkedList <LemmaInfo> .Append(ref Info, info);
 }
Пример #7
0
        /// <summary>
        /// Read list of lemmas from stream.
        /// </summary>
        /// <param name="sr"></param>
        private void ReadLemmas(StreamReader sr)
        {
            int base_count = int.Parse(sr.ReadLine());

            for (int b = 0; b < base_count; b++)
            {
                /*
                 * [0] = <base>
                 * [1] = <flex_model_no>
                 * [2] = <accent_model_no>
                 * [3] = <session_no>
                 * [4] = <type_ancode>
                 * [5] = <prefix_set_no>
                 */
                string[] datas         = sr.ReadLine().Trim().Split(' ');
                int      FlexiaModelNo = int.Parse(datas[1]);

                //Check CommonAncode
                if (datas[4] == "-")
                {
                    datas[4] = string.Empty;
                }

                //Check PrefixSetNo
                //	if (datas[5] != "-")
                //		if ((datas[5].Length == 0) || !int.TryParse(datas[5], out PrefixSetNo))
                //			throw new Exception("Cannot parse line ");

#if TESTING_FINDING
                if (b % 10000 == 0)
                {
                    //			if (b % 50000 == 0 && b!=0 )
                    //				Foo();
                }
#endif



                LemmaInfo li = new LemmaInfo(FlexiaModelNo, int.Parse(datas[2]), datas[4]);

                string lemm = datas[0];

                if (lemm == "#")
                {
                    lemm = string.Empty;
                }

                Tree.AppendLemmaInfo(lemm, li);

#if ENABLE_FAST_FINDING
                lemm += FlexiaModels[FlexiaModelNo].FirstFlex;

                if (!Lemmas.ContainsKey(lemm))
                {
                    Lemmas[lemm] = new Set <LemmaInfo>();
                }

                Lemmas[lemm].Add(li);
#endif
            }
#if TESTING_FINDING
            Foo();
#endif
        }
Пример #8
0
 public FullLemmaInfo(LemmaInfo lemmaInfo)
     : base(lemmaInfo)
 {
 }