예제 #1
0
        public void Load(Latino.BinarySerializer binRead, LemmatizerSettings lsett, LemmaRule lrRule)
        {
            //load metadata
            bool bThisTopObject = binRead.ReadBool();

            //load value types --------------------------------------
            sWord      = binRead.ReadString();
            sLemma     = binRead.ReadString();
            sSignature = binRead.ReadString();
            if (binRead.ReadBool())
            {
                sMsd = binRead.ReadString();
            }
            else
            {
                sMsd = null;
            }
            dWeight = binRead.ReadDouble();

            //load refernce types if needed -------------------------
            if (bThisTopObject)
            {
                this.lsett  = new LemmatizerSettings(binRead);
                this.lrRule = new LemmaRule(binRead, this.lsett);
            }
            else
            {
                this.lsett  = lsett;
                this.lrRule = lrRule;
            }
        }
        public void Load(Latino.BinarySerializer binRead, LemmatizerSettings lsett, ExampleList elExamples, LemmaTreeNode ltnParentNode)
        {
            this.lsett = lsett;

            if (binRead.ReadBool())
            {
                dictSubNodes = new Dictionary <char, LemmaTreeNode>();
                int iCount = binRead.ReadInt();
                for (int i = 0; i < iCount; i++)
                {
                    char          cKey   = binRead.ReadChar();
                    LemmaTreeNode ltrSub = new LemmaTreeNode(binRead, this.lsett, elExamples, this);
                    dictSubNodes.Add(cKey, ltrSub);
                }
            }
            else
            {
                dictSubNodes = null;
            }

            this.ltnParentNode = ltnParentNode;

            iSimilarity = binRead.ReadInt();
            sCondition  = binRead.ReadString();
            bWholeWord  = binRead.ReadBool();

            lrBestRule = elExamples.Rules[binRead.ReadString()];

            int iCountBest = binRead.ReadInt();

            aBestRules = new RuleWeighted[iCountBest];
            for (int i = 0; i < iCountBest; i++)
            {
                aBestRules[i] = new RuleWeighted(elExamples.Rules[binRead.ReadString()], binRead.ReadDouble());
            }

            dWeight = binRead.ReadDouble();

            iStart          = binRead.ReadInt();
            iEnd            = binRead.ReadInt();
            this.elExamples = elExamples;
        }