CoolFace
Datasetpublic

81melody/algerian-family-law-qa

algerian-family-law-qa A retrieval and reranking dataset for Algerian family-law question answering — real user questions scraped from Algerian Facebook legal-advice groups, paired with relevant articles from the Algerian Family Code (Law No. 84-11). Questions are written in Algerian Darja (dialect), Arabizi (Arabic in Latin script), Modern Standard Arabic, and French code-switched text. Documents are articles from the Algerian Family Code covering divorce, custody, alimony, and… See the full description on the dataset page: https://huggingface.co/datasets/81melody/algerian-family-law-qa.

sourceHugging Faceapache-2.0updated 3mo agoView on Hugging Face
0likes45downloads
Dataset Card

algerian-family-law-qa

A retrieval and reranking dataset for Algerian family-law question answering — real user questions scraped from Algerian Facebook legal-advice groups, paired with relevant articles from the Algerian Family Code (Law No. 84-11).

Questions are written in Algerian Darja (dialect), Arabizi (Arabic in Latin script), Modern Standard Arabic, and French code-switched text. Documents are articles from the Algerian Family Code covering divorce, custody, alimony, and related topics. This dataset was used to train the two-stage legal retrieval system: `81melody/algerian-law-biencoder-v2` (dense retriever) and `81melody/algerian-law-reranker-v1` (cross-encoder reranker).


Dataset Contents

FileSplitExamplesFormatUse
biencoder_train.jsonlTrain389JSONLBi-encoder / dense retriever training
reranker_train.jsonlTrain9,123JSONLCross-encoder reranker training
golden_dev.csvDev67CSVHuman-annotated evaluation (retrieval)
golden_test.csvTest150CSVHuman-annotated test set (retrieval)

The golden dev and test sets were manually reviewed — each query has a primary article (gold label), optional secondary article, and a hard negative, with a labeler-confidence score.


File Schemas

biencoder_train.jsonl

Each line is a JSON object with hard negatives, used for training a bi-encoder with MultipleNegativesRankingLoss:

json
{
  "query_id": "B24_6",
  "query": "17سنة زواج خيانات متكررة كي نواجهو يضربي...",
  "positive": "المادة 53",
  "hard_negatives": ["المادة 52", "المادة 112", "المادة 51"],
  "in_batch_eligible": true
}

reranker_train.jsonl

Each line is a (query, article) pair with a relevance label and confidence weight, used for training a CrossEncoder:

json
{
  "query": "17سنة زواج...",
  "article_id": "المادة 53",
  "article_structured": "[الموضوع: طلاق] [الباب: الباب الثاني: انحلال الزواج] يجوز للزوجة أن تطلب التطليق...",
  "article_text": "يجوز للزوجة أن تطلب التطليق...",
  "label": 1,
  "weight": 1.0
}

label is binary (1 = relevant, 0 = not relevant). weight in [0, 1] reflects annotator confidence (primary match = 1.0, secondary = 0.7, etc.). article_structured prefixes the article with its chapter and topic context.

golden_dev.csv / golden_test.csv

Columns: query_id, query_text, article_primary, article_secondary, hard_negative, labeler_confidence, is_oos, parse_warnings, stratum

is_oos=True marks out-of-scope queries (the legal question cannot be answered by the Family Code corpus). stratum labels the legal topic (طلاق / OOS / etc.).


Quick Start

python
from datasets import load_dataset
import json

# Load reranker training pairs
with open("reranker_train.jsonl") as f:
    reranker_data = [json.loads(line) for line in f]

# Load biencoder triplets
with open("biencoder_train.jsonl") as f:
    biencoder_data = [json.loads(line) for line in f]

# Load golden dev set
import csv
with open("golden_dev.csv", newline='', encoding='utf-8-sig') as f:
    dev = list(csv.DictReader(f))

# Filter to in-scope only
in_scope = [row for row in dev if row['is_oos'] == 'False']

Statistics

MetricValue
Unique queries in reranker set~1,014
Positive pairs in reranker set~1,014
Negative pairs in reranker set~8,109
Unique queries in biencoder set389
Family Code articles covered~100 (Law 84-11 articles 1–124+)
Golden dev queries (in-scope)48
Golden test queries (in-scope)~100
LanguagesDarja, Arabizi, MSA, French

Source

Questions were scraped from public Algerian Facebook groups dedicated to family-law advice. All questions are already publicly posted by users seeking legal guidance. No personally identifiable information (names, phone numbers) appears in the query text as collected — questions are framed around legal situations, not personal contact details.


Associated Models

ModelHF RepoTask
Dense bi-encoder81melody/algerian-law-biencoder-v2First-stage retrieval
CrossEncoder reranker81melody/algerian-law-reranker-v1Second-stage reranking
Domain-adapted base81melody/algerian-law-marbertShared encoder backbone

Citation

bibtex
@dataset{himeur2026algerian_family_law_qa,
  title        = {algerian-family-law-qa: Retrieval and Reranking Dataset
                  for Algerian Family-Law Question Answering},
  author       = {Himeur, Ayoub},
  year         = {2026},
  publisher    = {Hugging Face},
  url          = {https://huggingface.co/datasets/81melody/algerian-family-law-qa},
  note         = {User questions from Algerian Facebook legal-advice groups
                  paired with Algerian Family Code articles (Law 84-11)}
}

License

Apache 2.0