Blog · November 2026 · 9 min read Blog · Novembre 2026 · 9 min de lectureالمدونة · نوفمبر 2026 · 9 دقائق قراءة

A RAG over Algerian law: split by article, not by size Un RAG sur le droit algérien : découper par article, pas par tailleRAG على القانون الجزائري: التقسيم حسب المادة لا حسب الحجم

How we built the AI behind HOKOKI in a hackathon: official law PDFs turned into one document per article, answers that cite their sources, contract reports a front end can display, and questions asked in Arabic or Darija over laws written in French. Comment nous avons construit l'IA de HOKOKI pendant un hackathon : des PDF de lois officiels transformés en un document par article, des réponses qui citent leurs sources, des rapports de contrat qu'une interface peut afficher, et des questions posées en arabe ou en darija sur des lois écrites en français.كيف بنينا الذكاء الاصطناعي في HOKOKI خلال هاكاثون: ملفات PDF رسمية للقوانين تحوّلت إلى وثيقة لكل مادة، وإجابات تذكر مصادرها، وتقارير عقود يمكن للواجهة عرضها، وأسئلة تُطرح بالعربية أو بالدارجة عن قوانين مكتوبة بالفرنسية.

The problemLe problèmeالمشكلة

HOKOKI ("my rights") is a legal assistant for Algeria that we built as a team at the NCS Hackathon in Algiers. Algerian law lives in long PDFs published in the Journal Officiel: hard to search, hard to read, and mostly in French, while many users would rather ask in Arabic or in Darija. HOKOKI (« mes droits ») est un assistant juridique pour l'Algérie, construit en équipe au hackathon NCS à Alger. Le droit algérien se trouve dans de longs PDF publiés au Journal Officiel : difficiles à chercher, difficiles à lire, et surtout en français, alors que beaucoup d'utilisateurs préfèrent poser leurs questions en arabe ou en darija.HOKOKI («حقوقي») مساعد قانوني للجزائر بنيناه كفريق في هاكاثون NCS بالجزائر العاصمة. يوجد القانون الجزائري في ملفات PDF طويلة تُنشر في الجريدة الرسمية: يصعب البحث فيها وقراءتها، وأغلبها بالفرنسية، بينما يفضّل كثير من المستخدمين السؤال بالعربية أو بالدارجة.

An AI that answers legal questions from memory is dangerous: it invents articles that sound right. So the rule from the start was simple: every answer must come from real articles, and say which ones. That is what retrieval-augmented generation (RAG) is for. A teammate set up the first version of the AI service (embeddings, OCR and search). I then moved it to LangChain.js and added the HTTP API, the RAG chain with conversation history, the agent with one search tool per legal domain, and the translation layer. Une IA qui répond à des questions juridiques de mémoire est dangereuse : elle invente des articles qui ont l'air vrais. La règle était donc simple dès le départ : chaque réponse doit venir de vrais articles, et dire lesquels. C'est exactement le rôle du RAG (génération augmentée par la recherche). Un coéquipier a posé la première version du service IA (embeddings, OCR et recherche). Je l'ai ensuite passé sur LangChain.js et j'ai ajouté l'API HTTP, la chaîne RAG avec historique de conversation, l'agent avec un outil de recherche par domaine juridique, et la couche de traduction.الذكاء الاصطناعي الذي يجيب عن الأسئلة القانونية من ذاكرته خطير: يخترع مواد تبدو صحيحة. لذلك كانت القاعدة بسيطة منذ البداية: كل إجابة يجب أن تأتي من مواد حقيقية، وأن تذكرها. وهذا بالضبط دور RAG (التوليد المعزَّز بالاسترجاع). أعدّ أحد زملائي النسخة الأولى من خدمة الذكاء الاصطناعي (التضمينات، والتعرّف الضوئي على النصوص، والبحث). ثم نقلتها إلى LangChain.js وأضفت واجهة HTTP، وسلسلة RAG مع سجل المحادثة، والوكيل الذي يملك أداة بحث لكل مجال قانوني، وطبقة الترجمة.

Why fixed-size chunks fail on lawPourquoi des morceaux de taille fixe ne marchent pas pour le droitلماذا لا تصلح المقاطع ذات الحجم الثابت للقانون

