Match known patterns.
ssn = r"\b\d{3}-\d{2}-\d{4}\b"
card = r"\b(?:\d[ -]?){16}\b"
if (re.search(ssn, doc)
or re.search(card, doc)
or "passport" in doc.lower()):
block(doc)
else:
publish(doc)These checks miss the name and address.
Sage / The decision model
What if software could think while it runs?

Document: Maya Chen lives at 14 Cedar Lane.. The shown regexes find neither a name nor an address.
ssn = r"\b\d{3}-\d{2}-\d{4}\b"
card = r"\b(?:\d[ -]?){16}\b"
if (re.search(ssn, doc)
or re.search(card, doc)
or "passport" in doc.lower()):
block(doc)
else:
publish(doc)from levanto import LevantoClient
sage = LevantoClient(api_key=API_KEY)
private = sage.yesno(
doc, "Contains personal information?"
)
match private["answer"]:
case "yes": block(doc)
case "no": publish(doc)
case None: review(doc)API_KEY is read from the application environment. Sage returns yes. The application blocks the document. A no would publish it; null, represented by None in Python, sends it for review.
01 / Inside the machine
Maya Chen lives at 14 Cedar Lane.
ssn = r"\b\d{3}-\d{2}-\d{4}\b"
card = r"\b(?:\d[ -]?){16}\b"
if (re.search(ssn, doc)
or re.search(card, doc)
or "passport" in doc.lower()):
block(doc)
else:
publish(doc)These checks miss the name and address.
from levanto import LevantoClient
sage = LevantoClient(api_key=API_KEY)
private = sage.yesno(
doc, "Contains personal information?"
)
match private["answer"]:
case "yes": block(doc)
case "no": publish(doc)
case None: review(doc)The same document. A semantic decision.
It sends the question and the document to Sage while the program runs.
{
"answer": "yes",
"probability": 0.99
}The application blocks publication. An uncertain answer goes to a person.
