/// <summary> /// Convert FDO example LF example. /// </summary> /// <returns>LF example /// <param name="fdoExample">Fdo example.</param> private LfExample FdoExampleToLfExample(ILexExampleSentence fdoExample) { var lfExample = new LfExample(); ILgWritingSystem AnalysisWritingSystem = ServiceLocator.LanguageProject.DefaultAnalysisWritingSystem; ILgWritingSystem VernacularWritingSystem = ServiceLocator.LanguageProject.DefaultVernacularWritingSystem; lfExample.Guid = fdoExample.Guid; lfExample.Sentence = ToMultiText(fdoExample.Example); lfExample.Reference = LfMultiText.FromSingleITsString(fdoExample.Reference, ServiceLocator.WritingSystemFactory); // ILexExampleSentence fields we currently do not convert: // fdoExample.DoNotPublishInRC; // fdoExample.LiftResidue; // fdoExample.PublishIn; // NOTE: Currently, LanguageForge only stores one translation per example, whereas FDO can store // multiple translations with (possibly) different statuses (as freeform strings, like "old", "updated", // "needs fixing"...). Until LanguageForge acquires a data model where translations are stored in a list, // we will save only the first translation (if any) to Mongo. We also save the GUID so that the Mongo->FDO // direction will know which ICmTranslation object to update with any changes. // TODO: Once LF improves its data model for translations, persist all of them instead of just the first. foreach (ICmTranslation translation in fdoExample.TranslationsOC.Take(1)) { lfExample.Translation = ToMultiText(translation.Translation); lfExample.TranslationGuid = translation.Guid; } BsonDocument customFieldsAndGuids = _convertCustomField.GetCustomFieldsForThisCmObject(fdoExample, "examples", ListConverters); BsonDocument customFieldsBson = customFieldsAndGuids["customFields"].AsBsonDocument; BsonDocument customFieldGuids = customFieldsAndGuids["customFieldGuids"].AsBsonDocument; lfExample.CustomFields = customFieldsBson; lfExample.CustomFieldGuids = customFieldGuids; return(lfExample); }
public void Init(Mediator mediator, XmlNode configurationNode, ICmObject sourceObject) { CheckDisposed(); m_cache = sourceObject.Cache; // Find the sense we want examples for, which depends on the kind of source object. if (sourceObject is ILexExampleSentence) { m_les = sourceObject as ILexExampleSentence; m_owningSense = (ILexSense)m_les.Owner; } else if (sourceObject is ILexSense) { m_owningSense = sourceObject as ILexSense; } else { throw new ArgumentException("Invalid object type for sourceObject."); } m_mediator = mediator; m_configurationNode = configurationNode; helpProvider.SetHelpNavigator(this, HelpNavigator.Topic); helpProvider.SetShowHelp(this, true); if (m_mediator.HelpTopicProvider != null) { helpProvider.HelpNamespace = m_mediator.HelpTopicProvider.HelpFile; helpProvider.SetHelpKeyword(this, m_mediator.HelpTopicProvider.GetHelpString(m_helpTopic)); btnHelp.Enabled = true; } AddConfigurableControls(); }
public string ExampleValue(ILexExampleSentence example) { if (example == null || example.Example == null || example.Example.BestAnalysisVernacularAlternative == null) { return(""); } return(example.Example.BestAnalysisVernacularAlternative.Text ?? ""); }
private void btnAdd_Click(object sender, EventArgs e) { // Get the checked occurrences; List <int> occurrences = m_rbv.CheckedItems; if (occurrences == null || occurrences.Count == 0) { // do nothing. return; } List <int> uniqueSegments = (from fake in occurrences select m_clerk.VirtualListPublisher.get_ObjectProp(fake, ConcDecorator.kflidSegment)).Distinct().ToList (); int insertIndex = m_owningSense.ExamplesOS.Count; // by default, insert at the end. if (m_les != null) { // we were given a LexExampleSentence, so set our insertion index after the given one. insertIndex = m_owningSense.ExamplesOS.IndexOf(m_les) + 1; } UndoableUnitOfWorkHelper.Do(LexEdStrings.ksUndoAddExamples, LexEdStrings.ksRedoAddExamples, m_cache.ActionHandlerAccessor, () => { int cNewExamples = 0; ILexExampleSentence newLexExample = null; foreach (int segHvo in uniqueSegments) { var seg = m_cache.ServiceLocator.GetObject(segHvo) as ISegment; if (cNewExamples == 0 && m_les != null && m_les.Example.BestVernacularAlternative.Text == "***" && (m_les.TranslationsOC == null || m_les.TranslationsOC.Count == 0) && m_les.Reference.Length == 0) { // we were given an empty LexExampleSentence, so use this one for our first new Example. newLexExample = m_les; } else { // create a new example sentence. newLexExample = m_cache.ServiceLocator.GetInstance <ILexExampleSentenceFactory>().Create(); m_owningSense.ExamplesOS.Insert(insertIndex + cNewExamples, newLexExample); cNewExamples++; } // copy the segment string into the new LexExampleSentence // Enhance: bold the relevant occurrence(s). // LT-11388 Make sure baseline text gets copied into correct ws var baseWs = GetBestVernWsForNewExample(seg); newLexExample.Example.set_String(baseWs, seg.BaselineText); if (seg.FreeTranslation.AvailableWritingSystemIds.Length > 0) { var trans = m_cache.ServiceLocator.GetInstance <ICmTranslationFactory>().Create(newLexExample, m_cache.ServiceLocator.GetInstance <ICmPossibilityRepository>().GetObject( CmPossibilityTags.kguidTranFreeTranslation)); trans.Translation.CopyAlternatives(seg.FreeTranslation); } if (seg.LiteralTranslation.AvailableWritingSystemIds.Length > 0) { var trans = m_cache.ServiceLocator.GetInstance <ICmTranslationFactory>().Create(newLexExample, m_cache.ServiceLocator.GetInstance <ICmPossibilityRepository>().GetObject( CmPossibilityTags.kguidTranLiteralTranslation)); trans.Translation.CopyAlternatives(seg.LiteralTranslation); } // copy the reference. ITsString tssRef = seg.Paragraph.Reference(seg, seg.BeginOffset); // convert the plain reference string into a link. ITsStrBldr tsb = tssRef.GetBldr(); FwLinkArgs fwl = new FwLinkArgs("interlinearEdit", seg.Owner.Owner.Guid); // It's not clear how to focus in on something smaller than the text when following // a link. //fwl.PropertyTableEntries.Add(new Property("LinkSegmentGuid", seg.Guid.ToString())); tsb.SetStrPropValue(0, tsb.Length, (int)FwTextPropType.ktptObjData, (char)FwObjDataTypes.kodtExternalPathName + fwl.ToString()); tsb.SetStrPropValue(0, tsb.Length, (int)FwTextPropType.ktptNamedStyle, "Hyperlink"); newLexExample.Reference = tsb.GetString(); } }); }
private ICmTranslation GetOrMakeFirstTranslation(ILexExampleSentence example) { if (example.TranslationsOC.Count == 0) { var cmTranslation = example.Services.GetInstance<ICmTranslationFactory>().Create(example, m_cache.ServiceLocator.GetInstance<ICmPossibilityRepository>().GetObject(CmPossibilityTags.kguidTranFreeTranslation)); example.TranslationsOC.Add(cmTranslation); } return example.TranslationsOC.ToArray()[0]; }
private void WriteExampleSentence(TextWriter w, ILexExampleSentence example) { w.Write("<example"); WriteLiftDates(w, example); if (example.Reference != null && example.Reference.Length > 0) w.Write(" source=\"{0}\"", MakeSafeAndNormalizedAttribute(example.Reference.Text)); w.WriteLine(">"); WriteAllForms(w, null, null, "form", example.Example); foreach (var trans in example.TranslationsOC) WriteTranslation(w, trans); WriteString(w, "note", "type=\"reference\"", "form", example.Reference); foreach (var publication in example.DoNotPublishInRC) WritePossibilityLiftTrait(RangeNames.sDbPublicationTypesOA, w, publication.Hvo); WriteCustomFields(w, example); WriteLiftResidue(w, example); w.WriteLine("</example>"); }
/// <summary> /// Create a well-formed ICmTranslation which has the owner and Type property set. /// </summary> public ICmTranslation Create(ILexExampleSentence owner, ICmPossibility translationType) { if (owner == null) throw new ArgumentNullException("owner"); if (translationType == null) throw new ArgumentNullException("translationType"); return Create(owner.TranslationsOC, translationType); }
public override void FixtureSetup() { base.FixtureSetup(); m_entryFactory = Cache.ServiceLocator.GetInstance <ILexEntryFactory>(); m_senseFactory = Cache.ServiceLocator.GetInstance <ILexSenseFactory>(); m_exampleFactory = Cache.ServiceLocator.GetInstance <ILexExampleSentenceFactory>(); m_lexEntryRefFactory = Cache.ServiceLocator.GetInstance <ILexEntryRefFactory>(); m_lexRefTypeFactory = Cache.ServiceLocator.GetInstance <ILexRefTypeFactory>(); m_lexRefFactory = Cache.ServiceLocator.GetInstance <ILexReferenceFactory>(); m_possListFactory = Cache.ServiceLocator.GetInstance <ICmPossibilityListFactory>(); m_flidReferringSenses = Cache.MetaDataCacheAccessor.GetFieldId2(CmSemanticDomainTags.kClassId, "ReferringSenses", false); UndoableUnitOfWorkHelper.Do("do", "undo", Cache.ActionHandlerAccessor, () => { m_domainBadWords = Cache.ServiceLocator.GetInstance <ICmSemanticDomainFactory>().Create(); m_domainTemperature = Cache.ServiceLocator.GetInstance <ICmSemanticDomainFactory>().Create(); Cache.LangProject.SemanticDomainListOA.PossibilitiesOS.Add(m_domainBadWords); Cache.LangProject.SemanticDomainListOA.PossibilitiesOS.Add(m_domainTemperature); m_mainDict = Cache.LangProject.LexDbOA.PublicationTypesOA.PossibilitiesOS[0]; m_blank = MakeEntry("blank", "swear word", true); m_blank.SensesOS[0].SemanticDomainsRC.Add(m_domainBadWords); m_hot = MakeEntry("hot", "high temperature", false); m_hotTemp = m_hot.SensesOS[0]; m_hotTemp.SemanticDomainsRC.Add(m_domainTemperature); m_trouble = MakeSense(m_hot, "trouble"); m_trouble.DoNotPublishInRC.Add(m_mainDict); m_trouble.PicturesOS.Add(Cache.ServiceLocator.GetInstance <ICmPictureFactory>().Create()); m_desirable = MakeSense(m_hot, "desirable"); m_fastCar = MakeSense(m_desirable, "fast (car)"); m_badHot = MakeExample(m_hotTemp, "a hot pile of blank", true); m_goodHot = MakeExample(m_hotTemp, "a hot bath", false); m_water = MakeEntry("water", "H2O", false); m_waterH2O = m_water.SensesOS[0]; m_hotWater = MakeEntry("hot water", "trouble", false); m_hotWaterComponents = MakeEntryRef(m_hotWater, new ICmObject[] { m_trouble, m_waterH2O }, new[] { m_trouble, m_waterH2O }, LexEntryRefTags.krtComplexForm); m_blank2 = MakeEntry("blank", "vacant", false); m_blank3 = MakeEntry("blank", "erase", false); m_water2 = MakeEntry("water", "urinate", true); m_waterPrefix = MakeEntry("water", "aquatic", false); m_waterPrefix.LexemeFormOA.MorphTypeRA = Cache.ServiceLocator.GetInstance <IMoMorphTypeRepository>() .GetObject(MoMorphTypeTags.kguidMorphPrefix); m_synonym = MakeRefType("synonym", null, (int)LexRefTypeTags.MappingTypes.kmtSenseCollection); m_blip = MakeEntry("blip", "rude word", true); m_bother = MakeEntry("bother", "I'm annoyed by that", false); m_ouch = MakeEntry("ouch", "that hurt", false); m_blipOuch = MakeSense(m_blip.SensesOS[0], "rude ouch"); m_blankSynonyms = MakeLexRef(m_synonym, new ICmObject[] { m_blank, m_ouch.SensesOS[0], m_blip.SensesOS[0], m_blipOuch, m_bother }); m_problem = MakeEntry("problem", "difficulty", false); m_problemSynonyms = MakeLexRef(m_synonym, new ICmObject[] { m_problem, m_trouble }); m_body = MakeEntry("body", "body", true); m_arm = MakeEntry("arm", "arm", false); m_leg = MakeEntry("leg", "leg", false); m_belly = MakeEntry("belly", "belly", true); m_torso = MakeEntry("torso", "torso", false); m_partWhole = MakeRefType("partWhole", null, (int)LexRefTypeTags.MappingTypes.kmtEntryTree); m_bodyParts = MakeLexRef(m_partWhole, new ICmObject[] { m_body, m_arm, m_leg.SensesOS[0], m_torso, m_belly }); m_torsoParts = MakeLexRef(m_partWhole, new ICmObject[] { m_torso, m_arm, m_belly }); m_hotBlank = MakeEntry("hotBlank", "problem rude word", false); MakeEntryRef(m_hotBlank, new ICmObject[] { m_trouble, m_water2 }, new ICmObject[] { m_trouble, m_water2 }, LexEntryRefTags.krtComplexForm); m_blueColor = MakeEntry("blue", "color blue", false); m_blueCold = MakeEntry("blue", "cold", false); m_blueMusic = MakeEntry("blue", "jazzy", false); m_blueSad = MakeEntry("blue", "sad", false); m_blueMusic.HomographNumber = 2; // will duplicate blue cold; pathological, but should not crash. m_blueSad.HomographNumber = 3; // will conflict with renumbered blueMusic m_bluer = m_blueColor.SensesOS[0]; m_sky = MakeEntry("sky", "interface between atmosphere and space", false, true); // true excludes as headword m_skyReal = m_sky.SensesOS[0]; m_blueSky = MakeEntry("blue sky", "clear, huge potential", false, false); m_blueSkyComponents = MakeEntryRef(m_blueSky, new ICmObject[] { m_blueColor, m_skyReal }, new[] { m_bluer, m_skyReal }, LexEntryRefTags.krtComplexForm); m_ringBell = MakeEntry("ring", "bell", false, false); m_ringCircle = MakeEntry("ring", "circle", false, true); m_ringGold = MakeEntry("ring", "gold", false, false); m_blackVerb = MakeEntry("black", "darken", false, true); m_blackColor = MakeEntry("black", "dark", false, false); m_hotArm = MakeEntry("hotarm", "pitcher", false, false); m_hotArmComponents = MakeEntryRef(m_hotArm, new ICmObject[] { m_hot, m_arm }, new[] { m_hot, m_arm }, LexEntryRefTags.krtComplexForm); m_hotArm.DoNotPublishInRC.Add(m_mainDict); m_hotArmComponents.ShowComplexFormsInRS.Add(m_hot); m_nolanryan = MakeEntry("Nolan_Ryan", "pitcher", false, false); m_nolanryanComponents = MakeEntryRef(m_nolanryan, new ICmObject[] { m_hot }, new[] { m_hot }, LexEntryRefTags.krtVariant); m_nolanryanComponents.VariantEntryTypesRS.Add( (ILexEntryType)Cache.LangProject.LexDbOA.VariantEntryTypesOA.PossibilitiesOS[0]); m_nolanryan.DoNotPublishInRC.Add(m_mainDict); m_publisher = new MockPublisher((ISilDataAccessManaged)Cache.DomainDataByFlid, kmainFlid); m_publisher.SetOwningPropValue(Cache.LangProject.LexDbOA.Entries.Select(le => le.Hvo).ToArray()); m_decorator = new DictionaryPublicationDecorator(Cache, m_publisher, ObjectListPublisher.OwningFlid); }); }
private void btnAdd_Click(object sender, EventArgs e) { // Get the checked twfics; List <int> twfics = m_rbv.CheckedItems; if (twfics == null || twfics.Count == 0) { // do nothing. return; } List <int> twficSegments = StTxtPara.TwficSegments(m_cache, twfics); Set <int> uniqueSegments = new Set <int>(twficSegments); FdoObjectSet <CmBaseAnnotation> cbaSegments = new FdoObjectSet <CmBaseAnnotation>(m_cache, uniqueSegments.ToArray(), true); int insertIndex = m_owningSense.ExamplesOS.Count; // by default, insert at the end. int sourceIndex = -1; if (m_les != null) { // we were given a LexExampleSentence, so set our insertion index after the given one. List <int> examples = new List <int>(m_owningSense.ExamplesOS.HvoArray); sourceIndex = examples.IndexOf(m_les.Hvo); insertIndex = sourceIndex + 1; } // Load all the annotations for these twfics. int tagSegFF = StTxtPara.SegmentFreeformAnnotationsFlid(m_cache); Set <int> allAnalWsIds = new Set <int>(m_cache.LangProject.AnalysisWssRC.HvoArray); StTxtPara.LoadSegmentFreeformAnnotationData(m_cache, uniqueSegments, allAnalWsIds); bool fBoolModifiedExisting = false; List <ILexExampleSentence> newExamples = new List <ILexExampleSentence>(); // keep track of how many new objects we created. ILexExampleSentence newLexExample = null; // delay prop changes until all the new examples are added. using (new IgnorePropChanged(m_cache, PropChangedHandling.SuppressView)) { foreach (CmBaseAnnotation cbaSegment in cbaSegments) { if (newExamples.Count == 0 && m_les != null && m_les.Example.BestVernacularAlternative.Text == "***" && (m_les.TranslationsOC == null || m_les.TranslationsOC.Count == 0) && m_les.Reference.Length == 0) { // we were given an empty LexExampleSentence, so use this one for our first new Example. newLexExample = m_les; fBoolModifiedExisting = true; } else { // create a new example sentence. newLexExample = m_owningSense.ExamplesOS.InsertAt(new LexExampleSentence(), insertIndex + newExamples.Count); newExamples.Add(newLexExample); } // copy the segment string into the new LexExampleSentence // Enhance: bold the relevant twfic(s). newLexExample.Example.SetVernacularDefaultWritingSystem(StTxtPara.TssSubstring(cbaSegment).Text); int segDefn_literalTranslation = m_cache.GetIdFromGuid(LangProject.kguidAnnLiteralTranslation); int segDefn_freeTranslation = m_cache.GetIdFromGuid(LangProject.kguidAnnFreeTranslation); int hvoTransType_literalTranslation = m_cache.GetIdFromGuid(LangProject.kguidTranLiteralTranslation); int hvoTransType_freeTranslation = m_cache.GetIdFromGuid(LangProject.kguidTranFreeTranslation); // copy the translation information List <ICmTranslation> newTranslations = new List <ICmTranslation>(); foreach (int freeFormAnnotationId in m_cache.GetVectorProperty(cbaSegment.Hvo, tagSegFF, true)) { int hvoAnnType = m_cache.MainCacheAccessor.get_ObjectProp(freeFormAnnotationId, (int)CmAnnotation.CmAnnotationTags.kflidAnnotationType); // map annotation type to translation type. int hvoTranslationType = 0; if (hvoAnnType == segDefn_literalTranslation) { hvoTranslationType = hvoTransType_literalTranslation; } else if (hvoAnnType == segDefn_freeTranslation) { hvoTranslationType = hvoTransType_freeTranslation; } else { continue; // skip unsupported translation type. } ICmTranslation newTranslation = newLexExample.TranslationsOC.Add(new CmTranslation()); newTranslations.Add(newTranslation); newTranslation.TypeRAHvo = hvoTranslationType; foreach (int analWs in allAnalWsIds) { ITsString tssComment = m_cache.GetMultiStringAlt(freeFormAnnotationId, (int)CmAnnotation.CmAnnotationTags.kflidComment, analWs); if (tssComment.Length > 0) { newTranslation.Translation.SetAlternative(tssComment, analWs); } } } // copy the reference. // Enhance: get the ws from the 'Reference' column spec? // Enhance: AnnotationRefHandler can also m_cache the reference directly to the segment. int iTwfic = twficSegments.IndexOf(cbaSegment.Hvo); newLexExample.Reference.UnderlyingTsString = m_cache.GetTsStringProperty(twfics[iTwfic], m_virtFlidReference); // Need to correctly add Translations (or ghost if none). } } if (fBoolModifiedExisting) { m_cache.PropChanged(null, PropChangeType.kpctNotifyAll, m_les.Hvo, (int)LexExampleSentence.LexExampleSentenceTags.kflidExample, 0, 1, 1); m_cache.PropChanged(null, PropChangeType.kpctNotifyAll, m_les.Hvo, (int)LexExampleSentence.LexExampleSentenceTags.kflidReference, 0, 1, 1); //m_cache.PropChanged(null, PropChangeType.kpctNotifyAll, m_les.Hvo, // (int)LexExampleSentence.LexExampleSentenceTags.kflidTranslations, 0, 1, 1); //m_cache.PropChanged(null, PropChangeType.kpctNotifyAll, m_owningSense.Hvo, // (int)LexSense.LexSenseTags.kflidExamples, sourceIndex, 1, 1); } m_cache.PropChanged(null, PropChangeType.kpctNotifyAll, m_owningSense.Hvo, (int)LexSense.LexSenseTags.kflidExamples, insertIndex, newExamples.Count, 0); }
public override void FixtureSetup() { base.FixtureSetup(); m_entryFactory = Cache.ServiceLocator.GetInstance<ILexEntryFactory>(); m_senseFactory = Cache.ServiceLocator.GetInstance<ILexSenseFactory>(); m_exampleFactory = Cache.ServiceLocator.GetInstance<ILexExampleSentenceFactory>(); m_lexEntryRefFactory = Cache.ServiceLocator.GetInstance<ILexEntryRefFactory>(); m_lexRefTypeFactory = Cache.ServiceLocator.GetInstance<ILexRefTypeFactory>(); m_lexRefFactory = Cache.ServiceLocator.GetInstance<ILexReferenceFactory>(); m_possListFactory = Cache.ServiceLocator.GetInstance<ICmPossibilityListFactory>(); m_flidReferringSenses = Cache.MetaDataCacheAccessor.GetFieldId2(CmSemanticDomainTags.kClassId, "ReferringSenses", false); UndoableUnitOfWorkHelper.Do("do", "undo", Cache.ActionHandlerAccessor, () => { m_domainBadWords = Cache.ServiceLocator.GetInstance<ICmSemanticDomainFactory>().Create(); m_domainTemperature = Cache.ServiceLocator.GetInstance<ICmSemanticDomainFactory>().Create(); Cache.LangProject.SemanticDomainListOA.PossibilitiesOS.Add(m_domainBadWords); Cache.LangProject.SemanticDomainListOA.PossibilitiesOS.Add(m_domainTemperature); m_mainDict = Cache.LangProject.LexDbOA.PublicationTypesOA.PossibilitiesOS[0]; m_blank = MakeEntry("blank", "swear word", true); m_blank.SensesOS[0].SemanticDomainsRC.Add(m_domainBadWords); m_hot = MakeEntry("hot", "high temperature", false); m_hotTemp = m_hot.SensesOS[0]; m_hotTemp.SemanticDomainsRC.Add(m_domainTemperature); m_trouble = MakeSense(m_hot, "trouble"); m_trouble.DoNotPublishInRC.Add(m_mainDict); m_trouble.PicturesOS.Add(Cache.ServiceLocator.GetInstance<ICmPictureFactory>().Create()); m_desirable = MakeSense(m_hot, "desirable"); m_fastCar = MakeSense(m_desirable, "fast (car)"); m_badHot = MakeExample(m_hotTemp, "a hot pile of blank", true); m_goodHot = MakeExample(m_hotTemp, "a hot bath", false); m_water = MakeEntry("water", "H2O", false); m_waterH2O = m_water.SensesOS[0]; m_hotWater = MakeEntry("hot water", "trouble", false); m_hotWaterComponents = MakeEntryRef(m_hotWater, new ICmObject[] { m_trouble, m_waterH2O }, new[] { m_trouble, m_waterH2O }, LexEntryRefTags.krtComplexForm); m_blank2 = MakeEntry("blank", "vacant", false); m_blank3 = MakeEntry("blank", "erase", false); m_water2 = MakeEntry("water", "urinate", true); m_waterPrefix = MakeEntry("water", "aquatic", false); m_waterPrefix.LexemeFormOA.MorphTypeRA = Cache.ServiceLocator.GetInstance<IMoMorphTypeRepository>() .GetObject(MoMorphTypeTags.kguidMorphPrefix); m_synonym = MakeRefType("synonym", null, (int)LexRefTypeTags.MappingTypes.kmtSenseCollection); m_blip = MakeEntry("blip", "rude word", true); m_bother = MakeEntry("bother", "I'm annoyed by that", false); m_ouch = MakeEntry("ouch", "that hurt", false); m_blipOuch = MakeSense(m_blip.SensesOS[0], "rude ouch"); m_blankSynonyms = MakeLexRef(m_synonym, new ICmObject[] {m_blank, m_ouch.SensesOS[0], m_blip.SensesOS[0], m_blipOuch, m_bother}); m_problem = MakeEntry("problem", "difficulty", false); m_problemSynonyms = MakeLexRef(m_synonym, new ICmObject[] { m_problem, m_trouble }); m_body = MakeEntry("body", "body", true); m_arm = MakeEntry("arm", "arm", false); m_leg = MakeEntry("leg", "leg", false); m_belly = MakeEntry("belly", "belly", true); m_torso = MakeEntry("torso", "torso", false); m_partWhole = MakeRefType("partWhole", null, (int)LexRefTypeTags.MappingTypes.kmtEntryTree); m_bodyParts = MakeLexRef(m_partWhole, new ICmObject[] {m_body, m_arm, m_leg.SensesOS[0], m_torso, m_belly}); m_torsoParts = MakeLexRef(m_partWhole, new ICmObject[] {m_torso, m_arm, m_belly}); m_hotBlank = MakeEntry("hotBlank", "problem rude word", false); MakeEntryRef(m_hotBlank, new ICmObject[] { m_trouble, m_water2 }, new ICmObject[] { m_trouble, m_water2 }, LexEntryRefTags.krtComplexForm); m_blueColor = MakeEntry("blue", "color blue", false); m_blueCold = MakeEntry("blue", "cold", false); m_blueMusic = MakeEntry("blue", "jazzy", false); m_blueSad = MakeEntry("blue", "sad", false); m_blueMusic.HomographNumber = 2; // will duplicate blue cold; pathological, but should not crash. m_blueSad.HomographNumber = 3; // will conflict with renumbered blueMusic m_bluer = m_blueColor.SensesOS[0]; m_sky = MakeEntry("sky", "interface between atmosphere and space", false, true); // true excludes as headword m_skyReal = m_sky.SensesOS[0]; m_blueSky = MakeEntry("blue sky", "clear, huge potential", false, false); m_blueSkyComponents = MakeEntryRef(m_blueSky, new ICmObject[] { m_blueColor, m_skyReal }, new[] { m_bluer, m_skyReal }, LexEntryRefTags.krtComplexForm); m_ringBell = MakeEntry("ring", "bell", false, false); m_ringCircle = MakeEntry("ring", "circle", false, true); m_ringGold = MakeEntry("ring", "gold", false, false); m_blackVerb = MakeEntry("black", "darken", false, true); m_blackColor = MakeEntry("black", "dark", false, false); m_hotArm = MakeEntry("hotarm", "pitcher", false, false); m_hotArmComponents = MakeEntryRef(m_hotArm, new ICmObject[] { m_hot, m_arm }, new[] { m_hot, m_arm }, LexEntryRefTags.krtComplexForm); m_hotArm.DoNotPublishInRC.Add(m_mainDict); m_hotArmComponents.ShowComplexFormsInRS.Add(m_hot); m_nolanryan = MakeEntry("Nolan_Ryan", "pitcher", false, false); m_nolanryanComponents = MakeEntryRef(m_nolanryan, new ICmObject[] { m_hot }, new[] { m_hot }, LexEntryRefTags.krtVariant); m_nolanryanComponents.VariantEntryTypesRS.Add( (ILexEntryType)Cache.LangProject.LexDbOA.VariantEntryTypesOA.PossibilitiesOS[0]); m_nolanryan.DoNotPublishInRC.Add(m_mainDict); m_edName = MakeEntry("ed", "someone called ed", false); m_edSuffix = MakeEntry("ed", "past", false, false, true); m_publisher = new MockPublisher((ISilDataAccessManaged)Cache.DomainDataByFlid, kmainFlid); m_publisher.SetOwningPropValue(Cache.LangProject.LexDbOA.Entries.Select(le => le.Hvo).ToArray()); m_decorator = new DictionaryPublicationDecorator(Cache, m_publisher, ObjectListPublisher.OwningFlid); }); }
public void Ensure_smart_method_throws_on_null_owner_example_sentence() { const ILexExampleSentence sentence = null; m_factory.Create(sentence, m_backTranslationType); }
private void VerifyCustomFieldExample(ILexExampleSentence obj, CustomFieldData expectedData) { m_customFieldExampleSentencesIds = GetCustomFlidsOfObject(obj); VerifyCustomField(obj, expectedData, m_customFieldExampleSentencesIds[expectedData.CustomFieldname]); }