private LemmaExample Add(LemmaExample leNew) { LemmaExample leReturn = null; if (!dictExamples.TryGetValue(leNew.Signature, out leReturn)) { leReturn = leNew; dictExamples.Add(leReturn.Signature, leReturn); } else leReturn.Join(leNew); lstExamples = null; return leReturn; }
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 LemmaExample AddExample(string sWord, string sLemma, double dWeight, string sMsd) { string sNewMsd = lsett.eMsdConsider != LemmatizerSettings.MsdConsideration.Ignore ? sMsd : null; LemmaExample leNew = new LemmaExample(sWord, sLemma, dWeight, sNewMsd, rlRules, lsett); return Add(leNew); }