TF-4009 Add Arabic to attachment text detector

This commit is contained in:
dab246
2025-09-15 16:20:34 +07:00
committed by Dat H. Pham
parent 6ccaedc4ab
commit 22f6ca879a
2 changed files with 122 additions and 1 deletions
@@ -33,10 +33,18 @@ class AttachmentTextDetector {
'attach',
'attachment',
],
LanguageCodeConstants.arabic: [
"مرفق",
"مستند",
"ملف",
"تقرير",
"ملف",
"إرفاق",
],
};
/// Detect if the text contains keywords suggesting there is an attachment.
/// [lang] is the language code (`en`, `fr`, `ru`, `vi`, ...).
/// [lang] is the language code (`en`, `fr`, `ru`, `vi`, `ar`, ...).
static bool containsAttachmentKeyword(String text, {required String lang}) {
final lowerText = text.toLowerCase();
final keywords = _keywordsByLang[lang.toLowerCase()];