Ask questions about your data.
Lause compiles English sentences into programs that answer questions over CSV data.
Create an accountCustom questions over your own data · By invitation
01 / Orders
Which orders are shippable?
Orders
3 editable facts| Order | Paid | Packed | Digital |
|---|---|---|---|
| O1 | Unknown | ||
| O2 | Unknown | Unknown | |
| O3 | Unknown | Unknown | Unknown |
Checked: yes. Unchecked: unknown.
orders.csv · source data
Lause reads one fact per row. Unknown facts have no row.
thing,kind
O1,order
O1,paid
O1,packed
O2,order
O2,digital
O3,orderWhich orders are shippable?
Standing bounded
Of the 3 orders, shippable: O1 (by sentence 2, and orders.csv lines 2, 3 and 4) and O2 (by sentence 3, and orders.csv lines 5 and 6). The document does not say of O3. None is known not shippable.
Sentences, rows and receipt
question: Which orders are shippable?
answer: Of the 3 orders, shippable: O1 (by sentence 2, and orders.csv lines 2, 3 and 4) and O2 (by sentence 3, and orders.csv lines 5 and 6). The document does not say of O3. None is known not shippable.
standing: bounded
basis: document sha256:7b4414ff…; orders.csv: 6 rows, sha256:e20919cb…; sha256:a0975899…: “orders” is the plural of “order”.; sha256:e831481a…: If an order is paid and it is packed, it is shippable.; sha256:ef1b98e3…: If an order is digital, it is shippable.; reader: sha256:dbd3a49d…; orders.csv: true; ; orders.csv: thing,kind; sentence 1: “orders” is the plural of “order”.; sentence 2: If an order is paid and it is packed, it is shippable.; sentence 3: If an order is digital, it is shippable.; data: 6 rows told from 1 file; the program closed and checked: 32 atoms, the kernel accepted
receipt: sha256:ce544e87…sha256:ce544e871ec8a765efb71585c413de1a8f0e157e0fe2349fd6a426788f71d8f1
Is O1 shippable?
Standing established
Yes. O1 is shippable, by sentence 2, and orders.csv lines 2, 3 and 4.
Sentences, rows and receipt
question: Is O1 shippable?
answer: Yes. O1 is shippable, by sentence 2, and orders.csv lines 2, 3 and 4.
standing: established
basis: document sha256:7b4414ff…; orders.csv: 6 rows, sha256:e20919cb…; sha256:a0975899…: “orders” is the plural of “order”.; sha256:e831481a…: If an order is paid and it is packed, it is shippable.; sha256:ef1b98e3…: If an order is digital, it is shippable.; reader: sha256:dbd3a49d…; orders.csv: true; ; orders.csv: thing,kind; sentence 1: “orders” is the plural of “order”.; sentence 2: If an order is paid and it is packed, it is shippable.; sentence 3: If an order is digital, it is shippable.; data: 6 rows told from 1 file; the program closed and checked: 32 atoms, the kernel accepted
receipt: sha256:ce544e87…sha256:ce544e871ec8a765efb71585c413de1a8f0e157e0fe2349fd6a426788f71d8f1
02 / The same question
Formula, query, script, sentences
Lause
policy.lause- “orders” is the plural of “order”.
- If an order is paid and it is packed, it is shippable.
- If an order is digital, it is shippable.
Spreadsheet
Excel 365 · A1:B7=LET(
id,A2:A7,
kind,B2:B7,
orders,UNIQUE(FILTER(id,kind="order")),
FILTER(orders,
(COUNTIFS(id,orders,kind,"digital")
+COUNTIFS(id,orders,kind,"paid")
*COUNTIFS(id,orders,kind,"packed"))>0,
"")
)SQL
SQLiteSELECT thing
FROM orders
GROUP BY thing
HAVING MAX(kind = 'order') = 1
AND (
MAX(kind = 'digital') = 1
OR (
MAX(kind = 'paid') = 1
AND MAX(kind = 'packed') = 1
)
)
ORDER BY thing;Python
Standard libraryimport csv
from collections import defaultdict
kinds = defaultdict(set)
with open("orders.csv", newline="") as file:
for row in csv.DictReader(file):
kinds[row["thing"]].add(row["kind"])
shippable = sorted(
thing for thing, facts in kinds.items()
if "order" in facts and (
"digital" in facts
or {"paid", "packed"} <= facts
)
)
print("\n".join(shippable))Each returns the orders known to be shippable; other orders remain unknown.
03 / Custom questions
Your data.
For people who maintain policies, and engineers who work with their data.
Create an account By invitation · hello@lause.dev