1
0
Fork 0

Improved rules for automatic capitalization at the begining of a sentence (#314)

Co-authored-by: Alex Knop <alexknoptech@protonmail.com>
This commit is contained in:
alexknop 2023-07-26 08:45:39 -04:00 committed by GitHub
parent 8a1fbe5a6a
commit 60da04fa6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,7 +7,7 @@ public class TextTools {
private static final Pattern previousIsLetter = Pattern.compile("\\p{L}$");
private static final Pattern nextIsPunctuation = Pattern.compile("^\\p{Punct}");
private static final Pattern nextToWord = Pattern.compile("\\b$");
private static final Pattern startOfSentence = Pattern.compile("(?<!\\.)(^|[.?!¿¡])\\s*$");
private static final Pattern startOfSentence = Pattern.compile("(?<!\\.)(^|[.?!¿¡])\\s+$");
public static boolean containsOtherThan1(String str) {
return str != null && containsOtherThan1.matcher(str).find();