private int FindOrCreateMatchingAffixMsa(IMoStemMsa msa) { int hvoPOS = msa.PartOfSpeechRAHvo; foreach (IMoMorphSynAnalysis msaT in this.MorphoSyntaxAnalysesOC) { IMoUnclassifiedAffixMsa msaAffix = msaT as IMoUnclassifiedAffixMsa; if (msaAffix != null && msaAffix.PartOfSpeechRAHvo == hvoPOS) return msaAffix.Hvo; } IMoUnclassifiedAffixMsa msaNew = new MoUnclassifiedAffixMsa(); this.MorphoSyntaxAnalysesOC.Add(msaNew); msaNew.PartOfSpeechRAHvo = hvoPOS; return msaNew.Hvo; }
/// <summary> /// Go through the senses of this entry, ensuring that each one has an MSA assigned to it. /// MergeRedundantMSAs() should be called after this method. /// </summary> public void EnsureValidMSAsForSenses() { bool fIsAffix = MoMorphType.IsAffixType(this.MorphType); foreach (ILexSense ls in this.AllSenses) { if (ls.MorphoSyntaxAnalysisRAHvo != 0) continue; IMoMorphSynAnalysis msa; if (fIsAffix) { msa = FindEmptyAffixMsa(); if (msa == null) { msa = new MoUnclassifiedAffixMsa(); this.MorphoSyntaxAnalysesOC.Add(msa); } } else { msa = FindEmptyStemMsa(); if (msa == null) { msa = new MoStemMsa(); this.MorphoSyntaxAnalysesOC.Add(msa); } } ls.MorphoSyntaxAnalysisRAHvo = msa.Hvo; } }
/// <summary> /// Get the HVO for an appropriate default MoMorphSynAnalysis belonging to this /// entry, creating it if necessary. /// </summary> /// <returns></returns> public int FindOrCreateDefaultMsa() { // Search for an appropriate MSA already existing for the LexEntry. foreach (IMoMorphSynAnalysis msa in this.MorphoSyntaxAnalysesOC) { if (MoMorphType.IsAffixType(this.MorphType)) { if (msa is MoUnclassifiedAffixMsa) return msa.Hvo; } else { if (msa is MoStemMsa) return msa.Hvo; } } // Nothing exists, create the needed MSA. MoMorphSynAnalysis msaNew; if (MoMorphType.IsAffixType(MorphType)) msaNew = new MoUnclassifiedAffixMsa(); else msaNew = new MoStemMsa(); msaNew.InitNew(this.Cache, this.Hvo, this.MorphoSyntaxAnalysesOC.Flid, 0); MorphoSyntaxAnalysesOC.Add(msaNew); return msaNew.Hvo; }
public void MoUnclassifiedAffixMsa_EqualMsa() { CheckDisposed(); ILangProject lp = Cache.LangProject; ILexDb ld = lp.LexDbOA; ILexEntry le = MakeLexEntry(ld, "xyzTest1", "xyzDefn1.1", 0); MoUnclassifiedAffixMsa unclassifiedAffixMsa1 = new MoUnclassifiedAffixMsa(); MoUnclassifiedAffixMsa unclassifiedAffixMsa2 = new MoUnclassifiedAffixMsa(); MoStemMsa stemMsa = new MoStemMsa(); MoInflAffMsa inflAffixMsa = new MoInflAffMsa(); MoDerivAffMsa derivAffixMsa = new MoDerivAffMsa(); le.MorphoSyntaxAnalysesOC.Add(unclassifiedAffixMsa1); le.MorphoSyntaxAnalysesOC.Add(unclassifiedAffixMsa2); le.MorphoSyntaxAnalysesOC.Add(stemMsa); le.MorphoSyntaxAnalysesOC.Add(inflAffixMsa); le.MorphoSyntaxAnalysesOC.Add(derivAffixMsa); DummyGenericMSA dummyMsa1 = DummyGenericMSA.Create(unclassifiedAffixMsa1); DummyGenericMSA dummyMsa2 = DummyGenericMSA.Create(unclassifiedAffixMsa2); DummyGenericMSA dummyMsa3 = DummyGenericMSA.Create(stemMsa); DummyGenericMSA dummyMsa4 = DummyGenericMSA.Create(inflAffixMsa); DummyGenericMSA dummyMsa5 = DummyGenericMSA.Create(derivAffixMsa); // Verify we fail comparing on different MSA types. Assert.IsFalse(unclassifiedAffixMsa1.EqualsMsa(stemMsa)); Assert.IsFalse(unclassifiedAffixMsa1.EqualsMsa(inflAffixMsa)); Assert.IsFalse(unclassifiedAffixMsa1.EqualsMsa(derivAffixMsa)); Assert.IsFalse(unclassifiedAffixMsa1.EqualsMsa(dummyMsa3)); Assert.IsFalse(unclassifiedAffixMsa1.EqualsMsa(dummyMsa4)); Assert.IsFalse(unclassifiedAffixMsa1.EqualsMsa(dummyMsa5)); // Verify that unclassifiedAffixMsa1 equals itself. Assert.IsTrue(unclassifiedAffixMsa1.EqualsMsa(unclassifiedAffixMsa1), unclassifiedAffixMsa1.ToString() + " - should equal itself."); // Verify that unclassifiedAffixMsa1 equals unclassifiedAffixMsa2 Assert.IsTrue(unclassifiedAffixMsa1.EqualsMsa(unclassifiedAffixMsa2), unclassifiedAffixMsa1.ToString() + " - should equal - " + unclassifiedAffixMsa2.ToString()); Assert.IsTrue(unclassifiedAffixMsa1.EqualsMsa(dummyMsa2), "unclassifiedAffixMsa1 should equal dummyMsa2"); // compare with on different PartOfSpeech FdoOwningSequence<ICmPossibility> posSeq = lp.PartsOfSpeechOA.PossibilitiesOS; IPartOfSpeech pos1 = (IPartOfSpeech)posSeq.Append(new PartOfSpeech()); IPartOfSpeech pos2 = (IPartOfSpeech)posSeq.Append(new PartOfSpeech()); unclassifiedAffixMsa1.PartOfSpeechRA = pos1; unclassifiedAffixMsa2.PartOfSpeechRA = pos2; dummyMsa2.MainPOS = pos2.Hvo; Assert.IsTrue(unclassifiedAffixMsa1.PartOfSpeechRA != unclassifiedAffixMsa2.PartOfSpeechRA, "msa POSes should not be equal."); Assert.IsFalse(unclassifiedAffixMsa1.EqualsMsa(unclassifiedAffixMsa2), "unclassifiedAffixMsa1 should not be equal to unclassifiedAffixMsa2 due to different POS"); Assert.IsFalse(unclassifiedAffixMsa1.EqualsMsa(dummyMsa2), "unclassifiedAffixMsa1 should not equal dummyMsa2"); // reset POS unclassifiedAffixMsa1.PartOfSpeechRAHvo = unclassifiedAffixMsa2.PartOfSpeechRAHvo; dummyMsa2.MainPOS = unclassifiedAffixMsa1.PartOfSpeechRAHvo; Assert.IsTrue(unclassifiedAffixMsa1.EqualsMsa(unclassifiedAffixMsa2), "unclassifiedAffixMsa1 & unclassifiedAffixMsa2 should be equal with matching POS"); Assert.IsTrue(unclassifiedAffixMsa1.EqualsMsa(dummyMsa2), "unclassifiedAffixMsa1 should equal dummyMsa2"); }
public void MoDerivAffMsa_EqualMsa() { CheckDisposed(); CreateTestData(); ILangProject lp = Cache.LangProject; ILexDb ld = lp.LexDbOA; ILexEntry le = MakeLexEntry(ld, "xyzTest1", "xyzDefn1.1", 0); MoDerivAffMsa derivAffixMsa1 = new MoDerivAffMsa(); MoDerivAffMsa derivAffixMsa2 = new MoDerivAffMsa(); MoStemMsa stemMsa = new MoStemMsa(); MoInflAffMsa inflAffixMsa = new MoInflAffMsa(); MoUnclassifiedAffixMsa unclassifiedAffixMsa = new MoUnclassifiedAffixMsa(); le.MorphoSyntaxAnalysesOC.Add(derivAffixMsa1); le.MorphoSyntaxAnalysesOC.Add(derivAffixMsa2); le.MorphoSyntaxAnalysesOC.Add(stemMsa); le.MorphoSyntaxAnalysesOC.Add(inflAffixMsa); le.MorphoSyntaxAnalysesOC.Add(unclassifiedAffixMsa); DummyGenericMSA dummyMsa1 = DummyGenericMSA.Create(derivAffixMsa1); DummyGenericMSA dummyMsa2 = DummyGenericMSA.Create(derivAffixMsa2); DummyGenericMSA dummyMsa3 = DummyGenericMSA.Create(stemMsa); DummyGenericMSA dummyMsa4 = DummyGenericMSA.Create(inflAffixMsa); DummyGenericMSA dummyMsa5 = DummyGenericMSA.Create(unclassifiedAffixMsa); // Verify we fail comparing on different MSA types. Assert.IsFalse(derivAffixMsa1.EqualsMsa(stemMsa)); Assert.IsFalse(derivAffixMsa1.EqualsMsa(inflAffixMsa)); Assert.IsFalse(derivAffixMsa1.EqualsMsa(unclassifiedAffixMsa)); Assert.IsFalse(derivAffixMsa1.EqualsMsa(dummyMsa3)); Assert.IsFalse(derivAffixMsa1.EqualsMsa(dummyMsa4)); Assert.IsFalse(derivAffixMsa1.EqualsMsa(dummyMsa5)); // Verify that derivAffixMsa1 equals itself. Assert.IsTrue(derivAffixMsa1.EqualsMsa(derivAffixMsa1), derivAffixMsa1.ToString() + " - should equal itself."); // Verify that derivAffixMsa1 equals derivAffixMsa2 Assert.IsTrue(derivAffixMsa1.EqualsMsa(derivAffixMsa2), derivAffixMsa1.ToString() + " - should equal - " + derivAffixMsa2.ToString()); Assert.IsTrue(derivAffixMsa1.EqualsMsa(dummyMsa2), "derivAffixMsa1 should equal dummyMsa2"); // compare with on different FromPartOfSpeech FdoOwningSequence<ICmPossibility> posSeq = lp.PartsOfSpeechOA.PossibilitiesOS; IPartOfSpeech pos1 = (IPartOfSpeech)posSeq.Append(new PartOfSpeech()); IPartOfSpeech pos2 = (IPartOfSpeech)posSeq.Append(new PartOfSpeech()); derivAffixMsa1.FromPartOfSpeechRA = pos1; derivAffixMsa2.FromPartOfSpeechRA = pos2; dummyMsa2.MainPOS = pos2.Hvo; Assert.IsTrue(derivAffixMsa1.FromPartOfSpeechRA != derivAffixMsa2.FromPartOfSpeechRA, "msa POSes should not be equal."); Assert.IsFalse(derivAffixMsa1.EqualsMsa(derivAffixMsa2), "derivAffixMsa1 should not be equal to derivAffixMsa2 due to different FromPartOfSpeech"); Assert.IsFalse(derivAffixMsa1.EqualsMsa(dummyMsa2), "derivAffixMsa1 should not equal dummyMsa2"); // reset POS derivAffixMsa1.FromPartOfSpeechRAHvo = derivAffixMsa2.FromPartOfSpeechRAHvo; dummyMsa2.MainPOS = derivAffixMsa1.FromPartOfSpeechRAHvo; Assert.IsTrue(derivAffixMsa1.EqualsMsa(derivAffixMsa2), "derivAffixMsa1 & derivAffixMsa2 should be equal with matching POS"); Assert.IsTrue(derivAffixMsa1.EqualsMsa(dummyMsa2), "derivAffixMsa1 should equal dummyMsa2"); // compare with on different ToPartOfSpeech PartOfSpeech pos3 = (PartOfSpeech)posSeq.Append(new PartOfSpeech()); PartOfSpeech pos4 = (PartOfSpeech)posSeq.Append(new PartOfSpeech()); derivAffixMsa1.ToPartOfSpeechRA = pos3; derivAffixMsa2.ToPartOfSpeechRA = pos4; dummyMsa2.SecondaryPOS = pos4.Hvo; Assert.IsTrue(derivAffixMsa1.ToPartOfSpeechRA != derivAffixMsa2.ToPartOfSpeechRA, "msa POSes should not be equal."); Assert.IsFalse(derivAffixMsa1.EqualsMsa(derivAffixMsa2), "derivAffixMsa1 should not be equal to derivAffixMsa2 due to different ToPartOfSpeech"); Assert.IsFalse(derivAffixMsa1.EqualsMsa(dummyMsa2), "derivAffixMsa1 should not equal dummyMsa2"); // reset POS derivAffixMsa1.ToPartOfSpeechRAHvo = derivAffixMsa2.ToPartOfSpeechRAHvo; dummyMsa2.SecondaryPOS = derivAffixMsa1.ToPartOfSpeechRAHvo; Assert.IsTrue(derivAffixMsa1.EqualsMsa(derivAffixMsa2), "derivAffixMsa1 & derivAffixMsa2 should be equal with matching POS"); Assert.IsTrue(derivAffixMsa1.EqualsMsa(dummyMsa2), "derivAffixMsa1 should equal dummyMsa2"); // compare on different FromInflectionClass pos1.InflectionClassesOC.Add(new MoInflClass()); pos2.InflectionClassesOC.Add(new MoInflClass()); derivAffixMsa1.FromInflectionClassRAHvo = pos1.InflectionClassesOC.HvoArray[0]; derivAffixMsa2.FromInflectionClassRAHvo = pos2.InflectionClassesOC.HvoArray[0]; Assert.IsTrue(derivAffixMsa1.FromInflectionClassRA != derivAffixMsa2.FromInflectionClassRA, "inflection classes should not be equal."); Assert.IsFalse(derivAffixMsa1.EqualsMsa(derivAffixMsa2), "derivAffixMsa1 should not be equal to derivAffixMsa2 due to different inflection classes."); // reset InflectionClass derivAffixMsa1.FromInflectionClassRA = derivAffixMsa2.FromInflectionClassRA; Assert.IsTrue(derivAffixMsa1.EqualsMsa(derivAffixMsa2), "derivAffixMsa1 & derivAffixMsa2 should be equal with matching inflection classes"); // compare on different FromStemName pos1.StemNamesOC.Add(new MoStemName()); pos2.StemNamesOC.Add(new MoStemName()); derivAffixMsa1.FromStemNameRAHvo = pos1.StemNamesOC.HvoArray[0]; derivAffixMsa2.FromStemNameRAHvo = pos2.StemNamesOC.HvoArray[0]; Assert.IsTrue(derivAffixMsa1.FromStemNameRA != derivAffixMsa2.FromStemNameRA, "stem names should not be equal."); Assert.IsFalse(derivAffixMsa1.EqualsMsa(derivAffixMsa2), "derivAffixMsa1 should not be equal to derivAffixMsa2 due to different stem names."); // reset StemName derivAffixMsa1.FromStemNameRA = derivAffixMsa2.FromStemNameRA; Assert.IsTrue(derivAffixMsa1.EqualsMsa(derivAffixMsa2), "derivAffixMsa1 & derivAffixMsa2 should be equal with matching stem names"); // compare on different ToInflectionClass pos3.InflectionClassesOC.Add(new MoInflClass()); pos4.InflectionClassesOC.Add(new MoInflClass()); derivAffixMsa1.ToInflectionClassRAHvo = pos3.InflectionClassesOC.HvoArray[0]; derivAffixMsa2.ToInflectionClassRAHvo = pos4.InflectionClassesOC.HvoArray[0]; Assert.IsTrue(derivAffixMsa1.ToInflectionClassRA != derivAffixMsa2.ToInflectionClassRA, "inflection classes should not be equal."); Assert.IsFalse(derivAffixMsa1.EqualsMsa(derivAffixMsa2), "derivAffixMsa1 should not be equal to derivAffixMsa2 due to different inflection classes."); // reset InflectionClass derivAffixMsa1.ToInflectionClassRA = derivAffixMsa2.ToInflectionClassRA; Assert.IsTrue(derivAffixMsa1.EqualsMsa(derivAffixMsa2), "derivAffixMsa1 & derivAffixMsa2 should be equal with matching inflection classes"); // compare different FromProdRestrict ICmPossibility pr1 = lp.MorphologicalDataOA.ProdRestrictOA.PossibilitiesOS[0]; ICmPossibility pr2 = lp.MorphologicalDataOA.ProdRestrictOA.PossibilitiesOS[1]; derivAffixMsa1.FromProdRestrictRC.Add(pr1.Hvo); derivAffixMsa2.FromProdRestrictRC.Add(pr2.Hvo); Assert.IsFalse(derivAffixMsa1.EqualsMsa(derivAffixMsa2), "derivAffixMsa1 should not be equal to derivAffixMsa2 due to productivity restrictions differences."); derivAffixMsa1.FromProdRestrictRC.Add(pr2.Hvo); Assert.IsFalse(derivAffixMsa1.EqualsMsa(derivAffixMsa2), "derivAffixMsa1 should not be equal to derivAffixMsa2 due to productivity restrictions count difference."); // Match Productivity Restrictions derivAffixMsa2.FromProdRestrictRC.Add(pr1.Hvo); Assert.IsTrue(derivAffixMsa1.EqualsMsa(derivAffixMsa2), "derivAffixMsa1 & derivAffixMsa2 should be equal with matching productivity restrictions"); // compare different ToProdRestrict CmPossibility pr3 = lp.MorphologicalDataOA.ProdRestrictOA.PossibilitiesOS[2] as CmPossibility; CmPossibility pr4 = lp.MorphologicalDataOA.ProdRestrictOA.PossibilitiesOS[3] as CmPossibility; derivAffixMsa1.ToProdRestrictRC.Add(pr3.Hvo); derivAffixMsa2.ToProdRestrictRC.Add(pr4.Hvo); Assert.IsFalse(derivAffixMsa1.EqualsMsa(derivAffixMsa2), "derivAffixMsa1 should not be equal to derivAffixMsa2 due to productivity restrictions differences."); derivAffixMsa1.ToProdRestrictRC.Add(pr4.Hvo); Assert.IsFalse(derivAffixMsa1.EqualsMsa(derivAffixMsa2), "derivAffixMsa1 should not be equal to derivAffixMsa2 due to productivity restrictions count difference."); // Match Productivity Restrictions derivAffixMsa2.ToProdRestrictRC.Add(pr3.Hvo); Assert.IsTrue(derivAffixMsa1.EqualsMsa(derivAffixMsa2), "derivAffixMsa1 & derivAffixMsa2 should be equal with matching productivity restrictions"); // compare different FromMsFeatures XmlDocument doc = new XmlDocument(); doc.LoadXml(m_ksFS1); XmlNode itemNeut = doc.SelectSingleNode("/item/item[3]"); XmlNode itemFem = doc.SelectSingleNode("/item/item[2]"); derivAffixMsa1.FromMsFeaturesOA = new FsFeatStruc(); derivAffixMsa2.FromMsFeaturesOA = new FsFeatStruc(); derivAffixMsa1.FromMsFeaturesOA.AddFeatureFromXml(Cache, itemNeut); derivAffixMsa2.FromMsFeaturesOA.AddFeatureFromXml(Cache, itemFem); Assert.IsFalse(derivAffixMsa1.FromMsFeaturesOA.IsEquivalent(derivAffixMsa2.FromMsFeaturesOA), "FromMsFeaturesOA should not be equal."); Assert.IsFalse(derivAffixMsa1.EqualsMsa(derivAffixMsa2), "derivAffixMsa1 should not be equal to derivAffixMsa2 due to different FromMsFeaturesOA."); // match feature structures derivAffixMsa1.FromMsFeaturesOA.AddFeatureFromXml(Cache, itemFem); Assert.IsTrue(derivAffixMsa1.EqualsMsa(derivAffixMsa2), "derivAffixMsa1 & derivAffixMsa2 should be equal with matching feature structure"); // compare different ToMsFeatures derivAffixMsa1.ToMsFeaturesOA = new FsFeatStruc(); derivAffixMsa2.ToMsFeaturesOA = new FsFeatStruc(); derivAffixMsa1.ToMsFeaturesOA.AddFeatureFromXml(Cache, itemFem); derivAffixMsa2.ToMsFeaturesOA.AddFeatureFromXml(Cache, itemNeut); Assert.IsFalse(derivAffixMsa1.ToMsFeaturesOA.IsEquivalent(derivAffixMsa2.ToMsFeaturesOA), "ToMsFeaturesOA should not be equal."); Assert.IsFalse(derivAffixMsa1.EqualsMsa(derivAffixMsa2), "derivAffixMsa1 should not be equal to derivAffixMsa2 due to different ToMsFeaturesOA."); // match feature structures derivAffixMsa1.ToMsFeaturesOA.AddFeatureFromXml(Cache, itemNeut); Assert.IsTrue(derivAffixMsa1.EqualsMsa(derivAffixMsa2), "derivAffixMsa1 & derivAffixMsa2 should be equal with matching feature structure"); }
public void MoInflAffMsa_EqualMsa() { CheckDisposed(); CreateTestData(); ILangProject lp = Cache.LangProject; ILexDb ld = lp.LexDbOA; ILexEntry le = MakeLexEntry(ld, "xyzTest1", "xyzDefn1.1", 0); MoInflAffMsa infAffixMsa1 = new MoInflAffMsa(); MoInflAffMsa infAffixMsa2 = new MoInflAffMsa(); MoStemMsa stemMsa = new MoStemMsa(); MoDerivAffMsa derivAffixMsa = new MoDerivAffMsa(); MoUnclassifiedAffixMsa unclassifiedAffixMsa = new MoUnclassifiedAffixMsa(); le.MorphoSyntaxAnalysesOC.Add(infAffixMsa1); le.MorphoSyntaxAnalysesOC.Add(infAffixMsa2); le.MorphoSyntaxAnalysesOC.Add(stemMsa); le.MorphoSyntaxAnalysesOC.Add(derivAffixMsa); le.MorphoSyntaxAnalysesOC.Add(unclassifiedAffixMsa); DummyGenericMSA dummyMsa1 = DummyGenericMSA.Create(infAffixMsa1); DummyGenericMSA dummyMsa2 = DummyGenericMSA.Create(infAffixMsa2); DummyGenericMSA dummyMsa3 = DummyGenericMSA.Create(stemMsa); DummyGenericMSA dummyMsa4 = DummyGenericMSA.Create(derivAffixMsa); DummyGenericMSA dummyMsa5 = DummyGenericMSA.Create(unclassifiedAffixMsa); // Verify we fail comparing on different MSA types. Assert.IsFalse(infAffixMsa1.EqualsMsa(stemMsa)); Assert.IsFalse(infAffixMsa1.EqualsMsa(derivAffixMsa)); Assert.IsFalse(infAffixMsa1.EqualsMsa(unclassifiedAffixMsa)); Assert.IsFalse(infAffixMsa1.EqualsMsa(dummyMsa3)); Assert.IsFalse(infAffixMsa1.EqualsMsa(dummyMsa4)); Assert.IsFalse(infAffixMsa1.EqualsMsa(dummyMsa5)); // Verify that infAffixMsa1 equals itself. Assert.IsTrue(infAffixMsa1.EqualsMsa(infAffixMsa1), infAffixMsa1.ToString() + " - should equal itself."); // Verify that infAffixMsa1 equals infAffixMsa2 Assert.IsTrue(infAffixMsa1.EqualsMsa(infAffixMsa2), infAffixMsa1.ToString() + " - should equal - " + infAffixMsa2.ToString()); Assert.IsTrue(infAffixMsa1.EqualsMsa(dummyMsa2), "infAffixMsa1 should equal dummyMsa2"); // compare with on different PartOfSpeech FdoOwningSequence<ICmPossibility> posSeq = lp.PartsOfSpeechOA.PossibilitiesOS; IPartOfSpeech pos1 = (IPartOfSpeech)posSeq.Append(new PartOfSpeech()); IPartOfSpeech pos2 = (IPartOfSpeech)posSeq.Append(new PartOfSpeech()); infAffixMsa1.PartOfSpeechRA = pos1; infAffixMsa2.PartOfSpeechRA = pos2; dummyMsa2.MainPOS = pos2.Hvo; Assert.IsTrue(infAffixMsa1.PartOfSpeechRA != infAffixMsa2.PartOfSpeechRA, "msa POSes should not be equal."); Assert.IsFalse(infAffixMsa1.EqualsMsa(infAffixMsa2), "infAffixMsa1 should not be equal to infAffixMsa2 due to different POS"); Assert.IsFalse(infAffixMsa1.EqualsMsa(dummyMsa2), "infAffixMsa1 should not equal dummyMsa2"); // reset POS infAffixMsa1.PartOfSpeechRAHvo = infAffixMsa2.PartOfSpeechRAHvo; dummyMsa2.MainPOS = infAffixMsa1.PartOfSpeechRAHvo; Assert.IsTrue(infAffixMsa1.EqualsMsa(infAffixMsa2), "infAffixMsa1 & infAffixMsa2 should be equal with matching POS"); Assert.IsTrue(infAffixMsa1.EqualsMsa(dummyMsa2), "infAffixMsa1 should equal dummyMsa2"); // skip AffixCategory // compare different Slots pos1.AffixSlotsOC.Add(new MoInflAffixSlot()); pos1.AffixSlotsOC.Add(new MoInflAffixSlot()); infAffixMsa1.SlotsRC.Add(pos1.AffixSlotsOC.HvoArray[0]); infAffixMsa2.SlotsRC.Add(pos1.AffixSlotsOC.HvoArray[1]); dummyMsa2.Slot = pos1.AffixSlotsOC.HvoArray[1]; Assert.IsFalse(infAffixMsa1.EqualsMsa(infAffixMsa2), "infAffixMsa1 should not be equal to infAffixMsa2 due to affix slots differences."); Assert.IsFalse(infAffixMsa1.EqualsMsa(dummyMsa2), "infAffixMsa1 should not equal dummyMsa2"); infAffixMsa1.SlotsRC.Add(pos1.AffixSlotsOC.HvoArray[1]); Assert.IsTrue(infAffixMsa1.SlotsRC.Count != infAffixMsa2.SlotsRC.Count); Assert.IsFalse(infAffixMsa1.EqualsMsa(infAffixMsa2), "infAffixMsa1 should not be equal to infAffixMsa2 due to affix slots Count differences."); Assert.IsFalse(infAffixMsa1.EqualsMsa(dummyMsa2), "infAffixMsa1 should not equal dummyMsa2"); infAffixMsa2.SlotsRC.Add(pos1.AffixSlotsOC.HvoArray[0]); Assert.IsTrue(infAffixMsa1.EqualsMsa(infAffixMsa2), "infAffixMsa1 should equal infAffixMsa2 due to affix slots matching."); // compare different FromProdRestrict ICmPossibility pr1 = lp.MorphologicalDataOA.ProdRestrictOA.PossibilitiesOS[0]; ICmPossibility pr2 = lp.MorphologicalDataOA.ProdRestrictOA.PossibilitiesOS[1]; infAffixMsa1.FromProdRestrictRC.Add(pr1.Hvo); infAffixMsa2.FromProdRestrictRC.Add(pr2.Hvo); Assert.IsFalse(infAffixMsa1.EqualsMsa(infAffixMsa2), "infAffixMsa1 should not be equal to infAffixMsa2 due to productivity restrictions differences."); infAffixMsa1.FromProdRestrictRC.Add(pr2.Hvo); Assert.IsFalse(infAffixMsa1.EqualsMsa(infAffixMsa2), "infAffixMsa1 should not be equal to infAffixMsa2 due to productivity restrictions count difference."); // Match Productivity Restrictions infAffixMsa2.FromProdRestrictRC.Add(pr1.Hvo); Assert.IsTrue(infAffixMsa1.EqualsMsa(infAffixMsa2), "infAffixMsa1 & infAffixMsa2 should be equal with matching productivity restrictions"); // compare different InflFeats XmlDocument doc = new XmlDocument(); doc.LoadXml(m_ksFS1); XmlNode itemNeut = doc.SelectSingleNode("/item/item[3]"); XmlNode itemFem = doc.SelectSingleNode("/item/item[2]"); infAffixMsa1.InflFeatsOA = new FsFeatStruc(); infAffixMsa2.InflFeatsOA = new FsFeatStruc(); infAffixMsa1.InflFeatsOA.AddFeatureFromXml(Cache, itemNeut); infAffixMsa2.InflFeatsOA.AddFeatureFromXml(Cache, itemFem); Assert.IsFalse(infAffixMsa1.InflFeatsOA.IsEquivalent(infAffixMsa2.InflFeatsOA), "InflFeatsOA should not be equal."); Assert.IsFalse(infAffixMsa1.EqualsMsa(infAffixMsa2), "infAffixMsa1 should not be equal to infAffixMsa2 due to different InflFeatsOA."); // match feature structures infAffixMsa1.InflFeatsOA.AddFeatureFromXml(Cache, itemFem); Assert.IsTrue(infAffixMsa1.EqualsMsa(infAffixMsa2), "infAffixMsa1 & infAffixMsa2 should be equal with matching feature structure"); }