API References

QuranTree.PrefixType
Prefix(data::Symbol, pos::AbstractPartOfSpeech)

Create a new Prefix object with data as the symbol of the morphological feature with pos as the corresponding Part of Speech.

source
QuranTree.StemType
Stem(data::Symbol, pos::AbstractPartOfSpeech)

Create a new Stem object with data as the symbol of the morphological feature with pos as the corresponding Part of Speech.

source
QuranTree.SuffixType
Suffix(data::Symbol, pos::AbstractPartOfSpeech)

Create a new Suffix object with data as the symbol of the morphological feature with pos as the corresponding Part of Speech.

source
Base.parseMethod
parse(::Type{Features}, f::AbstractString)

Extract the features of a morphological Feature object.

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps)
julia> tnzldata = table(tnzl)
julia> parse(Features, select(crpsdata.data, :features)[53])
Stem(:NEG, NEG, AbstractFeature[Lemma("laA"), Special("<in~")])
source
Dagger.loadMethod
load(data::QuranData)

Load the raw QuranData as a ReadOnlyArray for both Quranic Corpus and Tanzil Data.

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data);
source
IndexedTables.tableMethod
table(crps::CorpusRaw)

Convert the CorpusRaw read-only array into a tabularized CorpusData using IndexedTable.

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps);
source
IndexedTables.tableMethod
table(tnzl::TanzilRaw)

Convert the TanzilRaw read-only array into a tabularized TanzilData using IndexedTable.

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> tnzldata = table(tnzl);
source
QuranTree.arabicMethod
arabic(s::String[, encoder::AbstractEncoder])

Encode the String object into Arabic characters. Custom encoder generated from @transliterator can be provided, but default is Buckwalter.

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps)
julia> tnzldata = table(tnzl)
julia> arabic(verses(crpsdata[114])[1])
"قُلْ أَعُوذُ بِرَبِّ ٱلنَّاسِ"
source
QuranTree.chapter_nameFunction
chapter_name(quran::AbstractQuran, transliterate::Bool=false; lang::Symbol=:arabic)

Extract the chapter name of the input quran, in either :arabic (default) or :english

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps)
julia> tnzldata = table(tnzl)
julia> chapter_name(crpsdata[13][2][1])
"ٱلرَّعْد"
source
QuranTree.dediacMethod
dediac(s::String)

Dediacritize the input String object.

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps)
julia> tnzldata = table(tnzl)
julia> dediac(verses(crpsdata[1][1])[1])
"bsm {llh {lrHm`n {lrHym"
julia> dediac(arabic(verses(crpsdata[1][1])[1]))
"بسم ٱلله ٱلرحمٰن ٱلرحيم"
source
QuranTree.encodeMethod
encode(s::String)

Transliterate the input String object using Buckwalter.

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps)
julia> tnzldata = table(tnzl)
julia> basmala = arabic(verses(crpsdata[1][1])[1])
julia> encode(basmala)
"bisomi {ll~ahi {lr~aHoma`ni {lr~aHiymi"
source
QuranTree.encodeMethod
encode(::Type{SimpleEncoder}, s::String)

Encode the input String object as SimpleEncoder.

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps)
julia> tnzldata = table(tnzl)
julia> basmala = arabic(verses(crpsdata[1][1])[1])
julia> encode(SimpleEncoder, basmala)
"Ba+Kasra | Seen+Sukun | Meem+Kasra | <space> | HamzatWasl | Lam | Lam+Shadda+Fatha | Ha+Kasra | <space> | HamzatWasl | Lam | Ra+Shadda+Fatha | HHa+Sukun | Meem+Fatha | AlifKhanjareeya | Noon+Kasra | <space> | HamzatWasl | Lam | Ra+Shadda+Fatha | HHa+Kasra | Ya | Meem+Kasra"
source
QuranTree.encodeMethod
encode(s::Union{Char,String}, encoder::AbstractEncoder)

Transliterate the input String object using a custom encoder. Custom encoder is generated using the @transliterator.

source
QuranTree.isfeatureMethod
isfeature(feat::Features, pos::Type{<:AbstractFeature})

Check if the morphological Feature object is a type of pos.

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps)
julia> tnzldata = table(tnzl)
julia> isfeature(parse(Features, select(crpsdata[1].data, :features)[2]), Stem)
true
source
QuranTree.lemmaMethod
lemma(feat::AbstractFeature)

Extract the lemma of the feature.

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps)
julia> tnzldata = table(tnzl)
julia> lemma(parse(Features, select(crpsdata[112].data, :features)[1]))
"qaAla"
source
QuranTree.normalizeMethod
normalize(s::String, chars::Array{Symbol,1})

