From f723abff6ddabe1c03bb86239f9b489a60f370b9 Mon Sep 17 00:00:00 2001 From: Martin Ball Date: Sun, 1 Nov 2026 22:24:53 +0000 Subject: [PATCH] =?UTF-8?q?CP6.13:=20tr=20hyphen=20=E2=80=94=20=C3=A2,=20?= =?UTF-8?q?=C3=AE=20and=20=C3=BB=20are=20vowels=20(d=C3=BCk-k=C3=A2n,=20hi?= =?UTF-8?q?-k=C3=A2-ye);=20the=20module=20doc's=20examples=20are=20the=20o?= =?UTF-8?q?nes=20the=20rules=20give=20(CodeRabbit=20on=20craft-libs#484)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FypgCX8LsYYE8fsj4byBm2 --- crates/proof/src/tr/hyphen.rs | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/crates/proof/src/tr/hyphen.rs b/crates/proof/src/tr/hyphen.rs index a8a48108..1479a53e 100644 --- a/crates/proof/src/tr/hyphen.rs +++ b/crates/proof/src/tr/hyphen.rs @@ -3,12 +3,13 @@ //! Turkish words are split at syllables according to Turkish Language Association (TDK) rules. //! Because Turkish syllable boundaries are fully regular, they can be determined directly by rule //! without needing external pattern files or word lists: -//! - Turkish vowels: `a`, `e`, `ı`, `i`, `o`, `ö`, `u`, `ü` (both lowercase and uppercase). -//! - A single consonant between two vowels joins the following syllable (`ba-lık`, `ö-ğren-ci`). +//! - Turkish vowels: `a`, `e`, `ı`, `i`, `o`, `ö`, `u`, `ü`, and `â`, `î`, `û` (`hi-kâ-ye`, +//! `dük-kân`), lowercase and uppercase. +//! - A single consonant between two vowels joins the following syllable (`ba-lık`, `a-ra-ba`). //! - Of two consonants between two vowels, the first stays with the preceding syllable and the -//! second joins the next (`alt-lık`, `sev-gi`, `tür-kçe`). +//! second joins the next (`öğ-ren-ci`, `sev-gi`, `kar-deş`). //! - Of three consonants between two vowels, the first two stay with the preceding syllable and the -//! third joins the next (`türk-çe`, `sürp-riz`). +//! third joins the next (`türk-çe`, `alt-lık`, `sürp-riz`). //! - In compound words, syllable division follows pronunciation across the boundary (`ba-şöğ-ret-men`, //! `il-ko-kul`), which matches the general vowel/consonant distribution rules. //! @@ -17,7 +18,7 @@ /// Is `c` a Turkish vowel? pub fn is_vowel(c: char) -> bool { - matches!(c, 'a' | 'e' | 'ı' | 'i' | 'o' | 'ö' | 'u' | 'ü' | 'A' | 'E' | 'I' | 'İ' | 'O' | 'Ö' | 'U' | 'Ü') + matches!(c, 'a' | 'e' | 'ı' | 'i' | 'o' | 'ö' | 'u' | 'ü' | 'â' | 'î' | 'û' | 'A' | 'E' | 'I' | 'İ' | 'O' | 'Ö' | 'U' | 'Ü' | 'Â' | 'Î' | 'Û') } /// Is `c` a Turkish letter? @@ -86,6 +87,18 @@ mod tests { assert_eq!(split("başöğretmen"), "ba-şöğ-ret-men"); } + /// CodeRabbit on craft-libs#484: `â`, `î` and `û` are vowels, and the module doc's examples + /// are the ones the rules give. + #[test] + fn circumflex_vowels_and_doc_examples() { + assert_eq!(split("dükkân"), "dük-kân"); + assert_eq!(split("hikâye"), "hi-kâ-ye"); + assert_eq!(split("kâğıt"), "kâ-ğıt"); + assert_eq!(split("millî"), "mil-lî"); + assert_eq!(split("kardeş"), "kar-deş"); + assert_eq!(split("sürpriz"), "sürp-riz"); + } + #[test] fn short_or_non_words_stay_unsplit() { assert_eq!(split(""), "");