Beispiel #1
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();
        }
Beispiel #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);
        }
Beispiel #3
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);
            }
        }
Beispiel #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(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();
        }
Beispiel #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();
        }
Beispiel #6
0
        public void Serialize(BinaryWriter binWrt, bool bThisTopObject)
        {
            //save metadata
            binWrt.Write(bThisTopObject);

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

            //save refernce types if needed -------------------------
            if (bThisTopObject)
            {
                lsett.Serialize(binWrt);
                lrRule.Serialize(binWrt, false);
            }
        }
Beispiel #7
0
        public void Serialize(BinaryWriter binWrt, bool bThisTopObject)
        {
            //save metadata
            binWrt.Write(bThisTopObject);

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

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

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

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

            //default rule is already saved in the list. Here just save its id.
            binWrt.Write(lrDefaultRule.Signature);
        }
Beispiel #8
0
        public void Serialize(BinaryWriter binWrt, bool bThisTopObject)
        {
            //save metadata
            binWrt.Write(bThisTopObject);

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

            if (bThisTopObject)
            {
                lsett.Serialize(binWrt);
            }
        }
        public void Serialize(BinaryWriter binWrt, bool bSerializeExamples)
        {
            lsett.Serialize(binWrt);

            binWrt.Write(bSerializeExamples);
            elExamples.Serialize(binWrt, bSerializeExamples, false);

            if (!bSerializeExamples)
            {
                elExamples.GetFrontRearExampleList(false).Serialize(binWrt, bSerializeExamples, false);
                elExamples.GetFrontRearExampleList(true).Serialize(binWrt, bSerializeExamples, false);
            }

            ltnRootNode.Serialize(binWrt);
            if (lsett.bBuildFrontLemmatizer)
            {
                ltnRootNodeFront.Serialize(binWrt);
            }

            bool bMsdSplitTreePresent = (msdSplitTree != null);

            binWrt.Write(bMsdSplitTreePresent);
            if (bMsdSplitTreePresent)
            {
                msdSplitTree.Serialize(binWrt);
            }
        }
        public void Serialize(BinaryWriter binWrt, bool bSerializeExamples, bool bThisTopObject)
        {
            //save metadata
            binWrt.Write(bThisTopObject);

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

            rlRules.Serialize(binWrt, false);

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

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

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

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

                    foreach (LemmaExample le in lstExamples)
                    {
                        binWrt.Write(le.Rule.Signature);
                        le.Serialize(binWrt, false);
                    }
                }
            }
        }
Beispiel #11
0
 public void Serialize(BinaryWriter binWrt, bool bSerializeExamples)
 {
     lsett.Serialize(binWrt);
     elExamples.Serialize(binWrt, bSerializeExamples, false);
     ltnRootNode.Serialize(binWrt);
 }