Esempio n. 1
0
 public void CopyFrom(MorphMiscInfo src)
 {
     Value = src.Value;
     foreach (string a in src.Attrs)
     {
         m_Attrs.Add(a);
     }
 }
Esempio n. 2
0
 public void CopyFromWordForm(MorphWordForm src)
 {
     base.CopyFrom(src);
     UndefCoef  = src.UndefCoef;
     NormalCase = src.NormalCase;
     NormalFull = src.NormalFull;
     Misc       = src.Misc;
 }
Esempio n. 3
0
 public MorphWordForm(Pullenti.Morph.Internal.MorphRuleVariant v, string word, MorphMiscInfo mi)
 {
     if (v == null)
     {
         return;
     }
     this.CopyFrom(v);
     Misc = mi;
     if (v.NormalTail != null && word != null)
     {
         string wordBegin = word;
         if (LanguageHelper.EndsWith(word, v.Tail))
         {
             wordBegin = word.Substring(0, word.Length - v.Tail.Length);
         }
         if (v.NormalTail.Length > 0)
         {
             NormalCase = wordBegin + v.NormalTail;
         }
         else
         {
             NormalCase = wordBegin;
         }
     }
     if (v.FullNormalTail != null && word != null)
     {
         string wordBegin = word;
         if (LanguageHelper.EndsWith(word, v.Tail))
         {
             wordBegin = word.Substring(0, word.Length - v.Tail.Length);
         }
         if (v.FullNormalTail.Length > 0)
         {
             NormalFull = wordBegin + v.FullNormalTail;
         }
         else
         {
             NormalFull = wordBegin;
         }
     }
 }
Esempio n. 4
0
 internal bool HasMorphEquals(List <MorphWordForm> list)
 {
     foreach (MorphWordForm mr in list)
     {
         if ((Class == mr.Class && Number == mr.Number && Gender == mr.Gender) && NormalCase == mr.NormalCase && NormalFull == mr.NormalFull)
         {
             mr.Case |= Case;
             MorphPerson p = Misc.Person;
             if (p != MorphPerson.Undefined && p != mr.Misc.Person)
             {
                 MorphMiscInfo mi = new MorphMiscInfo();
                 mi.CopyFrom(mr.Misc);
                 mi.Person = mr.Misc.Person | Misc.Person;
                 mr.Misc   = mi;
             }
             return(true);
         }
     }
     foreach (MorphWordForm mr in list)
     {
         if ((Class == mr.Class && Number == mr.Number && Case == mr.Case) && NormalCase == mr.NormalCase && NormalFull == mr.NormalFull)
         {
             mr.Gender |= Gender;
             return(true);
         }
     }
     foreach (MorphWordForm mr in list)
     {
         if ((Class == mr.Class && Gender == mr.Gender && Case == mr.Case) && NormalCase == mr.NormalCase && NormalFull == mr.NormalFull)
         {
             mr.Number |= Number;
             return(true);
         }
     }
     return(false);
 }