/// <summary> /// Проверка, что заданное найденное значение союза разрезает сущность /// </summary> /// <param name="entity">сущность</param> /// <param name="conjunctionMatch">найденное значение союза</param> /// <returns>результат проверки</returns> private bool IsConjunctionSplitEntity(Entity entity, Match conjunctionMatch) { int realStart = _conjunctionShift + _sourceBuilder.GetRealPosition(conjunctionMatch.Index); int realEnd = _conjunctionShift + _sourceBuilder.GetRealPosition(conjunctionMatch.Index + conjunctionMatch.Length); return(!IsConjunctionContainEntity(entity, realStart, realEnd) && (entity.IsPositionInsideEntity(realStart) || entity.IsPositionInsideEntity(realEnd))); }
/// <summary> /// Замена исключений в заданном тексте /// </summary> /// <param name="sourceText">текст</param> /// <returns>результирующая строка</returns> private string ReplaceExclusions(string sourceText) { StringBuilder text = new StringBuilder(sourceText); SimpleStringBuilder builder = new SimpleStringBuilder(text.ToString()); foreach (Match match in _conjunctionExclusionsRegex.Matches(builder.LowerValue)) { if (IsPossibleNearSymbols(builder.LowerValue, match)) { int start = builder.GetRealPosition(match.Index); int length = builder.GetRealPosition(match.Index + match.Length) - start; text.Replace(sourceText.Substring(start, length), new string('_', length), start, length); } } return(text.ToString()); }