本文整理汇总了C#中SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence.BreakPhrase方法的典型用法代码示例。如果您正苦于以下问题:C# AnalysisOccurrence.BreakPhrase方法的具体用法?C# AnalysisOccurrence.BreakPhrase怎么用?C# AnalysisOccurrence.BreakPhrase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIL.FieldWorks.FDO.DomainServices.AnalysisOccurrence
的用法示例。
在下文中一共展示了AnalysisOccurrence.BreakPhrase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BreakPhrase
virtual internal protected void BreakPhrase(int iSegment, int iSegForm)
{
var analysisOccurrence = new AnalysisOccurrence(m_para.SegmentsOS[iSegment], iSegForm);
analysisOccurrence.BreakPhrase();
}
示例2: MakeAndBreakPhrase
public void MakeAndBreakPhrase()
{
UndoableUnitOfWorkHelper.Do("doit", "undoit", Cache.ActionHandlerAccessor,
() =>
{
//the book is red. the pages in the book are the color of the paper.
IStTxtPara para0 = MakeSimpleParsedText();
Assert.AreEqual(5, para0.SegmentsOS[0].AnalysesRS.Count, "check preconditions -- includes final punctuation");
var firstBook = new AnalysisOccurrence(para0.SegmentsOS[0], 1);
firstBook.Analysis.Wordform.Form.AnalysisDefaultWritingSystem = Cache.TsStrFactory.MakeString(
"bookA", Cache.DefaultAnalWs);
var firstIs = new AnalysisOccurrence(para0.SegmentsOS[0], 2);
firstIs.Analysis.Wordform.Form.AnalysisDefaultWritingSystem = Cache.TsStrFactory.MakeString(
"isA", Cache.DefaultAnalWs);
var bookIs = firstBook.MakePhraseWithNextWord();
Assert.AreEqual(4, para0.SegmentsOS[0].AnalysesRS.Count);
Assert.AreEqual("book is", bookIs.BaselineText.Text);
Assert.AreEqual("bookA isA", bookIs.Analysis.Wordform.Form.AnalysisDefaultWritingSystem.Text);
var firstThe = new AnalysisOccurrence(para0.SegmentsOS[0], 0);
Assert.AreEqual(firstThe.BaselineWs, bookIs.BaselineWs);
var bookIsRed = bookIs.MakePhraseWithNextWord();
Assert.AreEqual(3, para0.SegmentsOS[0].AnalysesRS.Count);
Assert.AreEqual("book is red", bookIsRed.BaselineText.Text);
Assert.AreEqual(firstThe.BaselineWs, bookIsRed.BaselineWs);
Assert.IsNull(bookIsRed.MakePhraseWithNextWord());
Assert.IsFalse(bookIsRed.CanMakePhraseWithNextWord());
var phraseWf = bookIsRed.Analysis;
bookIsRed.BreakPhrase();
Assert.AreEqual(5, para0.SegmentsOS[0].AnalysesRS.Count, "break phrase should have restored all wordforms");
Assert.AreEqual("the", new AnalysisOccurrence(para0.SegmentsOS[0], 0).BaselineText.Text);
Assert.AreEqual("book", new AnalysisOccurrence(para0.SegmentsOS[0], 1).BaselineText.Text);
Assert.AreEqual("is", new AnalysisOccurrence(para0.SegmentsOS[0], 2).BaselineText.Text);
Assert.AreEqual("red", new AnalysisOccurrence(para0.SegmentsOS[0], 3).BaselineText.Text);
Assert.AreEqual(".", new AnalysisOccurrence(para0.SegmentsOS[0], 4).BaselineText.Text);
Assert.IsFalse(phraseWf.IsValidObject);
// This checks that we do NOT delete a broken phrase when there are other references.
firstThe.MakePhraseWithNextWord();
var secondTheBook = new AnalysisOccurrence(para0.SegmentsOS[1], 3).MakePhraseWithNextWord();
secondTheBook.BreakPhrase();
Assert.AreEqual("the book", firstThe.BaselineText.Text);
Assert.IsTrue(firstThe.Analysis.IsValidObject);
});
}