本文整理汇总了C#中Sentence.IsValid方法的典型用法代码示例。如果您正苦于以下问题:C# Sentence.IsValid方法的具体用法?C# Sentence.IsValid怎么用?C# Sentence.IsValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sentence
的用法示例。
在下文中一共展示了Sentence.IsValid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: parseSentences
/// <summary>
/// Parses the specifiekd paragraph into sentences, creates
/// a list of sentence object and adds the list to the paragraph
/// object
/// </summary>
/// <param name="para">paragraph object</param>
/// <param name="text">para text</param>
/// <param name="index">index in the text to start from</param>
/// <returns>index in the text where parsing stopped</returns>
private int parseSentences(Paragraph para, String text, int index)
{
int ii;
for (ii = index; ii < text.Length; )
{
if (isParagraphTerminator(text[ii]))
{
break;
}
ii = skipWhiteSpaces(text, ii);
int start = ii;
ii = skipSentenceAndParaTerminators(text, start);
if (ii > start)
{
var sentence = new Sentence(para) { Start = start, Length = ii - start };
if (sentence.Length > 0 &&
sentence.IsValid(textBox1.Text.Substring(sentence.Start, sentence.Length)))
{
para.Sentences.Add(sentence);
}
}
ii = skipSentenceTerminators(text, ii);
}
while (true)
{
int sentenceNum = resolveAbbreviations(para, text);
if (sentenceNum < 0)
{
break;
}
Sentence s = para.Sentences[sentenceNum + 1];
para.Sentences[sentenceNum].Length += s.Length + (s.Start - para.Sentences[sentenceNum].End);
para.Sentences.Remove(s);
}
return ii;
}