Esempio n. 1
0
        internal void Deserialize(Pullenti.Morph.Internal.ByteArrayWrapper str, ref int pos)
        {
            int attr = str.DeserializeShort(ref pos);

            if (((attr & 1)) != 0)
            {
                IsDummy = true;
            }
            if (((attr & 2)) != 0)
            {
                NotGenerate = true;
            }
            Prefix = str.DeserializeString(ref pos);
            Model.Deserialize(str, ref pos);
            Cm.Deserialize(str, ref pos);
            CmRev.Deserialize(str, ref pos);
            int cou = str.DeserializeShort(ref pos);

            for (; cou > 0; cou--)
            {
                DerivateWord w = new DerivateWord();
                w.Spelling = str.DeserializeString(ref pos);
                int sh = str.DeserializeShort(ref pos);
                w.Class       = new Pullenti.Morph.MorphClass();
                w.Class.Value = (short)sh;
                sh            = str.DeserializeShort(ref pos);
                w.Lang        = new Pullenti.Morph.MorphLang();
                w.Lang.Value  = (short)sh;
                sh            = str.DeserializeShort(ref pos);
                w.Attrs.Value = (short)sh;
                byte b = str.DeserializeByte(ref pos);
                w.Aspect = (Pullenti.Morph.MorphAspect)b;
                b        = str.DeserializeByte(ref pos);
                w.Tense  = (Pullenti.Morph.MorphTense)b;
                b        = str.DeserializeByte(ref pos);
                w.Voice  = (Pullenti.Morph.MorphVoice)b;
                b        = str.DeserializeByte(ref pos);
                int cou1 = (int)b;
                for (; cou1 > 0; cou1--)
                {
                    string n = str.DeserializeString(ref pos);
                    if (w.NextWords == null)
                    {
                        w.NextWords = new List <string>();
                    }
                    if (n != null)
                    {
                        w.NextWords.Add(n);
                    }
                }
                Words.Add(w);
            }
        }
Esempio n. 2
0
        public DerivateGroup CreateByPrefix(string pref, Pullenti.Morph.MorphLang lang)
        {
            DerivateGroup res = new DerivateGroup()
            {
                IsGenerated = true, Prefix = pref
            };

            foreach (DerivateWord w in Words)
            {
                if (lang != null && !lang.IsUndefined && ((w.Lang & lang)).IsUndefined)
                {
                    continue;
                }
                DerivateWord rw = new DerivateWord()
                {
                    Spelling = pref + w.Spelling, Lang = w.Lang, Class = w.Class, Aspect = w.Aspect, Reflexive = w.Reflexive, Tense = w.Tense, Voice = w.Voice, Attrs = w.Attrs
                };
                res.Words.Add(rw);
            }
            return(res);
        }