Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Arabic word Searching from Arabic text File

I am working on a Quran application. I have text file(UTF-8) of the Quran (in Arabic language). I want to search my Arabic word from the Quran. I want to write an Arabic word of Quran without Aarabs e.g. Zaber, Zair, shud, Mud and Paish. Aarabs are basically Arabic vowels. Arabic Aarabs detail

Following is the code to search the English word from my ArrayList called testingarray. But for Arabic it's not returning the correct word.

testingarray.get(Index).toString().trim().toLowerCase().contains(word.trim().toLowerCase())) {
like image 251
M.ArslanKhan Avatar asked Nov 01 '22 08:11

M.ArslanKhan


1 Answers

Here the Arabic set table of the Unicode, It's more easy to use Regex to filter such complex text.

This is an example for short vowels removing in PHP (I'm not a java programmer)

text.preg_replace("/[\x{064B}-\x{065F}]/u","")

There are more other vowels in Noble Quran you may need to add their ranges.

Just to be more accurate you may need to Normalize the Arabic text.

like image 161
user.dz Avatar answered Nov 08 '22 07:11

user.dz