/// <inheritdoc /> public bool MoveNext() { int i = _p; int j = 0; bool escapeMode = false; while (i != _charSet.Length) { char c = _charSet[i]; // Toggle escape mode if (c == SpecChars.DQ || c == SpecChars.SQ) { escapeMode = !escapeMode; } // In escape mode, we have nothing to do if (escapeMode) { goto TakeAndGo; } // Determine if we have a word separator bool isWordSeparator = Array.IndexOf(_wordSeparator, c) != -1; // Is this character a word separator? If so, it must not be a special construction (date, URL, ...) if (isWordSeparator && !_textKit.IsSpecialTerm(_charSet, i, _lang)) { string wordStr = new string(_buffer, 0, j); Current = new Word(wordStr, _p); // Play forward until we reach the next valuable letter int n = i + 1; _textKit.PlayForward(_charSet, ref n); _p = n; return(true); } // We ignore bias characters if (TextKit.IsBias(BiasSet, c)) { goto NextRound; } TakeAndGo: // Character is relevant, so we take it _buffer[j++] = c; NextRound: i++; } return(false); }
/// <inheritdoc /> public bool MoveNext() { int i = _p; bool escapeMode = false; while (i != _charSet.Length) { char c = _charSet[i]; // Toggle escape mode if (c == SpecChars.DQ || c == SpecChars.SQ) { escapeMode = !escapeMode; } // In escape mode, we have nothing to do if (escapeMode) { goto NextRound; } // Determine if we have a punctuation mark bool isPuncMark = Array.IndexOf(_puncMarks, c) != -1; if (isPuncMark) { // Get next valueable character int nx = i + 1; _textKit.PlayForward(_charSet, ref nx); // Sentence ends if there is no additional data or the next character is upper case bool closeSentence; if (nx == _charSet.Length) { closeSentence = true; } else { char cx = _charSet[nx]; closeSentence = char.IsUpper(cx); } // Shift and create sentence if (closeSentence) { int end = i + 1; int length = end - _p; string text = new string(_charSet, _p, length); Current = new Sentence(text, _p); _p = nx; return(true); } } // Sentence ends here, if the punc mark does not indiciate a special construction // if (isPuncMark && !_textKit.IsSpecialTerm(_charSet, i, _lang)) { // int end = i + 1; // int length = end - _p; // string text = new string(_charSet, _p, length); // Current = new Sentence(text, _p); // // // Play forward until we reach the next valuable letter // int n = end; // _textKit.PlayForward(_charSet, ref n); // // _p = n; // return true; // } NextRound: i++; } return(false); }