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; }
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); }
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 LemmaTreeNode(Latino.BinarySerializer binRead, LemmatizerSettings lsett, ExampleList elExamples, LemmaTreeNode ltnParentNode) { Load(binRead, lsett, elExamples, ltnParentNode); }
public LemmaRule(Latino.BinarySerializer binRead, LemmatizerSettings lsett) { Load(binRead, lsett); }
public void Load(Latino.BinarySerializer binRead, LemmatizerSettings lsett) { //load metadata bool bThisTopObject = binRead.ReadBool(); //load value types -------------------------------------- iId = binRead.ReadInt(); iFrom = binRead.ReadInt(); if (binRead.ReadBool()) sFrom = binRead.ReadString(); else sFrom = null; sTo = binRead.ReadString(); sSignature = binRead.ReadString(); //load refernce types if needed ------------------------- if (bThisTopObject) this.lsett = new LemmatizerSettings(binRead); else this.lsett = lsett; }
public void Load(Latino.BinarySerializer binRead, LemmatizerSettings lsett) { //load metadata bool bThisTopObject = binRead.ReadBool(); //load refernce types if needed ------------------------- if (bThisTopObject) this.lsett = new LemmatizerSettings(binRead); else this.lsett = lsett; rlRules = new RuleList(binRead, this.lsett); bool bCreateLstExamples = binRead.ReadBool(); lstExamples = bCreateLstExamples ? new List<LemmaExample>() : null; dictExamples = new Dictionary<string, LemmaExample>(); //load dictionary items int iCount = binRead.ReadInt(); for (int iId = 0; iId < iCount; iId++) { LemmaRule lrRule = rlRules[binRead.ReadString()]; LemmaExample le = new LemmaExample(binRead, this.lsett, lrRule); dictExamples.Add(le.Signature, le); if (bCreateLstExamples) lstExamples.Add(le); } }
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); } } } }
public LemmatizerSettings(Latino.BinarySerializer reader) { Load(reader); }
public ExampleList(Latino.BinarySerializer binRead, LemmatizerSettings lsett) { Load(binRead, lsett); }
public void Load(Latino.BinarySerializer binRead) { bUseFromInRules = binRead.ReadBool(); eMsdConsider = (MsdConsideration)binRead.ReadInt(); iMaxRulesPerNode = binRead.ReadInt(); bBuildFrontLemmatizer = binRead.ReadBool(); }
public void Save(Latino.BinarySerializer binWrt) { binWrt.WriteBool(bUseFromInRules); binWrt.WriteInt((int)eMsdConsider); binWrt.WriteInt(iMaxRulesPerNode); binWrt.WriteBool(bBuildFrontLemmatizer); }
public Lemmatizer(Latino.BinarySerializer binRead) { Load(binRead); }
public void Load(Latino.BinarySerializer binRead) { lsett = new LemmatizerSettings(binRead); elExamples = new ExampleList(binRead, lsett); if (!lsett.bBuildFrontLemmatizer) { ltnRootNode = new LemmaTreeNode(binRead, lsett, elExamples, null); } else { ltnRootNode = new LemmaTreeNode(binRead, lsett, elExamples.GetFrontRearExampleList(false) , null); ltnRootNodeFront = new LemmaTreeNode(binRead, lsett, elExamples.GetFrontRearExampleList(true), null); } }
public void Save(Latino.BinarySerializer binWrt) { lsett.Save(binWrt); elExamples.Save(binWrt, true, false); ltnRootNode.Save(binWrt); if (lsett.bBuildFrontLemmatizer) ltnRootNodeFront.Save(binWrt); }