Fiqh-Glossary Linker

Fiqh-Glossary Linker maps a technical term or phrase — and, in most cases, a sentence built around one — to its entry in a glossary of 2,034 jurisprudential terms in Arabic and Persian. Give it مسح الرأس في الوضوء and it returns the entries for مسح and مسح اعضاي وضو; give it خيار غبن and it lands on that entry whether the reader is Arabic or Persian. It is the piece that turns a passage into a hover-to-define reading experience, and a question into its controlled vocabulary.

Built by Sadiqoon Technologies on intfloat/multilingual-e5-base (278M parameters), shipped with the glossary vectors so linking works out of the box.

رابطُ مصطلحات: يأخذ مصطلحًا فقهيًّا أو جملةً تحتويه، عربيةً أو فارسية، ويردّه إلى مدخله في معجمٍ من 2,034 مصطلحًا. يشحن مع متجهات المعجم جاهزةً للاستعمال.

Highlights

  • Term or phrase in, entry out. Trained on headwords and on sentences from the reference works that use them, so it copes with inflected forms and short running text.
  • Arabic ⇄ Persian. Entries are defined in either language; the linker resolves across both.
  • Ships with the index. glossary_vectors.npy and glossary_index.json are included — no need to build anything.
  • Small and fast. 278M parameters; thousands of sentences per second on a single GPU.

Evaluation

772 held-out sentences from the reference works, each containing a glossary term, ranked against all 2,034 entries:

multilingual-e5-base Fiqh-Glossary Linker
Recall@1 0.197 0.764
Recall@5 0.381 0.955
MRR 0.284 0.852

Training

Contrastive fine-tuning (in-batch negatives, temperature 0.05) on ~6,000 pairs: every glossary headword to its definition, plus sentences mined from the reference corpus that use the term in context. Five epochs.

Usage

Link a sentence to the glossary

import json, numpy as np
from huggingface_hub import hf_hub_download
from sentence_transformers import SentenceTransformer

model = SentenceTransformer("sadiqoon/fiqh-glossary-linker")
V = np.load(hf_hub_download("sadiqoon/fiqh-glossary-linker", "glossary_vectors.npy")).astype("float32")
index = json.load(open(hf_hub_download("sadiqoon/fiqh-glossary-linker", "glossary_index.json")))

def link(text, k=3):
    q = model.encode("query: " + text, normalize_embeddings=True)
    top = np.argsort(-(V @ q))[:k]
    return [(index[i]["term"], index[i]["lang"], float(V[i] @ q)) for i in top]

link("خيار غبن")
# [('خيار غبن', 'fa', 0.93), ('غبن', 'fa', 0.76), ('غبن فاحش', 'fa', 0.56)]
link("مسح الرأس في الوضوء")
# [('مسح', 'fa', 0.73), ('مسح اعضاي وضو', 'fa', 0.52), ('فحص', 'fa', 0.46)]

Embed your own glossary

Entries were encoded as "passage: <term> — <definition>" and queries as "query: <text>"; keep the same prefixes to add or replace entries.

Citation

@misc{sadiqoon2026fiqhglossary,
  title  = {Fiqh-Glossary Linker: Term Linking for Arabic and Persian Jurisprudence},
  author = {Sadiqoon Technologies},
  year   = {2026},
  url    = {https://huggingface.co/sadiqoon/fiqh-glossary-linker}
}

License & Contact

MIT. Built and maintained by Sadiqoon Technologies Ltd, London. Questions and collaboration: info@sadiqoon.uk

Downloads last month
-
Safetensors
Model size
0.3B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for sadiqoon/fiqh-glossary-linker

Finetuned
(160)
this model