Minimal “context gate” for homophones → shows linguistic gate before commit

SENSES = {
“read”: {“past”: “I read yesterday”, “present”: “I read today”},
“light”: {“illumination”:”turn on the light”, “weight”:”a light box”, “understanding”:”see the light”}
}

def gate(word, sentence):
sentence_l = sentence.lower()
if word == “read”:
return “past” if “yesterday” in sentence_l else “present”
if word == “light”:
if “turn on” in sentence_l: return “illumination”
if “box” in sentence_l or “carry” in sentence_l: return “weight”
if “see the” in sentence_l: return “understanding”
return “unknown”

tests = (“read”, “I read yesterday at noon.”), (“read”, “I read today at noon.”), (“light”, “turn on the light”), (“light”, “a light box”), (“light”, “see the light”)
for w,s in tests:
print(f”{w:>5} | {s:<35} → {gate(w,s)}”)