Quranize provides Alquran in Go representation. Original source of Alquran is taken from http://tanzil.net in XML format.
Quranize can transform alphabet into arabic using fast and efficient algorithm: suffix-tree for indexing and dynamic programming for parsing.
https://godoc.org/github.com/alpancs/quranize
Here is a minimal example.
package main
import (
"fmt"
"github.com/alpancs/quranize"
)
func main() {
q := quranize.NewDefaultQuranize()
quran := quranize.NewQuranSimpleEnhanced()
encodeds := q.Encode("alhamdulillah hirobbil 'alamin")
fmt.Println(encodeds)
// Output: [الحمد لله رب العالمين]
locations := q.Locate(encodeds[0])
fmt.Println(locations)
// Output: [{1 2 0} {10 10 10} {39 75 13} {40 65 10}]
suraName, _ := quran.GetSuraName(locations[0].GetSura())
fmt.Println(suraName)
// Output: الفاتحة
aya, _ := quran.GetAya(locations[0].GetSura(), locations[0].GetAya())
fmt.Println(aya)
// Output: الْحَمْدُ لِلَّهِ رَبِّ الْعَالَمِينَ
}