本文整理汇总了C#中LexSense类的典型用法代码示例。如果您正苦于以下问题:C# LexSense类的具体用法?C# LexSense怎么用?C# LexSense使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LexSense类属于命名空间,在下文中一共展示了LexSense类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ModifiedDateAfterLexSenseGlossChange
public void ModifiedDateAfterLexSenseGlossChange()
{
LexSense sense = new LexSense();
_entry.Senses.Add(sense);
long start = _entry.ModificationTime.Ticks;
Thread.Sleep(1000); //else modtime doesn't change
sense.Gloss["foo"] = "hello";
Assert.Greater((decimal) _entry.ModificationTime.Ticks, start);
Assert.IsTrue(_didNotify);
}
开发者ID:bbriggs,项目名称:wesay,代码行数:10,代码来源:EventsAndDates.cs
示例2: ModifiedDateAfterAddingExampleSentence
public void ModifiedDateAfterAddingExampleSentence()
{
LexSense sense = new LexSense();
_entry.Senses.Add(sense);
long start = _entry.ModificationTime.Ticks;
Thread.Sleep(1000); //else modtime doesn't change
sense.ExampleSentences.Add(new LexExampleSentence());
;
Assert.Greater((decimal) _entry.ModificationTime.Ticks, start);
Assert.IsTrue(_didNotify);
}
开发者ID:bbriggs,项目名称:wesay,代码行数:11,代码来源:EventsAndDates.cs
示例3: Create
/// <summary>
/// Create a new sense and add it to the given entry.
/// </summary>
/// <param name="entry"></param>
/// <param name="sandboxMSA"></param>
/// <param name="gloss"></param>
/// <returns></returns>
public ILexSense Create(ILexEntry entry, SandboxGenericMSA sandboxMSA, ITsString gloss)
{
var sense = new LexSense();
entry.SensesOS.Add(sense);
sense.SandboxMSA = sandboxMSA;
if (gloss != null)
{
sense.Gloss.set_String(gloss.get_WritingSystemAt(0), gloss);
}
return sense;
}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:19,代码来源:FdoFactoryAdditions.cs
示例4: SpinSenseOffToItsOwnEntry
/// <summary>
/// Note, this isn't very ambitious. The only thing the new entry will have is the lexeme form and the new sense, not any other traits/fields
/// </summary>
/// <param name="repo"> </param>
/// <param name="sense"></param>
private static void SpinSenseOffToItsOwnEntry(LiftLexEntryRepository repo, LexSense sense, IProgress progress)
{
var existingEntry = (LexEntry) sense.Parent;
progress.WriteMessage("Splitting off {0} ({1}) into its own entry", existingEntry.LexicalForm.GetFirstAlternative(), sense.Definition.GetFirstAlternative());
LexEntry newEntry = repo.CreateItem();
newEntry.LexicalForm.MergeIn(existingEntry.LexicalForm);
existingEntry.Senses.Remove(sense);
newEntry.Senses.Add(sense);
sense.Parent = newEntry;
repo.SaveItem(existingEntry);
repo.SaveItem(newEntry);
}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:17,代码来源:EntrySplitter.cs
示例5: Construct_TargetIdNull_TargetIdIsEmptyString
public void Construct_TargetIdNull_TargetIdIsEmptyString()
{
LexSense sense = new LexSense();
LexRelationType synonymRelationType = new LexRelationType("synonym",
LexRelationType.Multiplicities
.Many,
LexRelationType.TargetTypes.
Sense);
LexRelation relation = new LexRelation(synonymRelationType.ID, null, sense);
Assert.AreEqual(null, relation.GetTarget(_lexEntryRepository));
Assert.AreEqual(string.Empty, relation.Key);
}
开发者ID:bbriggs,项目名称:wesay,代码行数:13,代码来源:LexRelationTests.cs
示例6: TargetId_SetNull_GetStringEmpty
public void TargetId_SetNull_GetStringEmpty()
{
LexSense sense = new LexSense();
LexRelationType synonymRelationType = new LexRelationType("synonym",
LexRelationType.Multiplicities
.Many,
LexRelationType.TargetTypes.
Sense);
LexRelation relation = new LexRelation(synonymRelationType.ID, "something", sense);
relation.Key = null;
Assert.AreEqual(null, relation.GetTarget(_lexEntryRepository));
Assert.AreEqual(string.Empty, relation.Key);
}
开发者ID:bbriggs,项目名称:wesay,代码行数:14,代码来源:LexRelationTests.cs
示例7: HelperGetsActivationCall
public void HelperGetsActivationCall()
{
LexEntry entry = _db4oRepository.CreateItem();
entry.LexicalForm.SetAlternative("en", "test");
LexSense sense = new LexSense();
entry.Senses.Add(sense);
_db4oRepository.SaveItem(entry);
Assert.AreEqual(entry, sense.Parent);
int activations = _db4oRepository.ActivationCount;
CycleDatabase();
entry = GetFirstEntry();
Assert.AreEqual(1, _db4oRepository.CountAllItems());
Assert.AreEqual(1, entry.Senses.Count);
Assert.AreEqual(activations + 1 /*entry*/+ 1 /*sense*/, _db4oRepository.ActivationCount);
}
开发者ID:bbriggs,项目名称:wesay,代码行数:18,代码来源:PersistenceTests.cs
示例8: TryMergeSenseWithSomeExistingSense
public static bool TryMergeSenseWithSomeExistingSense(LexSense targetSense, LexSense incomingSense, string[] traitsWithMultiplicity, IProgress progress)
{
//can we unify the properites?
if (!TryMergeProperties(targetSense, incomingSense, traitsWithMultiplicity, "senses of " + targetSense.Parent.ToString(), progress))
{
return false;
}
progress.WriteMessageWithColor("blue", "Merged two senses of {0} together: {1} into {2}", targetSense.Parent.ToString(), incomingSense.Id, targetSense.Id);
//at this point, we're committed);
foreach (var lexExampleSentence in incomingSense.ExampleSentences)
{
targetSense.ExampleSentences.Add(lexExampleSentence);
}
return true;
}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:19,代码来源:SenseMerger.cs
示例9: MergeOrAddSense
private static void MergeOrAddSense(LexEntry targetEntry, LexSense incomingSense, string[] traitsWithMultiplicity, IProgress progress)
{
if (targetEntry.Senses.Count == 0)
{
targetEntry.Senses.Add(incomingSense);//no problem!
}
else
{
if (targetEntry.Senses.Count == 1)
{
var targetSense = targetEntry.Senses[0];
if (SenseMerger.TryMergeSenseWithSomeExistingSense(targetSense, incomingSense, traitsWithMultiplicity, progress))
{
//it was merged in
return;
}
}
}
//it needs to be added
targetEntry.Senses.Add(incomingSense);
}
开发者ID:jwickberg,项目名称:libpalaso,代码行数:21,代码来源:EntryMerger.cs
示例10: Setup
public void Setup()
{
_entry = new LexEntry();
_sense = new LexSense();
_entry.Senses.Add(_sense);
#if GlossMeaning
this._sense.Gloss["th"] = "sense";
#else
_sense.Definition["th"] = "sense";
#endif
MultiText customFieldInSense =
_sense.GetOrCreateProperty<MultiText>("customFieldInSense");
customFieldInSense["th"] = "custom";
_examples = new LexExampleSentence();
_sense.ExampleSentences.Add(_examples);
_examples.Sentence["th"] = "example";
_examples.Translation["en"] = "translation";
MultiText customFieldInExample =
_examples.GetOrCreateProperty<MultiText>("customFieldInExample");
customFieldInExample["th"] = "custom";
_entry.EmptyObjectsRemoved += _entry_EmptyObjectsRemoved;
_entry.PropertyChanged += _entry_PropertyChanged;
_removed = false;
}
开发者ID:bbriggs,项目名称:wesay,代码行数:24,代码来源:LexEntryTests.cs
示例11: Picture_OutputAsPictureWithCaption
public void Picture_OutputAsPictureWithCaption()
{
LexSense sense = new LexSense();
PictureRef p = sense.GetOrCreateProperty<PictureRef>("Picture");
p.Value = "bird.jpg";
p.Caption = new MultiText();
p.Caption["aa"] = "aCaption";
_exporter.Add(sense);
_exporter.End();
CheckAnswer(GetSenseElement(sense) +
"<illustration href=\"bird.jpg\"><label><form lang=\"aa\"><text>aCaption</text></form></label></illustration></sense>");
}
开发者ID:bbriggs,项目名称:wesay,代码行数:12,代码来源:LiftExportTests.cs
示例12: LexSense_becomes_sense
public void LexSense_becomes_sense()
{
LexSense sense = new LexSense();
_exporter.Add(sense);
_exporter.End();
Assert.IsTrue(_stringBuilder.ToString().StartsWith("<sense"));
}
开发者ID:bbriggs,项目名称:wesay,代码行数:7,代码来源:LiftExportTests.cs
示例13: NoteOnSense_OutputAsNote
public void NoteOnSense_OutputAsNote()
{
LexSense sense = new LexSense();
MultiText m =
sense.GetOrCreateProperty<MultiText>(WeSayDataObject.WellKnownProperties.Note);
m["zz"] = "orange";
_exporter.Add(sense);
_exporter.End();
AssertXPathNotNull("sense/note/form[@lang='zz' and text='orange']");
AssertXPathNotNull("sense[not(field)]");
}
开发者ID:bbriggs,项目名称:wesay,代码行数:11,代码来源:LiftExportTests.cs
示例14: MultipleGlossesCombined
public void MultipleGlossesCombined()
{
LexSense sense = new LexSense();
_builder.MergeInGloss(sense, MakeBasicLiftMultiText());
LiftMultiText secondGloss = new LiftMultiText();
secondGloss.Add("ws-one", "UNO");
secondGloss.Add("ws-three", "tres");
_builder.MergeInGloss(sense, secondGloss);
//MultiText mt = sense.GetProperty<MultiText>(LexSense.WellKnownProperties.Note);
Assert.AreEqual(3, sense.Gloss.Forms.Length);
Assert.AreEqual("uno; UNO", sense.Gloss["ws-one"]);
}
开发者ID:JohnThomson,项目名称:libpalaso,代码行数:13,代码来源:LexEntryFromLiftBuilderTests.cs
示例15: SenseGetsNote
public void SenseGetsNote()
{
LexSense sense = new LexSense();
_builder.MergeInNote(sense, null, MakeBasicLiftMultiText(), string.Empty);
AssertPropertyHasExpectedMultiText(sense, PalasoDataObject.WellKnownProperties.Note);
}
开发者ID:JohnThomson,项目名称:libpalaso,代码行数:6,代码来源:LexEntryFromLiftBuilderTests.cs
示例16: SenseGetsRelation
public void SenseGetsRelation()
{
LexSense sense = new LexSense();
_builder.MergeInRelation(sense, "synonym", "foo", null);
LexRelationCollection synonyms = sense.GetProperty<LexRelationCollection>("synonym");
LexRelation relation = synonyms.Relations[0];
Assert.AreEqual("synonym", relation.FieldId);
Assert.AreEqual("foo", relation.Key);
}
开发者ID:JohnThomson,项目名称:libpalaso,代码行数:9,代码来源:LexEntryFromLiftBuilderTests.cs
示例17: GrammiGetsFlagTrait
public void GrammiGetsFlagTrait()
{
LexSense sense = new LexSense();
_builder.MergeInGrammaticalInfo(sense,
"red",
new List<Trait>(new Trait[] {new Trait("flag", "1")}));
OptionRef optionRef =
sense.GetProperty<OptionRef>(LexSense.WellKnownProperties.PartOfSpeech);
Assert.IsTrue(optionRef.IsStarred);
}
开发者ID:JohnThomson,项目名称:libpalaso,代码行数:10,代码来源:LexEntryFromLiftBuilderTests.cs
示例18: GetSenseElement
private static string GetSenseElement(LexSense sense)
{
return string.Format("<sense id=\"{0}\">", sense.GetOrCreateId());
}
开发者ID:bbriggs,项目名称:wesay,代码行数:4,代码来源:LiftExportTests.cs
示例19: Picture_OutputAsPictureURLRef
public void Picture_OutputAsPictureURLRef()
{
LexSense sense = new LexSense();
PictureRef p = sense.GetOrCreateProperty<PictureRef>("Picture");
p.Value = "bird.jpg";
_exporter.Add(sense);
_exporter.End();
CheckAnswer(GetSenseElement(sense) + "<illustration href=\"bird.jpg\" /></sense>");
}
开发者ID:bbriggs,项目名称:wesay,代码行数:9,代码来源:LiftExportTests.cs
示例20: SenseGetsGrammi
public void SenseGetsGrammi()
{
LexSense sense = new LexSense();
_builder.MergeInGrammaticalInfo(sense, "red", null);
OptionRef optionRef =
sense.GetProperty<OptionRef>(LexSense.WellKnownProperties.PartOfSpeech);
Assert.IsNotNull(optionRef);
Assert.AreEqual("red", optionRef.Value);
}
开发者ID:JohnThomson,项目名称:libpalaso,代码行数:9,代码来源:LexEntryFromLiftBuilderTests.cs
注:本文中的LexSense类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论