The usual RAG recipe cuts documents into chunks of, say, 1,000 characters, embeds them and stores them. On a legal code, that breaks the one thing that matters: the article. A chunk can end in the middle of article 54 and start article 55 halfway, and the model then answers from half a rule. Worse, the chunk no longer knows which article, chapter or code it came from, so the answer cannot cite it. La recette RAG habituelle coupe les documents en morceaux de, disons, 1 000 caractères, les transforme en vecteurs et les stocke. Sur un code juridique, ça casse la seule chose qui compte : l'article. Un morceau peut s'arrêter au milieu de l'article 54 et commencer l'article 55 en plein milieu, et le modèle répond alors à partir d'une demi-règle. Pire, le morceau ne sait plus de quel article, chapitre ou code il vient, donc la réponse ne peut pas le citer.الطريقة المعتادة في RAG تقطّع الوثائق إلى مقاطع من 1000 حرف مثلاً، ثم تحوّلها إلى متجهات وتخزّنها. لكن في نص قانوني، هذا يكسر الشيء الوحيد المهم: المادة. قد ينتهي مقطع في منتصف المادة 54 ويبدأ المادة 55 من وسطها، فيجيب النموذج انطلاقاً من نصف قاعدة. والأسوأ أن المقطع لم يعد يعرف من أي مادة أو فصل أو قانون جاء، فلا يمكن للإجابة أن تذكره.

So we made one law article = one document in the vector database, with its number, its place in the code and its keywords as metadata. Nous avons donc fait un article de loi = un document dans la base vectorielle, avec son numéro, sa place dans le code et ses mots-clés en métadonnées.لذلك جعلنا كل مادة قانونية = وثيقة واحدة في قاعدة المتجهات، مع رقمها وموقعها في القانون وكلماتها المفتاحية كبيانات وصفية.

Letting the model find the articlesLaisser le modèle trouver les articlesترك النموذج يجد المواد

Splitting on "Article X" with a regular expression sounds easy, until you meet real PDFs: bilingual pages, page headers from the Journal Officiel, "Art." and "Article" broken across two lines, "3 bis" and "1er". The indexing pipeline has three steps: Couper sur « Article X » avec une expression régulière paraît facile, jusqu'aux vrais PDF : des pages bilingues, les en-têtes du Journal Officiel, des « Art. » et « Article » coupés sur deux lignes, des « 3 bis » et des « 1er ». L'indexation se fait en trois étapes :يبدو التقسيم عند «Article X» بتعبير نمطي سهلاً، إلى أن تواجه ملفات PDF الحقيقية: صفحات ثنائية اللغة، وترويسات الجريدة الرسمية، و«Art.» و«Article» مقسومة على سطرين، و«3 bis» و«1er». تمر الفهرسة بثلاث مراحل:

Law PDFPDF de loiPDF القانونJournal Officiel
→
CleanNettoyageالتنظيفregex · 8,000 chars
→
Llama 3.3 70BJSON articlesarticles en JSONمواد بصيغة JSON
→
Chroma1 doc / article1 doc / articleوثيقة / مادة
  • Clean the text with a few regular expressions: remove the Arabic half of bilingual pages, the Journal Officiel headers, page numbers, and glue "Article" back to its number.Nettoyer le texte avec quelques expressions régulières : enlever la moitié arabe des pages bilingues, les en-têtes du Journal Officiel, les numéros de page, et recoller « Article » à son numéro.تنظيف النص ببعض التعابير النمطية: حذف النصف العربي من الصفحات ثنائية اللغة، وترويسات الجريدة الرسمية، وأرقام الصفحات، وإعادة لصق «Article» برقمها.
  • Cut it into large segments of 8,000 characters with a 500-character overlap, ending on a paragraph break when possible, so an article is rarely split.Découper en grands segments de 8 000 caractères qui se chevauchent de 500 caractères, en s'arrêtant si possible sur un saut de paragraphe, pour qu'un article soit rarement coupé.التقسيم إلى أجزاء كبيرة من 8000 حرف تتداخل بـ 500 حرف، مع التوقف عند نهاية فقرة إن أمكن، حتى لا تنقسم المادة إلا نادراً.
  • Extract: the model reads each segment and returns every article as JSON, validated by a Zod schema: number, book, chapter, section, a short title, the exact text, 3 to 7 keywords, and the other articles it refers to. The prompt includes two worked examples (Civil Code and Penal Code), to keep the output consistent.Extraire : le modèle lit chaque segment et renvoie chaque article en JSON, validé par un schéma Zod : numéro, livre, chapitre, section, un titre court, le texte exact, 3 à 7 mots-clés, et les autres articles qu'il cite. Le prompt contient deux exemples complets (Code civil et Code pénal), pour garder un résultat régulier.الاستخراج: يقرأ النموذج كل جزء ويعيد كل مادة بصيغة JSON يتحقق منها مخطط Zod: الرقم، والكتاب، والفصل، والقسم، وعنوان قصير، والنص الحرفي، ومن 3 إلى 7 كلمات مفتاحية، والمواد الأخرى التي تحيل إليها. ويتضمن الموجّه مثالين كاملين (القانون المدني وقانون العقوبات)، للحفاظ على انتظام النتيجة.

