#!/usr/bin/env python3 """ USLaP Root Meaning Populator Populates root_meaning in quran_root_dictionary from: 1. Curated Qur'anic root meanings (high + mid frequency) 2. A1_ENTRIES lattice data (cross-reference) Root meanings are from the ROOT — not from translators. """ import sqlite3 try: from uslap_db_connect import connect as _uslap_connect _HAS_WRAPPER = True except ImportError: _HAS_WRAPPER = False import os DB_PATH = os.path.join(os.path.dirname(__file__), "uslap_database_v3.db") # ═══════════════════════════════════════════════════════════════ # COMPREHENSIVE QUR'ANIC ROOT MEANINGS # Organized by frequency tier. Meanings from ROOT, not translators. # ═══════════════════════════════════════════════════════════════ ROOT_MEANINGS = { # ── TIER 1: 100+ tokens (94 roots, ~25,500 tokens) ── "أله": "to be god, to worship, divinity", "قول": "to say, to speak, speech, utterance", "كون": "to be, to exist, to come into being", "علم": "to know, knowledge, to be aware", "قوم": "to stand, to rise, to establish, a people", "أتي": "to come, to arrive, to bring", "بين": "to make clear, between, evidence, clarity", "شيأ": "a thing, something, an entity", "رسل": "to send, a messenger, a message", "يوم": "a day, a period of time", "أرض": "earth, land, ground", "سمو": "to be high, to be elevated, sky, heaven", "كلل": "all, every, entirety, totality", "عمل": "to work, to do, to act, a deed", "جعل": "to make, to place, to set, to appoint", "أنس": "humanity, people, to be familiar", "رأي": "to see, to perceive, vision, opinion", "كتب": "to write, to prescribe, a book, scripture", "هدي": "to guide, guidance, a gift, right direction", "نفس": "a self, a soul, breath, essence", "قبل": "to accept, to receive, before, facing", "نزل": "to send down, to descend, to reveal, a station", "كذب": "to deny, to reject as false, falsehood", "جيأ": "to come, to arrive, to bring forth", "أخذ": "to take, to seize, to grasp", "خلق": "to create, creation, character, nature", "أخر": "another, other, the latter, the hereafter", "أمر": "to command, authority, a matter, an affair", "بعد": "after, far, distant, remote", "دعو": "to call, to invoke, to summon, a prayer", "حكم": "to judge, to rule, wisdom, authority", "ملك": "to possess, to own, sovereignty, dominion, king", "عند": "with, at, near, in the presence of", "سمع": "to hear, to listen, hearing, obedience", "خير": "good, better, goodness, welfare", "حسن": "to be good, to be beautiful, excellence", "نور": "light, illumination, radiance", "ضلل": "to go astray, to be lost, misguidance, error", "حيي": "to live, to be alive, life, to greet", "بني": "to build, to construct, a son, offspring", "خرج": "to go out, to exit, to bring forth, to extract", "صلح": "to be good, to be righteous, to reform, prayer", "سبل": "a way, a path, a road", "تبع": "to follow, to pursue, a follower", "قتل": "to kill, to slay, to fight", "مثل": "to resemble, a likeness, a parable, an example", "قلب": "to turn, to overturn, a heart, the core", "سوأ": "to be bad, evil, wrongdoing, harm", "كثر": "to be many, much, abundance, majority", "موت": "to die, death, to be lifeless", "كبر": "to be great, to be old, greatness, pride", "شهد": "to witness, to testify, testimony, to be present", "نبأ": "news, tidings, information, a report", "بعض": "some, a part, a portion", "صدق": "to be truthful, truth, sincerity, charity", "غير": "other than, to change, different", "وعد": "to promise, a promise, an appointment", "بصر": "to see, sight, vision, insight, perception", "رود": "to seek, to want, to intend, will", "لقي": "to meet, to encounter, to find", "دون": "below, beneath, without, less than", "نعم": "blessing, favor, grace, to be pleasant", "وسي": "to be wide, to encompass, capacity", "دنو": "to be near, to be close, the lowest, worldly life", "قدر": "to measure, to decree, power, ability, destiny", "نذر": "to warn, a warning, a vow", "جمع": "to gather, to collect, to assemble, all together", "سأل": "to ask, to question, to request", "طوع": "to obey, to submit, obedience, willingly", "نظر": "to look, to see, to observe, to consider", "عظم": "to be great, to be mighty, greatness, a bone", "أهل": "people, family, inhabitants, worthy of", "دخل": "to enter, to go in, entrance", "أول": "first, beginning, to interpret, to return", "خوف": "to fear, fear, dread", "بشر": "humanity, skin, to give good news, glad tidings", "رزق": "to provide, provision, sustenance, livelihood", "عزز": "to be mighty, to be powerful, honor, strength", "يدي": "a hand, power, possession, means", "جزي": "to repay, to reward, to recompense, sufficient", "أبو": "a father, ancestry, parentage", "نهر": "a river, flowing water, daytime, to rebuke", "أكل": "to eat, food, sustenance, consumption", "حسب": "to reckon, to count, to think, sufficient", "أجر": "reward, recompense, wages, payment", "فعل": "to do, to act, an action, a deed", "وجد": "to find, to discover, to feel", "عدو": "to be hostile, an enemy, enmity, to transgress", "رجع": "to return, to go back, to come back", "فضل": "to be superior, grace, favor, bounty, surplus", "صبر": "to be patient, patience, endurance, steadfastness", "أذن": "to permit, an ear, permission, to announce", "شدد": "to be strong, to be severe, intensity, firmness", "ولد": "to give birth, a child, offspring, parentage", # ── TIER 2: 50-99 tokens (high-mid frequency) ── "وجه": "a face, a direction, to turn toward", "حرم": "to forbid, to be sacred, forbidden, sanctuary", "بلغ": "to reach, to convey, to attain, mature", "فرق": "to separate, to divide, to distinguish, a group", "حمل": "to carry, to bear, to conceive, a burden", "وقي": "to protect, to guard, to fear (Allāh), piety", "ولي": "to be near, to be a guardian, an ally, authority", "عرف": "to know, to recognize, the heights, custom", "ظلم": "to wrong, to oppress, darkness, injustice", "شرك": "to associate, to partner, polytheism, a partner", "زين": "to adorn, to beautify, adornment, beauty", "فتن": "to test, to try, a trial, a tribulation", "غفر": "to forgive, to cover, forgiveness", "حدث": "to happen, to speak, new, an event", "مسس": "to touch, to reach, to afflict", "رحم": "to show mercy, mercy, compassion, a womb", "كفر": "to cover, to deny, to disbelieve, ingratitude", "صلو": "to pray, to connect, prayer, bond", "عبد": "to worship, to serve, a servant, devotion", "نصر": "to help, to support, victory, aid", "سبح": "to swim, to glorify, to declare perfection", "شكر": "to be grateful, gratitude, thankfulness", "عرض": "to show, to present, width, this world", "وضع": "to place, to put down, to lay, position", "فتح": "to open, to begin, victory, an opening", "ذكر": "to remember, to mention, male, remembrance", "حول": "to change, to transform, around, power, a year", "وصي": "to advise, to command, a bequest, a will", "وصل": "to connect, to reach, a bond, joining", "قرأ": "to read, to recite, a recitation", "طعم": "to taste, to eat, food, flavor", "لبس": "to wear, to clothe, clothing, to confuse", "زوج": "a pair, a spouse, a type, to join in pairs", "كسب": "to earn, to gain, acquisition", "مرر": "to pass, to go by, bitter, a time", "حمد": "to praise, praise, thankworthy", "فسد": "to be corrupt, corruption, decay, disorder", "قرب": "to be near, to approach, nearness, an offering", "شعر": "to feel, to perceive, hair, a poet", "حور": "to return, to converse, intense whiteness", "مسك": "to hold, to grasp, to retain, to withhold", "وكل": "to entrust, to rely, a guardian, trust", "ذهب": "to go, to depart, gold", "فرح": "to rejoice, joy, happiness", "عقب": "to follow, to succeed, a consequence, a heel", "عقل": "to understand, reason, intellect, to bind", "قصص": "to narrate, to tell, a story, to track", "لعل": "perhaps, maybe, so that", "حبب": "to love, love, a seed, beloved", "ثمر": "fruit, produce, result", "ذنب": "a sin, a fault, a tail", "فلق": "to split, to cleave, daybreak, dawn", "حزن": "to grieve, to be sad, sorrow, grief", "جهل": "to be ignorant, ignorance, foolishness", "سكن": "to dwell, to be still, tranquility, a dwelling", "جنب": "a side, to avoid, a companion", "وحد": "to be one, oneness, alone, unity", "حفظ": "to guard, to protect, to preserve, to memorize", "ظهر": "to appear, to become visible, a back, outward", "مكن": "to establish, to empower, a place, power", "وحي": "to reveal, revelation, inspiration", "شرع": "to ordain, to legislate, a law, a path", "صنع": "to make, to manufacture, craftsmanship", "غنم": "to gain, spoils, wealth, sheep", "زمن": "time, a period, an age", "لحق": "to join, to reach, to follow", "نطق": "to speak, to utter, speech", "حقق": "to be true, truth, right, reality, binding", "كرم": "to be generous, to honor, noble, generous", "فقر": "to be poor, poverty, need, a vertebra", "كلم": "to speak, to wound, a word, speech", "بدل": "to change, to replace, to substitute, in exchange", "وزن": "to weigh, weight, balance, measure", "حبل": "a rope, a cord, a covenant", "جهنم": "Jahannam (the fire), hellfire", "شغل": "to occupy, to busy, occupation", "ظنن": "to think, to assume, opinion, conjecture", "قعد": "to sit, to stay, to remain, a seat", "نعق": "to call, to cry out (of a herder)", "فوز": "to win, to succeed, victory, salvation", "فرر": "to flee, to escape, flight", "نقم": "to punish, to avenge, retribution", "حشر": "to gather, to assemble, resurrection gathering", "عهد": "to covenant, a pledge, a promise, an era", "عصي": "to disobey, to rebel, disobedience, a staff", "هلك": "to perish, to destroy, destruction, ruin", "صرف": "to turn away, to spend, to direct", "غلب": "to overcome, to defeat, to prevail", "لعب": "to play, amusement, sport, a game", "حزب": "a party, a group, a faction", "قسم": "to divide, to distribute, a share, an oath", "مطر": "rain, to rain", "حبس": "to confine, to restrain, to imprison", "ذرأ": "to create, to multiply, offspring, creation", "سحر": "to bewitch, magic, sorcery, dawn", "خشي": "to fear, to be in awe, reverence", "غيب": "to be absent, unseen, hidden, the unknown", "حرص": "to desire eagerly, greed, keenness", "مكر": "to plan, to scheme, a plan, stratagem", "رقب": "to watch, to observe, a neck, to guard", "سجد": "to prostrate, to bow down, prostration", "عذب": "to punish, punishment, torment, sweet (water)", "ضرب": "to strike, to set forth, to travel, an example", "نبت": "to grow, to sprout, a plant, vegetation", # ── TIER 3: 10-49 tokens (mid frequency, most common) ── "شفع": "to intercede, intercession, even (number), a pair", "بطل": "to be void, to be false, falsehood, vanity", "صدر": "a chest, a breast, to issue forth, to begin", "عجب": "to wonder, to marvel, amazement, strange", "عرش": "a throne, a roof, a structure", "عصم": "to protect, to preserve, protection", "مهل": "to delay, to grant respite, slowly", "نسخ": "to copy, to abrogate, to replace", "سخر": "to mock, to ridicule, to subject, to make serve", "سلم": "to be safe, to submit, peace, Islam, a ladder", "حرب": "war, battle, to fight", "حرث": "to cultivate, a field, tillage, harvest", "خبر": "to know, news, to inform, experience", "صمم": "to be deaf, deafness, to be silent", "عدد": "to count, a number, to prepare", "عدل": "to be just, justice, equity, balance", "غضب": "to be angry, anger, wrath", "فلح": "to succeed, to prosper, to cultivate, a farmer", "كفل": "to guarantee, to take charge, a guarantor", "منع": "to prevent, to withhold, to forbid", "نجو": "to be saved, to escape, salvation, deliverance", "نسي": "to forget, forgetfulness", "هون": "to be easy, to humiliate, shame, disgrace", "صوم": "to fast, fasting, abstinence", "سكت": "to be silent, silence", "شفي": "to heal, to cure, healing, a remedy", "ريح": "wind, a scent, mercy, rest", "بلو": "to test, to try, a trial, affliction", "برر": "to be righteous, piety, land, good", "جري": "to flow, to run, a stream", "زرع": "to sow, to plant, crops, agriculture", "طلب": "to seek, to request, to demand", "عجل": "to hasten, to hurry, haste, a calf", "غرر": "to deceive, deception, vanity", "فقه": "to understand, understanding, jurisprudence", "قضي": "to decree, to judge, to fulfill, a decree", "لسن": "a tongue, a language, speech", "مرض": "to be sick, illness, disease", "ندو": "to call, an assembly, a gathering", "نكح": "to marry, marriage", "وزر": "a burden, a sin, a minister", "ورث": "to inherit, inheritance, heir", "يمن": "right side, oath, blessing, Yemen", "يسر": "to be easy, ease, prosperity, left side", "بسط": "to spread, to extend, to expand", "تجر": "to trade, commerce, merchandise", "حبط": "to be in vain, to nullify, loss of deeds", "حلل": "to be lawful, to untie, to alight", "حلف": "to swear, an oath, an ally", "حمي": "to protect, to be hot, protection, zeal", "خفي": "to be hidden, to hide, secret", "دبر": "to manage, a back, behind, to reflect", "ربب": "a lord, to nourish, to sustain, lordship", "ربح": "to gain, profit, advantage", "زلل": "to slip, to stumble, error", "سبق": "to precede, to outstrip, earlier", "سرر": "to be happy, a secret, joy, a bed", "سلط": "to give authority, power, dominion, a proof", "سلك": "to enter, to thread, a path", "سور": "a chapter, a wall, a fence", "شرب": "to drink, a drink", "شقق": "to split, to separate, difficulty, wretched", "صوب": "to be right, to direct, correct, to afflict", "ضرر": "to harm, harm, damage, adversity", "عبر": "to cross, to pass, a lesson, to interpret", "عشر": "ten, a tenth, a tithe, a clan", "علو": "to be high, to exalt, highness, arrogance", "عمر": "to live long, life, to build, to inhabit", "عور": "to be defective, an eye, a spring of water", "فتر": "to slacken, to weaken, a period, to subside", "فقد": "to lose, loss, to miss", "كيد": "to plot, to scheme, a stratagem", "لحم": "flesh, meat, to join", "لعن": "to curse, a curse, expulsion", "لوم": "to blame, blame, reproach", "مدد": "to extend, to stretch, to supply, a period", "مسي": "evening, to become evening", "نبي": "a prophet, prophethood", "نجم": "a star, a plant, to appear", "نحر": "to slaughter, the chest, the throat", "نزع": "to remove, to pull out, to strip", "نسب": "to attribute, lineage, genealogy", "نشر": "to spread, to scatter, to publish, resurrection", "وثق": "to trust, to bind, a bond, reliable", "وقع": "to fall, to happen, to occur, an event", "بدأ": "to begin, to originate, to start", "برق": "lightning, to flash, to shine", "بسم": "to name, in the name of, to smile", "بطن": "a belly, interior, hidden, inward", "جبر": "to compel, to mend, mighty, a bone-setter", "جحد": "to deny, to reject, denial", "جدل": "to argue, to debate, argument, dispute", "جسم": "a body, bodily, large", "جلد": "skin, a hide, to endure", "جلس": "to sit, a session, a gathering", "جنح": "to incline, to turn, a wing, a side", "حبط": "to be in vain, to nullify, loss of deeds", "حدد": "iron, to sharpen, to define, a limit", "حرر": "to free, freedom, heat, silk", "حفر": "to dig, a pit, an excavation", "خبأ": "to hide, to store, hidden", "خدع": "to deceive, deception, a trick", "خرر": "to fall, to murmur, flowing water", "خسر": "to lose, loss, ruin, bankrupt", "خطأ": "to err, a mistake, error, wrong", "خلد": "to remain forever, eternal, to be immortal", "خلص": "to be pure, to be sincere, sincerity", "خمر": "to cover, to ferment, wine, a headcover", "خون": "to betray, betrayal, treachery", "ذبح": "to slaughter, a sacrifice", "ذرر": "an atom, a particle, offspring", "رجز": "punishment, filth, abomination", "رجم": "to stone, to curse, a meteor", "ردد": "to return, to reject, to repeat", "ركب": "to ride, to mount, a rider", "ركع": "to bow, to kneel, bowing in prayer", "رمي": "to throw, to cast, to shoot", "زلف": "to approach, nearness, a station", "زهق": "to perish, to vanish, to be void", "سبت": "rest, the Sabbath, Saturday", "سبع": "seven, a beast of prey", "ستر": "to cover, to conceal, a veil", "سفر": "to travel, a journey, a book", "سقي": "to give drink, to water, a drink", "سمن": "to be fat, ghee, butter", "سند": "to lean, to support, elevated", "سود": "to be black, to be master, a leader", "صبح": "morning, dawn, to become", "صحب": "to accompany, a companion", "صرخ": "to cry out, a scream, a shout", "صوت": "a sound, a voice, to call", "ضحك": "to laugh, laughter", "ضيف": "a guest, hospitality", "طبع": "to stamp, to seal, nature, a print", "طرق": "to knock, a path, a way, night-comer", "طغي": "to transgress, tyranny, to exceed bounds", "طلع": "to rise, to appear, to ascend, sunrise", "طمع": "to desire, to covet, greed", "طهر": "to be pure, to purify, purity, clean", "طين": "clay, mud, earth", "طيب": "to be good, pleasant, pure, lawful", "عتق": "to free, ancient, old", "عجز": "to be unable, weakness, the rear, old age", "عرب": "to express clearly, Lisān Arabic speakers, clear", "عسي": "perhaps, may, to be near", "عقد": "to tie, to contract, a knot, a covenant", "علق": "to attach, to hang, a blood clot, to cling", "غرق": "to drown, drowning, to sink", "غسل": "to wash, washing, ablution", "غلل": "to enter, to deceive, a chain, a fetter", "غوي": "to go astray, to seduce, error", "فتي": "a youth, a young man, to give opinion", "فجر": "to break open, dawn, wickedness, to flow", "فرد": "to be single, alone, individual", "فرض": "to ordain, an obligation, a duty", "فزع": "to fear, to be alarmed, fright, terror", "فسق": "to transgress, to deviate, wickedness", "قبض": "to seize, to grasp, to contract, a handful", "قبس": "to take fire, a spark, to learn", "قدم": "to advance, a foot, ancient, the front", "قذف": "to throw, to hurl, to accuse", "قرر": "to settle, to be cool, an eye's comfort", "قسط": "to be just, justice, equity", "قصد": "to intend, purpose, moderate, straight", "قطع": "to cut, to sever, to break off", "لطف": "to be gentle, subtle, kind, gracious", "لقم": "a morsel, to feed, Luqmān", "لهو": "to be distracted, amusement, play", "متع": "to enjoy, enjoyment, provision, benefit", "مرج": "to mix, to release, to let loose", "مسح": "to wipe, to anoint, al-Masīḥ", "منن": "to bestow favor, a favor, a benefit", "نحل": "a bee, to grant, to attribute", "نسأ": "to delay, to postpone, a woman", "نشأ": "to grow, to arise, to create, origin", "نعت": "to describe, a quality, description", "نفخ": "to blow, to breathe, to inflate", "نفع": "to benefit, profit, advantage", "نفق": "to spend, expenditure, to tunnel, a hypocrite", "نقص": "to decrease, to diminish, deficiency", "وبل": "heavy rain, severity, bad consequence", "وثن": "an idol, a statue", "وفي": "to fulfill, to complete, fullness", "وقف": "to stop, to stand, to pause", "وقد": "to light, to kindle, fire, fuel", "وهب": "to give, to grant, a gift", # ── TIER 4: 1-9 tokens (low frequency, selected important ones) ── "أبب": "a pasture, herbage, fresh grass", "أبد": "eternity, forever, always", "أبق": "to flee, to escape, a fugitive", "أبل": "a camel, camels", "أبي": "to refuse, to reject, to disdain", "أثث": "furniture, furnishings, goods", "أثر": "a trace, a mark, a sign, to prefer", "أثل": "a tamarisk tree, firmly rooted", "أثم": "to sin, sin, guilt, transgression", "أجل": "a term, a period, a deadline, because of", "أخو": "a brother, brotherhood", "أدم": "skin, surface, Ādam, to bring together", "أرك": "a couch, a throne, to recline", "أزر": "to support, to strengthen, a wrap, backing", "أزز": "to be agitated, a buzz, to drive", "أزف": "to approach, to be near, the approaching", "أسر": "to capture, a prisoner, bonds, family", "أسس": "to found, a foundation, a base", "أسف": "to grieve, sorrow, regret", "أسن": "to stagnate, stale, unchanged", "أفف": "to express disgust, ugh, annoyance", "أفق": "a horizon, horizons", "أفك": "to lie, a lie, to turn away", "ألف": "to unite, to bring together, a thousand", "أمد": "a term, a period, a limit of time", "أنث": "female, feminine", "أني": "when, a time, ripe", "أوب": "to return, to repent, a return", "أوي": "to shelter, to take refuge, a shelter", "بأس": "might, power, strength, severity, war", "بتت": "to cut off, to decide, firmly", "بتل": "to devote, to cut off, devotion", "بثث": "to scatter, to spread, to disperse, grief", "بخس": "to diminish, to wrong, deficient", "بخل": "to be stingy, miserliness, niggardliness", "بدع": "to originate, to innovate, a creator", "برأ": "to create, to be free, innocent", "برج": "a tower, a constellation, a sign", "برد": "cold, coolness, hail", "بركك": "to bless, blessing, abundance", "برم": "to twist, to be weary, to dislike", "بزغ": "to rise, to appear, to shine", "بسل": "to be brave, to detain, forbidden", "بشع": "to be ugly, ugliness", "بصل": "an onion", "بضع": "a few, some (3-9), merchandise", "بطأ": "to be slow, to delay, slowness", "بطش": "to seize, to strike, power, might", "بعث": "to raise, to resurrect, to send", "بعد": "after, far, distant, remote", "بغض": "to hate, hatred, animosity", "بغي": "to desire, to seek, to transgress, a rebel", "بقر": "a cow, cattle", "بقي": "to remain, to last, everlasting", "بكك": "Bakkah (Makkah)", "بكم": "to be dumb, mute, speechless", "بكي": "to weep, to cry, weeping", "بلد": "a land, a town, a country", "بلس": "to despair, to be confounded", "بلع": "to swallow, to gulp", "بهت": "to be confused, to slander, falsehood", "بهج": "to be beautiful, beauty, delight", "بهم": "an animal, livestock, cattle", "بوأ": "to settle, a dwelling, to deserve", "بور": "to perish, to be ruined, fallow land", "بيت": "a house, a home, overnight", "بيض": "white, an egg, to be white", "بيع": "to sell, a sale, commerce, a pledge", "ثبت": "to be firm, to be stable, steadfast", "ثقب": "to pierce, a bright star", "ثقل": "to be heavy, weight, a burden, humans and jinn", "ثلث": "three, a third", "ثنن": "to fold, to double, two, a second", "ثوب": "to return, a garment, clothing, a reward", "ثور": "to rise, to stir up, a bull", "جبل": "a mountain, to create, nature", "جبن": "to be cowardly, a forehead", "جثو": "to kneel, to gather, on knees", "جدد": "to be new, to renew, serious, striving", "جرم": "to commit, a crime, a sin, a body", "جرر": "to drag, to draw, to pull", "جزع": "to be anxious, to be impatient", "جسد": "a body, embodied", "جعل": "to make, to place, to set, to appoint", "جلل": "to be great, a covering, to be majestic", "جنح": "to incline, to turn, a wing, a side", "جوب": "to cut through, to respond, to traverse", "جور": "to be unjust, injustice, nearby", "جوع": "hunger, to be hungry, famine", "جوف": "interior, hollow, inside", "حبب": "to love, love, a seed, beloved", "حتم": "to decree, to decide, definite", "حدب": "to arch, a hill, devoted care", "حذر": "to be cautious, caution, warning", "حرف": "a letter, an edge, to turn away", "حسد": "to envy, envy, jealousy", "حصد": "to reap, to harvest, a harvest", "حصن": "to be fortified, a fortress, chaste", "حصي": "to count, to enumerate, pebbles", "حضر": "to attend, to be present, settled life", "حمم": "to heat, hot water, black mud", "حنث": "to break an oath, sin, guilt", "حنف": "to incline, to be upright, true monotheism", "حوط": "to surround, to encompass, a wall", "حول": "to change, to transform, around, power, a year", "خبث": "to be impure, evil, wicked, filth", "خبط": "to strike, to confuse, to seize randomly", "خبت": "to be humble, humility", "ختم": "to seal, to stamp, a seal, an end", "خذل": "to forsake, to abandon, to fail", "خرص": "to guess, to conjecture, a liar", "خزي": "to be disgraced, shame, humiliation", "خسأ": "to drive away, to be despised", "خشع": "to be humble, to submit, humility", "خصم": "to dispute, an opponent, a quarrel", "خضر": "to be green, green, verdant", "خطب": "to address, a sermon, a matter", "خفض": "to lower, to humble, lowering", "خلل": "a gap, a defect, between", "خمس": "five, a fifth", "دحض": "to slip, to refute, false", "دحو": "to spread out, to extend", "دسس": "to hide, to bury, to corrupt", "دفع": "to push, to repel, to defend", "دكك": "to crush, to demolish, to level", "دلك": "to rub, to set (sun), decline", "دلو": "a bucket, to draw water", "دمر": "to destroy, destruction, ruin", "دمع": "tears, to weep", "دهر": "time, fate, an age, a long period", "ربص": "to wait, to watch, to lie in wait", "ربط": "to tie, to bind, to fasten, patient", "رتع": "to graze, to enjoy, pasture", "رتق": "to close, to seal, joined together", "رجف": "to tremble, to quake, an earthquake", "رجل": "a man, a foot, on foot", "رحل": "to depart, a journey, a saddle", "ردأ": "to support, to assist, a helper", "رسو": "to be firm, to anchor, mountains", "رشد": "to be rightly guided, right path, maturity", "رصد": "to watch, to observe, to lie in wait", "رضع": "to suckle, nursing, breastfeeding", "رضي": "to be pleased, to approve, contentment", "رعد": "thunder, to tremble", "رعي": "to tend, to watch over, to herd", "رغب": "to desire, to wish, willingness", "رفت": "to crumble, to decay, dust", "رفع": "to raise, to elevate, to lift", "رفق": "to be gentle, kindness, a companion", "ركد": "to be still, to be calm, motionless", "ركز": "to plant, to fix, a faint sound", "ركس": "to reverse, to overturn, to return to evil", "ركض": "to run, to stamp, to gallop", "رمض": "to be hot, scorching heat", "روح": "spirit, soul, rest, mercy, a breeze", "روض": "a garden, a meadow", "ريب": "doubt, suspicion, to disturb", "زبر": "to write, iron, to restrain", "زجر": "to rebuke, to scold, to drive away", "زحف": "to crawl, to advance, to march", "زخرف": "adornment, gold, decoration", "زكو": "to be pure, to grow, purity, charity", "زمر": "a group, a company, a band", "زنو": "to commit adultery, fornication", "زهد": "to renounce, asceticism", "زيت": "olive oil, olives", "زيد": "to increase, to add, more, increase", "زيغ": "to deviate, to swerve, crookedness", "سبب": "a cause, a means, a rope", "سبغ": "to be ample, to complete, abundant", "سترر": "to cover, to conceal, a veil", "سجل": "to record, a register, a bucket", "سجن": "to imprison, a prison", "سحب": "a cloud, clouds, to drag", "سحق": "to crush, remote, far away", "سخط": "to be angry, to be displeased, anger", "سرب": "to flow, a group, a flock, free", "سرج": "a lamp, a saddle, to shine", "سرح": "to let loose, to set free, to divorce", "سرع": "to hasten, to hurry, speed, quick", "سرق": "to steal, theft, a thief", "سطح": "to spread, to flatten, a surface, a roof", "سطر": "to write, a line, a row", "سعد": "to be happy, happiness, prosperity", "سعر": "to kindle, fire, a price, madness", "سعي": "to walk, to strive, to endeavor, an effort", "سفه": "to be foolish, folly, light-minded", "سقط": "to fall, to drop, a fall", "سقف": "a roof, a ceiling", "سكب": "to pour, to flow, pouring", "سكر": "to be drunk, intoxication, to close", "سلب": "to take away, to snatch, to strip", "سلسل": "a chain, to chain, fresh water", "سنن": "to prescribe, a way, a practice, a law", "سيح": "to flow, to travel, to roam", "سير": "to travel, to walk, a journey, a way of life", "شتت": "to scatter, to disperse, dispersed", "شجر": "a tree, trees, to dispute", "شحح": "to be stingy, to be greedy, miserliness", "شخص": "to raise, to stare, a person", "شرق": "to rise (sun), the east, to choke", "شطر": "a half, to face, a portion", "شعب": "a people, a nation, a tribe, to divide", "شفف": "an edge, a brink, to fear", "شمل": "to include, left side, to encompass", "شمس": "the sun", "شنأ": "to hate, hatred", "شهب": "a flame, a shooting star", "شهق": "to sob, to inhale, to be high", "شور": "to consult, consultation, to point", "شيب": "to become gray-haired, old age", "شيخ": "an elder, an old man", "صحح": "to be healthy, correct, true", "صخر": "a rock, rocks, stone", "صدع": "to split, to proclaim, a crack", "صدف": "to turn away, shells", "صرح": "to clarify, a palace, a building", "صرر": "to insist, to persist, a bundle, cold", "صعد": "to ascend, to climb, ascending", "صعق": "to swoon, a thunderbolt, to be struck", "صغر": "to be small, small, young", "صفح": "to forgive, to turn away, a page", "صفف": "to arrange, to line up, a row", "صفو": "to be pure, to choose, purity, clarity", "صلب": "to crucify, hard, firm, the backbone", "صمت": "to be silent, silence", "صهر": "to melt, a relation by marriage", "صوف": "wool", "صيح": "to cry out, a shout, a blast", "ضحي": "to sacrifice, morning, a sacrifice", "ضعف": "to be weak, weakness, double", "ضيق": "to be narrow, to be tight, distress", "طرح": "to throw, to cast, to discard", "طرد": "to drive away, to expel", "طفأ": "to extinguish, to put out", "طفق": "to begin, to set about", "طلق": "to divorce, to release, to set free", "طمس": "to obliterate, to erase, to blind", "طوف": "to go around, to circle, to roam", "طول": "to be long, length, power, a favor", "طيب": "to be good, pleasant, pure, lawful", "طير": "to fly, a bird, an omen", "عبأ": "to care, to prepare, to mind", "عبث": "to play, to act vainly, futile", "عبس": "to frown, to scowl", "عتب": "to blame, to censure, a step", "عتد": "to prepare, prepared, ready", "عثر": "to stumble, to find, to discover", "عدن": "a garden, Eden, to settle", "عرج": "to ascend, to limp, a stairway", "عرض": "to show, to present, width, this world", "عزل": "to isolate, to remove, to withdraw", "عسل": "honey", "عصب": "a nerve, a group, to bind, hardship", "عصر": "time, an era, to squeeze, juice", "عضد": "an upper arm, to support, help", "عطف": "to turn, to incline, kindness", "عقر": "to wound, to hamstring, barren", "عكف": "to stay, to devote, to be attached", "علن": "to announce, publicly, openly", "عمد": "to intend, a pillar, deliberately", "عمم": "to be general, an uncle, to include", "عنب": "a grape, grapes", "عنت": "hardship, difficulty, to be distressed", "عنق": "a neck, a group", "عود": "to return, to go back, a custom", "عوذ": "to seek refuge, to take shelter", "غبر": "dust, to remain, past", "غدو": "morning, tomorrow, to go early", "غرب": "to set (sun), the west, far, strange", "غرف": "a room, an upper chamber, to scoop", "غشي": "to cover, to overwhelm, to faint", "غلق": "to close, to lock, to seal", "غلو": "to exceed, to exaggerate, excessive", "غمم": "to cover, to grieve, sorrow, a cloud", "غني": "to be rich, to be free of need, wealth", "غور": "to sink, to go deep, depression", "فتق": "to split open, to tear, to undo", "فجج": "a wide road, a pass, a gap", "فدي": "to ransom, a ransom, redemption", "فرش": "to spread, a carpet, furniture, a bed", "فرغ": "to be empty, to pour, to be free", "فرق": "to separate, to divide, to distinguish, a group", "فزع": "to fear, to be alarmed, fright, terror", "فسح": "to make room, to be spacious", "فصل": "to separate, to decide, a season, to detail", "فطر": "to split, to originate, to create, nature", "فلك": "an orbit, a ship, celestial sphere", "فهم": "to understand, understanding, comprehension", "فور": "to boil, immediately, quickly", "قبر": "a grave, to bury", "قبس": "to take fire, a spark, to learn", "قحم": "to plunge into, a steep path", "قرض": "to lend, a loan, to cut", "قرع": "to knock, to strike, to draw lots", "قرن": "to join, a companion, a generation, a horn", "قسو": "to be hard, hardness of heart, harsh", "قشعر": "to shiver, to tremble, goosebumps", "قصر": "to shorten, a palace, to fall short", "قنت": "to be devout, to be obedient, devotion", "قنع": "to be content, to be satisfied", "قنط": "to despair, despair, hopelessness", "قوس": "a bow, an arc", "قوي": "to be strong, strength, power", "كتم": "to conceal, to hide, to suppress", "كذب": "to deny, to reject as false, falsehood", "كره": "to hate, to dislike, hatred, reluctance", "كشف": "to uncover, to reveal, to remove", "كفأ": "to be equal, equivalent, to overturn", "كفي": "to be sufficient, enough, adequate", "كمل": "to complete, to perfect, wholeness", "كنز": "to store, a treasure, to hoard", "لبث": "to stay, to remain, a duration", "لبن": "milk, a brick", "لجأ": "to take refuge, a shelter, a refuge", "لحد": "to deviate, a grave, a niche", "لذذ": "to enjoy, pleasure, delight", "لعب": "to play, amusement, sport, a game", "لغو": "vain talk, idle speech, nonsense", "لفت": "to turn, to twist, to wrap", "لفف": "to wrap, to gather, twisted", "لقط": "to pick up, to find, a foundling", "لمح": "to glance, a moment, a glimpse", "لمس": "to touch, to feel, to seek", "لوح": "a tablet, a plank, a board", "لوط": "Lūṭ, to adhere, to cling", "ليل": "night, nighttime", "مأي": "a hundred, hundreds", "متن": "to be firm, to strengthen, on board", "مجد": "to be glorious, glory, honor", "مدن": "a city, to civilize, Madīnah", "مرأ": "a man, a person, a mirror", "مسد": "twisted fiber, palm fiber", "معن": "to help, a spring, water", "مكث": "to stay, to remain, a while", "منو": "death, destiny, to wish", "مهد": "to prepare, to smooth, a cradle, a bed", "مور": "to move, to flow, to sway", "ميد": "to sway, to shake, a table", "ميز": "to distinguish, to separate, to test", "ميل": "to incline, to lean, a mile", "نبذ": "to throw away, to reject, to discard", "نبع": "a spring, to gush forth, source", "نتق": "to shake, to raise, to extract", "نجس": "to be impure, impurity, unclean", "نجم": "a star, a plant, to appear", "نحت": "to carve, to sculpture, to hew", "نخل": "a palm tree, date palm", "ندم": "to regret, remorse, repentance", "نزف": "to drain, to exhaust, to bleed", "نسل": "offspring, progeny, to slip out", "نشز": "to rise, to rebel, disobedience", "نصب": "to erect, to set up, fatigue, an idol", "نصف": "half, to be just, to divide", "نضج": "to be ripe, to cook, to mature", "نفذ": "to penetrate, to pass through, to carry out", "نفر": "to flee, to be alarmed, a group", "نقب": "to pierce, to investigate, a chief", "نمل": "an ant, ants", "نهي": "to forbid, to prohibit, an end, intellect", "نور": "light, illumination, radiance", "هبط": "to descend, to go down, to fall", "هجر": "to abandon, to migrate, to leave", "هدد": "to threaten, to demolish, to rumble", "هدم": "to demolish, to destroy, destruction", "همم": "to intend, to resolve, determination, worry", "هنأ": "to be pleasant, comfortable, wholesome", "هود": "to be Jewish, to repent, Jews, Hūd", "وبل": "heavy rain, severity, bad consequence", "وتر": "a string, odd number, to single out", "وثب": "to leap, to jump", "وجب": "to be obligatory, to fall, to be necessary", "وحش": "to be lonely, wild, savage", "ودد": "to love, to wish, love, affection", "ودع": "to leave, to let be, calm, farewell", "ورد": "to arrive, to come to, a rose, a watering place", "ورق": "a leaf, leaves, paper, silver", "وزع": "to restrain, to distribute, to hold back", "وسخ": "to be dirty, filth", "وسط": "middle, moderate, the best", "وسق": "to load, to carry, to gather", "وسم": "to mark, to brand, a sign", "وشي": "to adorn, to mix, to walk quickly", "وطأ": "to step on, to tread, to prepare", "وعظ": "to admonish, to preach, admonition", "وعي": "to comprehend, to contain, awareness", "ولج": "to enter, to penetrate, entrance", "ولي": "to be near, to be a guardian, an ally, authority", "ومض": "to flash, to gleam, lightning", "يبس": "to be dry, dry, withered", "يتم": "to be an orphan, an orphan, alone", "يقن": "to be certain, certainty, conviction", "يئس": "to despair, despair, to give up hope", } def populate_meanings(): conn = _uslap_connect(DB_PATH) if _HAS_WRAPPER else sqlite3.connect(DB_PATH) conn.execute("PRAGMA foreign_keys = ON") # Count before before = conn.execute( "SELECT COUNT(*) FROM quran_root_dictionary WHERE root_meaning IS NULL" ).fetchone()[0] print(f"NULL root_meaning before: {before}") # Also extract from A1_ENTRIES in lattice lattice_meanings = {} try: rows = conn.execute(""" SELECT row_data FROM excel_data_consolidated WHERE source_sheet = 'A1_ENTRIES' AND row_data NOT LIKE '#%' AND row_data NOT LIKE 'ENTRY_ID%' """).fetchall() for r in rows: parts = r[0].split(' | ') if len(parts) >= 7: root_letters = parts[5].strip() qur_meaning = parts[6].strip() if root_letters and qur_meaning and '/' in qur_meaning: att_parts = qur_meaning.split('/') if len(att_parts) >= 3: eng = att_parts[-1].strip() unhyph = root_letters.replace('-', '').replace('‑', '') if unhyph not in lattice_meanings and len(eng) > 3: lattice_meanings[unhyph] = eng print(f"Extracted {len(lattice_meanings)} meanings from A1_ENTRIES") except Exception as e: print(f"Note: Could not read A1_ENTRIES: {e}") # Merge: curated takes priority, then lattice fills gaps all_meanings = dict(ROOT_MEANINGS) lattice_fills = 0 for root, meaning in lattice_meanings.items(): if root not in all_meanings: all_meanings[root] = meaning lattice_fills += 1 print(f"Lattice gap-fills: {lattice_fills}") # Apply updates updated = 0 skipped = 0 for root, meaning in all_meanings.items(): # Check if this root exists and needs update row = conn.execute( "SELECT root_meaning FROM quran_root_dictionary WHERE root_unhyphenated=?", (root,) ).fetchone() if row is None: skipped += 1 continue if row[0] is not None: # Already has a meaning, skip continue conn.execute( "UPDATE quran_root_dictionary SET root_meaning=? WHERE root_unhyphenated=?", (meaning, root) ) updated += 1 conn.commit() # Count after after = conn.execute( "SELECT COUNT(*) FROM quran_root_dictionary WHERE root_meaning IS NULL" ).fetchone()[0] print(f"\nUpdated: {updated} roots") print(f"Skipped (not in dictionary): {skipped}") print(f"NULL root_meaning after: {after}") print(f"Filled: {before - after} / {before}") # Show remaining high-frequency nulls remaining = conn.execute(""" SELECT root_unhyphenated, root_hyphenated, token_count FROM quran_root_dictionary WHERE root_meaning IS NULL ORDER BY token_count DESC LIMIT 30 """).fetchall() if remaining: print(f"\nTop remaining NULL roots:") for r in remaining: print(f" {r[1]:<10} ({r[0]}) — {r[2]} tokens") conn.close() if __name__ == "__main__": populate_meanings()