示例#1
0
        // Serialization Functions (Regular) ------------

        public void Serialize(StreamWriter sWrt, bool bSerializeExamples)
        {
            Lsett.Serialize(sWrt);

            sWrt.WriteLine(bSerializeExamples);
            ElExamples.Serialize(sWrt, bSerializeExamples, false);

            if (!bSerializeExamples)
            {
                ElExamples.GetFrontRearExampleList(false).Serialize(sWrt, bSerializeExamples, false);
                ElExamples.GetFrontRearExampleList(true).Serialize(sWrt, bSerializeExamples, false);
            }

            //LtnRootNode.Serialize(sWrt);
            if (Lsett.bBuildFrontLemmatizer)
            {
                LtnRootNodeFront.Serialize(sWrt);
            }

            // exceptions
            foreach (var exception in this.Exceptions)
            {
                sWrt.WriteLine("{0} {1}", exception.Key, exception.Value);
            }
        }
示例#2
0
        // Serialization Functions (regular) ------

        public void Serialize(StreamWriter sWrt, bool bThisTopObject)
        {
            //save metadata
            sWrt.Write(bThisTopObject); sWrt.WriteLine(Constants.Separator);

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

            //save refernce types if needed -------------------------
            if (bThisTopObject)
            {
                lsett.Serialize(sWrt);
            }

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

            sWrt.WriteLine(iCount);
            foreach (KeyValuePair <string, LemmaRule> kvp in this)
            {
                sWrt.WriteLine(kvp.Key);
                kvp.Value.Serialize(sWrt, false);
            }

            //default rule is already saved in the list. Here just save its id.
            sWrt.WriteLine(lrDefaultRule.Signature);
        }
示例#3
0
        // Serialization functions (regular) ------------

        public void Serialize(StreamWriter sWrt, bool bThisTopObject)
        {
            //save metadata
            sWrt.Write(bThisTopObject); sWrt.Write(Constants.Separator);

            //save value types --------------------------------------
            sWrt.Write(sWord); sWrt.Write(Constants.Separator);
            sWrt.Write(sLemma); sWrt.Write(Constants.Separator);
            sWrt.Write(sSignature); sWrt.Write(Constants.Separator);
            if (sMsd == null)
            {
                sWrt.Write(false);
                sWrt.Write(Constants.Separator);
            }
            else
            {
                sWrt.Write(true); sWrt.Write(Constants.Separator);
                sWrt.Write(sMsd); sWrt.Write(Constants.Separator);
            }
            sWrt.Write(dWeight); sWrt.Write(Constants.Separator);

            //save refernce types if needed -------------------------
            if (bThisTopObject)
            {
                lsett.Serialize(sWrt);
                lrRule.Serialize(sWrt, false);
            }

            sWrt.WriteLine();
        }
示例#4
0
        // Serialization Functions (regular) -----

        public void Serialize(StreamWriter sWrt, bool bThisTopObject)
        {
            //save metadata
            sWrt.Write(bThisTopObject); sWrt.Write(Constants.Separator);

            //save value types --------------------------------------
            sWrt.Write(iId); sWrt.Write(Constants.Separator);
            sWrt.Write(iFrom); sWrt.Write(Constants.Separator);
            if (sFrom == null)
            {
                sWrt.Write(false); sWrt.Write(Constants.Separator);
            }
            else
            {
                sWrt.Write(true); sWrt.Write(Constants.Separator);
                sWrt.Write(sFrom); sWrt.Write(Constants.Separator);
            }
            sWrt.Write(sTo); sWrt.Write(Constants.Separator);
            sWrt.Write(sSignature); sWrt.Write(Constants.Separator);

            if (bThisTopObject)
            {
                lsett.Serialize(sWrt); sWrt.Write(Constants.Separator);
            }

            sWrt.WriteLine();
        }
示例#5
0
        // Serialization functions (regular) ----------------------

        public void Serialize(StreamWriter sWrt, bool bSerializeExamples, bool bThisTopObject)
        {
            //save metadata
            sWrt.Write(bThisTopObject); sWrt.Write(Constants.Separator);

            //save refernce types if needed -------------------------
            if (bThisTopObject)
            {
                lsett.Serialize(sWrt); sWrt.Write(Constants.Separator);
            }

            rlRules.Serialize(sWrt, false);

            if (!bSerializeExamples)
            {
                sWrt.Write(false); // lstExamples == null
                sWrt.Write(Constants.Separator);
                sWrt.Write(0);     // dictExamples.Count == 0
                sWrt.Write(Constants.Separator);
            }
            else
            {
                if (lstExamples == null)
                {
                    sWrt.Write(false); // lstExamples == null
                    sWrt.Write(Constants.Separator);

                    //save dictionary items
                    int iCount = dictExamples.Count;
                    sWrt.Write(iCount); sWrt.Write(Constants.Separator);

                    foreach (KeyValuePair <string, LemmaExample> kvp in dictExamples)
                    {
                        sWrt.Write(kvp.Value.Rule.Signature); sWrt.Write(Constants.Separator);
                        kvp.Value.Serialize(sWrt, false);
                    }
                }
                else
                {
                    sWrt.Write(true); // lstExamples != null
                    sWrt.Write(Constants.Separator);

                    //save list & dictionary items
                    int iCount = lstExamples.Count;
                    sWrt.Write(iCount); sWrt.Write(Constants.Separator);

                    foreach (LemmaExample le in lstExamples)
                    {
                        sWrt.Write(le.Rule.Signature); sWrt.Write(Constants.Separator);
                        le.Serialize(sWrt, false);
                    }
                }
            }
            sWrt.WriteLine();
        }