@@ -18,6 +18,7 @@ import '../../providers/dictionary_provider.dart';
1818import '../../providers/saved_word_provider.dart' ;
1919import '../../services/dictionary/web_dictionary_source.dart' ;
2020import '../../services/tts_service.dart' ;
21+ import '../../utils/text_normalize.dart' ;
2122import '../../theme/app_theme.dart' ;
2223import '../animated_bookmark_icon.dart' ;
2324import '../common/text_context_menu.dart' ;
@@ -190,26 +191,24 @@ class _WordDictionarySheetState extends ConsumerState<WordDictionarySheet> {
190191 }
191192 }
192193
193- /// 清洗后的词形(去首尾标点),用于查询与展示
194- String get _normalizedWord => widget.word.trim ().replaceAll (
195- RegExp (r'^[^A-Za-z0-9]+|[^A-Za-z0-9]+$' ),
196- '' ,
197- );
194+ /// 归一化后的词形,用于查询(family key)与展示,
195+ /// 与各词典源、后端共用同一 [normalizeWord] (trim + 剥首尾标点[右撇号除外] + 小写)
196+ String get _normalizedWord => normalizeWord (widget.word);
198197
199- /// 标题展示词:优先用当前结果的 headword(本地原形/AI 词头),否则用清洗词形
198+ /// 标题展示词:优先用当前结果的 headword(本地原形/AI 词头),否则用归一化词形
200199 String _displayWord (DictionaryLookupState state) {
201200 final cur = state.current;
202201 if (cur is LookupLoaded ) return cur.result.headword;
203202 return _normalizedWord;
204203 }
205204
206- /// 收藏用 lemma:优先用本地词典返回的原形,否则用清洗词形
205+ /// 收藏用 lemma:优先用本地词典返回的原形,否则用归一化词形
207206 String _lemmaWord (DictionaryLookupState state) {
208207 final local = state.bySource['local' ];
209208 if (local case LookupLoaded (result: final LocalDictResult r)) {
210209 return r.entry.word.toLowerCase ();
211210 }
212- return _normalizedWord. toLowerCase () ;
211+ return _normalizedWord;
213212 }
214213
215214 Future <void > _toggleSave (String lemma, bool currentlySaved) async {
0 commit comments