public void Process() { _currentWordSegment = _wordNav.Next(_text, _currentWordSegment.Offset); _currentSentSegment = _sentenceNav.Next(_text, _currentSentSegment.Offset); _currentSent = _text.GetText(_currentSentSegment); while (!SimpleSegment.IsInvalid(_currentWordSegment)) { _currentWord = _text.GetText(_currentWordSegment); if (_currentWordSegment.Offset > _currentSentSegment.EndOffset) { _currentSentSegment = _sentenceNav.Next(_text, _currentSentSegment.Offset); _currentSent = _text.GetText(_currentSentSegment); } ProcessWord(); _currentWordSegment = _wordNav.Next(_text, _currentWordSegment.Offset); } // Save stat File.WriteAllText("notFound.txt", NotFoundWords.Count + Environment.NewLine); File.AppendAllLines("notFound.txt", NotFoundWords); File.WriteAllText("SingleAccentWords.txt", SingleAccentWords.Count + Environment.NewLine); File.AppendAllLines("SingleAccentWords.txt", SingleAccentWords); File.WriteAllText("ManyAccentWords.txt", ManyAccentWords.Count + Environment.NewLine); File.AppendAllLines("ManyAccentWords.txt", ManyAccentWords); }
public ISegment Next(IText text, int offset) { int textLength = text.TextLength; if (offset >= textLength - 1) { return(SimpleSegment.Invalid); } var sep1 = _baseNavigator.Next(text, offset); int nextOffset = sep1.EndOffset; if (SimpleSegment.IsInvalid(sep1)) { return(sep1); } var sep2 = _baseNavigator.Next(text, nextOffset); int endOffset = sep2.Offset; if (_baseNavigator is SentenceNavigator) { endOffset = sep2.EndOffset; } if (sep2.Offset == -1 || sep2.Length == -1) { endOffset = textLength; } int len = endOffset - nextOffset; if (len <= 0) { return(SimpleSegment.Invalid); } return(new SimpleSegment(nextOffset, len)); }