Пример #1
0
        public void Save(Latino.BinarySerializer binWrt, bool bThisTopObject)
        {
            //save metadata
            binWrt.WriteBool(bThisTopObject);

            //save value types --------------------------------------
            binWrt.WriteString(sWord);
            binWrt.WriteString(sLemma);
            binWrt.WriteString(sSignature);
            if (sMsd == null)
            {
                binWrt.WriteBool(false);
            }
            else
            {
                binWrt.WriteBool(true);
                binWrt.WriteString(sMsd);
            }
            binWrt.WriteDouble(dWeight);

            //save refernce types if needed -------------------------
            if (bThisTopObject)
            {
                lsett.Save(binWrt);
                lrRule.Save(binWrt, false);
            }
        }
Пример #2
0
        public void Save(Latino.BinarySerializer binWrt, bool bThisTopObject)
        {
            //save metadata
            binWrt.WriteBool(bThisTopObject);

            //save value types --------------------------------------

            //save refernce types if needed -------------------------
            if (bThisTopObject)
            {
                lsett.Save(binWrt);
            }

            //save list items ---------------------------------------
            int iCount = this.Count;

            binWrt.WriteInt(iCount);
            foreach (KeyValuePair <string, LemmaRule> kvp in this)
            {
                binWrt.WriteString(kvp.Key);
                kvp.Value.Save(binWrt, false);
            }

            //default rule is already saved in the list. Here just save its id.
            binWrt.WriteString(lrDefaultRule.Signature);
        }
Пример #3
0
        public void Save(Latino.BinarySerializer binWrt, bool bThisTopObject)
        {
            //save metadata
            binWrt.WriteBool(bThisTopObject);

            //save value types --------------------------------------
            binWrt.WriteInt(iId);
            binWrt.WriteInt(iFrom);
            if (sFrom == null)
            {
                binWrt.WriteBool(false);
            }
            else
            {
                binWrt.WriteBool(true);
                binWrt.WriteString(sFrom);
            }
            binWrt.WriteString(sTo);
            binWrt.WriteString(sSignature);

            if (bThisTopObject)
            {
                lsett.Save(binWrt);
            }
        }
Пример #4
0
        public void Save(Latino.BinarySerializer binWrt)
        {
            lsett.Save(binWrt);

            elExamples.Save(binWrt, true, false);

            ltnRootNode.Save(binWrt);
            if (lsett.bBuildFrontLemmatizer)
            {
                ltnRootNodeFront.Save(binWrt);
            }
        }
Пример #5
0
        public void Save(Latino.BinarySerializer binWrt, bool bSerializeExamples, bool bThisTopObject)
        {
            //save metadata
            binWrt.WriteBool(bThisTopObject);

            //save refernce types if needed -------------------------
            if (bThisTopObject)
            {
                lsett.Save(binWrt);
            }

            rlRules.Save(binWrt, false);

            if (!bSerializeExamples)
            {
                binWrt.WriteBool(false); // lstExamples == null
                binWrt.WriteInt(0);      // dictExamples.Count == 0
            }
            else
            {
                if (lstExamples == null)
                {
                    binWrt.WriteBool(false); // lstExamples == null

                    //save dictionary items
                    int iCount = dictExamples.Count;
                    binWrt.WriteInt(iCount);

                    foreach (KeyValuePair <string, LemmaExample> kvp in dictExamples)
                    {
                        binWrt.WriteString(kvp.Value.Rule.Signature);
                        kvp.Value.Save(binWrt, false);
                    }
                }
                else
                {
                    binWrt.WriteBool(true); // lstExamples != null

                    //save list & dictionary items
                    int iCount = lstExamples.Count;
                    binWrt.WriteInt(iCount);

                    foreach (LemmaExample le in lstExamples)
                    {
                        binWrt.WriteString(le.Rule.Signature);
                        le.Save(binWrt, false);
                    }
                }
            }
        }
Пример #6
0
 public void Save(Latino.BinarySerializer binWrt)
 {
     lsett.Save(binWrt);
     elExamples.Save(binWrt, true, false);
     ltnRootNode.Save(binWrt);
 }