realignByQuote method
Implementation
List<String> realignByQuote(String text, int lastQuotePos, String quoteType, bool useHeuristic, bool useQuotesBracketsProcessing,
int maxRecoverStep, int maxRecoverLength, int recoverStep) {
List<String> beforeQuote = splitSentences(
text.substring(0, lastQuotePos), useHeuristic, useQuotesBracketsProcessing, maxRecoverStep, maxRecoverLength, recoverStep, false);
String beforeLast = beforeQuote.isNotEmpty ? beforeQuote.last : "";
beforeQuote = beforeQuote.length == 1 ? [] : beforeQuote;
List<String> afterQuote = splitSentences(
text.substring(lastQuotePos + 1), useHeuristic, useQuotesBracketsProcessing, maxRecoverStep, maxRecoverLength, recoverStep, false);
String afterFirst = afterQuote.isNotEmpty ? afterQuote.first : "";
afterQuote = afterQuote.length == 1 || afterQuote.isEmpty ? [] : afterQuote.getRange(1, afterQuote.length - 1).toList();
List<String> middleQuote = [];
middleQuote.add(beforeLast + quoteType + afterFirst);
List<String> results = [];
results.addAll(beforeQuote);
results.addAll(middleQuote);
results.addAll(afterQuote);
return results;
}