Ejemplo n.º 1
0
        public void Save(Latino.BinarySerializer binWrt)
        {
            binWrt.WriteBool(dictSubNodes != null);
            if (dictSubNodes != null) {
                binWrt.WriteInt(dictSubNodes.Count);
                foreach (KeyValuePair<char, LemmaTreeNode> kvp in dictSubNodes) {
                    binWrt.WriteChar(kvp.Key);
                    kvp.Value.Save(binWrt);
                }
            }

            binWrt.WriteInt(iSimilarity);
            binWrt.WriteString(sCondition);
            binWrt.WriteBool(bWholeWord);

            binWrt.WriteString(lrBestRule.Signature);
            binWrt.WriteInt(aBestRules.Length);
            for (int i = 0; i < aBestRules.Length; i++) {
                binWrt.WriteString(aBestRules[i].Rule.Signature);
                binWrt.WriteDouble(aBestRules[i].Weight);
            }
            binWrt.WriteDouble(dWeight);

            binWrt.WriteInt(iStart);
            binWrt.WriteInt(iEnd);
        }
Ejemplo n.º 2
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);
                    }
                }
            }
        }
Ejemplo n.º 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);
        }
 public void Save(Latino.BinarySerializer binWrt) {
     binWrt.WriteBool(bUseFromInRules);
     binWrt.WriteInt((int)eMsdConsider);
     binWrt.WriteInt(iMaxRulesPerNode);
     binWrt.WriteBool(bBuildFrontLemmatizer);
 }