API References

QuranTree.FeaturesType
Features(data::String)

Convert a string to morphological feature object.

QuranTree.LemmaType
Lemma(data::String)

Convert a string to a Lemma object.

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.

QuranTree.RootType
Root(data::String)

Convert a string to a Root object.

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.

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.

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~")])
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);
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);
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);
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])
"قُلْ أَعُوذُ بِرَبِّ ٱلنَّاسِ"
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])
"ٱلرَّعْد"
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]))
"بسم ٱلله ٱلرحمٰن ٱلرحيم"
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"
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"
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.

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
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"
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])
"بِسْمِ اللَّهِ الرَّحْمَانِ الرَّحِيمِ"
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)
"بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ"
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"
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"
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~"
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])
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.

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]
"بِسْمِ ٱللَّهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ"
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]
"صِرَٰطَ"
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
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~
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"
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"