العودة للأعمال
تطبيق ويب مباشر

ديوان — محرك البحث الدلالي في الشعر العربي

محرك بحث دلالي في الشعر العربي — ابحث في 6.57 مليون بيت من الشعر الفصيح والنبطي بالمعنى لا بالكلمات. مبني على نموذج تضمين عربي وفهرس HNSW، ومُقيَّم على معيار Fann-or-Flop العلمي بنحو 22 ضعف العشوائية.

Deewan: Semantic Search Engine for Arabic Poetry

Deewan is a semantic search engine for Arabic poetry. Instead of matching letters, it understands meaning — search for an idea or feeling like "longing for home" and it surfaces verses that express it, even when those exact words never appear.

The Corpus

  • 6.57 million verses indexed in total
  • 6.44M classical (fusha) verses from the open ashaar dataset
  • 125K Nabati verses from the tarab dataset
  • Spanning twelve literary eras, from pre-Islamic to modern

How It Works

  • Every verse is encoded into a 384-dimensional vector using the Arabic-Triplet-Matryoshka-V2 embedding model
  • Verses close in meaning end up close in vector space
  • An HNSW (Hierarchical Navigable Small World) index searches all 6.57M verses in a few seconds on a single server
  • Classical and Nabati live in two separate indexes so the traditions never cross-contaminate
  • Era-aware re-ranking gives classical poets a fair share alongside modern ones

Academic Benchmark:
Deewan was evaluated on Fann-or-Flop (EMNLP 2025), a peer-reviewed benchmark of 53,047 scholar-written verse explanations. Given only an explanation, it must retrieve the correct poet out of thousands. Deewan places the correct poet in the top-10 for 3.13% of queries — about 22 times better than random (~0.14%). To our knowledge, this is the first time an Arabic poetry search engine has been measured against a published academic benchmark.

The Stack

  • FastAPI backend running as a systemd service
  • Next.js 15 (App Router) frontend, Arabic-first, with next-intl
  • hnswlib for approximate-nearest-neighbor search
  • Self-hosted on a single dedicated server with no external API dependency
  • Spans about 10,600 lines of code across frontend, backend, and data pipelines

ديوان هو محرك بحث دلالي في الشعر العربي. بدلاً من مطابقة الحروف، يفهم المعنى — ابحث عن فكرة أو شعور مثل «الحنين إلى الوطن» فيعرض لك أبياتاً تعبّر عنه، حتى لو لم ترد تلك الكلمات نفسها في البيت.

المحتوى المُفهرَس

  • 6.57 مليون بيت مُفهرَس إجمالاً
  • 6.44 مليون بيت من الشعر الفصيح من مجموعة بيانات ashaar المفتوحة
  • 125 ألف بيت من الشعر النبطي من مجموعة بيانات tarab
  • تمتد عبر اثني عشر عصراً أدبياً، من الجاهلي إلى الحديث

كيف يعمل

  • يُحوَّل كل بيت إلى متجه من 384 بُعداً باستخدام نموذج التضمين Arabic-Triplet-Matryoshka-V2
  • الأبيات المتقاربة في المعنى تتقارب في فضاء المتجهات
  • فهرس HNSW يبحث في 6.57 مليون بيت خلال ثوانٍ على خادم واحد
  • الفصيح والنبطي في فهرسين منفصلين حتى لا تختلط التقاليد الشعرية
  • إعادة ترتيب واعية بالعصور تمنح الشعراء الكلاسيكيين نصيباً عادلاً بجانب المعاصرين

المعيار الأكاديمي:
قُيِّم ديوان على Fann-or-Flop (EMNLP 2025)، وهو معيار محكَّم يضم 53,047 شرحاً علمياً للأبيات. المهمة: استرجاع الشاعر الصحيح من بين الآلاف انطلاقاً من الشرح وحده. يضع ديوان الشاعر الصحيح ضمن أفضل 10 نتائج في 3.13٪ من الاستعلامات — أي نحو 22 ضعف العشوائية (~0.14٪). على حد علمنا، هذه أول مرة يُقاس فيها محرك بحث للشعر العربي على معيار أكاديمي منشور.

التقنيات

  • خلفية FastAPI تُدار كخدمة systemd
  • واجهة Next.js 15 (App Router) عربية أولاً مع next-intl
  • مكتبة hnswlib للبحث التقريبي عن أقرب الجيران
  • مستضاف ذاتياً على خادم مستقل واحد دون أي اعتماد على واجهات خارجية
  • يمتد على نحو 10,600 سطر برمجي عبر الواجهة والخلفية وخطوط معالجة البيانات
تواصل

مهتم بـهذا المشروع؟ Interested in this project?

لديك فكرة مشروع، أو تحتاج ملفات مشروع، أو تريد التعاون؟ أرسل رسالتك وسأرد عليك.