API References
QuranTree.Features
— TypeFeatures(data::String)
Convert a string to morphological feature object.
QuranTree.Lemma
— TypeLemma(data::String)
Convert a string to a Lemma
object.
QuranTree.Prefix
— TypePrefix(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.Root
— TypeRoot(data::String)
Convert a string to a Root
object.
QuranTree.Special
— TypeSpecial(data::String)
Convert a string to a Special
object.
QuranTree.Stem
— TypeStem(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.Suffix
— TypeSuffix(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.parse
— Methodparse(::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.load
— Methodload(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.table
— Methodtable(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.table
— Methodtable(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.arabic
— Methodarabic(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_name
— Functionchapter_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.dediac
— Methoddediac(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.encode
— Methodencode(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.encode
— Methodencode(::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.encode
— Methodencode(s::Union{Char,String}, encoder::AbstractEncoder)
Transliterate the input String
object using a custom encoder
. Custom encoder
is generated using the @transliterator
.
QuranTree.isfeature
— Methodisfeature(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.lemma
— Methodlemma(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.normalize
— Methodnormalize(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.normalize
— Methodnormalize(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.normalize
— Methodnormalize(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.root
— Methodroot(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.special
— Methodspecial(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.verses
— Methodverses(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.verses
— Methodverses(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.verses
— Methodverses(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.words
— Methodwords(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.@data
— Macro@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.@desc
— Macro@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.@transliterator
— Macro@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.@transliterator
— Macro@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"