Because segments overlap, the same article can come back twice. A simple key removes duplicates, and each article becomes a document. One detail to know: Chroma only accepts plain values in metadata, so arrays have to be stored as JSON strings. Comme les segments se chevauchent, un même article peut revenir deux fois. Une simple clé élimine les doublons, et chaque article devient un document. Un détail à connaître : Chroma n'accepte que des valeurs simples en métadonnées, donc les tableaux doivent être stockés en chaînes JSON.بما أن الأجزاء متداخلة، قد تعود المادة نفسها مرتين. مفتاح بسيط يزيل التكرار، وتتحول كل مادة إلى وثيقة. وهناك تفصيل يجب معرفته: Chroma لا يقبل إلا قيماً بسيطة في البيانات الوصفية، لذا يجب تخزين المصفوفات كنصوص JSON.

const key = `${category}:${article.articleNum.trim().toLowerCase()}`;
if (seen.has(key)) continue; // same article seen in the overlap
seen.add(key);

new Document({
  pageContent: `${article.titleFr}\n\n${article.contentFr}`,
  metadata: {
    category,                       // "codeCivil", "codePenal"...
    articleNum: article.articleNum, // "54", "3 bis"
    chapter: article.chapter ?? "",
    // Chroma requires scalar values: serialise arrays as JSON strings
    keywords: JSON.stringify(article.keywords ?? []),
    relatedArticles: JSON.stringify(article.relatedArticles ?? []),
    sourceDocument: sourceUrl,
  },
});

The segments are sent one after another, not in parallel, to stay under the free Groq rate limit, and a segment that fails is logged and skipped instead of stopping the whole PDF. Les segments sont envoyés l'un après l'autre, pas en parallèle, pour rester sous la limite gratuite de Groq, et un segment qui échoue est noté puis ignoré au lieu d'arrêter tout le PDF.تُرسل الأجزاء واحداً تلو الآخر، لا بالتوازي، للبقاء تحت الحد المجاني لـ Groq، والجزء الذي يفشل يُسجَّل ويُتجاوز بدل إيقاف ملف PDF بأكمله.

Follow-up questionsLes questions de suiviأسئلة المتابعة

In a real conversation, the second question is often "and if the tenant refuses?". Searching the vector database for that sentence finds nothing useful. So before searching, a first call to the model rewrites the question into a complete, standalone one using the conversation history. Only then do we retrieve the 5 closest articles and answer. Dans une vraie conversation, la deuxième question est souvent « et si le locataire refuse ? ». Chercher cette phrase dans la base vectorielle ne trouve rien d'utile. Donc avant la recherche, un premier appel au modèle réécrit la question en une question complète et autonome grâce à l'historique. Ensuite seulement, on récupère les 5 articles les plus proches et on répond.في محادثة حقيقية، غالباً ما يكون السؤال الثاني «وإذا رفض المستأجر؟». البحث عن هذه الجملة في قاعدة المتجهات لا يجد شيئاً مفيداً. لذلك، قبل البحث، يعيد استدعاء أول للنموذج صياغة السؤال ليصبح كاملاً ومستقلاً بالاعتماد على سجل المحادثة. وبعدها فقط نسترجع أقرب 5 مواد ونجيب.

const ragChain = RunnableSequence.from([
  {
    standalone_question: condenseChain, // rewrite using chat history
    chat_history: (input) => input.chat_history ?? [],
  },
  {
    context: (input) =>
      retriever.invoke(input.standalone_question).then(formatDocs), // k = 5
    question: (input) => input.standalone_question,
    chat_history: (input) => input.chat_history ?? [],
  },
  ragAnswerPrompt,
  llm,
  new StringOutputParser(),
]);

