public ExampleList(LemmatizerSettings lsett) : base() { this.lsett = lsett; this.dictExamples = new Dictionary <string, LemmaExample>(); this.lstExamples = null; this.rlRules = new RuleList(lsett); }
public ExampleList(SerializationInfo info, StreamingContext context) { lsett = (LemmatizerSettings)info.GetValue("lsett", typeof(LemmatizerSettings)); this.dictExamples = new Dictionary <string, LemmaExample>(); this.lstExamples = null; this.rlRules = new RuleList(lsett); string[] aWords = (string[])info.GetValue("aWords", typeof(string[])); string[] aLemmas = (string[])info.GetValue("aLemmas", typeof(string[])); double[] aWeights = (double[])info.GetValue("aWeights", typeof(double[])); string[] aMsds = (string[])info.GetValue("aMsds", typeof(string[])); for (int iExm = 0; iExm < aWords.Length; iExm++) { AddExample(aWords[iExm], aLemmas[iExm], aWeights[iExm], aMsds[iExm]); } }
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(string sWord, string sLemma, double dWeight, string sMsd, RuleList rlRules, LemmatizerSettings lsett) { this.lsett = lsett; this.sWord = sWord; this.sLemma = sLemma; this.sMsd = sMsd; this.dWeight = dWeight; this.lrRule = rlRules.AddRule(this); switch (lsett.eMsdConsider) { case LemmatizerSettings.MsdConsideration.Ignore: case LemmatizerSettings.MsdConsideration.JoinAll: case LemmatizerSettings.MsdConsideration.JoinDistinct: case LemmatizerSettings.MsdConsideration.JoinSameSubstring: sSignature = "[" + sWord + "]==>[" + sLemma + "]"; break; case LemmatizerSettings.MsdConsideration.Distinct: default: sSignature = "[" + sWord + "]==>[" + sLemma + "](" + (sMsd != null ? sMsd : "") + ")"; break; } }