/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// <param name="text"></param> /// <returns></returns> /// ------------------------------------------------------------------------------------ private string CountLettersAndReturnWordWithOnlyWordFormingCharacters(string text) { for (int i = 0; i < text.Length; i++) { char cc = text[i]; if (m_categorizer.IsUpper(cc)) { m_upperCaseLetters++; } if (m_categorizer.IsLower(cc)) { m_lowerCaseLetters++; } if (m_categorizer.IsTitle(cc)) { m_upperCaseLetters++; m_lowerCaseLetters++; } if (!m_categorizer.IsWordFormingCharacter(cc)) { text = text.Remove(i, 1); i--; } } return(text); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Processes the Scripture token. /// </summary> /// <param name="tok">The token.</param> /// <param name="result">The result.</param> /// ------------------------------------------------------------------------------------ public void ProcessToken(ITextToken tok, List <TextTokenSubstring> result) { string tokenText = RemoveAbbreviations(tok); RecordParagraphStyle(tok); RecordCharacterStyle(tok); // must be at least one character in token to check the case of if (tok.Text == String.Empty) { return; } for (int iChar = 0; iChar < tokenText.Length; iChar++) { char ch = tokenText[iChar]; if (IsSentenceFinalPunctuation(ch)) { m_fAtSentenceStart = iChar + 1 == tokenText.Length || (iChar + 1 < tokenText.Length && !char.IsDigit(tokenText[iChar + 1])); continue; } if (!m_categorizer.IsWordFormingCharacter(ch)) { continue; } if (m_categorizer.IsLower(ch)) { TextTokenSubstring tts = GetSubstring(tok, iChar); if (!CheckForParaCapitalizationError(tok, tts, result) && !CheckForCharStyleCapilizationError(tok, tts, result) && m_fAtSentenceStart) { tts.Message = CapitalizationCheck.GetErrorMessage(m_checksDataSource, StyleCapInfo.CapCheckTypes.SentenceInitial, string.Empty); result.Add(tts); } } m_fAtSentenceStart = false; m_foundCharacterText = true; m_foundParagraphText = true; } }