Elamur Research⌕
☰
home / papers / 2021 / QuranTree.jl: A Julia Package for Quranic Arabic Corpus

QuranTree.jl: A Julia Package for Quranic Arabic Corpus

Paper · 2021 · Al-Ahmadgaid Asaad

Summary

The Quranic Arabic Corpus annotates every segment of every word of the Qur'an with part of speech, morphology, an ontology and dependency syntax. Until now its official programmatic access has been the Java library JQuranTree. That language is a hurdle for many humanities researchers. Meanwhile, existing high-level packages such as quRan for R and PyQuran for Python omit the corpus's morphological layer. The author builds QuranTree.jl, a registered open-source Julia package around three goals: speed, robustness and modularity. It provides:

  • indexing by chapter, verse, word and word part
  • Buckwalter and user-defined transliteration that converts back and forth with Arabic script
  • Simple Encoding
  • dediacritization and normalization for both scripts
  • a complete type system for all morphological tags

Julia's optional typing and multiple dispatch let users write wrappers that reject wrong inputs. PyCall.jl and RCall.jl give access to tools in other languages, shown with TextAnalysis.jl and CAMeL Tools. The paper also sets up a speed comparison against CAMeL Tools, but its results fall outside the extracted text. The resource lowers the barrier to linguistic study of Quranic Arabic, which differs markedly from MSA.

Key points

  • The corpus covers 77,430 words of the Qur'an. JQuranTree's object model nests Document → Chapter → Verse → Token → Character → Diacritic and uses extended Buckwalter encoding.
  • Raw morphology strings such as STEM|POS:N|LEM:...|ROOT:smw|M|GEN are converted with parse(Features, x) into typed objects. These can then be checked with isfeature(parsed, Masculine).
  • Every tag from Dukes and Habash (2010) is an immutable Julia struct placed in a type hierarchy. For example, verb moods sit under AbstractVerb, so a method written for the parent applies to all its subtypes.
  • Interoperability is demonstrated in two ways:
    • TextRank summarization of Chapter 18 (The Cave) via TextAnalysis.jl.
    • CAMeL Tools disambiguation of a dediacritized basmala, called through PyCall.jl's @pyimport.
  • The planned speed test chains three steps on the Uthmani corpus: transliterate to Buckwalter, dediacritize, then encode back to Arabic. It compares QuranTree.jl against CAMeL Tools.

Interesting ideas

  • I1. Morphological tags are modelled as a typed hierarchy instead of opaque strings, so code can target one tag or a whole family and wrong inputs are caught early.
  • I2. Annotation strings are parsed once into a structured object and then queried with simple predicates instead of repeated string processing.
  • I3. A round trip of script → transliteration → dediacritized → script serves as a single end-to-end task that exercises every conversion function at once.
  • I4. The core stays minimal ("nuts and bolts"), and missing capabilities are borrowed from other ecosystems through thin bridges rather than reimplemented.
  • I5. Raw source datasets are exposed only as read-only arrays, so analysis code cannot silently alter the reference data.

For Mova

How these ideas could serve Mova, our small open language model — its files, stages and tests:

  • I1 (tokens): UD FEATS and UPOS in crate en could become enums grouped under traits like "verbal feature", so tagger and lemmatizer code matches on types rather than strings.
  • I2 (tree): treebank loading and UD dialect conversion could parse FEATS/MISC once into typed records and filter sentences with predicate queries, making conversion rules more explicit.
  • I3 (back): the text → graph → text compressor could use a similar chained round trip as a standard regression and speed benchmark that flags lossy steps.
  • I4 (learn): external parsers could join the silver-data witness pool through thin adapters, keeping Mova's own core small while gaining more independent voters.
  • I5 (world): compiled knowledge such as WordNet/FrameNet/Wikidata tables could be loaded immutably, so each text's world model builds on an unchanging, auditable base.

Our summary of the paper, in our own words — not its text. The work belongs to its authors; read it at the links above.

 Fields, topics and concepts

Cite

Cite as Al-Ahmadgaid Asaad. 2021. QuranTree.jl: A Julia Package for Quranic Arabic Corpus. Proceedings of the Sixth Arabic Natural Language Processing Workshop.

The paper itself, not this page. BibTeX from the library's record of the work.

@inproceedings{asaad2021qurantree,
  title = {{QuranTree.jl: A Julia Package for Quranic Arabic Corpus}},
  author = {Al-Ahmadgaid Asaad},
  booktitle = {Proceedings of the Sixth Arabic Natural Language Processing Workshop},
  year = {2021},
  url = {https://aclanthology.org/2021.wanlp-1.22/}
}

References

5 references, 1 of them with a card of ours. ↗ leads to the work, «find» searches for one we have no id for yet.

  1. for 16 times and summarized into the following table: Metric CAMeL Tools QuranTree.jl Min Mean Median Max 342.3ms 352.4ms 350.6ms 375.6ms 418.3ms 434.9ms 436.2ms 452.7ms Jeff Bezanson, Alan Edelman, Stefan Karpinski, and Viral B Shah. 2017. Julia: A fresh approach to numerical computing. SIAM review, 59(1):65–98. find
  2. Tim Buckwalter. 2002. Buckwalter arabic morphological analyzer version 1.0. Linguistic Data Consortium, University of Pennsylvania. ↗
  3. Kais Dukes and Nizar Habash. 2010. Morphological annotation of quranic arabic. In Proceedings of the International Conference on Language Resources and Evaluation, LREC 2010, 17-23 May 2010, Valletta, Malta. European Language Resources Association. *Table 1: Speed of CAMeL Tools vs QuranTree.jl in milliseconds (ms).* While QuranTree.jl is aimed at speed, at the time of writing, the transliteration and dediacritization APIs are not well optimized compared to that of CAMeL Tools, as evident in the table. Indeed, this optimization is still a work-in-progress.
  4. Andrew Heiss. 2019. andrewheiss/quran: Initial cran release. find
  5. Mike Innes. 2018. Flux: Elegant machine learning with julia. Journal of Open Source Software, 3(25):602. Conclusion and Future Work ↗

Updated

↑ back to top

This page in Markdown → https://md.research.elamur.ai/free/en/papers/asaad-2021-qurantree-jl-julia-package-quranic/