المستوى: متقدّم · الدرس 14 من 14
أهداف الدرس
- أن تجمع كل ما تعلّمته في مساعد عربي.
- أن تعالج خصوصيات العربية.
العربية لها تحدّياتها: التشكيل، وصور الألف، والتاء المربوطة، واللهجات، والمصطلحات الإنجليزية داخل النص العربي. تطبيع النص قبل البحث يجعل «أحمد» و«احمد» و«أَحْمَد» كلمة واحدة.
import re
DIACRITICS = re.compile(r"[\u064B-\u0652\u0670\u0640]") # tashkeel and tatweel
def normalize_ar(text: str) -> str:
text = DIACRITICS.sub("", text)
text = re.sub("[إأآا]", "ا", text)
return text.replace("ى", "ي").replace("ة", "ه")
print(normalize_ar("أَحْمَدُ يُحِبُّ المَكْتَبَة")) # احمد يحب المكتبهتوجد اليوم نماذج مفتوحة تحسن العربية، منها نماذج طُوّرت في المنطقة العربية، ومقاييس عربية لاختبارها. جرّب أكثر من نموذج على أسئلتك أنت قبل أن تختار.
- اجمع مستندات مسار واحد: اللوائح أو مواد مساق.
- طبّع النص وقطّعه على حدود الجمل.
- ابنِ بحثاً هجيناً مع إعادة ترتيب.
- اكتب أمر نظام يفرض ذكر المصدر وقول «لا أعرف».
- اختبر بثلاثين سؤالاً حقيقياً من طلبتك، بالفصحى واللهجة.
شارك نتيجتك في الورشة، وأخبرنا بما تعلّمته عبر نموذج «رأيك».
تمرين
لماذا نحوّل «ة» إلى «ه» عند البحث فقط وليس عند عرض الإجابة؟
الإجابة
لأن التطبيع يوحّد الكلمات للمطابقة، لكن العرض يجب أن يبقى عربياً سليماً كما كُتب.
Level: Advanced · Lesson 14 of 14
Lesson goals
- Bring everything together in an Arabic assistant.
- Handle what is special about Arabic.
Arabic has its own challenges: diacritics, alef forms, taa marbuta, dialects, and English terms inside Arabic text. Normalising text before search makes «أحمد», «احمد» and «أَحْمَد» one word.
import re
DIACRITICS = re.compile(r"[\u064B-\u0652\u0670\u0640]") # tashkeel and tatweel
def normalize_ar(text: str) -> str:
text = DIACRITICS.sub("", text)
text = re.sub("[إأآا]", "ا", text)
return text.replace("ى", "ي").replace("ة", "ه")
print(normalize_ar("أَحْمَدُ يُحِبُّ المَكْتَبَة")) # احمد يحب المكتبهOpen models that handle Arabic well exist today, including models developed in the Arab region, and Arabic benchmarks to test them. Try more than one model on your own questions before choosing.
- Gather one area's documents: the rules or one course's materials.
- Normalise the text and chunk it on sentence boundaries.
- Build hybrid search with reranking.
- Write a system prompt that requires citations and «I don't know».
- Test with thirty real questions from your students, in MSA and dialect.
Share your result at the workshop, and tell us what you learned through the «Your view» form.
Your view of the teacher-sites platform
ProjectsThe college AI assistantExercise
Why turn «ة» into «ه» for search only, not when showing the answer?
Answer
Normalising unifies words for matching, but what readers see must stay correct Arabic as written.
التعليقات / Comments
لا تعليقات بعد. كن أول من يسأل. / No comments yet. Be the first to ask.