@@ -2076,6 +2076,30 @@ mod tests {
20762076 ) ;
20772077 }
20782078
2079+ #[ test]
2080+ fn contact_cta_rules_do_not_force_low_editorial_confidence ( ) {
2081+ let ruleset = crate :: rules:: loader:: load_embedded_ruleset ( ) . unwrap ( ) ;
2082+ let scanner = Scanner :: new ( ruleset. spelling_rules , ruleset. case_rules ) ;
2083+
2084+ let issues = scanner. scan ( "如需協助請聯繫客服" ) . issues ;
2085+ assert_eq ! (
2086+ issues. len( ) ,
2087+ 1 ,
2088+ "expected CTA phrase to match once: {issues:?}"
2089+ ) ;
2090+ assert_eq ! ( issues[ 0 ] . found, "如需協助請聯繫" ) ;
2091+ assert_eq ! ( issues[ 0 ] . editorial_confidence, None ) ;
2092+
2093+ let issues = scanner. scan ( "歡迎聯繫我們" ) . issues ;
2094+ assert_eq ! (
2095+ issues. len( ) ,
2096+ 1 ,
2097+ "expected contact-us phrase to match once: {issues:?}"
2098+ ) ;
2099+ assert_eq ! ( issues[ 0 ] . found, "聯繫我們" ) ;
2100+ assert_eq ! ( issues[ 0 ] . editorial_confidence, None ) ;
2101+ }
2102+
20792103 // --- positional_clues tests ---
20802104
20812105 #[ test]
@@ -2482,6 +2506,79 @@ mod tests {
24822506 ) ;
24832507 }
24842508
2509+ #[ test]
2510+ fn lian_xi_contact_copy_uses_phrase_rules_without_general_prose_fp ( ) {
2511+ let rules = vec ! [
2512+ SpellingRule :: new( "聯繫我們" , vec![ "聯絡我們" . into( ) ] , RuleType :: CrossStrait ) ,
2513+ SpellingRule :: new( "聯繫方式" , vec![ "聯絡方式" . into( ) ] , RuleType :: CrossStrait ) ,
2514+ SpellingRule :: new( "聯繫資訊" , vec![ "聯絡資訊" . into( ) ] , RuleType :: CrossStrait ) ,
2515+ SpellingRule :: new( "聯繫管道" , vec![ "聯絡管道" . into( ) ] , RuleType :: CrossStrait ) ,
2516+ SpellingRule :: new( "聯繫電話" , vec![ "聯絡電話" . into( ) ] , RuleType :: CrossStrait ) ,
2517+ SpellingRule :: new( "聯繫客服" , vec![ "聯絡客服" . into( ) ] , RuleType :: CrossStrait ) ,
2518+ SpellingRule :: new(
2519+ "如需協助請聯繫" ,
2520+ vec![ "如需協助請聯絡" . into( ) ] ,
2521+ RuleType :: CrossStrait ,
2522+ ) ,
2523+ ] ;
2524+ let scanner = Scanner :: new ( rules, vec ! [ ] ) ;
2525+
2526+ let issues = scanner. scan ( "歡迎聯繫我們" ) . issues ;
2527+ assert_eq ! ( issues. len( ) , 1 , "should flag contact CTA: {issues:?}" ) ;
2528+
2529+ let issues = scanner. scan ( "請查看聯繫方式" ) . issues ;
2530+ assert_eq ! ( issues. len( ) , 1 , "should flag contact label: {issues:?}" ) ;
2531+
2532+ let issues = scanner. scan ( "最新聯繫資訊如下" ) . issues ;
2533+ assert_eq ! (
2534+ issues. len( ) ,
2535+ 1 ,
2536+ "should flag contact info label: {issues:?}"
2537+ ) ;
2538+
2539+ let issues = scanner. scan ( "若需協助可參考聯繫管道" ) . issues ;
2540+ assert_eq ! (
2541+ issues. len( ) ,
2542+ 1 ,
2543+ "should flag contact channel label: {issues:?}"
2544+ ) ;
2545+
2546+ let issues = scanner. scan ( "聯繫電話:02-1234-5678" ) . issues ;
2547+ assert_eq ! (
2548+ issues. len( ) ,
2549+ 1 ,
2550+ "should flag contact phone label: {issues:?}"
2551+ ) ;
2552+
2553+ let issues = scanner. scan ( "請聯繫客服取得協助" ) . issues ;
2554+ assert_eq ! ( issues. len( ) , 1 , "should flag support CTA: {issues:?}" ) ;
2555+
2556+ let issues = scanner. scan ( "如需協助請聯繫" ) . issues ;
2557+ assert_eq ! (
2558+ issues. len( ) ,
2559+ 1 ,
2560+ "should flag imperative support CTA: {issues:?}"
2561+ ) ;
2562+
2563+ let issues = scanner. scan ( "我們與學界保持密切聯繫" ) . issues ;
2564+ assert ! (
2565+ issues. is_empty( ) ,
2566+ "should not flag ordinary prose: {issues:?}"
2567+ ) ;
2568+
2569+ let issues = scanner. scan ( "請加強國際聯繫" ) . issues ;
2570+ assert ! (
2571+ issues. is_empty( ) ,
2572+ "should not flag ordinary prose: {issues:?}"
2573+ ) ;
2574+
2575+ let issues = scanner. scan ( "我們透過電話聯繫對方" ) . issues ;
2576+ assert ! (
2577+ issues. is_empty( ) ,
2578+ "should not flag ordinary prose: {issues:?}"
2579+ ) ;
2580+ }
2581+
24852582 #[ test]
24862583 fn translationese_pipeline_keeps_only_indexed_zy2_issue ( ) {
24872584 let scanner = Scanner :: new ( vec ! [ ] , vec ! [ ] ) ;
0 commit comments