Comments (6)
This MAY help!
http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/fuzzy-matching.html
http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/phonetic-matching.html
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-phonetic-tokenfilter.html
https://github.com/elasticsearch/elasticsearch-analysis-phonetic
from quran.com-api.
If you search for : "
http://alpha.quran.com/search?q=%D8%A7%D9%84%D8%B1%D9%82%D8%A7%D8%A8
"
Then the second result have " /em> " in the search results (in mid of the arabic text)
from quran.com-api.
@mmahalwy is it for translation index only? how is the ES indexing works currently, I see translation index and ayah index?
from quran.com-api.
@ATouhou yes getting that error not sure why. @gozali currently, ES indexes these models: https://github.com/quran/quran-api-rails/blob/dev/app/models/concerns/searchable.rb#L5 in which translation is further indexed by language.
This isn't too bad, but the challenge here is that transliteration is doing a match query rather than an actual transliteration refinement and match
from quran.com-api.
@gozali see what @ahmedre has built:
require 'levenshtein'
def compareText(ayahtext, query)
str = ''
best = 0
cutoff = 80
minPercent = 70
# adjust percentage for short queries against long ayahs
factor = ayahtext.length / query.length
if (factor > 10)
minPercent = minPercent - (factor / 2)
end
val = 0
ayah = ayahtext
while (true)
if ayah.length == 1
return 0
end
ayah = ayah[val..-1]
if val == 0
val = 1
end
if ((ayah[0] != query[0]) and (ayah.index(query[0]) == nil))
return best
end
ayah = ayah[ayah.index(query[0])..-1]
len = [ayah.length, query.length].min
truncated = ayah[0..len]
print 'comparing ' + query + ' vs ' + truncated + "\n"
distance = Levenshtein.distance query, truncated
print 'got ' + distance.to_s + "\n"
percent = 100 * (1.0 - (distance.to_f / truncated.length))
print "percent: " + percent.to_s + "\n"
if percent > minPercent
if percent > best
best = percent
end
if best > cutoff
return best
end
end
end
return best
end
def prepareText(str)
return str.gsub('oo', 'u')
.gsub('-', '')
.downcase
.gsub('aa', 'a')
.gsub(' ', '')
.gsub('ia', 'i')
.gsub('7', 'h')
end
ayah = 'bismillahirrahmanirraheem' # from db
print compareText(ayah, prepareText('ra7man'))
We need to run this either prior to ES to find matching ayahs OR somehow add this to ES for it to use this as a scoring mechanism for Transliteration. I don't know how to do that, but I think @sharabash would have a better idea.
from quran.com-api.
closing this
from quran.com-api.
Related Issues (20)
- Changes for the search HOT 1
- Unable to get any English tafsirs from /quran/tafsirs/{tafsir_id} endpoint HOT 1
- No arabic language provided HOT 1
- Audio does not play without VPN in Uzbekistan
- can i get your surah_names font? HOT 1
- timestamps for juz
- Tafsir in English Language does not appear while fetching the data from the API by verse or by chapter HOT 2
- Kind of a translation bug
- translate problem
- Get a page using v2 page number
- Tafsir Ibn Kathir [en] missing for 87:11 to 87:13, 105:1, 81:11 ....
- [Bug] Surah Al Naml Ayat 62 audio not working HOT 3
- Showing circle with KFQC Hafs font HOT 5
- What font type should I use? HOT 3
- Typo in API calls
- Surah 82 Audio bug
- Inconsistent Endpoint Structure for Reciter Audio Files
- Need To download database in my android app
- Surahs do not start with Bismillahirahmaniraheem. Is this new?
- Wrong recitations from API
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quran.com-api.