jquery-crossword-puzzle-generator
jquery-crossword-puzzle-generator copied to clipboard
How to break word of Indic Languages with the Halant (associated character)
Hello HoldOffHunger,
I am referring to the demo at this link for Hindi Language. This is working absolutely correct. However, while reading the words from DEVNAGARI script (Used to write many Indic Languages) letters are formed with respective associated character (HALANT or VIRAM signs). Demo URL: https://www.earthfluent.com/hindi/nouns-concepts-part-35/play.php?action=CrosswordPuzzle&previousquizzes=10
How can we have the answer placed into grid same as what we see in answer dialog (yellow tick mark on the screen shot)? When added to grid it is broken as per the consonant and associated character (HALANT or VIRAM sign) Expected letter in grid is : क्षति whereas Actual letters in grid : क ् ष त ि
Thanks and best regards, Vidyesh.
Ah, that does indeed seem broken, I can confirm.
Let's see if I can whip up a fix, thanks for reporting.
Hello HoldOffHunger,
Thanks for the reply. I came across a function in python which uses the UNICODEDATA library. This produces the desired result. That is breaking DEVANAGARI words into clusters. Attaching the function for reference and the URL.
Function splitclusters Taken from: https://stackoverflow.com/questions/6805311/combining-devanagari-characters
Any idea of using a python library in jQuery? Below are two libraries on:
- https://github.com/mikekap/unicodedata2
- https://github.com/iwsfutcmd/unicodedataplus
Can you simulate/ retro-fit above function in jQuery ?
Also, if it works, then there is a need to make the max-cell-width to accommodate 3 characters. How to increase this width, please guide.
best regards,Vidyesh Ranade+91 9850 88 91 88
On Sat, Jul 18, 2020 at 9:37 PM HoldOffHunger [email protected] wrote:
Ah, that does indeed seem broken, I can confirm.
Let's see if I can whip up a fix, thanks for reporting.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/HoldOffHunger/jquery-crossword-puzzle-generator/issues/1#issuecomment-660503820, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXPESJXIJFM5BYANZTEUN3R4HCFXANCNFSM4O35NSNA .
import unicodedata, re
def splitclusters(s): """Generate the grapheme clusters for the string s. (Not the full Unicode text segmentation algorithm, but probably good enough for Devanagari.) Function Taken from: https://stackoverflow.com/questions/6805311/combining-devanagari-characters """ virama = u'\N{DEVANAGARI SIGN VIRAMA}' cluster = u'' last = None for c in s: cat = unicodedata.category(c)[0] if cat == 'M' or cat == 'L' and last == virama: cluster += c else: if cluster: yield cluster cluster = c last = c if cluster: yield cluster
a = "बिक्रम मेरो नाम हो" print (list(splitclusters(re.sub(r'\s', '', a))))
a = "क्षति" print (list(splitclusters(re.sub(r'\s', '', a))))