From 5afeda83278ebe2db6facb98ff226ca34a0ce76f Mon Sep 17 00:00:00 2001 From: VoiceLessQ <44067308+VoiceLessQ@users.noreply.github.com> Date: Thu, 12 Nov 2026 13:37:00 -0200 Subject: [PATCH] =?UTF-8?q?craft-proof=20it:=20a=20=E2=80=98=20quote=20can?= =?UTF-8?q?=20open=20the=20next=20sentence,=20as=20=E2=80=9C=20and=20?= =?UTF-8?q?=C2=AB=20do?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- crates/proof/src/it/grammar.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/proof/src/it/grammar.rs b/crates/proof/src/it/grammar.rs index 9019218c3..a46a5012a 100644 --- a/crates/proof/src/it/grammar.rs +++ b/crates/proof/src/it/grammar.rs @@ -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) { @@ -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"),