Normalize a specific Arabic or Buckwalter String character/s (chars).

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps);
julia> tnzldata = table(tnzl);
julia> normalize(arabic(verses(crpsdata[1][1])[1]), [:alif_khanjareeya, :hamzat_wasl])
"بِسْمِ اللَّهِ الرَّحْمَانِ الرَّحِيمِ"
source
QuranTree.normalizeMethod
normalize(s::String, char::Symbol)

Normalize a specific Arabic or Buckwalter String character (chars).

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps);
julia> tnzldata = table(tnzl);
julia> normalize(arabic(verses(crpsdata[1][1])[1]), :hamzat_wasl)
"بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ"
source
QuranTree.normalizeMethod
normalize(s::String)

Normalize a Arabic or Buckwalter String characters.

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps);
julia> tnzldata = table(tnzl);
julia> normalize(dediac(verses(crpsdata[1][1])[1]))
"bsm Allh AlrHmAn AlrHym"
source
QuranTree.rootMethod
root(feat::AbstractFeature)

Extract the root of the feature.

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps)
julia> tnzldata = table(tnzl)
julia> root(parse(Features, select(crpsdata[112].data, :features)[1]))
"qwl"
source
QuranTree.specialMethod
special(feat::AbstractFeature)

Extract the special feature of the token.

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps)
julia> tnzldata = table(tnzl)
julia> special(parse(Features, select(crpsdata.data, :features)[53]))
"<in~"
source
QuranTree.versesMethod
verses(quran::AbstractQuran; number=false, start_end=true)

Extract the verses of a AbstractQuran object.

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps)
julia> tnzldata = table(tnzl)
julia> verses(crpsdata[1])[7]
"Sira`Ta {l~a*iyna >anoEamota Ealayohimo gayori {lomagoDuwbi Ealayohimo walaA {lD~aA^l~iyna"
julia> verses(crpsdata[113:114], number=true)[1]
"113:(1,5)"
julia> verses(crpsdata[113:114], number=true, start_end=false)[1]
([113], [1, 2, 3, 4, 5])
source
QuranTree.versesMethod
verses(data::IndexedTable[, a::Int64[, b::Int64]]; number=false, start_end=true)

Extract the verses of a IndexedTable object from row a to row b.

source
QuranTree.versesMethod
verses(quran::TanzilData)

Extract the verses of a TanzilData object.

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps)
julia> tnzldata = table(tnzl)
julia> verses(tnzldata)[1]
"بِسْمِ ٱللَّهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ"
source
QuranTree.wordsMethod
words(quran::AbstractQuran)

Extract words of the input quran.

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps)
julia> tnzldata = table(tnzl)
julia> words(tnzldata[1][7])[1]
"صِرَٰطَ"
source
QuranTree.@dataMacro
@data(expr)

Extract the data property object.

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps);
julia> tnzldata = table(tnzl);
julia> feat = parse(Features, select(crpsdata.data, :features)[53])
julia> @data feat
:NEG
source
QuranTree.@descMacro
@desc(expr)

Extract the detailed description of a AbstractFeature.

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps);
julia> tnzldata = table(tnzl);
julia> feat = parse(Features, select(crpsdata.data, :features)[53])
julia> @desc feat
Stem
────
Negative:
 ├ data: NEG
 ├ desc: Negative particle
 └ ar_label: حرف نفي
Lemma:
 └ data: laA
Special:
 └ data: <in~
source
QuranTree.@transliteratorMacro
@transliterator(dict, name)

Create a custom transliterator using an input dict (Dict object) with its corresponding name as String object. This will automatically update the transliterator inside all functions like arabic, verses, and encode.

Examples

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps);
julia> tnzldata = table(tnzl);
julia> old_keys = collect(keys(BW_ENCODING))
julia> new_vals = reverse(collect(values(BW_ENCODING)))
julia> my_encoder = Dict(old_keys .=> new_vals)
julia> basmala = arabic(verses(crpsdata[1][1])[1])
julia> @transliterator my_encoder "MyEncoder"
julia> encode(basmala)
""S%gAS zppj[KS zp`j[&gA[r]S zp`j[&SkAS"
source
QuranTree.@transliteratorMacro
@transliterator(symbl)

Fallback to the default Buckwalter transliterator.

julia> data = QuranData()
julia> crps, tnzl = load(data)
julia> crpsdata = table(crps);
julia> tnzldata = table(tnzl);
julia> old_keys = collect(keys(BW_ENCODING))
julia> new_vals = reverse(collect(values(BW_ENCODING)))
julia> my_encoder = Dict(old_keys .=> new_vals)
julia> basmala = arabic(verses(crpsdata[1][1])[1])
julia> @transliterator my_encoder "MyEncoder"
julia> encode(basmala)
""S%gAS zppj[KS zp`j[&gA[r]S zp`j[&SkAS"
julia> @transliterator :default
julia> encode(basmala)
"bisomi {ll~ahi {lr~aHoma`ni {lr~aHiymi"
source