本文整理汇总了C#中ITsString.ToWsOnlyString方法的典型用法代码示例。如果您正苦于以下问题:C# ITsString.ToWsOnlyString方法的具体用法?C# ITsString.ToWsOnlyString怎么用?C# ITsString.ToWsOnlyString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITsString
的用法示例。
在下文中一共展示了ITsString.ToWsOnlyString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateOrReuseAnnotation
/// <summary>
///
/// </summary>
/// <param name="tssWordTextIn"></param>
/// <param name="ichMin"></param>
/// <param name="ichLim"></param>
/// <param name="iWfAnalysis">index of the analysis we will create in the overall list of wordform analyses for the paragraph.</param>
/// <param name="tssWordAnn">the wordform of the matching annotation (could be a phrase).</param>
/// <returns>the new or reused annotation id</returns>
private IAnalysis CreateOrReuseAnnotation(ITsString tssWordTextIn, int ichMin, int ichLim, int iWfAnalysis, out ITsString tssWordAnn)
{
ITsString tssWordText = tssWordTextIn.ToWsOnlyString();
// First see if we can find a real annotation we can reuse for the wordform or alternative case.
IWfiWordform wf;
IAnalysis analysis;
TryReuseAnalysis(tssWordText, ichMin, ichLim, iWfAnalysis, out wf, out tssWordAnn, out analysis);
if (tssWordAnn.Length == 0)
tssWordAnn = tssWordText;
// check to see if we can match a user-confirmed phrase to establish a user based guess.
// if we didn't find a real annotation or it's only an annotation for a WfiWordform.
if (!SegmentFormCollectionMode && PossiblePhrases.Count > 0 && HasTrivialAnalysis(analysis))
{
ITsString tssPhrase;
if (TryCreatePhrase(tssWordText, ichMin, iWfAnalysis, tssWordAnn.Length, out tssPhrase))
{
tssWordAnn = tssPhrase;
analysis = null; // indicates the need to create a new annotation.
}
}
// When searching for existing Wordforms, include lower-case forms when the beginning index is 0 or 1
// (in case of leading quote etc (one but not two), but still safe for one-letter initial word).
var isFirstWord = ichMin < 2;
// if we couldn't find an existing annotation to use, try to create one.
return analysis ?? FindOrCreateWordform(tssWordAnn, isFirstWord);
}