From 2f4f74dc6d3f57d51f4efa075c4d041c8201f4b2 Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Wed, 20 Nov 2024 11:19:49 -0800 Subject: [PATCH] Apostrophe should not always cause step to return CharClass::InWord (#244) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Similar to ", ”, «, and other such characters, an apostrophe can mark a quotation, in which case the character after it may need to be upper case. Before this commit, Hayagriva always considered the character after an apostrophe to be within a word, and therefore lowercased it. --- src/lang/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lang/mod.rs b/src/lang/mod.rs index 75cae07..0829bcd 100644 --- a/src/lang/mod.rs +++ b/src/lang/mod.rs @@ -164,7 +164,7 @@ impl CharClass { } '(' | '[' | '{' => Self::NewSubclause, ')' | ']' | '}' => self, - '"' | '”' | '“' | '»' | '›' | '«' | '‹' | '‘' => self, + '"' | '”' | '“' | '»' | '›' | '«' | '‹' | '‘' | '\'' => self, ',' | ';' => { if self.is_in_word() { Self::MaybeSubclause @@ -913,6 +913,10 @@ mod tests { let title = case.transform("Around a table: the reason why we just could not care"); assert_eq!("Around a Table: The Reason Why We Just Could Not Care", title); + + let title = + case.transform("'My colleague is a robot' – exploring frontline employees' willingness to work with collaborative service robots"); + assert_eq!("'My Colleague Is a Robot' – Exploring Frontline Employees' Willingness to Work with Collaborative Service Robots", title); } #[test]