Answer only from the contextRépondre uniquement à partir du contexteالإجابة من السياق فقط

The answer prompt is strict: answer only from the retrieved articles, always cite them ("Under article X of the Civil Code…"), never invent an article, and if the context does not contain the answer, say so and point to the official Journal Officiel website or a lawyer. The answer always has the same parts: the answer, the legal basis, points to watch, and a disclaimer that it is not personal legal advice. Le prompt de réponse est strict : répondre uniquement à partir des articles récupérés, toujours les citer (« Selon l'article X du Code civil… »), ne jamais inventer d'article, et si le contexte ne contient pas la réponse, le dire et renvoyer vers le site officiel du Journal Officiel ou vers un avocat. La réponse a toujours les mêmes parties : la réponse, les fondements légaux, les points d'attention, et un avertissement rappelant que ce n'est pas un conseil juridique personnalisé.موجّه الإجابة صارم: الإجابة فقط من المواد المسترجعة، وذكرها دائماً («حسب المادة X من القانون المدني…»)، وعدم اختراع أي مادة أبداً، وإذا لم يحتوِ السياق على الإجابة، يقول ذلك ويوجّه إلى الموقع الرسمي للجريدة الرسمية أو إلى محامٍ. وللإجابة دائماً الأجزاء نفسها: الإجابة، والأسس القانونية، ونقاط الانتباه، وتنبيه بأنها ليست استشارة قانونية شخصية.

"I don't know" is a feature here. A wrong answer about someone's rights is worse than no answer. « Je ne sais pas » est une fonctionnalité ici. Une mauvaise réponse sur les droits de quelqu'un est pire que pas de réponse.«لا أعرف» ميزة هنا. الإجابة الخاطئة عن حقوق شخص ما أسوأ من عدم الإجابة.

One search tool per legal domainUn outil de recherche par domaine juridiqueأداة بحث لكل مجال قانوني

A question about inheritance should not pull articles from the Commercial Code. Since every article carries its category, the chat goes through an agent that has six search tools, one per domain: commercial, civil, penal, family, personal protection, and post-independence land disputes. The model first decides which domains the question touches, can call several tools at once, then answers from what they returned. The API also returns which domains were consulted. Une question sur l'héritage ne devrait pas ramener des articles du Code de commerce. Comme chaque article porte sa catégorie, le chat passe par un agent qui a six outils de recherche, un par domaine : commerce, civil, pénal, famille, protection des personnes, et conflits fonciers d'après l'indépendance. Le modèle décide d'abord quels domaines la question touche, peut appeler plusieurs outils à la fois, puis répond à partir de ce qu'ils ont renvoyé. L'API renvoie aussi les domaines consultés.سؤال عن الميراث لا ينبغي أن يجلب مواد من القانون التجاري. وبما أن كل مادة تحمل تصنيفها، تمر المحادثة عبر وكيل يملك ست أدوات بحث، واحدة لكل مجال: التجاري، والمدني، والعقوبات، والأسرة، وحماية الأشخاص، والنزاعات العقارية بعد الاستقلال. يقرر النموذج أولاً المجالات التي يمسّها السؤال، ويمكنه استدعاء عدة أدوات في الوقت نفسه، ثم يجيب مما أعادته. وتعيد الواجهة البرمجية أيضاً المجالات التي استُشيرت.

Contracts: a report, not a paragraphLes contrats : un rapport, pas un paragrapheالعقود: تقرير لا فقرة

For contract analysis, free text was useless to the front end: it needed a score to show, a list of problems to highlight, and fixes to suggest. The contract type decides which codes to search (a rental contract → Civil Code, a commercial one → Commercial and Civil Codes), using a metadata filter, and the 8 closest articles are sent with the contract. The model must answer in a shape checked by a Zod schema: Pour l'analyse de contrat, un texte libre ne servait à rien côté interface : il fallait un score à afficher, une liste de problèmes à surligner, et des corrections à proposer. Le type de contrat décide des codes à chercher (un bail → Code civil, un contrat commercial → Codes de commerce et civil), grâce à un filtre sur les métadonnées, et les 8 articles les plus proches sont envoyés avec le contrat. Le modèle doit répondre dans une forme vérifiée par un schéma Zod :في تحليل العقود، لم يكن النص الحر مفيداً للواجهة: كانت تحتاج إلى نتيجة تعرضها، وقائمة مشكلات تبرزها، وتصحيحات تقترحها. نوع العقد يحدد القوانين التي يُبحث فيها (عقد إيجار ← القانون المدني، عقد تجاري ← القانونان التجاري والمدني) عبر مرشّح على البيانات الوصفية، وتُرسل أقرب 8 مواد مع العقد. ويجب أن يجيب النموذج بشكل يتحقق منه مخطط Zod:

const ComplianceIssueSchema = z.object({
  severity: z.enum(["critical", "warning", "info"]),
  clauseInContract: z.string(), // exact quote from the contract
  violatedArticle: z.string(),  // e.g. "Article 467 du Code Civil"
  explanation: z.string(),
  suggestion: z.string(),
});

const ComplianceReportSchema = z.object({
  overallScore: z.number().min(0).max(100),
  verdict: z.enum(["compliant", "mostly_compliant", "non_compliant"]),
  issues: z.array(ComplianceIssueSchema),
  missingClauses: z.array(z.string()), // mandatory clauses not found
  recommendedActions: z.array(z.string()),
  // ...summary, positiveClauses, applicableLaws
});

If the model returns something that does not match, parsing fails loudly instead of showing the user a broken report. Asking for a quote of the exact clause also made the issues easier to check by a human. Si le modèle renvoie quelque chose qui ne correspond pas, la lecture échoue clairement au lieu d'afficher un rapport cassé. Demander la citation exacte de la clause a aussi rendu les problèmes plus faciles à vérifier par un humain.إذا أعاد النموذج شيئاً لا يطابق المخطط، تفشل القراءة بوضوح بدل أن يُعرض على المستخدم تقرير معطوب. كما أن طلب الاقتباس الحرفي للبند جعل المشكلات أسهل في التحقق من طرف إنسان.

Arabic and Darija questions, French lawDes questions en arabe et en darija, un droit en françaisأسئلة بالعربية والدارجة، وقانون بالفرنسية

The indexed articles are in French, but the app is in Arabic. Before anything else, the question's language is detected with franc. A French question goes straight through. Standard languages are translated to French with a translation API, and Darija or another dialect goes to the model itself, because classic translators handle dialects badly. The answer is then translated back into the user's language, while article numbers and code names stay as they are. Les articles indexés sont en français, mais l'appli est en arabe. Avant tout, la langue de la question est détectée avec franc. Une question en français passe directement. Les langues standard sont traduites en français par une API de traduction, et la darija ou un autre dialecte passe par le modèle lui-même, parce que les traducteurs classiques gèrent mal les dialectes. La réponse est ensuite retraduite dans la langue de l'utilisateur, en gardant tels quels les numéros d'articles et les noms des codes.المواد المفهرسة بالفرنسية، لكن التطبيق بالعربية. قبل أي شيء، تُكتشف لغة السؤال بمكتبة franc. السؤال بالفرنسية يمر مباشرة. اللغات القياسية تُترجم إلى الفرنسية بواجهة ترجمة، أما الدارجة أو أي لهجة أخرى فتمر عبر النموذج نفسه، لأن المترجمات التقليدية لا تتعامل جيداً مع اللهجات. ثم تُترجم الإجابة إلى لغة المستخدم، مع إبقاء أرقام المواد وأسماء القوانين كما هي.

const lang = detectLanguage(question); // franc: "fra", "ara", "arq" (Darija)...

if (lang.isArabicDialect) {
  text = await llmTranslate(question, lang.name, "français formel");
} else if (lang.googleCode) {
  text = (await translate(question, { to: "fr" })).text; // falls back to the LLM on error
}

What I would do differentlyCe que je ferais autrementما كنت سأفعله بشكل مختلف

A hackathon rewards a working demo, not perfect choices. Looking back at the code, here is what I would change first: Un hackathon récompense une démo qui marche, pas des choix parfaits. En relisant le code, voici ce que je changerais en premier :الهاكاثون يكافئ عرضاً يعمل، لا اختيارات مثالية. وعند مراجعة الشيفرة، هذا ما كنت سأغيّره أولاً:

  • A multilingual embedding model. We used bge-base-en-v1.5, an English model, on French legal text. It works, but a multilingual model would retrieve better, and could even search Arabic questions directly.Un modèle d'embeddings multilingue. Nous avons utilisé bge-base-en-v1.5, un modèle anglais, sur des textes juridiques français. Ça marche, mais un modèle multilingue trouverait de meilleurs articles, et pourrait même chercher directement à partir des questions en arabe.نموذج تضمين متعدد اللغات. استعملنا bge-base-en-v1.5، وهو نموذج إنجليزي، على نصوص قانونية فرنسية. يعمل، لكن نموذجاً متعدد اللغات سيسترجع مواد أفضل، بل ويمكنه البحث مباشرة انطلاقاً من الأسئلة بالعربية.
  • Search clause by clause. For contracts, retrieval uses only the first 600 characters as the query, so a problem at the end of a long contract may get no relevant article. Searching once per clause would fix that.Chercher clause par clause. Pour les contrats, la recherche n'utilise que les 600 premiers caractères comme requête : un problème à la fin d'un long contrat peut donc n'avoir aucun article pertinent. Chercher une fois par clause réglerait ça.البحث بنداً بنداً. في العقود، لا يستعمل البحث إلا أول 600 حرف كاستعلام، لذا قد لا تجد مشكلة في آخر عقد طويل أي مادة مناسبة. البحث مرة لكل بند سيحل ذلك.
  • Persist conversations. Chat history lives in memory, so a server restart forgets every conversation. Storing it in the main PostgreSQL database would be easy.Garder les conversations. L'historique est en mémoire : un redémarrage du serveur oublie toutes les conversations. Le stocker dans la base PostgreSQL principale serait simple.حفظ المحادثات. السجل في الذاكرة، فإعادة تشغيل الخادم تُنسي كل المحادثات. وتخزينه في قاعدة PostgreSQL الرئيسية سيكون سهلاً.
  • Measure retrieval. We tested by asking questions and reading answers. A small set of questions with the articles they should find would show, with a number, whether a change makes retrieval better or worse.Mesurer la recherche. Nous avons testé en posant des questions et en lisant les réponses. Un petit jeu de questions avec les articles qu'elles devraient trouver montrerait, chiffres à l'appui, si un changement améliore ou dégrade la recherche.قياس الاسترجاع. اختبرنا بطرح الأسئلة وقراءة الإجابات. ومجموعة صغيرة من الأسئلة مع المواد التي يجب أن تجدها ستبيّن بالأرقام هل يحسّن التغيير الاسترجاع أم يسيء إليه.

TakeawaysÀ retenirالخلاصة

  • Split documents along their natural unit. For law, that is the article, not a number of characters.Découper les documents selon leur unité naturelle. Pour le droit, c'est l'article, pas un nombre de caractères.قسّم الوثائق حسب وحدتها الطبيعية. في القانون، هي المادة لا عدد الحروف.
  • Metadata is what makes citations and per-domain search possible. Extract it when you index.Ce sont les métadonnées qui rendent possibles les citations et la recherche par domaine. Il faut les extraire dès l'indexation.البيانات الوصفية هي ما يجعل الاستشهاد والبحث حسب المجال ممكنين. استخرجها عند الفهرسة.
  • When a front end has to display the result, ask the model for JSON validated by a schema, not prose.Quand une interface doit afficher le résultat, demander au modèle du JSON validé par un schéma, pas du texte.عندما يجب على الواجهة عرض النتيجة، اطلب من النموذج JSON يتحقق منه مخطط، لا نصاً حراً.
  • In a legal assistant, "the indexed texts don't cover this" is a correct answer.Dans un assistant juridique, « les textes indexés ne couvrent pas ce point » est une bonne réponse.في مساعد قانوني، «النصوص المفهرسة لا تغطي هذه النقطة» إجابة صحيحة.

Try the live demo (the public demo runs without the AI service and uses labelled sample answers), or read the code on GitHub. Essayez la démo en ligne (la démo publique tourne sans le service IA et utilise des réponses d'exemple signalées comme telles), ou lisez le code sur GitHub.جرّب العرض المباشر (يعمل العرض العام دون خدمة الذكاء الاصطناعي ويستعمل إجابات نموذجية موسومة بذلك)، أو اقرأ الشيفرة على GitHub.