-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add Kosha.__len__ - Add DhatuMeta with the following fields: - artha_sa - artha_en - artha_hi - karmatva - ittva - pada - Add PratipadikaEntry.lingas and BaseKrt.lingas
- Loading branch information
Showing
19 changed files
with
533 additions
and
70 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ clap.workspace = true | |
csv = "1.3.1" | ||
fst = "0.4.7" | ||
regex = "1.11.1" | ||
serde.workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Data scripts | ||
============ | ||
|
||
Simple utility scripts for creating Sanskrit data. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
"""Creates dhatu metadata based on data from ashtadhyayi.com. | ||
Usage: | ||
uv run fetch_dhatu_metadata.py | ||
""" | ||
|
||
|
||
import csv | ||
import io | ||
import json | ||
import pprint | ||
import urllib.request | ||
from vidyut.lipi import transliterate, Scheme | ||
|
||
|
||
def load_metadata() -> dict: | ||
url = "https://github.com/ashtadhyayi-com/data/raw/refs/heads/master/dhatu/data.txt" | ||
f = urllib.request.urlopen(url) | ||
return json.load(f) | ||
|
||
|
||
data = load_metadata() | ||
dhatus = data["data"] | ||
|
||
out = io.StringIO() | ||
w = csv.writer(out) | ||
w.writerow(["code", "artha_en", "artha_hi", "karma", "pada", "settva"]) | ||
for dhatu in dhatus: | ||
artha_en = dhatu["artha_english"] | ||
artha_hi = dhatu["artha_hindi"] | ||
code = dhatu["baseindex"] | ||
karma = dhatu["karma"] | ||
pada = dhatu["pada"] | ||
settva = dhatu["settva"] | ||
|
||
assert karma in {"S", "A", "D", '-'}, karma | ||
assert pada in {"P", "A", "U", '-'}, pada | ||
assert settva in {"S", "A", "V", '-'}, settva | ||
|
||
if karma == '-': | ||
assert karma == pada == settva == '-' | ||
continue | ||
|
||
w.writerow((code, artha_en, artha_hi, karma, pada, settva)) | ||
|
||
text = out.getvalue() | ||
print(text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[project] | ||
name = "scripts" | ||
version = "0.1.0" | ||
description = "Add your description here" | ||
readme = "README.md" | ||
requires-python = ">=3.13" | ||
dependencies = [ | ||
"vidyut>=0.3.1", | ||
] |
Oops, something went wrong.