craft-proof it: a ‘ quote can open the next sentence, as “ and « do

In "Vado. ‘poi’ torno." the capital-letter check skipped poi, because ends_sentence didn't count ‘ among the characters that may open the next sentence. This is the last part of storytold/wordcraft#3675; the rest came with #484.

---------

Co-authored-by: VoiceLessQ <t12kaem@gmail.com>
This commit is contained in:
VoiceLessQandVoiceLessQ authored and GitHub committed 2026-11-12 10:37:00 -05:00
1 parent 9b7b748fbb
commit 5afeda8327
1 file changed
+4 -1
+4 -1
View File
@@ -172,7 +172,7 @@ fn ends_sentence(gap: &str, prev: &str) -> bool {
return false;
}
rest.starts_with(char::is_whitespace)
&& rest.trim_start().chars().all(|c| c.is_whitespace() || matches!(c, '"' | '“' | '«' | '(' | '[' | '\'' | '—'))
&& rest.trim_start().chars().all(|c| c.is_whitespace() || matches!(c, '"' | '“' | '‘' | '«' | '(' | '[' | '\'' | '—'))
}
fn repeated_words(text: &str, ws: &[(usize, usize)], v: &mut Vec<Issue>) {
@@ -402,6 +402,9 @@ mod tests {
assert!(fixes("Vado a Roma. il cane dorme.").contains(&pair("il", "Il")));
assert!(fixes("Vado a Roma? sì.").contains(&pair("sì", "Sì")));
assert!(!fixes("Vado a Roma. Il cane dorme.").iter().any(|(_, b)| b == "Il"));
// A single opening quote can open the next sentence, as `“` and `«` do (wordcraft#3675).
assert!(fixes("Vado. ‘poi’ torno.").contains(&pair("poi", "Poi")), "{:?}", fixes("Vado. ‘poi’ torno."));
assert!(fixes("Vado. ‘Poi’ torno.").is_empty(), "{:?}", fixes("Vado. ‘Poi’ torno."));
for t in ["Il sig. rossi arriva.", "Vedi pp. dieci e oltre.", "Nella tab. due.", "Il dr. bianchi arriva.", "Mele, pere ecc. sono frutti."] {
assert!(
!fixes(t).iter().any(|(_, b)| b.starts_with(char::is_uppercase) && b != "Il" && b != "Vedi" && b != "Nella" && b != "Mele"),