uslap-query / Code_files /archive /batch_scripts /diwan_s38_vol3_batch.py
uslap's picture
Upload folder using huggingface_hub
7cc8e29 verified
Raw
History Blame Contribute Delete
14.9 kB
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Session 38 β€” Diwan Vol 3 Batch Write
Vol 3 pp.1-51 (PDF 775-825)
Content: NOUNS organized by vowel pattern
Sections: bilateral β†’ trilateral β†’ quadrilateral β†’ quinquelateral
Run: python3 Code_files/diwan_s38_vol3_batch.py
"""
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__)))
from uslap_handler import write_entry
KITAB = "kitab al-asma vol.3"
VOL = 3
def w(headword, gloss, page, section, wc="NOUN", nazm=False):
data = {
"headword": headword, "aa_gloss": gloss,
"ms_page": page, "diwan_section": section,
"word_class": wc, "kitab": KITAB, "volume": VOL,
}
if nazm:
data["has_nazm"] = 1
try:
r = write_entry(data, "WORD_DIWAN")
return r.get("success", False)
except Exception as e:
print(f" ERR: {headword[:40]} β€” {e}")
return False
ok = fail = 0
def track(result):
global ok, fail
if result: ok += 1
else: fail += 1
# ─── pp.1-2: Opening entries ──────────────────────────────────────────
track(w("yim (1)", "al-fida β€” ransom/redemption. waqa'a al-fida fi al-'aynayn", 1, "bab bilateral / (m)"))
track(w("yim (2)", "al-afawiya β€” spices/aromatics", 1, "bab bilateral / (m)"))
track(w("bin (1)", "al-furat β€” the Euphrates/sweet water", 1, "bab bilateral / (n)"))
track(w("bin (2)", "fazin al-asad β€” lion's mane", 1, "bab bilateral / (n)"))
track(w("NAZM: laghuz qurtash qaiy tuzlaqi", "nazm β€” verse about wind, storm and battle", 1, "bab bilateral / (n)", nazm=True))
# p.2 β€” kinship section
track(w("GRAMMAR: bab fa'l wa-fu'l wa-fi'l musakkana al-hashw", "New section: nouns with quiescent middle letter. Organized by vowel pattern across bilateral and trilateral forms", 2, "bab fa'l musakkana β€” introduction", "GRAMMAR"))
track(w("yizb al-malik", "al-shaykh al-hakim β€” the wise elder", 2, "bab fa'l musakkana / (b)"))
track(w("yizb (2)", "dhawqabi al-wajh β€” cold-faced. idha wajadahu al-surud", 2, "bab fa'l musakkana / (b)"))
track(w("yirt", "atlal wa-al-riy' wa-al-diman β€” ruins, remains and traces", 2, "bab fa'l musakkana / (t)"))
track(w("yirt (2)", "al-jabal al-sald β€” the hard/barren mountain", 2, "bab fa'l musakkana / (t)"))
track(w("yirkh", "akhu al-mar'a al-saghir β€” younger brother of the woman. Age-graded kinship: younger=yini, older=akhi (AA root A-KH-W), eldest=aka", 2, "bab fa'l musakkana / (j)"))
track(w("yind (1)", "al-habl β€” rope. yaqa'u 'ala al-wahid wa-al-jam' (singular and plural same form)", 2, "bab fa'l musakkana / (d)"))
# p.3
track(w("yind (2)", "ism ihda al-sittin al-almashi 'ashara bi-al-turkiyya: yindili", 3, "bab fa'l musakkana / (d)"))
track(w("GRAMMAR: bab fa'l wa-fu'l wa-fi'l haraka al-mashri", "New section: nouns with voweled middle", 3, "bab fa'l haraka β€” introduction", "GRAMMAR"))
track(w("yidat al-malik", "al-shay' alladhi la khayr fihi β€” the worthless thing", 3, "bab fa'l haraka / (t)"))
track(w("yikat", "al-thabit min kull shay' β€” the firm/established from everything", 3, "bab fa'l haraka / (t)"))
track(w("yikat (2)", "harf ya'ni: na'am β€” particle meaning: yes", 3, "bab fa'l haraka / (t)"))
track(w("bikh (1)", "al-maqila min al-fisal β€” resting place of young camels", 3, "bab fa'l haraka / (j)"))
track(w("bikh (2)", "al-hiqf β€” the sand dune", 3, "bab fa'l haraka / (j)"))
track(w("bikh (3)", "'awdat kull β€” every return/cycle", 3, "bab fa'l haraka / (j)"))
track(w("bikh (4)", "al-farsakh min al-ard β€” the parasang of land", 3, "bab fa'l haraka / (j)"))
# pp.4-6: more bilateral/trilateral entries
track(w("yish", "al-iman β€” faith/belief", 4, "bab fa'l haraka / (sh)"))
track(w("yilk", "al-mulk β€” kingdom/sovereignty", 4, "bab fa'l haraka / (k)"))
track(w("mush", "al-amana li-al-aqarib β€” the dowry/gift for relatives. Used in al-'urus (weddings)", 6, "bab fa'l haraka / (m)"))
track(w("mush (2)", "al-risala bayn al-julun β€” the letter/message between people. Also: al-malik should not be called from this word mushishi because al-malik is greater", 6, "bab fa'l haraka / (m)"))
track(w("'iysh", "al-fawaka β€” fruit. ism jami' (collective noun)", 6, "bab fa'l haraka / (m)"))
# (gh) section
track(w("yighigh", "al-imam β€” the leader. yastafidna shibil", 6, "bab fa'l haraka / (gh)"))
track(w("yighigh (2)", "al-labn min kull shay' β€” milk/sap from everything", 6, "bab fa'l haraka / (gh)"))
track(w("yughant", "al-hawtal β€” the rope/lasso. lugha kaghaz", 6, "bab fa'l haraka / (gh)"))
track(w("yighigh (3)", "anna al-insan yajzimu ghayurah β€” that a person resolves/determines others", 6, "bab fa'l haraka / (gh)"))
# pp.7-10
track(w("yash", "al-'umr β€” age/lifespan", 7, "bab fa'l haraka / (sh)"))
track(w("yash (2)", "al-rutuba β€” moisture/wetness", 7, "bab fa'l haraka / (sh)"))
track(w("yiz", "al-athar β€” trace/track", 8, "bab fa'l haraka / (z)"))
track(w("yuz", "al-wajh β€” the face", 8, "bab fa'l haraka / (z)"))
track(w("yuz (2)", "mi'a β€” hundred. al-'adad", 8, "bab fa'l haraka / (z)"))
# pp.11-14 β€” trilateral continued
track(w("yiqiq (1)", "al-fanbqu β€” the arrow/projectile. With proverb: awt nuqtalnuz yibas", 11, "bab thulathiyy / (q)"))
track(w("bisiq", "al-maqnus β€” the known/designated", 11, "bab thulathiyy / (q)"))
track(w("NAZM: yilki sayn allah al-kabira", "nazm β€” verse about brave man. Mentions sayn allah al-kabira wa-al-saghir (the great and small bounty of Allah)", 11, "bab thulathiyy / (q)", nazm=True))
track(w("yuqi", "al-tarz'a β€” the small path in the passage. wa-hiya tariq saghir fi al-mamazza", 11, "bab thulathiyy / (q)"))
track(w("laqi", "al-dabiq β€” the sticky/adhesive", 11, "bab thulathiyy / (q)"))
# pp.14-16 β€” proverbs and entries
track(w("yibin", "al-qarin min tahabbub β€” companion from affection/love", 14, "bab thulathiyy / (n)"))
track(w("yirin", "'azm al-kutub β€” greatness of books. wa-al-turkiyya fihi yaqul: yirin li-munsa libil li-munsur", 14, "bab thulathiyy / (n)"))
track(w("yizal", "fata'at al-sabah β€” piece of morning/dawn fragment", 14, "bab thulathiyy / (n)"))
track(w("yibin (2)", "al-abriq β€” the bright/lightning-like. With Turkic wisdom proverb", 14, "bab thulathiyy / (n)"))
track(w("yiyin", "al-shakuma min al-turab β€” the dust-heap. yiyin az = the man near to brethren", 14, "bab thulathiyy / (n)"))
track(w("yiqin", "al-qarib min kull shay' β€” the near/close from everything", 14, "bab thulathiyy / (n)"))
track(w("yiqin az", "al-rajul al-qarib min al-ukhuwwa β€” the man close to brotherhood", 14, "bab thulathiyy / (n)"))
# pp.16-18 β€” section transitions
track(w("yilw", "al-siraj β€” the lamp. wa-yuqal li-al-siraj: yila", 16, "bab thulathiyy / (l)"))
track(w("yuw", "harf wa-ma'nahu β€” particle meaning: and. Also: ayqat hadha al-kalam wa-hafiztuhu", 16, "bab thulathiyy / (m)"))
track(w("yinasuq", "wa-ma'nahu: naya β€” meaning: a flute", 16, "bab thulathiyy / (n)"))
track(w("GRAMMAR: wuqu' akhar β€” section on final patterns", "New sub-section: nouns ending in specific patterns. Opens with ya' entries", 16, "wuqu' akhar β€” introduction", "GRAMMAR"))
track(w("biya", "ayat al-insan sha'ma β€” the verse/sign of the person's mark/brand", 16, "wuqu' akhar / (b)"))
track(w("buwa", "al-tarzut β€” the stitch/suture. wa-huwa naqt bi-masirihi fi tukhaj", 16, "wuqu' akhar / (b)"))
# p.18 β€” section headers
track(w("GRAMMAR: bab fa'ali β€” new pattern section", "Section: fa'ali pattern nouns", 18, "bab fa'ali β€” introduction", "GRAMMAR"))
track(w("yiji", "al-sab'a fi al-'adad β€” the seven in counting", 18, "bab fa'ali / (t)"))
track(w("GRAMMAR: bab fu'al β€” new pattern section", "Section: fu'al pattern nouns", 18, "bab fu'al β€” introduction", "GRAMMAR"))
track(w("yubagh", "al-mur'azzi β€” goat hair/mohair", 18, "bab fu'al / (b)"))
track(w("GRAMMAR: bab fa'al fi harakatihi β€” new pattern section", "Section: fa'al nouns with their vowel movements", 18, "bab fa'al β€” introduction", "GRAMMAR"))
track(w("yishut", "al-jawab β€” the answer/reply", 18, "bab fa'al / (t)"))
track(w("yishut (2)", "al-mawd wa-al-naqsh β€” decoration and engraving", 18, "bab fa'al / (t)"))
track(w("biyakh", "lugha fi yibakh β€” dialect form of yibakh", 18, "bab fa'al / (j)"))
track(w("biyadh", "al-mask β€” the musk", 18, "bab fa'al / (d)"))
track(w("yiladh", "huwa 'idhar al-farasi β€” the horse's halter/cheekpiece", 18, "bab fa'al / (d)"))
# p.20 β€” continued
track(w("shimuw", "al-lu'lu' β€” pearls. wa-bihi yusamma al-amahu (by it named the maid). With proverb", 21, "bab thulathiyy / (sh)"))
track(w("binduw", "huwa tuwal wabr al-jamir 'ind al-maqshuk β€” long camel hair when combed", 21, "bab thulathiyy / (m)"))
track(w("yinduws", "al-'aha β€” calamity/misfortune", 21, "bab thulathiyy / (m)"))
track(w("bindi", "fisalat al-fisa' 'inda akl al-ta'am β€” hand-washing after eating food", 21, "bab thulathiyy / (m)"))
track(w("tizi yibz", "al-aradi al-musayyada β€” the level/flat lands", 21, "bab thulathiyy / (r)"))
track(w("yibinzu", "tul wabr al-jamir β€” length of camel hair. wa-al-dal ka-yuqal fi al-'arabiyya (sakandahu)", 21, "bab thulathiyy / (r)"))
# p.24 β€” CRITICAL: anti-borrowing statement
track(w("yigha", "ism qarij qunb β€” name of a town", 24, "bab thulathiyy / (gh)"))
track(w("yilgha", "al-lakda al-farasi min al-turkiyya β€” the horse-kick, from Turkic", 24, "bab thulathiyy / (gh)"))
track(w("GRAMMAR: Kashgari anti-borrowing statement", "Kashgari explicitly states: wa-laysa li-ahadin an yaqula inna al-turak akhadhat min al-furs β€” no one should say the Turks took from the Persians. la lahum akhwaj ila al-manzar min sa'ir al-hanaqi li-yakuna al-amtadh wa-al-naqsh fi biladihim akthar β€” they have no need to look to others, for crafts and engravings in their lands are more abundant", 24, "bab thulathiyy β€” anti-borrowing declaration", "GRAMMAR"))
track(w("yizna", "ism dhawj β€” name of a spouse", 24, "bab thulathiyy / (n)"))
track(w("yikna", "al-alwja β€” the almond", 24, "bab thulathiyy / (n)"))
# pp.26-34: quadrilateral nouns
track(w("GRAMMAR: hadhihi abwab al-ruba'iyy β€” quadrilateral nouns open", "Quadrilateral noun section opens. Pattern: fa'lal and variants", 26, "abwab al-ruba'iyy β€” introduction", "GRAMMAR"))
track(w("sibnaf", "al-haniya wa-al-qirdha min al-sha'r wa-al-suf β€” the henna and monkey-like from hair and wool", 26, "abwab al-ruba'iyy / (t)"))
track(w("sibnakh", "ibada saghira β€” small worship/prayer place", 26, "abwab al-ruba'iyy / (j)"))
track(w("yughraz", "al-matar β€” rain. lugha: yughraz", 26, "abwab al-ruba'iyy / (d)"))
track(w("NAZM: fandiy bak yughraz", "nazm β€” verse about rain and clouds descending. With proverb", 26, "abwab al-ruba'iyy / (d)", nazm=True))
track(w("yiqladuq", "ism amir ka-dha β€” name of a prince/commander. In origin: al-tashdid min kull shay'", 31, "abwab al-ruba'iyy / (q)"))
track(w("yitnaq", "al-mutazrij al-mudawwaz min kull naw' β€” the mixed/compound from every type", 31, "abwab al-ruba'iyy / (q)"))
track(w("yihnaqi", "alladhin min kull shay' β€” those of every kind", 31, "abwab al-ruba'iyy / (t)"))
track(w("yindiq yikan", "shawla al-fuqadh β€” the matter of jurists", 31, "abwab al-ruba'iyy / (t)"))
track(w("yindiq yikir", "al-ghariyubin β€” the strange/foreign ones", 31, "abwab al-ruba'iyy / (t)"))
track(w("yindaf", "dhawqi al-faras 'adatan β€” the horse's usual temperament. With proverb: yibnak irsa kuzal", 31, "abwab al-ruba'iyy / (d)"))
track(w("yibqi", "al-ashjan β€” sorrows/griefs", 31, "abwab al-ruba'iyy / (b)"))
# p.34 β€” quadrilateral conclusion + quinquelateral opens
track(w("bilaiqr", "ism yutlaqu 'ala dhulal al-muluk β€” name applied to agents of kings. lugha: amiz", 34, "abwab al-ruba'iyy / (r)"))
track(w("yibitiq at", "aqras alladhi la yasra' β€” the horse that does not gallop. With proverb", 34, "abwab al-ruba'iyy / (q)"))
track(w("yibshafur", "al-ukhrud β€” the furrow/groove", 34, "bab fa'alil / (gh)"))
track(w("GRAMMAR: inqadat abwab al-ruba'iyy", "Quadrilateral noun section concluded", 34, "abwab al-ruba'iyy β€” conclusion", "GRAMMAR"))
track(w("GRAMMAR: hadhihi abwab al-khumasiyy β€” quinquelateral nouns open", "Quinquelateral noun section opens. Pattern: fa'allal and variants", 34, "abwab al-khumasiyy β€” introduction", "GRAMMAR"))
track(w("yibudhiq kasir ku", "jirat β€” neighbors", 34, "abwab al-khumasiyy / (gh)"))
# pp.36-40: quinquelateral continued
track(w("yimqalabaq", "manbit al-juz β€” walnut growing place", 36, "abwab al-khumasiyy / (m)"))
track(w("yirqalaq", "al-nur wa-al-diya' β€” light and radiance", 36, "abwab al-khumasiyy / (r)"))
track(w("yindaqaq az", "al-rajul al-mizan β€” the balanced/just man", 36, "abwab al-khumasiyy / (d)"))
track(w("yiknaflak", "al-rabi' al-malbus al-quwwa β€” the strong-garmented spring", 36, "abwab al-khumasiyy / (k)"))
track(w("yishkilak yimaj", "ikhtama al-musunda β€” the sealed/authorized", 36, "abwab al-khumasiyy / (sh)"))
track(w("GRAMMAR: bab fa'malal fi harakatihi", "New pattern section within quinquelateral", 36, "bab fa'malal β€” introduction", "GRAMMAR"))
# pp.40-46: verb entries begin
track(w("al kashibi al nilm suruz yishnaql", "dhaka wa-dhaka al-kalam β€” this and that speech", 40, "bab fa'malal / (t)"))
track(w("shukri yibrlak yizshnaql", "allah ta'ala khalaqa al-ardh β€” Allah Most High created the earth", 40, "bab fa'malal / (t)"))
track(w("kan al-awni'gh yizshnaql", "al-ahtamshi hiya abadan β€” the sun forever its light and glory", 40, "bab fa'malal / (n)"))
# pp.44-46 β€” more entries
track(w("al yibkibi yibtadi", "as'ala awdhin min shaybuwr al-din β€” asked the elders of the religion", 44, "bab thulathiyy verbs / (b)"))
track(w("al bakibi yishndi", "asala awdhin min shaybuwr β€” asked the elders", 44, "bab thulathiyy verbs / (b)"))
track(w("al aghriz yibndi", "tawzi'a bi-al-aradi β€” distributed across the lands", 44, "bab thulathiyy verbs / (gh)"))
track(w("NAZM: naghraz biyit shat awfin", "nazm β€” verse about property and wealth distribution. With proverb about travel and possessions", 44, "bab thulathiyy verbs", nazm=True))
# pp.46-51 β€” final entries in range
track(w("al yibkbi yishndi (2)", "asala al-rijal β€” asked the men", 46, "bab thulathiyy verbs / (b)"))
track(w("al rakh yishndi", "al-barr wa-al-sha'ir wa-al-duhn β€” wheat, barley and oil (a drink)", 46, "bab thulathiyy verbs / (r)"))
track(w("al ani akhtanishi yishndi", "halama wa-aqishi β€” dreamed and awoke", 46, "bab thulathiyy verbs / (n)"))
track(w("al tari'kh yishndi", "awlaba al-qursa β€” turned the disk/wheel", 46, "bab thulathiyy verbs / (t)"))
track(w("azniq yishndi", "kharaja al-mihandis β€” the engineer/craftsman emerged. Also: ashbalaqu yishndi = qama'at al-silah (weapon manufacture)", 46, "bab thulathiyy verbs / (n)"))
print(f"\n{'='*60}")
print(f"VOL 3 BATCH COMPLETE")
print(f"Total OK: {ok}")
print(f"Total FAIL: {fail}")