ambuda-org / vidyut

Infrastructure for Sanskrit software. For Python bindings, see `vidyut-py`.
48 stars 21 forks source link

Show sutra text #33

Closed shreevatsa closed 1 year ago

shreevatsa commented 1 year ago

Hacky code for https://github.com/ambuda-org/vidyut/issues/26 , but it actually seems to work:

image

Before merging I guess at minimum we should copy over https://raw.githubusercontent.com/ashtadhyayi-com/data/master/sutraani/data.txt so that it's hosted here — maybe convert it to a simple data/sutrapatha.tsv as suggested at https://github.com/ambuda-org/vidyut/issues/26#issuecomment-1369427224 that has entries like

8.4.68  अ अ

— but just pushing this commit for now as a savepoint for when I return to this later (not today). (Or if I don't return 😱 )

(Curious how much faster it will get when we change from array of 4000 items to JS object for faster lookup…)

shreevatsa commented 1 year ago

The async is kind of weird but it works, and loading sutrapatha.json doesn't block the rest of the app from loading, so this is probably best? Please take a look whether it's ready to merge.

Aside: note that transliterating to SLP1 makes it hard (AFAICT) to recover the original Devanagari (which is debatable in the first place) for:

— see https://github.com/indic-transliteration/indic_transliteration_py/issues/75 (this is the kind of thing that I'm hoping a Rust transliteration library would fix by being "pedantic" and requiring specifying a strategy instead of making ad-hoc choices, but it's probably fine for now).

shreevatsa commented 1 year ago

Made a small change, updated screenshot (tested with manual removal of "1.3.9": "tasya lopaH" from sutrapatha.json) — no error messages in JS console:

image
akprasad commented 1 year ago

wonderful -- thank you!!

akprasad commented 5 months ago

this is the kind of thing that I'm hoping a Rust transliteration library would fix by being "pedantic" and requiring specifying a strategy instead of making ad-hoc choices, but it's probably fine for now).

I'd love to discuss this with you further now that we have a starter implementation (https://ambuda-org.github.io/vidyut-lipi/).