diff --git a/root/specialists/additive-v2/additive_panel_v2.json b/root/specialists/additive-v2/additive_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..0cee69c94652818cde0be39d976fd2641a948119 --- /dev/null +++ b/root/specialists/additive-v2/additive_panel_v2.json @@ -0,0 +1,366 @@ +[ + { + "split": "dev", + "kind": "mv", + "valid": true, + "q": "A closed, watertight STL mesh has 5,000 triangles. How many vertices does it have?", + "expect": 2502.0 + }, + { + "split": "dev", + "kind": "mv", + "valid": true, + "q": "A closed, watertight STL mesh has 1,000 triangles. How many vertices does it have?", + "expect": 502.0 + }, + { + "split": "dev", + "kind": "me", + "valid": true, + "q": "How many edges are in a closed triangle mesh with 20,480 faces?", + "expect": 30720.0 + }, + { + "split": "dev", + "kind": "mf", + "valid": true, + "q": "A watertight triangle mesh has 502 vertices. How many triangles does it have?", + "expect": 1000 + }, + { + "split": "dev", + "kind": "torus", + "valid": true, + "q": "How many vertices does a closed triangle mesh of a torus (genus 1) with 800 faces have?", + "expect": 400.0 + }, + { + "split": "dev", + "kind": "cube", + "valid": true, + "q": "What is the volume of cube([20,10,5]) in OpenSCAD?", + "expect": 1000 + }, + { + "split": "dev", + "kind": "cube", + "valid": true, + "q": "What is the volume of cube([40,40,2]) in OpenSCAD?", + "expect": 3200 + }, + { + "split": "dev", + "kind": "sphere", + "valid": true, + "q": "What is the volume of sphere(r=10) in OpenSCAD?", + "expect": 4188.790204786391 + }, + { + "split": "dev", + "kind": "cyl", + "valid": true, + "q": "What is the volume of cylinder(h=50, r=3) in OpenSCAD?", + "expect": 1413.7166941154069 + }, + { + "split": "dev", + "kind": "cyl", + "valid": true, + "q": "What is the volume of cylinder(h=20, r=5) in OpenSCAD?", + "expect": 1570.7963267948967 + }, + { + "split": "dev", + "kind": "cone", + "valid": true, + "q": "What is the volume of cylinder(h=30, r1=10, r2=0)?", + "expect": 3141.592653589793 + }, + { + "split": "dev", + "kind": "scale", + "valid": true, + "q": "If a 50 g print is scaled up by 1.5x, what will it weigh?", + "expect": 168.75 + }, + { + "split": "dev", + "kind": "scale", + "valid": true, + "q": "If a 100 g print is scaled up by 0.5x, what will it weigh?", + "expect": 12.5 + }, + { + "split": "dev", + "kind": "time", + "valid": true, + "q": "How long does it take to extrude 20 cm3 at a flow of 10 mm3/s?", + "expect": 33.333333333333336 + }, + { + "split": "dev", + "kind": "time", + "valid": true, + "q": "How long does it take to extrude 50 cm3 at a flow of 15 mm3/s?", + "expect": 55.55555555555556 + }, + { + "split": "dev", + "kind": "mv", + "valid": true, + "q": "Number of vertices in a watertight STL with 5,000 triangular faces? How many?", + "expect": 2502.0 + }, + { + "split": "dev", + "kind": "mv", + "valid": true, + "q": "Number of vertices in a watertight STL with 1,000 triangular faces? How many?", + "expect": 502.0 + }, + { + "split": "dev", + "kind": "me", + "valid": true, + "q": "A closed triangle mesh (no holes) has 1,000 facets. How many edges?", + "expect": 1500.0 + }, + { + "split": "dev", + "kind": "mf", + "valid": true, + "q": "Closed STL mesh, 8 vertices: how many triangles?", + "expect": 12 + }, + { + "split": "dev", + "kind": "torus", + "valid": true, + "q": "A torus-shaped closed mesh (genus 1) has 800 triangles. How many vertices?", + "expect": 400.0 + }, + { + "split": "dev", + "kind": "cube", + "valid": true, + "q": "OpenSCAD: volume of cube([15, 25, 30])?", + "expect": 11250 + }, + { + "split": "dev", + "kind": "cube", + "valid": true, + "q": "OpenSCAD: volume of cube([40, 40, 2])?", + "expect": 3200 + }, + { + "split": "dev", + "kind": "sphere", + "valid": true, + "q": "Volume of the OpenSCAD primitive sphere(d=50)?", + "expect": 65449.84694978735 + }, + { + "split": "dev", + "kind": "cyl", + "valid": true, + "q": "OpenSCAD cylinder(h=10, d=24): what volume?", + "expect": 4523.893421169302 + }, + { + "split": "dev", + "kind": "cyl", + "valid": true, + "q": "OpenSCAD cylinder(h=50, d=6): what volume?", + "expect": 1413.7166941154069 + }, + { + "split": "dev", + "kind": "cone", + "valid": true, + "q": "Volume of cylinder(h=20, r1=8, r2=4) in OpenSCAD?", + "expect": 2345.722514680379 + }, + { + "split": "dev", + "kind": "scale", + "valid": true, + "q": "Scale a 20 g part by 2 times in every dimension: how much will it weigh?", + "expect": 160 + }, + { + "split": "dev", + "kind": "scale", + "valid": true, + "q": "Scale a 50 g part by 1.5 times in every dimension: how much will it weigh?", + "expect": 168.75 + }, + { + "split": "dev", + "kind": "time", + "valid": true, + "q": "At 5 mm3/s volumetric flow, how many minutes to extrude 8 cm3?", + "expect": 26.666666666666668 + }, + { + "split": "dev", + "kind": "time", + "valid": true, + "q": "At 15 mm3/s volumetric flow, how many minutes to extrude 50 cm3?", + "expect": 55.55555555555556 + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "A closed, watertight STL mesh has 1001 triangles. How many vertices does it have?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "A closed triangle mesh (no holes) has 777 facets. How many edges?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "mv", + "valid": true, + "q": "An STL file describes a closed surface made of 36 triangles. How many vertices does it have?", + "expect": 20.0 + }, + { + "split": "heldout", + "kind": "mv", + "valid": true, + "q": "An STL file describes a closed surface made of 2,400 triangles. How many vertices does it have?", + "expect": 1202.0 + }, + { + "split": "heldout", + "kind": "me", + "valid": true, + "q": "How many edges does a watertight mesh of 12,800 triangles have?", + "expect": 19200.0 + }, + { + "split": "heldout", + "kind": "me", + "valid": true, + "q": "How many edges does a watertight mesh of 3,000 triangles have?", + "expect": 4500.0 + }, + { + "split": "heldout", + "kind": "mf", + "valid": true, + "q": "If a closed triangle mesh has 14 vertices, how many faces does it have?", + "expect": 24 + }, + { + "split": "heldout", + "kind": "mf", + "valid": true, + "q": "If a closed triangle mesh has 1,202 vertices, how many faces does it have?", + "expect": 2400 + }, + { + "split": "heldout", + "kind": "torus", + "valid": true, + "q": "A donut-shaped (genus 1) watertight mesh has 600 faces. How many vertices?", + "expect": 300.0 + }, + { + "split": "heldout", + "kind": "cube", + "valid": true, + "q": "In OpenSCAD, how much volume does cube([60, 30, 10]) enclose?", + "expect": 18000 + }, + { + "split": "heldout", + "kind": "cube", + "valid": true, + "q": "In OpenSCAD, how much volume does cube([25, 25, 25]) enclose?", + "expect": 15625 + }, + { + "split": "heldout", + "kind": "sphere", + "valid": true, + "q": "What volume does sphere(r=6) produce in OpenSCAD?", + "expect": 904.7786842338603 + }, + { + "split": "heldout", + "kind": "cyl", + "valid": true, + "q": "How much material is in cylinder(h=40, r=4) in OpenSCAD?", + "expect": 2010.6192982974676 + }, + { + "split": "heldout", + "kind": "cyl", + "valid": true, + "q": "How much material is in cylinder(h=8, r=20) in OpenSCAD?", + "expect": 10053.096491487338 + }, + { + "split": "heldout", + "kind": "cone", + "valid": true, + "q": "OpenSCAD cylinder(h=24, r1=6, r2=2): what is its volume?", + "expect": 1306.9025438933538 + }, + { + "split": "heldout", + "kind": "scale", + "valid": true, + "q": "A 40 g model is scaled to 2 times its size in every dimension. How much will the new print weigh?", + "expect": 320 + }, + { + "split": "heldout", + "kind": "scale", + "valid": true, + "q": "A 200 g model is scaled to 0.75 times its size in every dimension. How much will the new print weigh?", + "expect": 84.375 + }, + { + "split": "heldout", + "kind": "scale", + "valid": true, + "q": "A 30 g model is scaled to 3 times its size in every dimension. How much will the new print weigh?", + "expect": 810 + }, + { + "split": "heldout", + "kind": "time", + "valid": true, + "q": "How many minutes will it take to print 30 cm3 of plastic at 12 mm3/s?", + "expect": 41.666666666666664 + }, + { + "split": "heldout", + "kind": "time", + "valid": true, + "q": "How many minutes will it take to print 12 cm3 of plastic at 8 mm3/s?", + "expect": 25.0 + }, + { + "split": "heldout", + "kind": "time", + "valid": true, + "q": "How many minutes will it take to print 100 cm3 of plastic at 20 mm3/s?", + "expect": 83.33333333333333 + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "How many edges does a closed triangle mesh with 1,001 facets have?", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/additive-v2/additive_panel_v2.py b/root/specialists/additive-v2/additive_panel_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..92a802ad4fda2bcc4ca537f5b90dd4be406e01fe --- /dev/null +++ b/root/specialists/additive-v2/additive_panel_v2.py @@ -0,0 +1,102 @@ +#!/usr/bin/env python3 +"""additive_panel_v2 - the FRESH sealed panel for additive-v2 (#96). v1's held-out was measured once (NEGATIVE) and is +burned: its phrasings join DEV here. The v2 held-out is new phrasing and new numbers, written for people. Expected +values from the relations written here: genus-0 closed triangle mesh E = 3F/2, V = F/2 + 2, F = 2(V - 2); torus V = F/2; +OpenSCAD cube / sphere / cylinder / frustum volumes; scaling s^3 for mass; time = V / flow (minutes). +Must-decline: an odd face count for a closed triangle mesh. usage: additive_panel_v2.py """ +import collections +import json +import math +import random +import sys + +DEV_T = [{"mv": "A closed, watertight STL mesh has {f} triangles. How many vertices does it have?", + "me": "How many edges are in a closed triangle mesh with {f} faces?", + "mf": "A watertight triangle mesh has {v} vertices. How many triangles does it have?", + "torus": "How many vertices does a closed triangle mesh of a torus (genus 1) with {f} faces have?", + "cube": "What is the volume of cube([{x},{y},{z}]) in OpenSCAD?", + "sphere": "What is the volume of sphere(r={r}) in OpenSCAD?", + "cyl": "What is the volume of cylinder(h={h}, r={r}) in OpenSCAD?", + "cone": "What is the volume of cylinder(h={h}, r1={r1}, r2={r2})?", + "scale": "If a {m} g print is scaled up by {s}x, what will it weigh?", + "time": "How long does it take to extrude {v} cm3 at a flow of {q} mm3/s?"}, + {"mv": "Number of vertices in a watertight STL with {f} triangular faces? How many?", + "me": "A closed triangle mesh (no holes) has {f} facets. How many edges?", + "mf": "Closed STL mesh, {v} vertices: how many triangles?", + "torus": "A torus-shaped closed mesh (genus 1) has {f} triangles. How many vertices?", + "cube": "OpenSCAD: volume of cube([{x}, {y}, {z}])?", + "sphere": "Volume of the OpenSCAD primitive sphere(d={d})?", + "cyl": "OpenSCAD cylinder(h={h}, d={d}): what volume?", + "cone": "Volume of cylinder(h={h}, r1={r1}, r2={r2}) in OpenSCAD?", + "scale": "Scale a {m} g part by {s} times in every dimension: how much will it weigh?", + "time": "At {q} mm3/s volumetric flow, how many minutes to extrude {v} cm3?"}] +HELD_T = {"mv": "An STL file describes a closed surface made of {f} triangles. How many vertices does it have?", + "me": "How many edges does a watertight mesh of {f} triangles have?", + "mf": "If a closed triangle mesh has {v} vertices, how many faces does it have?", + "torus": "A donut-shaped (genus 1) watertight mesh has {f} faces. How many vertices?", + "cube": "In OpenSCAD, how much volume does cube([{x}, {y}, {z}]) enclose?", + "sphere": "What volume does sphere(r={r}) produce in OpenSCAD?", + "cyl": "How much material is in cylinder(h={h}, r={r}) in OpenSCAD?", + "cone": "OpenSCAD cylinder(h={h}, r1={r1}, r2={r2}): what is its volume?", + "scale": "A {m} g model is scaled to {s} times its size in every dimension. How much will the new print weigh?", + "time": "How many minutes will it take to print {v} cm3 of plastic at {q} mm3/s?"} +DECLINE = {"dev": ["A closed, watertight STL mesh has 1001 triangles. How many vertices does it have?", + "A closed triangle mesh (no holes) has 777 facets. How many edges?"], + "heldout": ["How many edges does a closed triangle mesh with 1,001 facets have?"]} +POOL = {"dev": {"mv": [12, 1000, 5000, 20480], "me": [12, 1000, 20480], "mf": [8, 502, 10242], "torus": [800, 2048], + "cube": [(20, 10, 5), (40, 40, 2), (15, 25, 30)], "sphere": [10, 5, 25], "cyl": [(20, 5), (10, 12), (50, 3)], + "cone": [(30, 10, 0), (20, 8, 4), (15, 5, 10)], "scale": [(20, 2), (50, 1.5), (100, 0.5)], "time": [(20, 10), (50, 15), (8, 5)]}, + "heldout": {"mv": [36, 2400, 81920], "me": [48, 3000, 12800], "mf": [14, 1202, 4098], "torus": [600, 4096], + "cube": [(12, 8, 3), (60, 30, 10), (25, 25, 25)], "sphere": [6, 12, 30], "cyl": [(40, 4), (15, 9), (8, 20)], + "cone": [(24, 6, 2), (10, 12, 0), (18, 3, 9)], "scale": [(40, 2), (30, 3), (200, 0.75)], "time": [(30, 12), (12, 8), (100, 20)]}} +N = 1 # per template per split: dev 2 each over the two template sets; held-out 1-3 per family below + + +def rows(kind, vals): + if kind == "mv": + return {"f": format(vals, ",")}, vals / 2 + 2 + if kind == "me": + return {"f": format(vals, ",")}, 3 * vals / 2 + if kind == "mf": + return {"v": format(vals, ",")}, 2 * (vals - 2) + if kind == "torus": + return {"f": format(vals, ",")}, vals / 2 + if kind == "cube": + x, y, z = vals + return {"x": x, "y": y, "z": z}, x * y * z + if kind == "sphere": + return {"r": vals, "d": 2 * vals}, 4 / 3 * math.pi * vals ** 3 + if kind == "cyl": + h, r = vals + return {"h": h, "r": r, "d": 2 * r}, math.pi * r * r * h + if kind == "cone": + h, r1, r2 = vals + return {"h": h, "r1": r1, "r2": r2}, math.pi * h * (r1 * r1 + r1 * r2 + r2 * r2) / 3 + if kind == "scale": + m, s = vals + return {"m": m, "s": s}, m * s ** 3 + v, q = vals + return {"v": v, "q": q}, v * 1000 / q / 60 + + +COUNT = {"dev": {"mv": 2, "me": 1, "mf": 1, "torus": 1, "cube": 2, "sphere": 1, "cyl": 2, "cone": 1, "scale": 2, "time": 2}, + "heldout": {"mv": 2, "me": 2, "mf": 2, "torus": 1, "cube": 2, "sphere": 1, "cyl": 2, "cone": 1, "scale": 3, "time": 3}} + + +def main(): + items = [] + for split, seed, temps in (("dev", 96, DEV_T), ("heldout", 969696, [HELD_T])): + rng = random.Random(seed) + for T in temps: + for kind, tpl in T.items(): + for vals in rng.sample(POOL[split][kind], COUNT[split][kind]): + kw, exp = rows(kind, vals) + items.append({"split": split, "kind": kind, "valid": True, "q": tpl.format(**kw), "expect": exp}) + for q in DECLINE[split]: + items.append({"split": split, "kind": "decline", "valid": False, "q": q, "expect": "decline"}) + json.dump(items, open(sys.argv[1], "w", encoding="utf-8"), indent=1, ensure_ascii=False) + print("panel:", dict(collections.Counter(i["split"] for i in items))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/additive-v2/additive_scorer.py b/root/specialists/additive-v2/additive_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..1fb47a60b6a9baf7d4529f0c24882a4362157f98 --- /dev/null +++ b/root/specialists/additive-v2/additive_scorer.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 +"""additive_scorer - the first number after is / has in the REPLY TEXT (commas allowed) must match the panel: mesh +counts exactly, volumes / masses / minutes within 0.5%. A must-decline item answered is a false yes. (ok, asserted).""" +import re + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + m = re.search(r"\b(?:is|has)\s+(?:about\s+)?([\d,]*\.?\d+)", text) + if not m: + return False, True + got, e = float(m.group(1).replace(",", "")), float(p["expect"]) + if p["kind"] in ("mv", "me", "mf", "torus"): + return got == e, True + return abs(got - e) <= 0.005 * abs(e), True diff --git a/root/specialists/additive-v2/manifest.json b/root/specialists/additive-v2/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..312d010dd3b796457c4b0bf69906461eb88c2de4 --- /dev/null +++ b/root/specialists/additive-v2/manifest.json @@ -0,0 +1,69 @@ +{ + "id": "additive-v2", + "name": "Oracle7 Additive Manufacturing & Design", + "number": 96, + "tier": "B", + "sources": [ + { + "name": "OpenSCAD User Manual (cube / sphere / cylinder primitives and parameters)", + "licence": "CC-BY-SA 3.0 (store ships share-alike)", + "url": "https://en.wikibooks.org/wiki/OpenSCAD_User_Manual" + }, + { + "name": "NIST additive manufacturing (STL / closed mesh); Euler characteristic V - E + F = 2 - 2g", + "licence": "public domain (US government) / facts", + "url": "https://www.nist.gov/additive-manufacturing" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/additive/organ_additive_v1.py" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/additive-v2", + "module": "organ_additive_v2", + "class": "AdditiveOrganV2", + "init": {} + }, + "accept": { + "kinds": [ + "scad_volume", + "mesh_vertices", + "mesh_edges", + "mesh_faces", + "scale_amount", + "scale_factor", + "extrude_time" + ], + "declines_in_domain": [ + "impossible", + "underspecified" + ], + "context_regex": "\\b(?:stl|mesh|watertight|openscad|cube\\(|sphere\\(|cylinder\\(|extrud\\w*|scal\\w*|mm3/s|volumetric flow|in every dimension)" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/additive-v2/additive_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "additive_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [ + "STL mesh vertices from faces", + "mesh edges", + "OpenSCAD primitive volume", + "scaled part mass", + "extrusion time" + ], + "budgets": { + "latency_p50_ms": 50, + "store_mb": 1 + }, + "notes": "v2 of additive (v1 NEGATIVE 2026-09-29: flow rate '15 mm3/s' read as the volume - confident wrong; 'Scale a 100 g part by 0.5 times' unread). Flow only as volume-per-time, volume never followed by '/'; scale factor from by/to N times; recognise-then-decline. Fresh panel v2.", + "core_sample": { + "n": 400, + "seed": 20260928 + } +} \ No newline at end of file diff --git a/root/specialists/additive-v2/narrow_v1.py b/root/specialists/additive-v2/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/additive-v2/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/additive-v2/organ_additive_v1.py b/root/specialists/additive-v2/organ_additive_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..965a721662bf2aed6649977649d22ca7abd7a06c --- /dev/null +++ b/root/specialists/additive-v2/organ_additive_v1.py @@ -0,0 +1,157 @@ +#!/usr/bin/env python3 +"""organ_additive_v1 - additive-manufacturing and CAD geometry (OpenSCAD primitives, mesh topology), exact, formula +named in every answer: +- closed triangle mesh of genus 0 (a watertight STL with no holes): F faces -> E = 3F/2 edges, V = F/2 + 2 vertices + (Euler V - E + F = 2); from V -> F = 2(V - 2), E = 3(V - 2); genus g given: V - E + F = 2 - 2g; +- OpenSCAD primitive volumes read from code: cube(s) / cube([x, y, z]); sphere(r) / sphere(d = D); + cylinder(h, r) / cylinder(h, d = D) / cylinder(h, r1, r2) (a cone frustum: pi h (r1^2 + r1 r2 + r2^2) / 3); +- uniform scaling by s: lengths x s, areas x s^2, volume and mass x s^3; +- ideal extrusion time = volume / volumetric flow (mm3/s), no travel or acceleration (said so). +Declines: an odd face count for a closed triangle mesh (3F/2 must be whole), negative sizes. +Narrowed from the start (narrow_v1). Returns {kind, status, response, value}.""" +from __future__ import annotations + +import math +import re + +from narrow_v1 import narrative, short_direct + +N = r"(\d+(?:,\d{3})*(?:\.\d+)?)" +F_ = r"(-?\d+(?:\.\d+)?)" + + +def num(v): + return float(str(v).replace(",", "")) + + +def g(x): + return ("%.3f" % x).rstrip("0").rstrip(".") if abs(x) < 1e6 else format(round(x), ",") + + +def kw(args, name): + m = re.search(r"\b" + name + r"\s*=\s*" + F_, args) + return float(m.group(1)) if m else None + + +class AdditiveOrgan: + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def _bad(self, why): + return self._say("impossible", why, status="withheld") + + def answer(self, text, session_id="default"): + if narrative(text): + return None + r = self._answer(text) + if r and r.get("status") != "answered" and not short_direct(text): + return None + return r + + def _scad(self, t): + m = re.search(r"\b(cube|sphere|cylinder)\s*\(([^()]*(?:\[[^\]]*\])?[^()]*)\)", t) + if not m: + return None + prim, args = m.group(1), m.group(2) + pos = [float(x) for x in re.findall(r"(?:^|,)\s*" + F_ + r"\s*(?=,|$)", args)] + if prim == "cube": + vec = re.search(r"\[\s*" + F_ + r"\s*,\s*" + F_ + r"\s*,\s*" + F_ + r"\s*\]", args) + if vec: + x, y, z = (float(vec.group(i)) for i in (1, 2, 3)) + else: + s = kw(args, "size") if kw(args, "size") is not None else (pos[0] if pos else None) + if s is None: + return None + x = y = z = s + if min(x, y, z) < 0: + return "neg" + return x * y * z, "cube %s × %s × %s" % (g(x), g(y), g(z)) + if prim == "sphere": + r = kw(args, "r") + if r is None and kw(args, "d") is not None: + r = kw(args, "d") / 2 + if r is None: + r = pos[0] if pos else None + if r is None: + return None + if r < 0: + return "neg" + return 4 / 3 * math.pi * r ** 3, "sphere r = %s: 4/3 π r³" % g(r) + h = kw(args, "h") if kw(args, "h") is not None else (pos[0] if pos else None) + r1, r2 = kw(args, "r1"), kw(args, "r2") + if r1 is None and kw(args, "d1") is not None: + r1 = kw(args, "d1") / 2 + if r2 is None and kw(args, "d2") is not None: + r2 = kw(args, "d2") / 2 + r = kw(args, "r") + if r is None and kw(args, "d") is not None: + r = kw(args, "d") / 2 + if r is None and len(pos) >= 2 and r1 is None: + r = pos[1] + if h is None: + return None + if r1 is not None and r2 is not None: + if min(h, r1, r2) < 0: + return "neg" + return math.pi * h * (r1 * r1 + r1 * r2 + r2 * r2) / 3, "cone frustum h = %s, r1 = %s, r2 = %s: π h (r1² + r1 r2 + r2²)/3" % (g(h), g(r1), g(r2)) + if r is None: + return None + if min(h, r) < 0: + return "neg" + return math.pi * r * r * h, "cylinder h = %s, r = %s: π r² h" % (g(h), g(r)) + + def _answer(self, text): + t = " ".join(str(text or "").split()) + low = t.lower() + # --- OpenSCAD primitive volume + if re.search(r"\b(?:cube|sphere|cylinder)\s*\(", low) and re.search(r"\bvolume\b|\bhow much material\b", low) and not re.search(r"\b(?:difference|union|intersection|hull|minkowski)\s*\(", low): + v = self._scad(low) + if v == "neg": + return self._bad("OpenSCAD sizes must be non-negative.") + if v is None: + return None + vol, how = v + return self._say("scad_volume", "The volume is %s cubic units (%s; units as in the model, usually mm)." % (g(vol), how), vol) + # --- mesh topology + if re.search(r"\bmesh\b|\bstl\b|\bpolyhedron\b|\bmanifold\b|\bwatertight\b", low) and re.search(r"\bhow many\b|\bnumber of\b", low): + fm = re.search(N + r"\s*(?:triangles|faces|triangular faces|facets)\b", low) + vm = re.search(N + r"\s*vertices\b", low) + gm = re.search(r"\bgenus\s*(?:of\s*)?(\d+)\b|\b(\d+)\s*holes?\b|\btorus\b", low) + gen = int(gm.group(1) or gm.group(2)) if gm and (gm.group(1) or gm.group(2)) else (1 if gm else 0) + if fm and re.search(r"\bvertices\b|\bedges\b", low.replace(fm.group(0), "")): + F = num(fm.group(1)) + if F % 2: + return self._bad("A closed triangle mesh has an even number of faces (every edge is shared by two triangles, so 3F/2 edges must be whole).") + E = 3 * F / 2 + V = 2 - 2 * gen + E - F + if re.search(r"\bedges\b", low.replace(fm.group(0), "")) and not re.search(r"\bvertices\b", low.replace(fm.group(0), "")): + return self._say("mesh_edges", "The mesh has %s edges (E = 3F/2 = 3 × %s / 2; closed triangle mesh)." % (g(E), g(F)), E) + return self._say("mesh_vertices", "The mesh has %s vertices (V = 2 - 2g + E - F = %d + %s - %s, E = 3F/2; closed triangle mesh, genus %d)." % (g(V), 2 - 2 * gen, g(E), g(F), gen), V) + if vm and re.search(r"\btriangles\b|\bfaces\b|\bfacets\b", low): + V = num(vm.group(1)) + F = 2 * (V - 2 + 2 * gen) + return self._say("mesh_faces", "The mesh has %s triangles (F = 2(V - 2 + 2g) = 2(%s - 2 + %d); closed triangle mesh, genus %d)." % (g(F), g(V), 2 * gen, gen), F) + return None + # --- scaling + sc = re.search(r"\bscal\w*\s*(?:it\s*)?(?:up\s*|down\s*)?(?:by\s*)?(?:a factor of\s*)?" + N + r"\s*(?:x|×|times)?|\b(\d+(?:\.\d+)?)\s*(?:x|×|times)\s*(?:larger|bigger|smaller|scale)|\b(\d+(?:\.\d+)?)\s*%\s*scale\b", low) + if sc and re.search(r"\bvolume\b|\bmass\b|\bweigh\w*\b|\bmaterial\b|\bfilament\b|\bsurface area\b|\barea\b", low): + s = num(sc.group(1) or sc.group(2)) if (sc.group(1) or sc.group(2)) else num(sc.group(3)) / 100 + base = re.search(N + r"\s*(g|grams?|kg|cm3|cm³|mm3|mm³|cm2|cm²|mm2|mm²|ml)\b", low) + area = re.search(r"\bsurface area\b|\barea\b", low) and not re.search(r"\bvolume\b|\bmass\b|\bweigh", low) + f = s ** 2 if area else s ** 3 + if base: + v = num(base.group(1)) * f + return self._say("scale_amount", "The new value is %s %s (× %s = %s^%d; %s scales with the %s of length)." % ( + g(v), base.group(2), g(f), g(s), 2 if area else 3, "area" if area else "volume and mass", "square" if area else "cube"), v) + return self._say("scale_factor", "The factor is %s (%s^%d; %s scales with the %s of length)." % (g(f), g(s), 2 if area else 3, "area" if area else "volume and mass", "square" if area else "cube"), f) + # --- extrusion time + vol = re.search(N + r"\s*(cm3|cm³|mm3|mm³|ml|cubic centimet\w+)\b", low) + flow = re.search(N + r"\s*(?:mm3|mm³)\s*/\s*s\b|\bflow (?:rate )?(?:of )?" + N + r"\s*(?:mm3|mm³)", low) + if vol and flow and re.search(r"\bhow long\b|\btime\b|\bminutes\b|\bhours\b", low): + V = num(vol.group(1)) * (1000 if vol.group(2) in ("cm3", "cm³", "ml") or vol.group(2).startswith("cubic") else 1) + q = num(flow.group(1) or flow.group(2)) + if q <= 0: + return None + s = V / q + return self._say("extrude_time", "The ideal extrusion time is %s minutes (%s mm³ ÷ %s mm³/s = %s s; no travel moves or acceleration)." % (g(s / 60), g(V), g(q), g(s)), s / 60) + return None diff --git a/root/specialists/additive-v2/organ_additive_v2.py b/root/specialists/additive-v2/organ_additive_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..df5f29f49e9efa8d2bf754ebc3877e25125ba4f8 --- /dev/null +++ b/root/specialists/additive-v2/organ_additive_v2.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python3 +"""organ_additive_v2 - organ_additive_v1 (NEGATIVE under gate v3, 2026-09-29: held-out 12/16 vs head 1/16 but 2 WRONG) +with the held-out class fixed: +- "At 15 mm3/s volumetric flow, how many minutes to extrude 50 cm3?" - v1 took the FIRST volume-unit number as the + volume, i.e. the flow rate "15 mm3(/s)": a CONFIDENT WRONG 0.017 min. v2 reads the flow ONLY as a volume unit per + second / minute and the volume ONLY as a volume unit NOT followed by "/" (mm3, cm3, ml; flow in mm3/s, cm3/s, mm3/min). +- "Scale a 100 g part by 0.5 times in every dimension: how much will it weigh?" - v1 needed "scale(d) by N" right after + the verb and fell silent (the head asked what "it" was). v2 reads the factor from "by N (times / x)", "to N times its + size", "N times the size / larger / smaller", "N% scale" - never from the part's mass. +- RECOGNISE-THEN-DECLINE (2026-09-29 law): a numeric extrusion-time or scaled-mass turn v2 cannot read DECLINES in-domain; + v1's own declines (odd face count, negative OpenSCAD size) are kept on numeric turns of any length. +Mesh topology and OpenSCAD volumes are v1. Judged on a FRESH panel v2.""" +from __future__ import annotations + +import re + +from narrow_v1 import narrative +from organ_additive_v1 import AdditiveOrgan, g, num + +N = r"(\d+(?:,\d{3})*(?:\.\d+)?)" +VU = r"(mm3|mm³|cm3|cm³|ml|cubic millimet\w+|cubic centimet\w+)" + + +def to_mm3(v, u): + return v * (1000 if u in ("cm3", "cm³", "ml") or u.startswith("cubic centi") else 1) + + +class AdditiveOrganV2(AdditiveOrgan): + def answer(self, text, session_id="default"): + if narrative(text): + return None + t = " ".join(str(text or "").split()) + low = t.lower() + r = self._extrude(low) + if r is None: + r = self._scale(low) + if r is None: + r = self._answer(t) + if r is not None and r.get("kind") in ("scale_amount", "scale_factor", "extrude_time"): + r = None # v1's readers for these two families are replaced, never consulted + if r is not None and r.get("status") != "answered" and not re.search(r"\d", t): + return None + return r + + def _extrude(self, low): + fl = re.search(N + r"\s*" + VU + r"\s*(?:/|per)\s*(s|sec\w*|min\w*)\b", low) + if not fl or not re.search(r"\bhow long\b|\btime\b|\bminutes\b|\bhours\b|\bseconds\b|\bhow many (?:min|sec|hour)", low): + return None + q = to_mm3(num(fl.group(1)), fl.group(2)) / (60 if fl.group(3).startswith("min") else 1) + vols = [m for m in re.finditer(N + r"\s*" + VU + r"\b(?!\s*(?:/|per\b))", low) if m.start() != fl.start()] + if not vols or q <= 0: + return self._say("underspecified", "I couldn't read both the volume to extrude and the volumetric flow; give them like '50 cm³ at 15 mm³/s'.", status="withheld") + V = to_mm3(num(vols[0].group(1)), vols[0].group(2)) + s = V / q + return self._say("extrude_time", "The ideal extrusion time is %s minutes (%s mm³ ÷ %s mm³/s = %s s; no travel moves or acceleration)." % (g(s / 60), g(V), g(q), g(s)), s / 60) + + def _scale(self, low): + if not re.search(r"\bscal\w*\b|\btimes (?:the|its) size\b|\b(?:x|×) (?:the|its) size\b|\bin every (?:dimension|direction)\b", low): + return None + if not re.search(r"\bvolume\b|\bmass\b|\bweigh\w*\b|\bheavy\b|\bmaterial\b|\bfilament\b|\bsurface area\b|\barea\b", low): + return None + sm = re.search(r"\b(?:by|to)\s+(?:a factor of\s+)?" + N + r"\s*(?:x|×|times)?(?!\s*(?:g|grams?|kg|mm|cm|ml|%))\b", low) or \ + re.search(N + r"\s*(?:x|×|times)\s+(?:larger|bigger|smaller|the size|its size|scale)\b", low) + pm = re.search(N + r"\s*%\s*(?:scale|of (?:the |its )?(?:original )?size)\b|\bscaled? to\s+" + N + r"\s*%", low) + if sm: + s = num(sm.group(1)) + elif pm: + s = num(pm.group(1) or pm.group(2)) / 100 + else: + return self._say("underspecified", "I couldn't read the scale factor; say e.g. 'scaled by 1.5 times in every dimension'.", status="withheld") + if s <= 0: + return None + area = re.search(r"\bsurface area\b|\barea\b", low) and not re.search(r"\bvolume\b|\bmass\b|\bweigh|\bheavy\b", low) + f = s ** 2 if area else s ** 3 + base = re.search(N + r"\s*(g|grams?|kg|cm3|cm³|mm3|mm³|cm2|cm²|mm2|mm²|ml)\b(?!\s*/)", low) + if base and base.start() != (sm.start(1) if sm else -1): + v = num(base.group(1)) * f + return self._say("scale_amount", "The new value is %s %s (× %s = %s^%d; %s scales with the %s of length)." % ( + g(v), base.group(2), g(f), g(s), 2 if area else 3, "area" if area else "volume and mass", "square" if area else "cube"), v) + return self._say("scale_factor", "The factor is %s (%s^%d; %s scales with the %s of length)." % (g(f), g(s), 2 if area else 3, "area" if area else "volume and mass", "square" if area else "cube"), f) diff --git a/root/specialists/additive-v2/verdict_dev.json b/root/specialists/additive-v2/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..79c5950af28976a7d2c28a637c6ccbce3508ecf7 --- /dev/null +++ b/root/specialists/additive-v2/verdict_dev.json @@ -0,0 +1,113 @@ +{ + "id": "additive-v2", + "name": "Oracle7 Additive Manufacturing & Design", + "tier": "B", + "split": "dev", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T12:38:45Z", + "domain": { + "head": { + "correct": 2, + "false_yes": 0, + "wrong": 0, + "n": 32, + "p50_ms": 63.47, + "fails": [ + [ + "mv", + "A closed, watertight STL mesh has 5,000 triangles. How many vertices d", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ], + [ + "mv", + "A closed, watertight STL mesh has 1,000 triangles. How many vertices d", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ], + [ + "me", + "How many edges are in a closed triangle mesh with 20,480 faces?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mf", + "A watertight triangle mesh has 502 vertices. How many triangles does i", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ], + [ + "torus", + "How many vertices does a closed triangle mesh of a torus (genus 1) wit", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "cube", + "What is the volume of cube([20,10,5]) in OpenSCAD?", + "corpus_query:property_of|vessel:reinforc", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nYou have asked \"Wha" + ], + [ + "cube", + "What is the volume of cube([40,40,2]) in OpenSCAD?", + "corpus_query:property_of|vessel:reinforc", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nYou have asked \"Wha" + ], + [ + "sphere", + "What is the volume of sphere(r=10) in OpenSCAD?", + "corpus_query:property_of|vessel:reinforc", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nYou have asked \"Wha" + ] + ] + }, + "spec": { + "correct": 32, + "false_yes": 0, + "wrong": 0, + "n": 32, + "p50_ms": 0.03, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/additive-v2/verdict_heldout.json b/root/specialists/additive-v2/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..820f96c2a28edb8910bf79b54841604c7f576a6e --- /dev/null +++ b/root/specialists/additive-v2/verdict_heldout.json @@ -0,0 +1,113 @@ +{ + "id": "additive-v2", + "name": "Oracle7 Additive Manufacturing & Design", + "tier": "B", + "split": "heldout", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T12:42:37Z", + "domain": { + "head": { + "correct": 1, + "false_yes": 0, + "wrong": 0, + "n": 20, + "p50_ms": 47.78, + "fails": [ + [ + "mv", + "An STL file describes a closed surface made of 36 triangles. How many ", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ], + [ + "mv", + "An STL file describes a closed surface made of 2,400 triangles. How ma", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ], + [ + "me", + "How many edges does a watertight mesh of 12,800 triangles have?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "me", + "How many edges does a watertight mesh of 3,000 triangles have?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mf", + "If a closed triangle mesh has 14 vertices, how many faces does it have", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ], + [ + "mf", + "If a closed triangle mesh has 1,202 vertices, how many faces does it h", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ], + [ + "torus", + "A donut-shaped (genus 1) watertight mesh has 600 faces. How many verti", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "cube", + "In OpenSCAD, how much volume does cube([60, 30, 10]) enclose?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 20, + "false_yes": 0, + "wrong": 0, + "n": 20, + "p50_ms": 0.06, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/arthistory/arthistory_panel_v1.json b/root/specialists/arthistory/arthistory_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..30c8e4578a1b5fd907c66cbedd68ac31c7f3c39d --- /dev/null +++ b/root/specialists/arthistory/arthistory_panel_v1.json @@ -0,0 +1,201 @@ +[ + { + "split": "dev", + "kind": "fact", + "valid": true, + "q": "Who painted the Mona Lisa?", + "expect": "Leonardo da Vinci", + "reject": [ + "Michelangelo", + "Raphael" + ] + }, + { + "split": "dev", + "kind": "fact", + "valid": true, + "q": "Who painted The Starry Night?", + "expect": "Vincent van Gogh", + "reject": [ + "Monet" + ] + }, + { + "split": "dev", + "kind": "fact", + "valid": true, + "q": "Who painted Guernica?", + "expect": "Pablo Picasso", + "reject": [] + }, + { + "split": "dev", + "kind": "fact", + "valid": true, + "q": "Who painted The Persistence of Memory?", + "expect": "Salvador Dali", + "reject": [ + "Magritte" + ] + }, + { + "split": "dev", + "kind": "fact", + "valid": true, + "q": "Who painted The Birth of Venus?", + "expect": "Sandro Botticelli", + "reject": [] + }, + { + "split": "dev", + "kind": "fact", + "valid": true, + "q": "Who painted The Night Watch?", + "expect": "Rembrandt", + "reject": [ + "Vermeer" + ] + }, + { + "split": "dev", + "kind": "fact", + "valid": true, + "q": "Who painted The Scream?", + "expect": "Edvard Munch", + "reject": [] + }, + { + "split": "dev", + "kind": "fact", + "valid": true, + "q": "Who sculpted The Thinker?", + "expect": "Auguste Rodin", + "reject": [] + }, + { + "split": "dev", + "kind": "fact", + "valid": true, + "q": "Who painted Water Lilies?", + "expect": "Claude Monet", + "reject": [ + "Manet" + ] + }, + { + "split": "dev", + "kind": "fact", + "valid": true, + "q": "Who painted Las Meninas?", + "expect": "Diego Velazquez", + "reject": [ + "Goya" + ] + }, + { + "split": "dev", + "kind": "off", + "valid": false, + "q": "What is the most beautiful painting ever made?", + "expect": "not taken" + }, + { + "split": "heldout", + "kind": "fact", + "valid": true, + "q": "Which artist painted Girl with a Pearl Earring?", + "expect": "Johannes Vermeer", + "reject": [ + "Rembrandt" + ] + }, + { + "split": "heldout", + "kind": "fact", + "valid": true, + "q": "Who painted American Gothic?", + "expect": "Grant Wood", + "reject": [] + }, + { + "split": "heldout", + "kind": "fact", + "valid": true, + "q": "Name the artist who painted The Kiss.", + "expect": "Gustav Klimt", + "reject": [ + "Schiele" + ] + }, + { + "split": "heldout", + "kind": "fact", + "valid": true, + "q": "Who created The Great Wave off Kanagawa?", + "expect": "Katsushika Hokusai", + "reject": [ + "Hiroshige" + ] + }, + { + "split": "heldout", + "kind": "fact", + "valid": true, + "q": "Which artist painted The Last Supper?", + "expect": "Leonardo da Vinci", + "reject": [ + "Michelangelo" + ] + }, + { + "split": "heldout", + "kind": "fact", + "valid": true, + "q": "Who painted The School of Athens?", + "expect": "Raphael", + "reject": [ + "Michelangelo" + ] + }, + { + "split": "heldout", + "kind": "fact", + "valid": true, + "q": "Who painted Nighthawks?", + "expect": "Edward Hopper", + "reject": [] + }, + { + "split": "heldout", + "kind": "fact", + "valid": true, + "q": "Who painted The Garden of Earthly Delights?", + "expect": "Hieronymus Bosch", + "reject": [ + "Bruegel" + ] + }, + { + "split": "heldout", + "kind": "fact", + "valid": true, + "q": "Which artist painted Liberty Leading the People?", + "expect": "Eugene Delacroix", + "reject": [] + }, + { + "split": "heldout", + "kind": "fact", + "valid": true, + "q": "Who painted The Arnolfini Portrait?", + "expect": "Jan van Eyck", + "reject": [] + }, + { + "split": "heldout", + "kind": "off", + "valid": false, + "q": "How much is the Mona Lisa worth?", + "expect": "not taken" + } +] \ No newline at end of file diff --git a/root/specialists/arthistory/arthistory_panel_v1.py b/root/specialists/arthistory/arthistory_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..41e2ec16a16328fd0c6fc7ae2946214ff4e51efc --- /dev/null +++ b/root/specialists/arthistory/arthistory_panel_v1.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +"""arthistory_panel_v1 - the sealed panel for specialist #87 (art history). Artists TYPED OUT here as a second copy; +"reject" lists commonly confused artists. Invalid: opinion / price / interpretation requests.""" +from facts_panel_v1 import build + +DEV = [("Who painted the Mona Lisa?", "Leonardo da Vinci", ["Michelangelo", "Raphael"]), ("Who painted The Starry Night?", "Vincent van Gogh", ["Monet"]), + ("Who painted Guernica?", "Pablo Picasso", []), ("Who painted The Persistence of Memory?", "Salvador Dali", ["Magritte"]), + ("Who painted The Birth of Venus?", "Sandro Botticelli", []), ("Who painted The Night Watch?", "Rembrandt", ["Vermeer"]), + ("Who painted The Scream?", "Edvard Munch", []), ("Who sculpted The Thinker?", "Auguste Rodin", []), + ("Who painted Water Lilies?", "Claude Monet", ["Manet"]), ("Who painted Las Meninas?", "Diego Velazquez", ["Goya"])] +HELD = [("Which artist painted Girl with a Pearl Earring?", "Johannes Vermeer", ["Rembrandt"]), ("Who painted American Gothic?", "Grant Wood", []), + ("Name the artist who painted The Kiss.", "Gustav Klimt", ["Schiele"]), ("Who created The Great Wave off Kanagawa?", "Katsushika Hokusai", ["Hiroshige"]), + ("Which artist painted The Last Supper?", "Leonardo da Vinci", ["Michelangelo"]), ("Who painted The School of Athens?", "Raphael", ["Michelangelo"]), + ("Who painted Nighthawks?", "Edward Hopper", []), ("Who painted The Garden of Earthly Delights?", "Hieronymus Bosch", ["Bruegel"]), + ("Which artist painted Liberty Leading the People?", "Eugene Delacroix", []), ("Who painted The Arnolfini Portrait?", "Jan van Eyck", [])] +OFF = {"dev": ["What is the most beautiful painting ever made?"], "heldout": ["How much is the Mona Lisa worth?"]} + +if __name__ == "__main__": + build(DEV, HELD, OFF) diff --git a/root/specialists/arthistory/facts_arthistory_v1.py b/root/specialists/arthistory/facts_arthistory_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..9605109cc4277002ad711169196a4c25213d4aa1 --- /dev/null +++ b/root/specialists/arthistory/facts_arthistory_v1.py @@ -0,0 +1,18 @@ +"""facts_arthistory_v1 - the store for specialist #87 (art history): the artist of famous works (Met Open Access +and museum records - facts). One answer per work; titles matched as phrases.""" +GATE = r"\b(?:paint\w*|artist|sculpt\w*|who (?:made|created|painted|sculpted))\b" +BLOCK = r"\bbest\b|\bworst\b|\bfavou?rite\b|\bopinion\b|\bworth\b|\bprice\b|\bvalue\b|\bmeaning\b|\binterpret\w*\b|\bbeautiful\b" +ASK = r"\bwho\b|\bwhich artist\b|\bwhat artist\b|\bname the (?:artist|painter|sculptor)\b" +KIND = "artist" +WORKS = [("mona lisa", "Leonardo da Vinci"), ("the last supper", "Leonardo da Vinci"), ("the starry night", "Vincent van Gogh"), ("starry night", "Vincent van Gogh"), + ("sunflowers", "Vincent van Gogh"), ("guernica", "Pablo Picasso"), ("les demoiselles d'?avignon", "Pablo Picasso"), + ("the persistence of memory", "Salvador Dali"), ("the birth of venus", "Sandro Botticelli"), ("the night watch", "Rembrandt"), + ("girl with a pearl earring", "Johannes Vermeer"), ("the scream", "Edvard Munch"), ("american gothic", "Grant Wood"), + ("the creation of adam", "Michelangelo"), ("sistine chapel ceiling", "Michelangelo"), ("david", "Michelangelo"), ("water lilies", "Claude Monet"), + ("impression,? sunrise", "Claude Monet"), ("the kiss", "Gustav Klimt"), ("las meninas", "Diego Velazquez"), + ("the great wave off kanagawa", "Katsushika Hokusai"), ("the great wave", "Katsushika Hokusai"), ("the thinker", "Auguste Rodin"), + ("the garden of earthly delights", "Hieronymus Bosch"), ("nighthawks", "Edward Hopper"), ("campbell'?s soup cans", "Andy Warhol"), + ("the school of athens", "Raphael"), ("liberty leading the people", "Eugene Delacroix"), ("a sunday afternoon on the island of la grande jatte", "Georges Seurat"), + ("whistler'?s mother", "James McNeill Whistler"), ("the arnolfini portrait", "Jan van Eyck"), ("the son of man", "Rene Magritte"), + ("the treachery of images", "Rene Magritte"), ("composition with red,? blue,? and yellow", "Piet Mondrian")] +FACTS = [(r"\b" + t + r"\b", a, "It is by %s." % a) for t, a in sorted(WORKS, key=lambda x: -len(x[0]))] diff --git a/root/specialists/arthistory/facts_panel_v1.py b/root/specialists/arthistory/facts_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..dc5b51fa8440ee06aa10d97d8f0c3a014163763b --- /dev/null +++ b/root/specialists/arthistory/facts_panel_v1.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +"""facts_panel_v1 - the shared panel writer for typed-fact specialists. A specialist's panel file defines DEV and HELD +as [(question, expect or [accepted...], [rejected...])] and OFF as {"dev": [...], "heldout": [...]} (turns that must NOT +be taken), then calls build(). Expectations are typed by hand in the panel file, as a copy separate from the store.""" +import collections +import json +import sys + + +def build(DEV, HELD, OFF, out=None): + out = out or sys.argv[1] + items = [] + for split, rows in (("dev", DEV), ("heldout", HELD)): + for q, e, rej in rows: + items.append({"split": split, "kind": "fact", "valid": True, "q": q, "expect": e, "reject": rej}) + for q in OFF[split]: + items.append({"split": split, "kind": "off", "valid": False, "q": q, "expect": "not taken"}) + json.dump(items, open(out, "w"), indent=1, ensure_ascii=False) + print("panel:", dict(collections.Counter(i["split"] for i in items))) diff --git a/root/specialists/arthistory/facts_scorer_v1.py b/root/specialists/arthistory/facts_scorer_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..3b3242a53358377b6158b9cdc4a0b35e4e1f69ab --- /dev/null +++ b/root/specialists/arthistory/facts_scorer_v1.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +"""facts_scorer_v1 - the shared scorer for typed-fact specialists. An item's expect is a string or a list of accepted +strings; the reply is right when ANY accepted string appears in it as a whole word / phrase (case-insensitive, +punctuation-normalised, like the core's answer_any), AND the reply does not also contain an item-listed wrong answer +("reject"), so a reply that hedges between two answers is not credited. Invalid (off-domain / advice) items must not +be answered - answering one is a false yes. A simple plural of an expected answer (arachnid / arachnids) counts. (ok, asserted).""" +import re + + +def norm(s): + return " " + " ".join(re.sub(r"[^a-z0-9 ]+", " ", str(s).lower()).split()) + " " + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + b = norm(text) + want = p["expect"] if isinstance(p["expect"], list) else [p["expect"]] + rej = p.get("reject") or [] + good = any(norm(w).strip() and (norm(w) in b or norm(w + "s") in b or norm(w + "es") in b) for w in want) # plural of the same answer + bad = any(norm(x).strip() and norm(x) in b for x in rej) + return good and not bad, True diff --git a/root/specialists/arthistory/manifest.json b/root/specialists/arthistory/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..4ba16d5002c9bf2add2439eeee77286f3e2e72d0 --- /dev/null +++ b/root/specialists/arthistory/manifest.json @@ -0,0 +1,18 @@ +{ + "id": "arthistory", + "name": "Oracle7 Art History (attribution)", + "number": 87, + "tier": "B", + "sources": [ + {"name": "The Metropolitan Museum of Art Open Access (CC0) and museum collection records (attribution facts)", "licence": "CC0 / facts", "url": "https://www.metmuseum.org/about-the-met/policies-and-documents/open-access"} + ], + "store": {"path": "__ORACLE7_ROOT__/specialists/arthistory/facts_arthistory_v1.py"}, + "organ": {"dir": "__ORACLE7_ROOT__/specialists/arthistory", "module": "organ_facts_v1", "class": "FactsOrgan", "init": {"store": "facts_arthistory_v1"}}, + "accept": {"kinds": ["artist"], "declines_in_domain": [], "context_regex": "\\b(?:painted|painting|artist|sculpt\\w*)\\b"}, + "panel": {"path": "__ORACLE7_ROOT__/specialists/arthistory/arthistory_panel_v1.json", "splits": ["dev", "heldout"], + "exclude_kinds_composed": [], "scorer_module": "facts_scorer_v1", "scorer_fn": "ok"}, + "routing_cues": ["who painted a famous work", "who sculpted a famous work"], + "budgets": {"latency_p50_ms": 50, "store_mb": 1}, + "core_sample": {"n": 400, "seed": 20260928}, + "notes": "Typed-fact organ: attributions of famous works; opinions, prices and interpretations are blocked. Narrowed (narrow_v1)." +} diff --git a/root/specialists/arthistory/narrow_v1.py b/root/specialists/arthistory/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/arthistory/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/arthistory/organ_facts_v1.py b/root/specialists/arthistory/organ_facts_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..4c00754a2f59922614398ded18a226484232c343 --- /dev/null +++ b/root/specialists/arthistory/organ_facts_v1.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 +"""organ_facts_v1 - the shared TYPED-FACT organ for reference specialists. A specialist supplies a store module with: + GATE - regex a turn must match to be in this domain at all; + BLOCK - regex for turns the specialist must never take (opinion, advice, medical / legal / personal, safety); + ASK - regex marking a question (default: who / what / which / when / how many / name / is ...); + FACTS - [(pattern, value, sentence)] tried IN ORDER (specific patterns first); the sentence is the reply. +The first fact whose pattern matches answers; nothing matching -> silence (the head answers), never a guess. +Narrowed (narrow_v1). Returns {kind, status, response, value}.""" +from __future__ import annotations + +import importlib +import re + +from narrow_v1 import narrative + +DEFAULT_ASK = r"\bwho\b|\bwhat\b|\bwhich\b|\bwhen\b|\bhow many\b|\bhow much\b|\bname\b|\bwhere\b|\bis\b|\bare\b|\bdoes\b|\bdo\b|\bcan\b|\bcould\b" + + +class FactsOrgan: + def __init__(self, store): + self.s = importlib.import_module(store) + self.gate = re.compile(self.s.GATE, re.I) + self.block = re.compile(self.s.BLOCK, re.I) if getattr(self.s, "BLOCK", None) else None + self.ask = re.compile(getattr(self.s, "ASK", DEFAULT_ASK), re.I) + self.facts = [(re.compile(p, re.I), v, sent) for p, v, sent in self.s.FACTS] + self.kind = getattr(self.s, "KIND", "fact") + + def answer(self, text, session_id="default"): + if narrative(text): + return None + t = " ".join(str(text or "").split()) + if not self.gate.search(t) or (self.block and self.block.search(t)) or not self.ask.search(t): + return None + for rx, v, sent in self.facts: + if rx.search(t): + return {"kind": self.kind, "status": "answered", "response": sent, "value": v} + return None diff --git a/root/specialists/arthistory/verdict_dev.json b/root/specialists/arthistory/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..3338bbc6ca43811a84ea8af8ba6ad8b7d610eccf --- /dev/null +++ b/root/specialists/arthistory/verdict_dev.json @@ -0,0 +1,96 @@ +{ + "id": "arthistory", + "name": "Oracle7 Art History (attribution)", + "tier": "B", + "split": "dev", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T11:12:49Z", + "domain": { + "head": { + "correct": 7, + "false_yes": 1, + "wrong": 2, + "n": 11, + "p50_ms": 40.03, + "fails": [ + [ + "fact", + "Who painted The Persistence of Memory?", + "factoid:page", + "[ev:direct] There is a strange shadow in the foreground of the painting, which is a refere" + ], + [ + "fact", + "Who painted Water Lilies?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fact", + "Who painted Las Meninas?", + "factoid:page", + "[ev:direct] On his chest is the red cross of the Order of Santiago, which he did not recei" + ], + [ + "off", + "What is the most beautiful painting ever made?", + "arb:definitional->definitional_encyclope", + "[ev:direct] Painting is using colors to make visual art. [simplewiki_0335fa9c875bedae19e34" + ] + ] + }, + "spec": { + "correct": 10, + "false_yes": 1, + "wrong": 0, + "n": 11, + "p50_ms": 0.01, + "fails": [ + [ + "off", + "What is the most beautiful painting ever made?", + "arb:definitional->definitional_encyclope", + "[ev:direct] Painting is using colors to make visual art. [simplewiki_0335fa9c875bedae19e34" + ] + ] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/arthistory/verdict_heldout.json b/root/specialists/arthistory/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..c98de5ef3b5738512b8c39c1baebdd4335902371 --- /dev/null +++ b/root/specialists/arthistory/verdict_heldout.json @@ -0,0 +1,95 @@ +{ + "id": "arthistory", + "name": "Oracle7 Art History (attribution)", + "tier": "B", + "split": "heldout", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T11:16:42Z", + "domain": { + "head": { + "correct": 6, + "false_yes": 0, + "wrong": 3, + "n": 11, + "p50_ms": 47.93, + "fails": [ + [ + "fact", + "Name the artist who painted The Kiss.", + "compose:bridge", + "[ev:derived] Francesco Hayez (February 10, 1791, Venice \u2013 December 21, 1882, Milan) was th" + ], + [ + "fact", + "Who created The Great Wave off Kanagawa?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fact", + "Which artist painted The Last Supper?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fact", + "Who painted The School of Athens?", + "factoid:page", + "[ev:direct] It was painted during the Italian Renaissance between 1510 and 1511. [simplewi" + ], + [ + "fact", + "Which artist painted Liberty Leading the People?", + "factoid:page", + "[ev:direct] Liberty Leading the People ( ) is a painting of the Romantic era by the French" + ] + ] + }, + "spec": { + "correct": 11, + "false_yes": 0, + "wrong": 0, + "n": 11, + "p50_ms": 0.01, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/biology/biology_panel_v1.json b/root/specialists/biology/biology_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..a954135b32c14046c56c0909b67d8d8b54190c9d --- /dev/null +++ b/root/specialists/biology/biology_panel_v1.json @@ -0,0 +1,212 @@ +[ + { + "split": "dev", + "kind": "codon", + "valid": true, + "q": "What amino acid does the codon CCG code for?", + "expect": "proline" + }, + { + "split": "dev", + "kind": "codon", + "valid": true, + "q": "What amino acid does the codon UUU code for?", + "expect": "phenylalanine" + }, + { + "split": "dev", + "kind": "codon", + "valid": true, + "q": "What amino acid does the codon UAA code for?", + "expect": "stop" + }, + { + "split": "dev", + "kind": "comp", + "valid": true, + "q": "What is the complementary DNA strand of CATGGT?", + "expect": "GTACCA" + }, + { + "split": "dev", + "kind": "comp", + "valid": true, + "q": "What is the complementary DNA strand of AAGCTTC?", + "expect": "TTCGAAG" + }, + { + "split": "dev", + "kind": "rc", + "valid": true, + "q": "What is the reverse complement of the DNA sequence ATGCGT?", + "expect": "ACGCAT" + }, + { + "split": "dev", + "kind": "rc", + "valid": true, + "q": "What is the reverse complement of the DNA sequence GGCCTTAA?", + "expect": "TTAAGGCC" + }, + { + "split": "dev", + "kind": "tx", + "valid": true, + "q": "Transcribe the DNA coding strand TTTACCGG into mRNA.", + "expect": "UUUACCGG" + }, + { + "split": "dev", + "kind": "tx", + "valid": true, + "q": "Transcribe the DNA coding strand ATGCGT into mRNA.", + "expect": "AUGCGU" + }, + { + "split": "dev", + "kind": "tl", + "valid": true, + "q": "Translate the sequence AUGGGCUUUUGA into a protein.", + "expect": "MGF" + }, + { + "split": "dev", + "kind": "tl", + "valid": true, + "q": "Translate the sequence ATGGCCTTTAAA into a protein.", + "expect": "MAFK" + }, + { + "split": "dev", + "kind": "tl", + "valid": true, + "q": "Translate the sequence ATGTGGTAAGGG into a protein.", + "expect": "MW" + }, + { + "split": "dev", + "kind": "gc", + "valid": true, + "q": "What is the GC content of the DNA sequence TTTACCGG?", + "expect": 50.0 + }, + { + "split": "dev", + "kind": "gc", + "valid": true, + "q": "What is the GC content of the DNA sequence GGCCTTAA?", + "expect": 50.0 + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "Translate the sequence ATGGCCTT into a protein.", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "codon", + "valid": true, + "q": "Which amino acid is specified by the mRNA codon GAU?", + "expect": "aspartic acid" + }, + { + "split": "heldout", + "kind": "codon", + "valid": true, + "q": "Which amino acid is specified by the mRNA codon GGC?", + "expect": "glycine" + }, + { + "split": "heldout", + "kind": "codon", + "valid": true, + "q": "Which amino acid is specified by the mRNA codon UUU?", + "expect": "phenylalanine" + }, + { + "split": "heldout", + "kind": "comp", + "valid": true, + "q": "Give the complement of the DNA strand ACGTACGT.", + "expect": "TGCATGCA" + }, + { + "split": "heldout", + "kind": "comp", + "valid": true, + "q": "Give the complement of the DNA strand AAGCTTC.", + "expect": "TTCGAAG" + }, + { + "split": "heldout", + "kind": "rc", + "valid": true, + "q": "Reverse complement of TTTACCGG?", + "expect": "CCGGTAAA" + }, + { + "split": "heldout", + "kind": "rc", + "valid": true, + "q": "Reverse complement of ATGCGT?", + "expect": "ACGCAT" + }, + { + "split": "heldout", + "kind": "tx", + "valid": true, + "q": "What mRNA is transcribed from the coding strand ACGTACGT?", + "expect": "ACGUACGU" + }, + { + "split": "heldout", + "kind": "tx", + "valid": true, + "q": "What mRNA is transcribed from the coding strand GGCCTTAA?", + "expect": "GGCCUUAA" + }, + { + "split": "heldout", + "kind": "tl", + "valid": true, + "q": "What protein does the sequence ATGGCCTTTAAA encode (one-letter codes)?", + "expect": "MAFK" + }, + { + "split": "heldout", + "kind": "tl", + "valid": true, + "q": "What protein does the sequence AUGGGCUUUUGA encode (one-letter codes)?", + "expect": "MGF" + }, + { + "split": "heldout", + "kind": "tl", + "valid": true, + "q": "What protein does the sequence ATGCATCACGAT encode (one-letter codes)?", + "expect": "MHHD" + }, + { + "split": "heldout", + "kind": "gc", + "valid": true, + "q": "GC content (percent) of the sequence GGCCTTAA?", + "expect": 50.0 + }, + { + "split": "heldout", + "kind": "gc", + "valid": true, + "q": "GC content (percent) of the sequence ACGTACGT?", + "expect": 50.0 + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "What protein does the sequence AUGGCAUUAA encode (one-letter codes)?", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/biology/biology_panel_v1.py b/root/specialists/biology/biology_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..3f4fa2ac3092418bfd809b8e7e2eab18a8e47787 --- /dev/null +++ b/root/specialists/biology/biology_panel_v1.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 +"""biology_panel_v1 - the sealed panel for specialist #26 (biology, molecular). Codon meanings are TYPED OUT from the +standard genetic code (AUG methionine, UUU phenylalanine, UAA stop, GGC glycine, UGG tryptophan, CAU histidine, AAA +lysine, GAU aspartic acid); complements / reverse complements / transcripts / proteins / GC typed or computed by the +simple string rules written here (A<->T, C<->G, T->U), independent of the organ. Must-decline: a length that is not a +multiple of 3 for translation. Dev / held-out differ in seed and phrasing. usage: biology_panel_v1.py """ +import collections +import json +import random +import sys + +CODONS = {"AUG": "methionine", "UUU": "phenylalanine", "UAA": "stop", "GGC": "glycine", "UGG": "tryptophan", "CAU": "histidine", + "AAA": "lysine", "GAU": "aspartic acid", "UCA": "serine", "CCG": "proline"} +PROT = {"ATGGCCTTTAAA": "MAFK", "ATGTGGTAAGGG": "MW", "AUGGGCUUUUGA": "MGF", "ATGCATCACGAT": "MHHD", "AUGAAAGAUUAG": "MKD"} +SEQS = ["ATGCGT", "GGCCTTAA", "ACGTACGT", "TTTACCGG", "CATGGT", "AAGCTTC"] +C = {"A": "T", "T": "A", "C": "G", "G": "C"} +T = {"dev": {"codon": "What amino acid does the codon {c} code for?", + "comp": "What is the complementary DNA strand of {s}?", + "rc": "What is the reverse complement of the DNA sequence {s}?", + "tx": "Transcribe the DNA coding strand {s} into mRNA.", + "tl": "Translate the sequence {s} into a protein.", + "gc": "What is the GC content of the DNA sequence {s}?"}, + "heldout": {"codon": "Which amino acid is specified by the mRNA codon {c}?", + "comp": "Give the complement of the DNA strand {s}.", + "rc": "Reverse complement of {s}?", + "tx": "What mRNA is transcribed from the coding strand {s}?", + "tl": "What protein does the sequence {s} encode (one-letter codes)?", + "gc": "GC content (percent) of the sequence {s}?"}} +DECLINE = {"dev": ["Translate the sequence ATGGCCTT into a protein."], "heldout": ["What protein does the sequence AUGGCAUUAA encode (one-letter codes)?"]} + + +def main(): + items = [] + for split, seed in (("dev", 26), ("heldout", 2626)): + rng = random.Random(seed) + t = T[split] + add = [] + for c in rng.sample(sorted(CODONS), 3): + add.append(("codon", {"c": c}, CODONS[c])) + for s in rng.sample(SEQS, 2): + add.append(("comp", {"s": s}, "".join(C[b] for b in s))) + for s in rng.sample(SEQS, 2): + add.append(("rc", {"s": s}, "".join(C[b] for b in reversed(s)))) + for s in rng.sample(SEQS, 2): + add.append(("tx", {"s": s}, s.replace("T", "U"))) + for s in rng.sample(sorted(PROT), 3): + add.append(("tl", {"s": s}, PROT[s])) + for s in rng.sample(SEQS, 2): + add.append(("gc", {"s": s}, (s.count("G") + s.count("C")) / len(s) * 100)) + for kind, kw, exp in add: + items.append({"split": split, "kind": kind, "valid": True, "q": t[kind].format(**kw), "expect": exp}) + for q in DECLINE[split]: + items.append({"split": split, "kind": "decline", "valid": False, "q": q, "expect": "decline"}) + json.dump(items, open(sys.argv[1], "w"), indent=1) + print("panel:", dict(collections.Counter(i["split"] for i in items))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/biology/biology_scorer.py b/root/specialists/biology/biology_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..502267223cdb35aa303bb0c2b20b30eb7b7b0699 --- /dev/null +++ b/root/specialists/biology/biology_scorer.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +"""biology_scorer - reads the REPLY TEXT. Sequences / proteins: the first all-caps sequence token after "is" must equal +the expected string exactly. Codons: the amino-acid name right after "encodes" must equal the expected name. GC: the +first number after "is" within 0.01. A must-decline item answered is a false yes. (ok, asserted).""" +import re + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + e, k = p["expect"], p["kind"] + if k == "codon": + m = re.search(r"\bencodes\s+(aspartic acid|glutamic acid|[a-z]+)\b", text, re.I) + return bool(m) and m.group(1).lower() == e, True + if k == "gc": + m = re.search(r"\bis\s+(\d*\.?\d+)", text) + return bool(m) and abs(float(m.group(1)) - e) <= 0.01, True + m = re.search(r"\bis\s+([A-Z*]+)\b", text) + return bool(m) and m.group(1) == e, True diff --git a/root/specialists/biology/manifest.json b/root/specialists/biology/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..5baa1e38e7637c4bc86d10899a83afdb70d66679 --- /dev/null +++ b/root/specialists/biology/manifest.json @@ -0,0 +1,23 @@ +{ + "id": "biology", + "name": "Oracle7 Biology (molecular sequences)", + "number": 26, + "tier": "A", + "sources": [ + {"name": "OpenStax Biology 2e ch. 14-15 (DNA structure, transcription, translation, the genetic code)", "licence": "CC-BY 4.0", "url": "https://openstax.org/details/books/biology-2e"}, + {"name": "NCBI Genetic Codes - translation table 1 (the standard code)", "licence": "public domain (US government)", "url": "https://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi"} + ], + "store": {"path": "__ORACLE7_ROOT__/specialists/biology/organ_biology_v1.py"}, + "organ": {"dir": "__ORACLE7_ROOT__/specialists/biology", "module": "organ_biology_v1", "class": "BiologyOrgan", "init": {}}, + "accept": { + "kinds": ["codon", "gc", "revcomp", "complement", "transcribe", "translate", "protein_len"], + "declines_in_domain": ["impossible"], + "context_regex": "\\b(?:dna|rna|mrna|codon|translat\\w*|transcri\\w*|complement\\w*|gc content|sequence)\\b" + }, + "panel": {"path": "__ORACLE7_ROOT__/specialists/biology/biology_panel_v1.json", "splits": ["dev", "heldout"], + "exclude_kinds_composed": [], "scorer_module": "biology_scorer", "scorer_fn": "ok"}, + "routing_cues": ["codon to amino acid", "DNA complement", "reverse complement", "transcription to mRNA", "translation to protein", "GC content"], + "budgets": {"latency_p50_ms": 50, "store_mb": 1}, + "core_sample": {"n": 400, "seed": 20260928}, + "notes": "Standard genetic code (NCBI table 1); translation from the first base, stops at the first stop codon (said so); never guesses a reading frame for a length not divisible by 3. The broader biology curriculum (MMLU biology) is not covered by this organ - v1 is the sequence core. Narrowed from the start (narrow_v1)." +} diff --git a/root/specialists/biology/narrow_v1.py b/root/specialists/biology/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/biology/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/biology/organ_biology_v1.py b/root/specialists/biology/organ_biology_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..63fa90b26af29e48ad03d085ce03167a56ea1612 --- /dev/null +++ b/root/specialists/biology/organ_biology_v1.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python3 +"""organ_biology_v1 - molecular-biology sequence operations, exact (the standard genetic code, NCBI translation table 1): +- DNA complement (A-T, C-G) and reverse complement (5'->3' of the other strand); +- transcription of a DNA coding (sense) strand to mRNA (T -> U); of a template strand when it is called the template + (reverse complement, then T -> U); +- translation of mRNA / DNA coding sequence to protein from the first codon given, one-letter codes, "*" at a stop and + translation ends there (stated); the amino acid a single codon encodes; +- GC content = (G + C) / length x 100; +- sequence length arithmetic: protein length = codons before the first stop. +Declines: characters that are not nucleotides, a sequence whose length is not a multiple of 3 for translation. +Narrowed from the start (narrow_v1). Returns {kind, status, response, value}.""" +from __future__ import annotations + +import re + +from narrow_v1 import narrative, short_direct + +BASES = "TCAG" +AAS = "FFLLSSSSYY**CC*WLLLLPPPPHHQQRRRRIIIMTTTTNNKKSSRRVVVVAAAADDEEGGGG" +CODON = {a + b + c: AAS[16 * i + 4 * j + k] for i, a in enumerate(BASES) for j, b in enumerate(BASES) for k, c in enumerate(BASES)} +NAMES = {"F": "phenylalanine", "L": "leucine", "S": "serine", "Y": "tyrosine", "*": "stop", "C": "cysteine", "W": "tryptophan", "P": "proline", + "H": "histidine", "Q": "glutamine", "R": "arginine", "I": "isoleucine", "M": "methionine", "T": "threonine", "N": "asparagine", + "K": "lysine", "V": "valine", "A": "alanine", "D": "aspartic acid", "E": "glutamic acid", "G": "glycine"} +COMP = {"A": "T", "T": "A", "C": "G", "G": "C", "U": "A"} + + +def clean(s): + return re.sub(r"[\s\-]", "", s.upper().replace("5'", "").replace("3'", "")) + + +class BiologyOrgan: + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def _bad(self, why): + return self._say("impossible", why, status="withheld") + + def answer(self, text, session_id="default"): + if narrative(text): + return None + r = self._answer(text) + if r and r.get("status") != "answered" and not short_direct(text): + return None + return r + + def _seq(self, t): + # upper-case runs (spaces / hyphens only between codon triplets), or one lower-case token of 6+ bases - + # dev: a case-insensitive, space-tolerant pattern read "codon CCG code" as CCGC + m = re.search(r"\b([ACGTU]{3,}(?:[ \-][ACGTU]{3})*)\b", t) or re.search(r"\b([acgtu]{6,})\b", t) + if not m: + return None + s = clean(m.group(1)) + return s if len(s) >= 3 and re.fullmatch(r"[ACGTU]+", s) else None + + def _answer(self, text): + t = " ".join(str(text or "").split()) + low = t.lower() + if not re.search(r"\bdna\b|\brna\b|\bmrna\b|\bsequence\b|\bstrand\b|\bcodon\b|\btranslat\w*\b|\btranscri\w*\b|\bcomplement\w*\b|\bgc content\b|\bprotein\b|\bamino acid\b", low): + return None + s = self._seq(t) + if s is None: + return None + if "U" in s and "T" in s: + return self._bad("A sequence cannot contain both T (DNA) and U (RNA).") + # --- single codon + if len(s) == 3 and re.search(r"\bcodon\b|\bcode for\b|\bencode\w*\b|\bamino acid\b|\bspecif\w*\b", low): + aa = CODON[s.replace("U", "T")] + if aa == "*": + return self._say("codon", "The codon %s encodes stop - it is a stop codon (no amino acid; translation ends; standard genetic code)." % s, "stop") + return self._say("codon", "The codon %s encodes %s (%s; standard genetic code)." % (s, NAMES[aa], aa), NAMES[aa]) + # --- GC content + if re.search(r"\bgc content\b|\bgc percent\w*\b|\bgc %|\bpercent(?:age)? (?:of )?g(?:\s*\+\s*|c\b)", low): + gc = (s.count("G") + s.count("C")) / len(s) * 100 + return self._say("gc", "The GC content is %s%% (%d G + C of %d bases)." % (("%.2f" % gc).rstrip("0").rstrip("."), s.count("G") + s.count("C"), len(s)), gc) + # --- reverse complement / complement + if re.search(r"\breverse[- ]complement\b", low): + rc = "".join(COMP[b] for b in reversed(s.replace("U", "T"))) + return self._say("revcomp", "The reverse complement is %s (5'->3' of the opposite strand)." % rc, rc) + if re.search(r"\bcomplement\w*\b", low) and not re.search(r"\btranscri\w*\b|\btranslat\w*\b", low): + c = "".join(COMP[b] for b in s.replace("U", "T")) + return self._say("complement", "The complementary strand is %s (A-T, C-G, written 3'->5' under the given strand)." % c, c) + # --- transcription + if re.search(r"\btranscri\w*\b|\bmrna\b(?!.*\btranslat)", low) and not re.search(r"\btranslat\w*\b|\bprotein\b|\bamino acids?\b", low): + if "U" in s: + return None + if re.search(r"\btemplate\b|\bantisense\b|\bnon-?coding strand\b", low): + m = "".join(COMP[b] for b in reversed(s)).replace("T", "U") + return self._say("transcribe", "The mRNA is %s (the template strand read 3'->5', complementary bases, U for T; written 5'->3')." % m, m) + m = s.replace("T", "U") + return self._say("transcribe", "The mRNA is %s (same as the coding strand with U in place of T)." % m, m) + # --- translation + if re.search(r"\btranslat\w*\b|\bprotein\b|\bamino acid sequence\b|\bpeptide\b", low): + nt = s.replace("U", "T") + if len(nt) % 3: + return self._bad("The sequence has %d bases, not a whole number of codons; I won't guess a reading frame." % len(nt)) + aa = [] + for i in range(0, len(nt), 3): + a = CODON[nt[i:i + 3]] + if a == "*": + break + aa.append(a) + stop = len(aa) * 3 < len(nt) + prot = "".join(aa) + if re.search(r"\bhow many amino acids\b|\blength of the protein\b|\bhow long\b", low): + return self._say("protein_len", "The protein is %d amino acids long (%d codons before %s)." % (len(aa), len(aa), "the stop codon" if stop else "the end of the sequence"), len(aa)) + return self._say("translate", "The protein is %s (standard genetic code, reading frame from the first base; %s)." % (prot or "(empty - it starts with a stop codon)", "translation stops at the stop codon" if stop else "no stop codon in the sequence"), prot) + return None diff --git a/root/specialists/biology/verdict_dev.json b/root/specialists/biology/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..06016ab932c230e3db9348eef8c0e61e0a5101af --- /dev/null +++ b/root/specialists/biology/verdict_dev.json @@ -0,0 +1,113 @@ +{ + "id": "biology", + "name": "Oracle7 Biology (molecular sequences)", + "tier": "A", + "split": "dev", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T09:48:00Z", + "domain": { + "head": { + "correct": 1, + "false_yes": 0, + "wrong": 2, + "n": 15, + "p50_ms": 437.58, + "fails": [ + [ + "codon", + "What amino acid does the codon CCG code for?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "codon", + "What amino acid does the codon UUU code for?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "codon", + "What amino acid does the codon UAA code for?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "comp", + "What is the complementary DNA strand of CATGGT?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "comp", + "What is the complementary DNA strand of AAGCTTC?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "rc", + "What is the reverse complement of the DNA sequence ATGCGT?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "rc", + "What is the reverse complement of the DNA sequence GGCCTTAA?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "tx", + "Transcribe the DNA coding strand TTTACCGG into mRNA.", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 15, + "false_yes": 0, + "wrong": 0, + "n": 15, + "p50_ms": 0.02, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/biology/verdict_heldout.json b/root/specialists/biology/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..785ef84721bfef712a493346076e7688a79375cc --- /dev/null +++ b/root/specialists/biology/verdict_heldout.json @@ -0,0 +1,113 @@ +{ + "id": "biology", + "name": "Oracle7 Biology (molecular sequences)", + "tier": "A", + "split": "heldout", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T09:51:54Z", + "domain": { + "head": { + "correct": 1, + "false_yes": 0, + "wrong": 0, + "n": 15, + "p50_ms": 432.26, + "fails": [ + [ + "codon", + "Which amino acid is specified by the mRNA codon GAU?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "codon", + "Which amino acid is specified by the mRNA codon GGC?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "codon", + "Which amino acid is specified by the mRNA codon UUU?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "comp", + "Give the complement of the DNA strand ACGTACGT.", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "comp", + "Give the complement of the DNA strand AAGCTTC.", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "rc", + "Reverse complement of TTTACCGG?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "rc", + "Reverse complement of ATGCGT?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "tx", + "What mRNA is transcribed from the coding strand ACGTACGT?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 15, + "false_yes": 0, + "wrong": 0, + "n": 15, + "p50_ms": 0.02, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/carboncapture/carboncapture_panel_v1.json b/root/specialists/carboncapture/carboncapture_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..a4b46cae2f46775d8d4b8f4a6149bc54daae778c --- /dev/null +++ b/root/specialists/carboncapture/carboncapture_panel_v1.json @@ -0,0 +1,198 @@ +[ + { + "split": "dev", + "kind": "c2co2", + "valid": true, + "q": "How much CO2 is produced when 2.5 tonnes of carbon are burned?", + "expect": 9.16035300974107 + }, + { + "split": "dev", + "kind": "c2co2", + "valid": true, + "q": "How much CO2 is produced when 100 tonnes of carbon are burned?", + "expect": 366.41412038964285 + }, + { + "split": "dev", + "kind": "co22c", + "valid": true, + "q": "How much carbon is in 1000 tonnes of CO2?", + "expect": 272.9152465348784 + }, + { + "split": "dev", + "kind": "co22c", + "valid": true, + "q": "How much carbon is in 44 tonnes of CO2?", + "expect": 12.00827084753465 + }, + { + "split": "dev", + "kind": "fuel", + "valid": true, + "q": "How much CO2 is emitted by burning 10 gallons of gasoline?", + "expect": 88.87 + }, + { + "split": "dev", + "kind": "fuel", + "valid": true, + "q": "How much CO2 is emitted by burning 15 gallons of diesel?", + "expect": 152.7 + }, + { + "split": "dev", + "kind": "mile", + "valid": true, + "q": "How many grams of CO2 per mile does a gasoline car getting 40 mpg emit?", + "expect": 222.175 + }, + { + "split": "dev", + "kind": "mile", + "valid": true, + "q": "How many grams of CO2 per mile does a gasoline car getting 25 mpg emit?", + "expect": 355.48 + }, + { + "split": "dev", + "kind": "cap", + "valid": true, + "q": "A plant emits 10,000 tonnes of CO2 a year and captures 95% of it. How much CO2 is captured?", + "expect": 9500.0 + }, + { + "split": "dev", + "kind": "cap", + "valid": true, + "q": "A plant emits 1,000 tonnes of CO2 a year and captures 90% of it. How much CO2 is captured?", + "expect": 900.0 + }, + { + "split": "dev", + "kind": "energy", + "valid": true, + "q": "Capturing 90% of 1000 tonnes of CO2 at 400 kWh per tonne: how much energy is needed?", + "expect": 360000.0 + }, + { + "split": "dev", + "kind": "energy", + "valid": true, + "q": "Capturing 85% of 200 tonnes of CO2 at 300 kWh per tonne: how much energy is needed?", + "expect": 51000.0 + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "A plant emits 1000 tonnes of CO2 a year and captures 120% of it. How much CO2 is captured?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "off", + "valid": false, + "q": "What is the price of a carbon offset per tonne?", + "expect": "not taken" + }, + { + "split": "heldout", + "kind": "c2co2", + "valid": true, + "q": "Burning 1 t of pure carbon produces how many tonnes of CO2?", + "expect": 3.6641412038964285 + }, + { + "split": "heldout", + "kind": "c2co2", + "valid": true, + "q": "Burning 12 t of pure carbon produces how many tonnes of CO2?", + "expect": 43.969694446757146 + }, + { + "split": "heldout", + "kind": "co22c", + "valid": true, + "q": "Express 1000 tonnes of CO2 as carbon: how much carbon is that?", + "expect": 272.9152465348784 + }, + { + "split": "heldout", + "kind": "co22c", + "valid": true, + "q": "Express 44 tonnes of CO2 as carbon: how much carbon is that?", + "expect": 12.00827084753465 + }, + { + "split": "heldout", + "kind": "fuel", + "valid": true, + "q": "CO2 emissions in kg from 10 US gallons of gasoline?", + "expect": 88.87 + }, + { + "split": "heldout", + "kind": "fuel", + "valid": true, + "q": "CO2 emissions in kg from 100 US gallons of gasoline?", + "expect": 888.7 + }, + { + "split": "heldout", + "kind": "mile", + "valid": true, + "q": "At 30 miles per gallon, a diesel vehicle emits how many grams of CO2 per mile?", + "expect": 339.3333333333333 + }, + { + "split": "heldout", + "kind": "mile", + "valid": true, + "q": "At 25 miles per gallon, a gasoline vehicle emits how many grams of CO2 per mile?", + "expect": 355.48 + }, + { + "split": "heldout", + "kind": "cap", + "valid": true, + "q": "With a capture rate of 90%, how many tonnes are captured from 1,000 tonnes of CO2 emissions?", + "expect": 900.0 + }, + { + "split": "heldout", + "kind": "cap", + "valid": true, + "q": "With a capture rate of 95%, how many tonnes are captured from 10,000 tonnes of CO2 emissions?", + "expect": 9500.0 + }, + { + "split": "heldout", + "kind": "energy", + "valid": true, + "q": "A direct air capture unit uses 400 kWh per tonne and captures 90% of 1000 tonnes. How much energy?", + "expect": 360000.0 + }, + { + "split": "heldout", + "kind": "energy", + "valid": true, + "q": "A direct air capture unit uses 2000 kWh per tonne and captures 100% of 50 tonnes. How much energy?", + "expect": 100000.0 + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "With a capture rate of 150%, how many tonnes are captured from 500 tonnes of CO2 emissions?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "off", + "valid": false, + "q": "How much are carbon credits worth?", + "expect": "not taken" + } +] \ No newline at end of file diff --git a/root/specialists/carboncapture/carboncapture_panel_v1.py b/root/specialists/carboncapture/carboncapture_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..366667477ad9160648f1095d8c13dae6a79f6c59 --- /dev/null +++ b/root/specialists/carboncapture/carboncapture_panel_v1.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 +"""carboncapture_panel_v1 - the sealed panel for specialist #93 (carbon capture & climate technology). Expected values +from the relations written here: CO2 = C x 44.01/12.011; C = CO2 x 12.011/44.01; gasoline 8,887 g/gal, diesel +10,180 g/gal (EPA); g/mile = factor / mpg; captured = emissions x rate; energy = captured x intensity. +Must-decline: capture rate above 100%. Off-domain: offset pricing must not be taken. +Dev / held-out differ in seed and phrasing. usage: carboncapture_panel_v1.py """ +import collections +import json +import random +import sys + +R = 44.01 / 12.011 +EF = {"gasoline": 8887.0, "diesel": 10180.0} +T = {"dev": {"c2co2": "How much CO2 is produced when {m} tonnes of carbon are burned?", + "co22c": "How much carbon is in {m} tonnes of CO2?", + "fuel": "How much CO2 is emitted by burning {g} gallons of {f}?", + "mile": "How many grams of CO2 per mile does a {f} car getting {mpg} mpg emit?", + "cap": "A plant emits {m} tonnes of CO2 a year and captures {c}% of it. How much CO2 is captured?", + "energy": "Capturing {c}% of {m} tonnes of CO2 at {e} kWh per tonne: how much energy is needed?"}, + "heldout": {"c2co2": "Burning {m} t of pure carbon produces how many tonnes of CO2?", + "co22c": "Express {m} tonnes of CO2 as carbon: how much carbon is that?", + "fuel": "CO2 emissions in kg from {g} US gallons of {f}?", + "mile": "At {mpg} miles per gallon, a {f} vehicle emits how many grams of CO2 per mile?", + "cap": "With a capture rate of {c}%, how many tonnes are captured from {m} tonnes of CO2 emissions?", + "energy": "A direct air capture unit uses {e} kWh per tonne and captures {c}% of {m} tonnes. How much energy?"}} +DECLINE = {"dev": ["A plant emits 1000 tonnes of CO2 a year and captures 120% of it. How much CO2 is captured?"], + "heldout": ["With a capture rate of 150%, how many tonnes are captured from 500 tonnes of CO2 emissions?"]} +OFF = {"dev": ["What is the price of a carbon offset per tonne?"], "heldout": ["How much are carbon credits worth?"]} + + +def main(): + items = [] + for split, seed in (("dev", 93), ("heldout", 9393)): + rng = random.Random(seed) + t = T[split] + add = [] + for m in rng.sample([1, 12, 100, 2.5], 2): + add.append(("c2co2", {"m": m}, m * R)) + for m in rng.sample([44, 1, 1000, 3.67], 2): + add.append(("co22c", {"m": m}, m / R)) + for gg, f in rng.sample([(10, "gasoline"), (15, "diesel"), (100, "gasoline"), (1, "diesel")], 2): + add.append(("fuel", {"g": gg, "f": f}, gg * EF[f] / 1000)) + for f, mpg in rng.sample([("gasoline", 25), ("gasoline", 40), ("diesel", 30), ("diesel", 18)], 2): + add.append(("mile", {"f": f, "mpg": mpg}, EF[f] / mpg)) + for m, c in rng.sample([(1000, 90), (5000, 85), (250, 60), (10000, 95)], 2): + add.append(("cap", {"m": format(m, ","), "c": c}, m * c / 100)) + for c, m, e in rng.sample([(90, 1000, 400), (100, 50, 2000), (85, 200, 300)], 2): + add.append(("energy", {"c": c, "m": m, "e": e}, m * c / 100 * e)) + for kind, kw, exp in add: + items.append({"split": split, "kind": kind, "valid": True, "q": t[kind].format(**kw), "expect": exp}) + for q in DECLINE[split]: + items.append({"split": split, "kind": "decline", "valid": False, "q": q, "expect": "decline"}) + for q in OFF[split]: + items.append({"split": split, "kind": "off", "valid": False, "q": q, "expect": "not taken"}) + json.dump(items, open(sys.argv[1], "w"), indent=1) + print("panel:", dict(collections.Counter(i["split"] for i in items))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/carboncapture/carboncapture_scorer.py b/root/specialists/carboncapture/carboncapture_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..824d6c54fab94fad3ca15cb542b0cba464d084f1 --- /dev/null +++ b/root/specialists/carboncapture/carboncapture_scorer.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +"""carboncapture_scorer - the first number after "is" in the REPLY TEXT (commas allowed) must be within 0.5% of the +panel's relation (tonnes, kg, g/mile, kWh). A must-decline or off-domain item answered is a false yes. (ok, asserted).""" +import re + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + m = re.search(r"\bis\s+(?:about\s+)?([\d,]*\.?\d+)", text) + if not m: + return False, True + got, e = float(m.group(1).replace(",", "")), float(p["expect"]) + return abs(got - e) <= 0.005 * abs(e), True diff --git a/root/specialists/carboncapture/manifest.json b/root/specialists/carboncapture/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..7d6bb1c8c14b9584ea2bcd08db2eda14468935df --- /dev/null +++ b/root/specialists/carboncapture/manifest.json @@ -0,0 +1,23 @@ +{ + "id": "carboncapture", + "name": "Oracle7 Carbon Capture & Climate Technology", + "number": 93, + "tier": "B", + "sources": [ + {"name": "EPA Greenhouse Gas Emissions from a Typical Passenger Vehicle (8,887 g CO2/gal gasoline, 10,180 g/gal diesel)", "licence": "public domain (US government)", "url": "https://www.epa.gov/greenvehicles/greenhouse-gas-emissions-typical-passenger-vehicle"}, + {"name": "DOE / NETL carbon capture: capture rate, energy intensity; molar masses C 12.011, CO2 44.01", "licence": "public domain (US government)", "url": "https://netl.doe.gov/carbon-management/carbon-capture"} + ], + "store": {"path": "__ORACLE7_ROOT__/specialists/carboncapture/organ_carboncapture_v1.py"}, + "organ": {"dir": "__ORACLE7_ROOT__/specialists/carboncapture", "module": "organ_carboncapture_v1", "class": "CarbonCaptureOrgan", "init": {}}, + "accept": { + "kinds": ["c_to_co2", "co2_to_c", "fuel_co2", "co2_per_mile", "captured", "capture_energy"], + "declines_in_domain": ["impossible"], + "context_regex": "\\b(?:co2|carbon dioxide|captur\\w*|emissions?|gasoline|diesel|direct air capture)\\b" + }, + "panel": {"path": "__ORACLE7_ROOT__/specialists/carboncapture/carboncapture_panel_v1.json", "splits": ["dev", "heldout"], + "exclude_kinds_composed": [], "scorer_module": "carboncapture_scorer", "scorer_fn": "ok"}, + "routing_cues": ["carbon to CO2 mass", "CO2 from burning fuel", "CO2 per mile from mpg", "CO2 captured at a capture rate", "capture energy"], + "budgets": {"latency_p50_ms": 50, "store_mb": 1}, + "core_sample": {"n": 400, "seed": 20260928}, + "notes": "EPA emission factors named; capture rate and energy intensity only as given. No offset / credit pricing (falls through). Narrowed from the start (narrow_v1)." +} diff --git a/root/specialists/carboncapture/narrow_v1.py b/root/specialists/carboncapture/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/carboncapture/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/carboncapture/organ_carboncapture_v1.py b/root/specialists/carboncapture/organ_carboncapture_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..fa33e9123d5d2c9787ce5751f396f509e74118c8 --- /dev/null +++ b/root/specialists/carboncapture/organ_carboncapture_v1.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python3 +"""organ_carboncapture_v1 - carbon accounting and capture arithmetic (EPA / DOE conventions), factor named in every +answer: +- carbon <-> CO2 mass: CO2 = C x 44.01 / 12.011 (and back); +- fuel combustion CO2 (EPA emission factors): gasoline 8,887 g CO2 per US gallon, diesel 10,180 g per gallon; +- tailpipe CO2 per mile from fuel economy: 8,887 / mpg grams (gasoline), 10,180 / mpg (diesel); +- CO2 captured = emissions x capture rate (rate must be given); +- capture energy = tonnes captured x stated energy intensity (kWh or GJ per tonne). +Declines: a capture rate above 100%. No offsets / credits valuation. Narrowed from the start (narrow_v1). +Returns {kind, status, response, value}.""" +from __future__ import annotations + +import re + +from narrow_v1 import narrative, short_direct + +N = r"(\d+(?:,\d{3})*(?:\.\d+)?)" +R = 44.01 / 12.011 +EF = {"gasoline": 8887.0, "petrol": 8887.0, "diesel": 10180.0} + + +def num(s): + return float(s.replace(",", "")) + + +def g(x): + return ("%.4f" % x).rstrip("0").rstrip(".") if abs(x) < 1e5 else format(round(x), ",") + + +class CarbonCaptureOrgan: + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def _bad(self, why): + return self._say("impossible", why, status="withheld") + + def answer(self, text, session_id="default"): + if narrative(text): + return None + r = self._answer(text) + if r and r.get("status") != "answered" and not short_direct(text): + return None + return r + + def _answer(self, text): + t = " ".join(str(text or "").split()) + low = t.lower() + if re.search(r"\boffsets?\b|\bcredits?\b|\bprice\b|\bworth\b|\$", low): + return None + mass = re.search(N + r"\s*(tonnes?|tons?|t|kg|kilograms?|mt|gt|gigatonnes?|megatonnes?)\b", low) + unit = mass.group(2) if mass else None + # --- fuel combustion CO2 + fuel = next((f for f in EF if re.search(r"\b" + f + r"\b", low)), None) + mpg = re.search(N + r"\s*(?:mpg|miles per gallon)\b", low) + if fuel and mpg and re.search(r"\bper mile\b|\bco2 per\b|\bgrams\b", low): + v = EF[fuel] / num(mpg.group(1)) + return self._say("co2_per_mile", "The tailpipe CO2 is %s g per mile (%s g CO2/gal ÷ %s mpg; EPA %s factor)." % (g(v), g(EF[fuel]), g(num(mpg.group(1))), fuel), v) + gal = re.search(N + r"\s*(?:us\s+)?gallons?\b", low) + if fuel and gal and re.search(r"\bco2\b|\bcarbon dioxide\b|\bemi\w+\b", low): + v = num(gal.group(1)) * EF[fuel] / 1000 + return self._say("fuel_co2", "The CO2 emitted is %s kg (%s gal × %s g CO2/gal; EPA %s factor)." % (g(v), g(num(gal.group(1))), g(EF[fuel]), fuel), v) + # --- captured + cap = re.search(r"(\d+(?:\.\d+)?)\s*%\s*(?:capture|of (?:the |its )?(?:co2|emissions))|\bcapture (?:rate|efficiency)\s*(?:of|is)?\s*(\d+(?:\.\d+)?)\s*%|\bcaptur\w*\s*(\d+(?:\.\d+)?)\s*%", low) # captures / capturing / captured (dev: "Capturing 90% of ...") + if cap and mass and re.search(r"\bcaptur\w*\b", low): + c = float(cap.group(1) or cap.group(2) or cap.group(3)) + if c > 100: + return self._bad("A capture rate above 100% is not possible.") + ekwh = re.search(N + r"\s*(kwh|mwh|gj)\s*(?:per|/|a)\s*(?:tonne|ton|t)\b", low) + got = num(mass.group(1)) * c / 100 + if ekwh and re.search(r"\benergy\b|\bhow much (?:energy|electricity|power)\b", low): + e = got * num(ekwh.group(1)) + return self._say("capture_energy", "The energy needed is %s %s (%s %s captured × %s %s per tonne)." % (g(e), ekwh.group(2).upper() if ekwh.group(2) != "kwh" else "kWh", g(got), unit, g(num(ekwh.group(1))), ekwh.group(2) if ekwh.group(2) != "kwh" else "kWh"), e) + return self._say("captured", "The CO2 captured is %s %s (%s × %s%% capture rate)." % (g(got), unit, g(num(mass.group(1))), g(c)), got) + # --- carbon <-> CO2 + if mass and re.search(r"\bco2\b|\bcarbon dioxide\b", low) and re.search(r"\bcarbon\b", low.replace("carbon dioxide", "")): + if re.search(r"\b(?:of|from) (?:pure )?carbon\b|\bcarbon (?:is )?(?:burned|burnt|combusted|oxidi[sz]ed)\b|\bburning\b.*\bcarbon\b|\bcarbon\b.*\b(?:produce|make|form|yield)s?\b", low) and \ + re.search(r"\bhow much co2\b|\bhow many\b.*\bco2\b|\bco2 (?:is )?(?:produced|formed|released|made)\b|\bmass of co2\b|\bproduce\b", low): + v = num(mass.group(1)) * R + return self._say("c_to_co2", "That is %s %s of CO2 (%s × 44.01/12.011)." % (g(v), unit, g(num(mass.group(1)))), v) + if re.search(r"\bhow much carbon\b|\bcarbon content\b|\bmass of carbon\b|\bin terms of carbon\b|\bas carbon\b", low): + v = num(mass.group(1)) / R + return self._say("co2_to_c", "That is %s %s of carbon (%s × 12.011/44.01)." % (g(v), unit, g(num(mass.group(1)))), v) + return None diff --git a/root/specialists/carboncapture/verdict_dev.json b/root/specialists/carboncapture/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..5ba1c3f04612c5bb526003d731b4e87062ebe122 --- /dev/null +++ b/root/specialists/carboncapture/verdict_dev.json @@ -0,0 +1,113 @@ +{ + "id": "carboncapture", + "name": "Oracle7 Carbon Capture & Climate Technology", + "tier": "B", + "split": "dev", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T08:03:57Z", + "domain": { + "head": { + "correct": 2, + "false_yes": 0, + "wrong": 0, + "n": 14, + "p50_ms": 33.54, + "fails": [ + [ + "c2co2", + "How much CO2 is produced when 2.5 tonnes of carbon are burned?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "c2co2", + "How much CO2 is produced when 100 tonnes of carbon are burned?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "co22c", + "How much carbon is in 1000 tonnes of CO2?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "co22c", + "How much carbon is in 44 tonnes of CO2?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fuel", + "How much CO2 is emitted by burning 10 gallons of gasoline?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fuel", + "How much CO2 is emitted by burning 15 gallons of diesel?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mile", + "How many grams of CO2 per mile does a gasoline car getting 40 mpg emit", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mile", + "How many grams of CO2 per mile does a gasoline car getting 25 mpg emit", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 14, + "false_yes": 0, + "wrong": 0, + "n": 14, + "p50_ms": 0.07, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/carboncapture/verdict_heldout.json b/root/specialists/carboncapture/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..d5ba0953e0fa7bbf783f74838647474f3d31b89d --- /dev/null +++ b/root/specialists/carboncapture/verdict_heldout.json @@ -0,0 +1,113 @@ +{ + "id": "carboncapture", + "name": "Oracle7 Carbon Capture & Climate Technology", + "tier": "B", + "split": "heldout", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T08:07:45Z", + "domain": { + "head": { + "correct": 2, + "false_yes": 0, + "wrong": 0, + "n": 14, + "p50_ms": 53.85, + "fails": [ + [ + "c2co2", + "Burning 1 t of pure carbon produces how many tonnes of CO2?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "c2co2", + "Burning 12 t of pure carbon produces how many tonnes of CO2?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "co22c", + "Express 1000 tonnes of CO2 as carbon: how much carbon is that?", + "act:clarify_specific", + "What does \"that\" refer to? Nothing earlier in this conversation names it. Tell me the name" + ], + [ + "co22c", + "Express 44 tonnes of CO2 as carbon: how much carbon is that?", + "act:clarify_specific", + "What does \"that\" refer to? Nothing earlier in this conversation names it. Tell me the name" + ], + [ + "fuel", + "CO2 emissions in kg from 10 US gallons of gasoline?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fuel", + "CO2 emissions in kg from 100 US gallons of gasoline?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mile", + "At 30 miles per gallon, a diesel vehicle emits how many grams of CO2 p", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mile", + "At 25 miles per gallon, a gasoline vehicle emits how many grams of CO2", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 14, + "false_yes": 0, + "wrong": 0, + "n": 14, + "p50_ms": 0.07, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/chemistry/chemistry_panel_v1.json b/root/specialists/chemistry/chemistry_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..7e5818f00956af90372340707a0a1cbe27e5e689 --- /dev/null +++ b/root/specialists/chemistry/chemistry_panel_v1.json @@ -0,0 +1,3544 @@ +[ + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of H2O.", + "expect": 18.015 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 50 g of H2O to moles.", + "expect": 2.7754648903691366 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 3 mol of H2O in grams?", + "expect": 54.045 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of H2O is oxygen?", + "expect": 88.80932556203165 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of CO2?", + "expect": 44.009 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 100 g of CO2?", + "expect": 2.2722624917630485 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 0.5 mol of CO2?", + "expect": 22.0045 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of carbon in CO2?", + "expect": 27.292144788565974 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of NaCl?", + "expect": 58.4397693 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 10 g of NaCl?", + "expect": 0.17111634970126413 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 3 mol of NaCl?", + "expect": 175.3193079 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of sodium in NaCl?", + "expect": 39.33925403090186 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of H2SO4?", + "expect": 98.08200000000001 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 1 g of H2SO4?", + "expect": 0.010195550661691238 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 0.25 mol of H2SO4?", + "expect": 24.520500000000002 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of sulfur in H2SO4?", + "expect": 32.697130972043794 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of HCl.", + "expect": 36.458000000000006 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 2.5 g of HCl to moles.", + "expect": 0.06857205551593613 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.25 mol of HCl in grams?", + "expect": 9.114500000000001 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of HCl is hydrogen?", + "expect": 2.764825278402545 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of HNO3?", + "expect": 63.012 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 10 g of HNO3?", + "expect": 0.1586999301720307 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 2 mol of HNO3?", + "expect": 126.024 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of oxygen in HNO3?", + "expect": 76.1712054846696 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of NH3.", + "expect": 17.031 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 10 g of NH3 to moles.", + "expect": 0.5871645822323998 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.25 mol of NH3 in grams?", + "expect": 4.25775 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of NH3 is nitrogen?", + "expect": 82.24414303329225 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of CH4.", + "expect": 16.043 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 18 g of CH4 to moles.", + "expect": 1.1219846662095618 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.25 mol of CH4 in grams?", + "expect": 4.01075 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of CH4 is hydrogen?", + "expect": 25.132456523094184 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of C2H6.", + "expect": 30.07 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 2.5 g of C2H6 to moles.", + "expect": 0.08313934153641503 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.25 mol of C2H6 in grams?", + "expect": 7.5175 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of C2H6 is carbon?", + "expect": 79.88693049551047 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of C3H8?", + "expect": 44.097 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 36 g of C3H8?", + "expect": 0.8163820668072658 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 3 mol of C3H8?", + "expect": 132.291 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of carbon in C3H8?", + "expect": 81.71304170351723 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of C2H5OH.", + "expect": 46.069 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 18 g of C2H5OH to moles.", + "expect": 0.39071827042045626 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.25 mol of C2H5OH in grams?", + "expect": 11.51725 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of C2H5OH is carbon?", + "expect": 52.143523844667776 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of C6H12O6.", + "expect": 180.156 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 1 g of C6H12O6 to moles.", + "expect": 0.005550744909966918 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 3 mol of C6H12O6 in grams?", + "expect": 540.4680000000001 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of C6H12O6 is hydrogen?", + "expect": 6.714181043095983 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of C12H22O11.", + "expect": 342.297 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 50 g of C12H22O11 to moles.", + "expect": 0.14607197842809022 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.25 mol of C12H22O11 in grams?", + "expect": 85.57425 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of C12H22O11 is oxygen?", + "expect": 51.414122823162344 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of NaOH?", + "expect": 39.9967693 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 100 g of NaOH?", + "expect": 2.50020193505979 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 0.25 mol of NaOH?", + "expect": 9.999192325 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of oxygen in NaOH?", + "expect": 40.000730759021586 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of KOH?", + "expect": 56.1053 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 1 g of KOH?", + "expect": 0.01782362807078832 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 1 mol of KOH?", + "expect": 56.1053 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of potassium in KOH?", + "expect": 69.6873557400103 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of Ca(OH)2?", + "expect": 74.094 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 1 g of Ca(OH)2?", + "expect": 0.013496369476610794 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 2 mol of Ca(OH)2?", + "expect": 148.188 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of calcium in Ca(OH)2?", + "expect": 54.09344886225606 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of Mg(OH)2?", + "expect": 58.319 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 50 g of Mg(OH)2?", + "expect": 0.8573535211509113 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 1 mol of Mg(OH)2?", + "expect": 58.319 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of magnesium in Mg(OH)2?", + "expect": 41.6759546631458 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of Al(OH)3?", + "expect": 78.002538 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 1 g of Al(OH)3?", + "expect": 0.012820095674322803 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 0.5 mol of Al(OH)3?", + "expect": 39.001269 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of hydrogen in Al(OH)3?", + "expect": 3.876796931915215 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of CaCO3.", + "expect": 100.088 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 10 g of CaCO3 to moles.", + "expect": 0.09991207737191272 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 1 mol of CaCO3 in grams?", + "expect": 100.088 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of CaCO3 is calcium?", + "expect": 40.04476061066262 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of Na2CO3?", + "expect": 105.9875386 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 18 g of Na2CO3?", + "expect": 0.16983128618480817 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 3 mol of Na2CO3?", + "expect": 317.9626158 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of sodium in Na2CO3?", + "expect": 43.38202321456685 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of NaHCO3?", + "expect": 84.0057693 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 10 g of NaHCO3?", + "expect": 0.11903944316357806 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 2 mol of NaHCO3?", + "expect": 168.0115386 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of hydrogen in NaHCO3?", + "expect": 1.1999175870888668 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of KNO3.", + "expect": 101.1023 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 18 g of KNO3 to moles.", + "expect": 0.178037492717772 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 2 mol of KNO3 in grams?", + "expect": 202.2046 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of KNO3 is oxygen?", + "expect": 47.47369743319391 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of NH4NO3?", + "expect": 80.043 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 50 g of NH4NO3?", + "expect": 0.6246642429694039 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 1 mol of NH4NO3?", + "expect": 80.043 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of oxygen in NH4NO3?", + "expect": 59.96401933960497 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of (NH4)2SO4.", + "expect": 132.144 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 10 g of (NH4)2SO4 to moles.", + "expect": 0.07567502118900593 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.5 mol of (NH4)2SO4 in grams?", + "expect": 66.072 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of (NH4)2SO4 is nitrogen?", + "expect": 21.199600435888122 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of Fe2O3.", + "expect": 159.67700000000002 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 36 g of Fe2O3 to moles.", + "expect": 0.22545513755894708 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.25 mol of Fe2O3 in grams?", + "expect": 39.919250000000005 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of Fe2O3 is iron?", + "expect": 69.94119378495337 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of Fe3O4.", + "expect": 231.51600000000002 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 10 g of Fe3O4 to moles.", + "expect": 0.04319355897648542 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.5 mol of Fe3O4 in grams?", + "expect": 115.75800000000001 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of Fe3O4 is iron?", + "expect": 72.35784999740838 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of FeCl3.", + "expect": 162.19 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 100 g of FeCl3 to moles.", + "expect": 0.6165608237252606 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 3 mol of FeCl3 in grams?", + "expect": 486.57 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of FeCl3 is chlorine?", + "expect": 65.57124360318147 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of CuSO4?", + "expect": 159.61599999999999 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 100 g of CuSO4?", + "expect": 0.6265036086607859 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 2 mol of CuSO4?", + "expect": 319.23199999999997 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of copper in CuSO4?", + "expect": 39.81430433039294 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of Cu(NO3)2.", + "expect": 187.558 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 1 g of Cu(NO3)2 to moles.", + "expect": 0.005331684065729001 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.25 mol of Cu(NO3)2 in grams?", + "expect": 46.8895 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of Cu(NO3)2 is oxygen?", + "expect": 51.180968020558986 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of AgNO3?", + "expect": 169.87199999999999 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 36 g of AgNO3?", + "expect": 0.21192427239333148 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 2 mol of AgNO3?", + "expect": 339.74399999999997 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of oxygen in AgNO3?", + "expect": 28.25480361684092 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of AgCl.", + "expect": 143.31799999999998 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 1 g of AgCl to moles.", + "expect": 0.006977490615275124 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 1 mol of AgCl in grams?", + "expect": 143.31799999999998 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of AgCl is chlorine?", + "expect": 24.735204231150316 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of BaSO4.", + "expect": 233.39600000000002 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 2.5 g of BaSO4 to moles.", + "expect": 0.01071140893588579 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 3 mol of BaSO4 in grams?", + "expect": 700.1880000000001 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of BaSO4 is sulfur?", + "expect": 13.740595382954291 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of BaCl2?", + "expect": 208.23000000000002 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 1 g of BaCl2?", + "expect": 0.004802381981462805 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 1 mol of BaCl2?", + "expect": 208.23000000000002 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of barium in BaCl2?", + "expect": 65.95111175142871 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of KMnO4.", + "expect": 158.03234 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 36 g of KMnO4 to moles.", + "expect": 0.22780147405271603 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 3 mol of KMnO4 in grams?", + "expect": 474.09702000000004 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of KMnO4 is potassium?", + "expect": 24.740695480431413 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of K2Cr2O7?", + "expect": 294.1816 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 2.5 g of K2Cr2O7?", + "expect": 0.00849815216179394 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 3 mol of K2Cr2O7?", + "expect": 882.5448 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of chromium in K2Cr2O7?", + "expect": 35.349593584371014 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of H3PO4?", + "expect": 97.993762 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 36 g of H3PO4?", + "expect": 0.3673703230211735 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 0.25 mol of H3PO4?", + "expect": 24.4984405 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of phosphorus in H3PO4?", + "expect": 31.60789153089153 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of Ca3(PO4)2.", + "expect": 310.179524 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 50 g of Ca3(PO4)2 to moles.", + "expect": 0.16119697185427365 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 2 mol of Ca3(PO4)2 in grams?", + "expect": 620.359048 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of Ca3(PO4)2 is calcium?", + "expect": 38.76464779151573 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of Na3PO4.", + "expect": 163.9390699 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 1 g of Na3PO4 to moles.", + "expect": 0.006099827213915407 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 2 mol of Na3PO4 in grams?", + "expect": 327.8781398 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of Na3PO4 is phosphorus?", + "expect": 18.89345963649389 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of MgSO4?", + "expect": 120.37100000000001 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 10 g of MgSO4?", + "expect": 0.0830764885229831 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 0.5 mol of MgSO4?", + "expect": 60.185500000000005 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of magnesium in MgSO4?", + "expect": 20.191740535511045 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of ZnCl2.", + "expect": 136.3 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 18 g of ZnCl2 to moles.", + "expect": 0.13206162876008803 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.25 mol of ZnCl2 in grams?", + "expect": 34.075 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of ZnCl2 is chlorine?", + "expect": 52.01760821716801 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of ZnO.", + "expect": 81.399 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 10 g of ZnO to moles.", + "expect": 0.12285163208393224 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 2 mol of ZnO in grams?", + "expect": 162.798 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of ZnO is oxygen?", + "expect": 19.65503261710832 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of Al2O3.", + "expect": 101.960076 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 18 g of Al2O3 to moles.", + "expect": 0.17653968794609373 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 1 mol of Al2O3 in grams?", + "expect": 101.960076 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of Al2O3 is aluminum?", + "expect": 52.92569220917411 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of SiO2.", + "expect": 60.083 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 36 g of SiO2 to moles.", + "expect": 0.5991711465805636 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 2 mol of SiO2 in grams?", + "expect": 120.166 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of SiO2 is oxygen?", + "expect": 53.25632874523576 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of TiO2?", + "expect": 79.865 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 18 g of TiO2?", + "expect": 0.2253803293057034 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 0.5 mol of TiO2?", + "expect": 39.9325 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of oxygen in TiO2?", + "expect": 40.06510987291054 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of CaO.", + "expect": 56.079 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 36 g of CaO to moles.", + "expect": 0.6419515326592842 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.25 mol of CaO in grams?", + "expect": 14.01975 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of CaO is calcium?", + "expect": 71.47060396940032 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of MgO.", + "expect": 40.304 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 36 g of MgO to moles.", + "expect": 0.8932115919015482 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 3 mol of MgO in grams?", + "expect": 120.912 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of MgO is oxygen?", + "expect": 39.69581183009131 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of Na2O?", + "expect": 61.9785386 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 10 g of Na2O?", + "expect": 0.16134617281860208 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 0.5 mol of Na2O?", + "expect": 30.9892693 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of oxygen in Na2O?", + "expect": 25.81377418924815 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of K2O?", + "expect": 94.1956 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 10 g of K2O?", + "expect": 0.1061620712644752 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 3 mol of K2O?", + "expect": 282.5868 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of oxygen in K2O?", + "expect": 16.98486978160339 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of SO2?", + "expect": 64.068 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 18 g of SO2?", + "expect": 0.2809514890428919 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 2 mol of SO2?", + "expect": 128.136 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of oxygen in SO2?", + "expect": 49.94380970219142 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of SO3.", + "expect": 80.06700000000001 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 2.5 g of SO3 to moles.", + "expect": 0.031223850025603555 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 3 mol of SO3 in grams?", + "expect": 240.20100000000002 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of SO3 is oxygen?", + "expect": 59.94604518715576 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of NO2.", + "expect": 46.005 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 36 g of NO2 to moles.", + "expect": 0.78252363873492 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 2 mol of NO2 in grams?", + "expect": 92.01 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of NO2 is oxygen?", + "expect": 69.55330942288882 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of N2O.", + "expect": 44.013 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 2.5 g of N2O to moles.", + "expect": 0.056801399586485814 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.5 mol of N2O in grams?", + "expect": 22.0065 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of N2O is nitrogen?", + "expect": 63.64937632063255 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of CO?", + "expect": 28.009999999999998 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 2.5 g of CO?", + "expect": 0.08925383791503036 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 0.25 mol of CO?", + "expect": 7.0024999999999995 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of oxygen in CO?", + "expect": 57.11888611210283 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of O3?", + "expect": 47.997 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 1 g of O3?", + "expect": 0.02083463549805196 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 1 mol of O3?", + "expect": 47.997 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of oxygen in O3?", + "expect": 100.00000000000001 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of H2O2.", + "expect": 34.014 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 10 g of H2O2 to moles.", + "expect": 0.29399658963956016 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.5 mol of H2O2 in grams?", + "expect": 17.007 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of H2O2 is oxygen?", + "expect": 94.07302875286646 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of CH3COOH.", + "expect": 60.052 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 18 g of CH3COOH to moles.", + "expect": 0.2997402251382135 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.5 mol of CH3COOH in grams?", + "expect": 30.026 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of CH3COOH is oxygen?", + "expect": 53.283820688736434 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of HCOOH.", + "expect": 46.025 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 18 g of HCOOH to moles.", + "expect": 0.39109179793590443 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 3 mol of HCOOH in grams?", + "expect": 138.075 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of HCOOH is oxygen?", + "expect": 69.52308527973928 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of C6H6.", + "expect": 78.114 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 2.5 g of C6H6 to moles.", + "expect": 0.032004506234477814 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 1 mol of C6H6 in grams?", + "expect": 78.114 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of C6H6 is carbon?", + "expect": 92.25746985175512 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of C7H8?", + "expect": 92.14099999999999 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 36 g of C7H8?", + "expect": 0.3907055491040905 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 2 mol of C7H8?", + "expect": 184.28199999999998 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of hydrogen in C7H8?", + "expect": 8.751804299931628 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of C8H18?", + "expect": 114.232 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 1 g of C8H18?", + "expect": 0.008754114433783879 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 1 mol of C8H18?", + "expect": 114.232 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of hydrogen in C8H18?", + "expect": 15.883465228657467 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of CCl4?", + "expect": 153.811 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 10 g of CCl4?", + "expect": 0.06501485589457191 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 0.5 mol of CCl4?", + "expect": 76.9055 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of carbon in CCl4?", + "expect": 7.808934341497031 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of CHCl3.", + "expect": 119.36900000000001 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 1 g of CHCl3 to moles.", + "expect": 0.00837738441303856 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.25 mol of CHCl3 in grams?", + "expect": 29.842250000000003 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of CHCl3 is chlorine?", + "expect": 89.09348323266511 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of C2H4.", + "expect": 28.054 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 10 g of C2H4 to moles.", + "expect": 0.3564554074285307 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 2 mol of C2H4 in grams?", + "expect": 56.108 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of C2H4 is hydrogen?", + "expect": 14.372282027518358 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of C2H2.", + "expect": 26.037999999999997 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 10 g of C2H2 to moles.", + "expect": 0.3840540748137338 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 3 mol of C2H2 in grams?", + "expect": 78.11399999999999 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of C2H2 is carbon?", + "expect": 92.25746985175513 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of CH3OH.", + "expect": 32.042 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 18 g of CH3OH to moles.", + "expect": 0.5617626864740028 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 3 mol of CH3OH in grams?", + "expect": 96.126 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of CH3OH is hydrogen?", + "expect": 12.583484177017663 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of C3H6O.", + "expect": 58.08 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 50 g of C3H6O to moles.", + "expect": 0.8608815426997245 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.25 mol of C3H6O in grams?", + "expect": 14.52 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of C3H6O is hydrogen?", + "expect": 10.413223140495868 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of Li2CO3?", + "expect": 74.008 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 2.5 g of Li2CO3?", + "expect": 0.03378013187763485 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 1 mol of Li2CO3?", + "expect": 74.008 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of oxygen in Li2CO3?", + "expect": 64.85379958923362 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of LiOH?", + "expect": 24.007 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 50 g of LiOH?", + "expect": 2.0827258716207773 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 2 mol of LiOH?", + "expect": 48.014 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of oxygen in LiOH?", + "expect": 66.64306244012162 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of KCl?", + "expect": 74.54830000000001 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 100 g of KCl?", + "expect": 1.341412211948495 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 1 mol of KCl?", + "expect": 74.54830000000001 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of potassium in KCl?", + "expect": 52.44693708642584 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of KBr.", + "expect": 118.9983 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 50 g of KBr to moles.", + "expect": 0.42017406971360094 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 2 mol of KBr in grams?", + "expect": 237.9966 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of KBr is potassium?", + "expect": 32.85618365976657 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of KI?", + "expect": 166.0028 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 10 g of KI?", + "expect": 0.0602399477599173 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 1 mol of KI?", + "expect": 166.0028 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of potassium in KI?", + "expect": 23.552795495015747 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of NaF.", + "expect": 41.98817246 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 50 g of NaF to moles.", + "expect": 1.1908115326436859 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.5 mol of NaF in grams?", + "expect": 20.99408623 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of NaF is fluorine?", + "expect": 45.247035169484484 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of CaF2?", + "expect": 78.07680632 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 100 g of CaF2?", + "expect": 1.2807900926447626 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 2 mol of CaF2?", + "expect": 156.15361264 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of fluorine in CaF2?", + "expect": 48.6659330867979 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of MgCl2.", + "expect": 95.20500000000001 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 36 g of MgCl2 to moles.", + "expect": 0.3781314006617299 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 2 mol of MgCl2 in grams?", + "expect": 190.41000000000003 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of MgCl2 is magnesium?", + "expect": 25.52912136967596 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of CaCl2.", + "expect": 110.98 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 36 g of CaCl2 to moles.", + "expect": 0.3243827716705713 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 1 mol of CaCl2 in grams?", + "expect": 110.98 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of CaCl2 is chlorine?", + "expect": 63.885384754009735 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of AlCl3.", + "expect": 133.33153800000002 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 1 g of AlCl3 to moles.", + "expect": 0.0075001009888598135 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.5 mol of AlCl3 in grams?", + "expect": 66.66576900000001 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of AlCl3 is aluminum?", + "expect": 20.236425983475865 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of PbO2.", + "expect": 238.998 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 2.5 g of PbO2 to moles.", + "expect": 0.010460338580239165 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.25 mol of PbO2 in grams?", + "expect": 59.7495 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of PbO2 is lead?", + "expect": 86.6116034443803 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of Pb(NO3)2.", + "expect": 331.008 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 10 g of Pb(NO3)2 to moles.", + "expect": 0.030210750193348804 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.5 mol of Pb(NO3)2 in grams?", + "expect": 165.504 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of Pb(NO3)2 is nitrogen?", + "expect": 8.463239559164734 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of SnCl2?", + "expect": 189.61 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 18 g of SnCl2?", + "expect": 0.09493170191445598 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 0.5 mol of SnCl2?", + "expect": 94.805 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of tin in SnCl2?", + "expect": 62.60745741258372 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of NiSO4.", + "expect": 154.75900000000001 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 1 g of NiSO4 to moles.", + "expect": 0.006461659741921309 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.5 mol of NiSO4 in grams?", + "expect": 77.37950000000001 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of NiSO4 is sulfur?", + "expect": 20.72254279234164 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of CoCl2.", + "expect": 129.83319 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 50 g of CoCl2 to moles.", + "expect": 0.3851095394020589 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 3 mol of CoCl2 in grams?", + "expect": 389.49957 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of CoCl2 is chlorine?", + "expect": 54.608532687211955 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of MnO2?", + "expect": 86.93604 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 18 g of MnO2?", + "expect": 0.20704876826687757 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 0.5 mol of MnO2?", + "expect": 43.46802 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of manganese in MnO2?", + "expect": 63.19363062775806 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of Cr2O3.", + "expect": 151.989 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 2.5 g of Cr2O3 to moles.", + "expect": 0.016448558777279933 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 1 mol of Cr2O3 in grams?", + "expect": 151.989 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of Cr2O3 is oxygen?", + "expect": 31.579259025324205 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of Na2S2O3?", + "expect": 158.1165386 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 100 g of Na2S2O3?", + "expect": 0.632444909845756 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 3 mol of Na2S2O3?", + "expect": 474.34961580000004 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of sulfur in Na2S2O3?", + "expect": 40.565016517506784 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of NaClO.", + "expect": 74.4387693 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 2.5 g of NaClO to moles.", + "expect": 0.03358464982037256 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.5 mol of NaClO in grams?", + "expect": 37.21938465 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of NaClO is chlorine?", + "expect": 47.62303344528831 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of NaClO3?", + "expect": 106.43676930000001 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 10 g of NaClO3?", + "expect": 0.09395249466670912 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 3 mol of NaClO3?", + "expect": 319.3103079 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of chlorine in NaClO3?", + "expect": 33.306159359348385 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of KClO3?", + "expect": 122.5453 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 50 g of KClO3?", + "expect": 0.40801238399187895 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 0.25 mol of KClO3?", + "expect": 30.636325 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of oxygen in KClO3?", + "expect": 39.166740788916435 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of Na2SO4.", + "expect": 142.0455386 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 36 g of Na2SO4 to moles.", + "expect": 0.2534398500284894 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 3 mol of Na2SO4 in grams?", + "expect": 426.13661579999996 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of Na2SO4 is sulfur?", + "expect": 22.57726664003793 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of K2SO4.", + "expect": 174.26260000000002 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 36 g of K2SO4 to moles.", + "expect": 0.20658477493162616 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.5 mol of K2SO4 in grams?", + "expect": 87.13130000000001 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of K2SO4 is oxygen?", + "expect": 36.72388682367875 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of (NH4)3PO4.", + "expect": 149.086762 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 36 g of (NH4)3PO4 to moles.", + "expect": 0.2414701313319824 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 2 mol of (NH4)3PO4 in grams?", + "expect": 298.173524 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of (NH4)3PO4 is nitrogen?", + "expect": 28.185601079725647 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of Mg3N2.", + "expect": 100.92899999999999 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 1 g of Mg3N2 to moles.", + "expect": 0.009907955097147501 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 2 mol of Mg3N2 in grams?", + "expect": 201.85799999999998 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of Mg3N2 is nitrogen?", + "expect": 27.75614540914901 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of Li3N?", + "expect": 35.007 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 1 g of Li3N?", + "expect": 0.028565715428342905 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 0.25 mol of Li3N?", + "expect": 8.75175 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of lithium in Li3N?", + "expect": 59.9880023995201 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of CS2?", + "expect": 76.151 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 36 g of CS2?", + "expect": 0.47274494097254144 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 0.25 mol of CS2?", + "expect": 19.03775 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of carbon in CS2?", + "expect": 15.772609683392208 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of PCl5?", + "expect": 208.223762 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 10 g of PCl5?", + "expect": 0.048025258519726485 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 2 mol of PCl5?", + "expect": 416.447524 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of chlorine in PCl5?", + "expect": 85.12477072621522 + }, + { + "split": "dev", + "kind": "molar_mass", + "valid": true, + "q": "What is the molar mass of PCl3?", + "expect": 137.32376200000002 + }, + { + "split": "dev", + "kind": "g2mol", + "valid": true, + "q": "How many moles are in 1 g of PCl3?", + "expect": 0.0072820609152842745 + }, + { + "split": "dev", + "kind": "mol2g", + "valid": true, + "q": "How many grams is 2 mol of PCl3?", + "expect": 274.64752400000003 + }, + { + "split": "dev", + "kind": "percent", + "valid": true, + "q": "What is the percent of chlorine in PCl3?", + "expect": 77.44471783404828 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of SF6.", + "expect": 146.06041896 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 1 g of SF6 to moles.", + "expect": 0.006846481799246785 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 3 mol of SF6 in grams?", + "expect": 438.18125688 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of SF6 is sulfur?", + "expect": 21.95666713018444 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of XeF4.", + "expect": 207.28361264 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 2.5 g of XeF4 to moles.", + "expect": 0.01206077011182682 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 0.25 mol of XeF4 in grams?", + "expect": 51.82090316 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of XeF4 is xenon?", + "expect": 63.338340319269726 + }, + { + "split": "heldout", + "kind": "molar_mass", + "valid": true, + "q": "Give me the molecular weight of UF6.", + "expect": 352.01931895999996 + }, + { + "split": "heldout", + "kind": "g2mol", + "valid": true, + "q": "Convert 1 g of UF6 to moles.", + "expect": 0.002840753180690149 + }, + { + "split": "heldout", + "kind": "mol2g", + "valid": true, + "q": "What mass is 2 mol of UF6 in grams?", + "expect": 704.0386379199999 + }, + { + "split": "heldout", + "kind": "percent", + "valid": true, + "q": "What percentage by mass of UF6 is fluorine?", + "expect": 32.38186452288227 + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the melting point for hydrogen.", + "expect": "13.81" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the density of helium?", + "expect": "0.0001785" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the electronegativity for lithium.", + "expect": "0.98" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the boiling point of beryllium?", + "expect": "2744" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the melting point for boron.", + "expect": "2348" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the electron configuration of carbon?", + "expect": "[He]2s2 2p2" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the atomic mass for nitrogen.", + "expect": "14.007" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the atomic number of oxygen?", + "expect": "8" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the atomic mass for fluorine.", + "expect": "18.99840316" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the symbol of neon?", + "expect": "Ne" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the boiling point for sodium.", + "expect": "1156" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the density of magnesium?", + "expect": "1.74" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the electron configuration for aluminum.", + "expect": "[Ne]3s2 3p1" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the electronegativity of silicon?", + "expect": "1.9" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the electronegativity for phosphorus.", + "expect": "2.19" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the boiling point of sulfur?", + "expect": "717.75" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the boiling point for chlorine.", + "expect": "239.11" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the melting point of argon?", + "expect": "83.8" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the atomic number for potassium.", + "expect": "19" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the density of calcium?", + "expect": "1.54" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the boiling point for scandium.", + "expect": "3109" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the density of titanium?", + "expect": "4.5" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the melting point for vanadium.", + "expect": "2183" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the atomic mass of chromium?", + "expect": "51.996" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the atomic mass for manganese.", + "expect": "54.93804" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the atomic number of iron?", + "expect": "26" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the density for cobalt.", + "expect": "8.86" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the electronegativity of nickel?", + "expect": "1.91" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the electronegativity for copper.", + "expect": "1.9" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the atomic number of zinc?", + "expect": "30" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the density for gallium.", + "expect": "5.91" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the density of germanium?", + "expect": "5.323" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the atomic number for arsenic.", + "expect": "33" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the electronegativity of selenium?", + "expect": "2.55" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the electronegativity for bromine.", + "expect": "2.96" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the melting point of krypton?", + "expect": "115.79" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the electronegativity for rubidium.", + "expect": "0.82" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the atomic number of strontium?", + "expect": "38" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the electron configuration for yttrium.", + "expect": "[Kr]5s2 4d1" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the boiling point of zirconium?", + "expect": "4682" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the atomic number for niobium.", + "expect": "41" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the atomic number of molybdenum?", + "expect": "42" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the atomic number for technetium.", + "expect": "43" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the symbol of ruthenium?", + "expect": "Ru" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the boiling point for rhodium.", + "expect": "3968" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the electron configuration of palladium?", + "expect": "[Kr]4d10" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the electronegativity for silver.", + "expect": "1.93" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the symbol of cadmium?", + "expect": "Cd" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the atomic number for indium.", + "expect": "49" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the melting point of tin?", + "expect": "505.08" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the symbol for antimony.", + "expect": "Sb" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the boiling point of tellurium?", + "expect": "1261" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the symbol for iodine.", + "expect": "I" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the electronegativity of xenon?", + "expect": "2.6" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the atomic mass for cesium.", + "expect": "132.9054520" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the electron configuration of barium?", + "expect": "[Xe]6s2" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the electron configuration for lanthanum.", + "expect": "[Xe]6s2 5d1" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the electronegativity of cerium?", + "expect": "1.12" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the electronegativity for praseodymium.", + "expect": "1.13" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the density of neodymium?", + "expect": "7.01" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the symbol for promethium.", + "expect": "Pm" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the atomic number of samarium?", + "expect": "62" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the density for europium.", + "expect": "5.24" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the melting point of gadolinium?", + "expect": "1586" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the atomic number for terbium.", + "expect": "65" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the atomic number of dysprosium?", + "expect": "66" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the atomic number for holmium.", + "expect": "67" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the atomic number of erbium?", + "expect": "68" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the electronegativity for thulium.", + "expect": "1.25" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the melting point of ytterbium?", + "expect": "1092" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the melting point for lutetium.", + "expect": "1936" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the density of hafnium?", + "expect": "13.3" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the symbol for tantalum.", + "expect": "Ta" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the symbol of tungsten?", + "expect": "W" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the atomic mass for rhenium.", + "expect": "186.207" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the symbol of osmium?", + "expect": "Os" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the electron configuration for iridium.", + "expect": "[Xe]6s2 4f14 5d7" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the melting point of platinum?", + "expect": "2041.55" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the electron configuration for gold.", + "expect": "[Xe]6s1 4f14 5d10" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the atomic mass of mercury?", + "expect": "200.59" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the atomic mass for thallium.", + "expect": "204.383" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the melting point of lead?", + "expect": "600.61" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the atomic mass for bismuth.", + "expect": "208.98040" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the melting point of polonium?", + "expect": "527" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the symbol for astatine.", + "expect": "At" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the electron configuration of radon?", + "expect": "[Xe]6s2 4f14 5d10 6p6" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the melting point for francium.", + "expect": "300" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the atomic number of radium?", + "expect": "88" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the electron configuration for actinium.", + "expect": "[Rn]7s2 6d1" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the atomic number of thorium?", + "expect": "90" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the density for protactinium.", + "expect": "15.37" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the density of uranium?", + "expect": "18.95" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the symbol for neptunium.", + "expect": "Np" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the boiling point of plutonium?", + "expect": "3501" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the symbol for americium.", + "expect": "Am" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the atomic number of curium?", + "expect": "96" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the atomic number for berkelium.", + "expect": "97" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the atomic mass of californium?", + "expect": "251.07959" + }, + { + "split": "heldout", + "kind": "property", + "valid": true, + "q": "Tell me the atomic mass for einsteinium.", + "expect": "252.0830" + }, + { + "split": "dev", + "kind": "property", + "valid": true, + "q": "What is the melting point of fermium?", + "expect": "1800" + }, + { + "split": "dev", + "kind": "unknown", + "valid": false, + "q": "What is the melting point of unobtainium?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown", + "valid": false, + "q": "Tell me the melting point for adamantium.", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown", + "valid": false, + "q": "What is the melting point of vibranium?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown", + "valid": false, + "q": "Tell me the melting point for mithrilium.", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown", + "valid": false, + "q": "What is the melting point of kryptonium?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown", + "valid": false, + "q": "Tell me the melting point for dilithium.", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown", + "valid": false, + "q": "What is the melting point of octarinium?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown", + "valid": false, + "q": "Tell me the melting point for phlogiston.", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown", + "valid": false, + "q": "What is the molar mass of XyO2?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown", + "valid": false, + "q": "Give me the molecular weight of QzCl3.", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown", + "valid": false, + "q": "What is the molar mass of Jb2SO4?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown", + "valid": false, + "q": "Give me the molecular weight of NaXq.", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown", + "valid": false, + "q": "What is the molar mass of Zz3(PO4)2?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown", + "valid": false, + "q": "Give me the molecular weight of MgEe2.", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/chemistry/chemistry_panel_v1.py b/root/specialists/chemistry/chemistry_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..2a96bcbfe0a7ac6eb3acfc2f943a604c9f5cbf9e --- /dev/null +++ b/root/specialists/chemistry/chemistry_panel_v1.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python3 +"""chemistry_panel_v1 - the sealed panel for specialist #38, computed from PubChem's table with a formula parser written +SEPARATELY from the organ's (so a parsing bug cannot sit in both the organ and its answer key). Real compounds; element +properties; grams<->moles; percent composition; must-decline items (invented elements, invalid symbols). Dev / held-out +split by compound or element; different phrasings per split. +usage: chemistry_panel_v1.py """ +import csv +import json +import random +import re +import sys + +COMPOUNDS = """H2O CO2 NaCl H2SO4 HCl HNO3 NH3 CH4 C2H6 C3H8 C2H5OH C6H12O6 C12H22O11 NaOH KOH Ca(OH)2 Mg(OH)2 Al(OH)3 CaCO3 +Na2CO3 NaHCO3 KNO3 NH4NO3 (NH4)2SO4 Fe2O3 Fe3O4 FeCl3 CuSO4 Cu(NO3)2 AgNO3 AgCl BaSO4 BaCl2 KMnO4 K2Cr2O7 H3PO4 Ca3(PO4)2 +Na3PO4 MgSO4 ZnCl2 ZnO Al2O3 SiO2 TiO2 CaO MgO Na2O K2O SO2 SO3 NO2 N2O CO O3 H2O2 CH3COOH HCOOH C6H6 C7H8 C8H18 CCl4 +CHCl3 C2H4 C2H2 CH3OH C3H6O Li2CO3 LiOH KCl KBr KI NaF CaF2 MgCl2 CaCl2 AlCl3 PbO2 Pb(NO3)2 SnCl2 NiSO4 CoCl2 MnO2 Cr2O3 +Na2S2O3 NaClO NaClO3 KClO3 Na2SO4 K2SO4 (NH4)3PO4 Mg3N2 Li3N CS2 PCl5 PCl3 SF6 XeF4 UF6""".split() +FAKE_EL = ["unobtainium", "adamantium", "vibranium", "mithrilium", "kryptonium", "dilithium", "octarinium", "phlogiston"] +FAKE_F = ["XyO2", "QzCl3", "Jb2SO4", "NaXq", "Zz3(PO4)2", "MgEe2"] +PROPS = [("atomic number", "AtomicNumber"), ("atomic mass", "AtomicMass"), ("electronegativity", "Electronegativity"), + ("melting point", "MeltingPoint"), ("boiling point", "BoilingPoint"), ("density", "Density"), + ("electron configuration", "ElectronConfiguration"), ("symbol", "Symbol")] +T = {"dev": {"mm": "What is the molar mass of {f}?", "g2mol": "How many moles are in {q} g of {f}?", "mol2g": "How many grams is {q} mol of {f}?", + "pct": "What is the percent of {e} in {f}?", "prop": "What is the {p} of {e}?"}, + "heldout": {"mm": "Give me the molecular weight of {f}.", "g2mol": "Convert {q} g of {f} to moles.", "mol2g": "What mass is {q} mol of {f} in grams?", + "pct": "What percentage by mass of {f} is {e}?", "prop": "Tell me the {p} for {e}."}} + + +def counts(formula, table): + """independent parser: recursive descent over tokens""" + tokens = re.findall(r"[A-Z][a-z]?|\d+|\(|\)|\.", formula) + pos = 0 + + def group(): + nonlocal pos + c = {} + while pos < len(tokens) and tokens[pos] not in (")", "."): + tk = tokens[pos] + if tk == "(": + pos += 1 + inner = group() + pos += 1 # ')' + k = 1 + if pos < len(tokens) and tokens[pos].isdigit(): + k = int(tokens[pos]); pos += 1 + for e, n in inner.items(): + c[e] = c.get(e, 0) + n * k + else: + if tk not in table: + raise KeyError(tk) + pos += 1 + k = 1 + if pos < len(tokens) and tokens[pos].isdigit(): + k = int(tokens[pos]); pos += 1 + c[tk] = c.get(tk, 0) + k + return c + return group() + + +def main(): + table = {r["Symbol"]: r for r in csv.DictReader(open(sys.argv[1], encoding="utf-8"))} + mass = {s: float(r["AtomicMass"]) for s, r in table.items()} + rng = random.Random(38) + items = [] + for f in COMPOUNDS: + c = counts(f, table) + mm = sum(mass[e] * n for e, n in c.items()) + split = "dev" if sum(map(ord, f)) % 2 == 0 else "heldout" + tt = T[split] + items.append({"split": split, "kind": "molar_mass", "valid": True, "q": tt["mm"].format(f=f), "expect": mm}) + q = rng.choice([1, 2.5, 10, 18, 36, 50, 100]) + items.append({"split": split, "kind": "g2mol", "valid": True, "q": tt["g2mol"].format(q=q, f=f), "expect": q / mm}) + q2 = rng.choice([0.5, 1, 2, 3, 0.25]) + items.append({"split": split, "kind": "mol2g", "valid": True, "q": tt["mol2g"].format(q=q2, f=f), "expect": q2 * mm}) + e = rng.choice(sorted(c)) + items.append({"split": split, "kind": "percent", "valid": True, "q": tt["pct"].format(e=table[e]["Name"].lower(), f=f), + "expect": 100 * mass[e] * c[e] / mm}) + for s, r in table.items(): + if int(r["AtomicNumber"]) > 100: + continue + split = "dev" if int(r["AtomicNumber"]) % 2 == 0 else "heldout" + p, col = rng.choice([x for x in PROPS if r[x[1]] not in ("", None)]) + items.append({"split": split, "kind": "property", "valid": True, "q": T[split]["prop"].format(p=p, e=r["Name"].lower()), "expect": r[col]}) + for i, w in enumerate(FAKE_EL): + split = "dev" if i % 2 == 0 else "heldout" + items.append({"split": split, "kind": "unknown", "valid": False, "q": T[split]["prop"].format(p="melting point", e=w), "expect": "decline"}) + for i, f in enumerate(FAKE_F): + split = "dev" if i % 2 == 0 else "heldout" + items.append({"split": split, "kind": "unknown", "valid": False, "q": T[split]["mm"].format(f=f), "expect": "decline"}) + json.dump(items, open(sys.argv[2], "w"), indent=1) + import collections + print("panel:", dict(collections.Counter((i["split"], i["kind"]) for i in items))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/chemistry/chemistry_scorer.py b/root/specialists/chemistry/chemistry_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..312f34070345e1b046ece22732de7eaad91ec6ab --- /dev/null +++ b/root/specialists/chemistry/chemistry_scorer.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +"""chemistry_scorer - answer identity in the REPLY TEXT. Numeric answers (molar mass, moles, grams, percent): the first +number the reply states for the result must be within 0.5% of the value computed independently from PubChem. Element +properties: PubChem's own value must appear in the reply. A must-decline item answered is a false yes. (ok, asserted).""" +import re + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + if p["kind"] == "property": + return str(p["expect"]) in text, True + pat = {"molar_mass": r"\bis (\d+(?:\.\d+)?) g/mol", "g2mol": r"\bis (\d+(?:\.\d+)?(?:e-?\d+)?) mol\b", + "mol2g": r"\bis (\d+(?:\.\d+)?(?:e[+-]?\d+)?) g\b", "percent": r"\bis (\d+(?:\.\d+)?)% of\b"}[p["kind"]] + m = re.search(pat, text) + if not m: + return False, True + got, want = float(m.group(1)), float(p["expect"]) + return abs(got - want) <= 0.005 * abs(want) + 1e-9, True diff --git a/root/specialists/chemistry/manifest.json b/root/specialists/chemistry/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..b85aa1d0144ce62d591a829566d2819b77c45947 --- /dev/null +++ b/root/specialists/chemistry/manifest.json @@ -0,0 +1,26 @@ +{ + "id": "chemistry", + "name": "Oracle7 Chemistry", + "number": 38, + "tier": "A", + "sources": [ + {"name": "PubChem periodic table (118 elements: masses, electronegativity, melting/boiling points, density, configuration)", "licence": "public domain (NIH/NCBI)", "url": "https://pubchem.ncbi.nlm.nih.gov/periodic-table/"}, + {"name": "OpenStax Chemistry 2e (already in the core's world stores)", "licence": "CC-BY 4.0", "url": "https://openstax.org/details/books/chemistry-2e"} + ], + "store": {"path": "__ORACLE7_ROOT__/specialists/chemistry/pubchem_periodic_table.csv"}, + "organ": {"dir": "__ORACLE7_ROOT__/specialists/chemistry", "module": "organ_chemistry_v1", "class": "ChemistryOrgan", + "init": {"table_path": "__ORACLE7_ROOT__/specialists/chemistry/pubchem_periodic_table.csv"}}, + "accept": { + "kinds": ["molar_mass", "g2mol", "mol2g", "percent", "atomic_mass", "atomic_number", "electronegativity", "melting_point", + "boiling_point", "density", "electron_configuration", "ionization_energy", "standard_state", "group_block", + "year_discovered", "symbol"], + "declines_in_domain": ["unknown", "no_value"], + "context_regex": "\\b(?:molar mass|molecular (?:mass|weight)|formula (?:mass|weight)|moles?|mol|atomic|element|periodic|electronegativity|melting point|boiling point|ionization energy|electron configuration)\\b" + }, + "panel": {"path": "__ORACLE7_ROOT__/specialists/chemistry/chemistry_panel_v1.json", "splits": ["dev", "heldout"], + "exclude_kinds_composed": [], "scorer_module": "chemistry_scorer", "scorer_fn": "ok"}, + "routing_cues": ["molar mass", "moles", "grams of", "element", "atomic", "electronegativity", "melting point", "boiling point", "percent by mass"], + "budgets": {"latency_p50_ms": 50, "store_mb": 1}, + "core_sample": {"n": 400, "seed": 20260928}, + "notes": "Gain is computation, not text (OpenStax is already in the core). Panel answer key computed with a formula parser written separately from the organ's. Held-out phrasings were written by the same author in the same session and were NOT used to tune the organ; one of them reverses the percent-composition word order." +} diff --git a/root/specialists/chemistry/organ_chemistry_v1.py b/root/specialists/chemistry/organ_chemistry_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..bbaca24c2721a6908227c66ee73ffbc725319f35 --- /dev/null +++ b/root/specialists/chemistry/organ_chemistry_v1.py @@ -0,0 +1,152 @@ +#!/usr/bin/env python3 +"""organ_chemistry_v1 - chemistry OPERATIONS over PubChem's periodic table (public domain): element properties, exact +molar mass of any formula (nested brackets, hydrates), grams <-> moles, percent composition. OpenStax chemistry text is +already in the core, so this organ earns its place by computing, and says which element data it used. +Declines: an element or formula that does not exist, a property PubChem does not list. Returns {kind, status, response, value}.""" +from __future__ import annotations + +import csv +import re + +PROPS = [("atomic mass", r"\batomic (?:mass|weight)\b", "AtomicMass", "u"), + ("atomic number", r"\batomic number\b|\bproton number\b|\bhow many protons\b", "AtomicNumber", ""), + ("electronegativity", r"\belectronegativity\b", "Electronegativity", "(Pauling)"), + ("melting point", r"\bmelting point\b|\bmelts? at\b", "MeltingPoint", "K"), + ("boiling point", r"\bboiling point\b|\bboils? at\b", "BoilingPoint", "K"), + ("density", r"\bdensity\b", "Density", "g/cm³"), + ("electron configuration", r"\belectron configuration\b", "ElectronConfiguration", ""), + ("ionization energy", r"\bioni[sz]ation energy\b", "IonizationEnergy", "eV"), + ("standard state", r"\bstandard state\b|\b(?:solid|liquid|gas) at room temperature\b|\bstate at room temperature\b", "StandardState", ""), + ("group block", r"\bgroup block\b|\bwhat (?:kind|type) of element\b|\bis \w+ a (?:metal|nonmetal|metalloid|noble gas)\b", "GroupBlock", ""), + ("year discovered", r"\bdiscovered\b|\byear (?:of )?discovery\b", "YearDiscovered", ""), + ("symbol", r"\b(?:chemical )?symbol\b", "Symbol", "")] +FORMULA = re.compile(r"\b((?:[A-Z][a-z]?\d*|\((?:[A-Z][a-z]?\d*)+\)\d*)+(?:[·.*]\d*(?:[A-Z][a-z]?\d*)+)?)\b") +MOLAR = re.compile(r"\bmolar mass\b|\bmolecular (?:mass|weight)\b|\bformula (?:mass|weight)\b|\bmass of one mole\b", re.I) +G2MOL = re.compile(r"\b(\d+(?:\.\d+)?)\s*(?:g|grams?)\s+of\s+(\S+)", re.I) +MOL2G = re.compile(r"\b(\d+(?:\.\d+)?)\s*(?:mol|moles?)\s+of\s+(\S+)", re.I) +PCT = re.compile(r"\b(?:percent|percentage|%)\s+(?:by mass\s+)?(?:of\s+)?(\w+)\s+in\s+(\S+)", re.I) + + +class ChemistryOrgan: + def __init__(self, table_path): + self.el = {} + for r in csv.DictReader(open(table_path, encoding="utf-8")): + self.el[r["Symbol"]] = r + self.by_name = {r["Name"].lower(): s for s, r in self.el.items()} + + # ---- exact molar mass, with brackets and hydrates ---------------------------------------------------------------- + def parse(self, f): + f = f.replace("·", ".").replace("*", ".") + total = {} + for part in f.split("."): + m = re.match(r"^(\d*)(.*)$", part) + mult = int(m.group(1)) if m.group(1) else 1 + for s, n in self._counts(m.group(2)).items(): + total[s] = total.get(s, 0) + n * mult + return total + + def _counts(self, s): + stack, i = [{}], 0 + while i < len(s): + c = s[i] + if c == "(": + stack.append({}); i += 1 + elif c == ")": + i += 1; m = re.match(r"\d+", s[i:]); k = int(m.group()) if m else 1; i += len(m.group()) if m else 0 + top = stack.pop() + for e, n in top.items(): + stack[-1][e] = stack[-1].get(e, 0) + n * k + else: + m = re.match(r"([A-Z][a-z]?)(\d*)", s[i:]) + if not m: + raise ValueError("bad formula near %r" % s[i:]) + if m.group(1) not in self.el: + raise KeyError(m.group(1)) + stack[-1][m.group(1)] = stack[-1].get(m.group(1), 0) + (int(m.group(2)) if m.group(2) else 1) + i += len(m.group()) + if len(stack) != 1: + raise ValueError("unbalanced brackets") + return stack[0] + + def molar_mass(self, f): + c = self.parse(f) + return sum(float(self.el[s]["AtomicMass"]) * n for s, n in c.items()), c + + def _formula_in(self, t): + for m in FORMULA.finditer(t): + f = m.group(1) + if re.search(r"[a-z]\d|\d|\(|[A-Z][a-z]?[A-Z]", f) or f in self.el: # looks like a formula, not a word + return f + return None + + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def answer(self, text, session_id="default"): + t = " ".join(str(text or "").split()) + if not t: + return None + # grams -> moles / moles -> grams + for rx, kind in ((G2MOL, "g2mol"), (MOL2G, "mol2g")): + m = rx.search(t) + if m and re.search(r"\bmol(?:e|es)?\b|\bgrams?\b|\bhow many\b|\bmass\b", t, re.I): + f = m.group(2).rstrip("?.,") + try: + mm, _ = self.molar_mass(f) + except KeyError as e: + return self._say("unknown", "%s isn't an element symbol, so %s isn't a formula I can weigh." % (e.args[0], f), status="withheld") + except ValueError: + continue + q = float(m.group(1)) + if kind == "g2mol": + v = q / mm + return self._say("g2mol", "%g g of %s is %.4g mol (molar mass %.3f g/mol, from PubChem atomic masses)." % (q, f, v, mm), v) + v = q * mm + return self._say("mol2g", "%g mol of %s is %.4g g (molar mass %.3f g/mol, from PubChem atomic masses)." % (q, f, v, mm), v) + m = PCT.search(t) + if m: + elw, f = m.group(1), m.group(2).rstrip("?.,") + sym = self.by_name.get(elw.lower(), elw if elw in self.el else None) + try: + mm, c = self.molar_mass(f) + except (KeyError, ValueError): + sym = None + if sym and sym in c: + v = 100.0 * float(self.el[sym]["AtomicMass"]) * c[sym] / mm + return self._say("percent", "%s is %.2f%% of %s by mass (%d × %s in %.3f g/mol)." % (self.el[sym]["Name"], v, f, c[sym], self.el[sym]["AtomicMass"], mm), v) + if MOLAR.search(t): + f = self._formula_in(t) + if f: + try: + mm, c = self.molar_mass(f) + except KeyError as e: + return self._say("unknown", "%s isn't an element symbol, so %s isn't a formula I can weigh." % (e.args[0], f), status="withheld") + except ValueError: + return None + parts = " + ".join("%d × %s" % (n, s) for s, n in c.items()) + return self._say("molar_mass", "The molar mass of %s is %.3f g/mol (%s, PubChem atomic masses)." % (f, mm, parts), mm) + # element property + prop = next((p for p in PROPS if re.search(p[1], t, re.I)), None) + if prop: + sym = None + for name, s in self.by_name.items(): + if re.search(r"\b%s\b" % re.escape(name), t, re.I): + sym = s + break + if not sym: + m = re.search(r"\b(?:of|for|is)\s+([A-Z][a-z]?)\b", t) + sym = m.group(1) if m and m.group(1) in self.el else None + if not sym: + w = re.search(r"\b(?:of|for)\s+([a-z]+ium|[a-z]+on|[a-z]+gen)\b", t, re.I) + if w: + return self._say("unknown", "There's no element called %s in PubChem's periodic table." % w.group(1), status="withheld") + return None + r = self.el[sym] + val = r[prop[2]] + if val in ("", None): + return self._say("no_value", "PubChem lists no %s for %s, so I won't estimate one." % (prop[0], r["Name"]), status="withheld") + unit = (" " + prop[3]) if prop[3] and prop[3] != "(Pauling)" else (" (Pauling scale)" if prop[3] else "") + if prop[3] == "K": + unit = " K (%.2f °C)" % (float(val) - 273.15) + return self._say(prop[0].replace(" ", "_"), "The %s of %s (%s) is %s%s, per PubChem." % (prop[0], r["Name"], sym, val, unit), val) + return None diff --git a/root/specialists/chemistry/pubchem_periodic_table.csv b/root/specialists/chemistry/pubchem_periodic_table.csv new file mode 100644 index 0000000000000000000000000000000000000000..4185845f8ebd7bb9747d3aef3c6421b9014ca74f --- /dev/null +++ b/root/specialists/chemistry/pubchem_periodic_table.csv @@ -0,0 +1,119 @@ +"AtomicNumber","Symbol","Name","AtomicMass","CPKHexColor","ElectronConfiguration","Electronegativity","AtomicRadius","IonizationEnergy","ElectronAffinity","OxidationStates","StandardState","MeltingPoint","BoilingPoint","Density","GroupBlock","YearDiscovered" +1,"H","Hydrogen",1.0080,"FFFFFF","1s1",2.2,120,13.598,0.754,"+1, -1","Gas",13.81,20.28,0.00008988,"Nonmetal",1766 +2,"He","Helium",4.00260,"D9FFFF","1s2","",140,24.587,"","0","Gas",0.95,4.22,0.0001785,"Noble gas",1868 +3,"Li","Lithium",7.0,"CC80FF","[He]2s1",0.98,182,5.392,0.618,"+1","Solid",453.65,1615,0.534,"Alkali metal",1817 +4,"Be","Beryllium",9.012183,"C2FF00","[He]2s2",1.57,153,9.323,"","+2","Solid",1560,2744,1.85,"Alkaline earth metal",1798 +5,"B","Boron",10.81,"FFB5B5","[He]2s2 2p1",2.04,192,8.298,0.277,"+3","Solid",2348,4273,2.37,"Metalloid",1808 +6,"C","Carbon",12.011,"909090","[He]2s2 2p2",2.55,170,11.260,1.263,"+4, +2, -4","Solid",3823,4098,2.2670,"Nonmetal","Ancient" +7,"N","Nitrogen",14.007,"3050F8","[He] 2s2 2p3",3.04,155,14.534,"","+5, +4, +3, +2, +1, -1, -2, -3","Gas",63.15,77.36,0.0012506,"Nonmetal",1772 +8,"O","Oxygen",15.999,"FF0D0D","[He]2s2 2p4",3.44,152,13.618,1.461,"-2","Gas",54.36,90.2,0.001429,"Nonmetal",1774 +9,"F","Fluorine",18.99840316,"90E050","[He]2s2 2p5",3.98,135,17.423,3.339,"-1","Gas",53.53,85.03,0.001696,"Halogen",1670 +10,"Ne","Neon",20.180,"B3E3F5","[He]2s2 2p6","",154,21.565,"","0","Gas",24.56,27.07,0.0008999,"Noble gas",1898 +11,"Na","Sodium",22.9897693,"AB5CF2","[Ne]3s1",0.93,227,5.139,0.548,"+1","Solid",370.95,1156,0.97,"Alkali metal",1807 +12,"Mg","Magnesium",24.305,"8AFF00","[Ne]3s2",1.31,173,7.646,"","+2","Solid",923,1363,1.74,"Alkaline earth metal",1808 +13,"Al","Aluminum",26.981538,"BFA6A6","[Ne]3s2 3p1",1.61,184,5.986,0.441,"+3","Solid",933.437,2792,2.70,"Post-transition metal","Ancient" +14,"Si","Silicon",28.085,"F0C8A0","[Ne]3s2 3p2",1.9,210,8.152,1.385,"+4, +2, -4","Solid",1687,3538,2.3296,"Metalloid",1854 +15,"P","Phosphorus",30.97376200,"FF8000","[Ne]3s2 3p3",2.19,180,10.487,0.746,"+5, +3, -3","Solid",317.3,553.65,1.82,"Nonmetal",1669 +16,"S","Sulfur",32.07,"FFFF30","[Ne]3s2 3p4",2.58,180,10.360,2.077,"+6, +4, -2","Solid",388.36,717.75,2.067,"Nonmetal","Ancient" +17,"Cl","Chlorine",35.45,"1FF01F","[Ne]3s2 3p5",3.16,175,12.968,3.617,"+7, +5, +1, -1","Gas",171.65,239.11,0.003214,"Halogen",1774 +18,"Ar","Argon",39.9,"80D1E3","[Ne]3s2 3p6","",188,15.760,"","0","Gas",83.8,87.3,0.0017837,"Noble gas",1894 +19,"K","Potassium",39.0983,"8F40D4","[Ar]4s1",0.82,275,4.341,0.501,"+1","Solid",336.53,1032,0.89,"Alkali metal",1807 +20,"Ca","Calcium",40.08,"3DFF00","[Ar]4s2",1,231,6.113,"","+2","Solid",1115,1757,1.54,"Alkaline earth metal","Ancient" +21,"Sc","Scandium",44.95591,"E6E6E6","[Ar]4s2 3d1",1.36,211,6.561,0.188,"+3","Solid",1814,3109,2.99,"Transition metal",1879 +22,"Ti","Titanium",47.867,"BFC2C7","[Ar]4s2 3d2",1.54,187,6.828,0.079,"+4, +3, +2","Solid",1941,3560,4.5,"Transition metal",1791 +23,"V","Vanadium",50.9415,"A6A6AB","[Ar]4s2 3d3",1.63,179,6.746,0.525,"+5, +4, +3, +2","Solid",2183,3680,6.0,"Transition metal",1801 +24,"Cr","Chromium",51.996,"8A99C7","[Ar]3d5 4s1",1.66,189,6.767,0.666,"+6, +3, +2","Solid",2180,2944,7.15,"Transition metal",1797 +25,"Mn","Manganese",54.93804,"9C7AC7","[Ar]4s2 3d5",1.55,197,7.434,"","+7, +4, +3, +2","Solid",1519,2334,7.3,"Transition metal",1774 +26,"Fe","Iron",55.84,"E06633","[Ar]4s2 3d6",1.83,194,7.902,0.163,"+3, +2","Solid",1811,3134,7.874,"Transition metal","Ancient" +27,"Co","Cobalt",58.93319,"F090A0","[Ar]4s2 3d7",1.88,192,7.881,0.661,"+3, +2","Solid",1768,3200,8.86,"Transition metal",1735 +28,"Ni","Nickel",58.693,"50D050","[Ar]4s2 3d8",1.91,163,7.640,1.156,"+3, +2","Solid",1728,3186,8.912,"Transition metal",1751 +29,"Cu","Copper",63.55,"C88033","[Ar]4s1 3d10",1.9,140,7.726,1.228,"+2, +1","Solid",1357.77,2835,8.933,"Transition metal","Ancient" +30,"Zn","Zinc",65.4,"7D80B0","[Ar]4s2 3d10",1.65,139,9.394,"","+2","Solid",692.68,1180,7.134,"Transition metal",1746 +31,"Ga","Gallium",69.723,"C28F8F","[Ar]4s2 3d10 4p1",1.81,187,5.999,0.3,"+3","Solid",302.91,2477,5.91,"Post-transition metal",1875 +32,"Ge","Germanium",72.63,"668F8F","[Ar]4s2 3d10 4p2",2.01,211,7.900,1.35,"+4, +2","Solid",1211.4,3106,5.323,"Metalloid",1886 +33,"As","Arsenic",74.92159,"BD80E3","[Ar]4s2 3d10 4p3",2.18,185,9.815,0.81,"+5, +3, -3","Solid",1090,887,5.776,"Metalloid","Ancient" +34,"Se","Selenium",78.97,"FFA100","[Ar]4s2 3d10 4p4",2.55,190,9.752,2.021,"+6, +4, -2","Solid",493.65,958,4.809,"Nonmetal",1817 +35,"Br","Bromine",79.90,"A62929","[Ar]4s2 3d10 4p5",2.96,183,11.814,3.365,"+5, +1, -1","Liquid",265.95,331.95,3.11,"Halogen",1826 +36,"Kr","Krypton",83.80,"5CB8D1","[Ar]4s2 3d10 4p6",3,202,14.000,"","0","Gas",115.79,119.93,0.003733,"Noble gas",1898 +37,"Rb","Rubidium",85.468,"702EB0","[Kr]5s1",0.82,303,4.177,0.468,"+1","Solid",312.46,961,1.53,"Alkali metal",1861 +38,"Sr","Strontium",87.62,"00FF00","[Kr]5s2",0.95,249,5.695,"","+2","Solid",1050,1655,2.64,"Alkaline earth metal",1790 +39,"Y","Yttrium",88.90584,"94FFFF","[Kr]5s2 4d1",1.22,219,6.217,0.307,"+3","Solid",1795,3618,4.47,"Transition metal",1794 +40,"Zr","Zirconium",91.22,"94E0E0","[Kr]5s2 4d2",1.33,186,6.634,0.426,"+4","Solid",2128,4682,6.52,"Transition metal",1789 +41,"Nb","Niobium",92.90637,"73C2C9","[Kr]5s1 4d4",1.6,207,6.759,0.893,"+5, +3","Solid",2750,5017,8.57,"Transition metal",1801 +42,"Mo","Molybdenum",95.95,"54B5B5","[Kr]5s1 4d5",2.16,209,7.092,0.746,"+6","Solid",2896,4912,10.2,"Transition metal",1778 +43,"Tc","Technetium",96.90636,"3B9E9E","[Kr]5s2 4d5",1.9,209,7.28,0.55,"+7, +6, +4","Solid",2430,4538,11,"Transition metal",1937 +44,"Ru","Ruthenium",101.1,"248F8F","[Kr]5s1 4d7",2.2,207,7.361,1.05,"+3","Solid",2607,4423,12.1,"Transition metal",1827 +45,"Rh","Rhodium",102.9055,"0A7D8C","[Kr]5s1 4d8",2.28,195,7.459,1.137,"+3","Solid",2237,3968,12.4,"Transition metal",1803 +46,"Pd","Palladium",106.42,"6985","[Kr]4d10",2.2,202,8.337,0.557,"+3, +2","Solid",1828.05,3236,12.0,"Transition metal",1803 +47,"Ag","Silver",107.868,"C0C0C0","[Kr]5s1 4d10",1.93,172,7.576,1.302,"+1","Solid",1234.93,2435,10.501,"Transition metal","Ancient" +48,"Cd","Cadmium",112.41,"FFD98F","[Kr]5s2 4d10",1.69,158,8.994,"","+2","Solid",594.22,1040,8.69,"Transition metal",1817 +49,"In","Indium",114.818,"A67573","[Kr]5s2 4d10 5p1",1.78,193,5.786,0.3,"+3","Solid",429.75,2345,7.31,"Post-transition metal",1863 +50,"Sn","Tin",118.71,"668080","[Kr]5s2 4d10 5p2",1.96,217,7.344,1.2,"+4, +2","Solid",505.08,2875,7.287,"Post-transition metal","Ancient" +51,"Sb","Antimony",121.760,"9E63B5","[Kr]5s2 4d10 5p3",2.05,206,8.64,1.07,"+5, +3, -3","Solid",903.78,1860,6.685,"Metalloid","Ancient" +52,"Te","Tellurium",127.6,"D47A00","[Kr]5s2 4d10 5p4",2.1,206,9.010,1.971,"+6, +4, -2","Solid",722.66,1261,6.232,"Metalloid",1782 +53,"I","Iodine",126.9045,"940094","[Kr]5s2 4d10 5p5",2.66,198,10.451,3.059,"+7, +5, +1, -1","Solid",386.85,457.55,4.93,"Halogen",1811 +54,"Xe","Xenon",131.29,"429EB0","[Kr]5s2 4d10 5p6",2.6,216,12.130,"","0","Gas",161.36,165.03,0.005887,"Noble gas",1898 +55,"Cs","Cesium",132.9054520,"57178F","[Xe]6s1",0.79,343,3.894,0.472,"+1","Solid",301.59,944,1.93,"Alkali metal",1860 +56,"Ba","Barium",137.33,"00C900","[Xe]6s2",0.89,268,5.212,"","+2","Solid",1000,2170,3.62,"Alkaline earth metal",1808 +57,"La","Lanthanum",138.9055,"70D4FF","[Xe]6s2 5d1",1.1,240,5.577,0.5,"+3","Solid",1191,3737,6.15,"Lanthanide",1839 +58,"Ce","Cerium",140.116,"FFFFC7","[Xe]6s2 4f1 5d1",1.12,235,5.539,0.5,"+4, +3","Solid",1071,3697,6.770,"Lanthanide",1803 +59,"Pr","Praseodymium",140.90766,"D9FFC7","[Xe]6s2 4f3",1.13,239,5.464,"","+3","Solid",1204,3793,6.77,"Lanthanide",1885 +60,"Nd","Neodymium",144.24,"C7FFC7","[Xe]6s2 4f4",1.14,229,5.525,"","+3","Solid",1294,3347,7.01,"Lanthanide",1885 +61,"Pm","Promethium",144.91276,"A3FFC7","[Xe]6s2 4f5","",236,5.55,"","+3","Solid",1315,3273,7.26,"Lanthanide",1945 +62,"Sm","Samarium",150.4,"8FFFC7","[Xe]6s2 4f6",1.17,229,5.644,"","+3, +2","Solid",1347,2067,7.52,"Lanthanide",1879 +63,"Eu","Europium",151.964,"61FFC7","[Xe]6s2 4f7","",233,5.670,"","+3, +2","Solid",1095,1802,5.24,"Lanthanide",1901 +64,"Gd","Gadolinium",157.25,"45FFC7","[Xe]6s2 4f7 5d1",1.2,237,6.150,"","+3","Solid",1586,3546,7.90,"Lanthanide",1880 +65,"Tb","Terbium",158.92535,"30FFC7","[Xe]6s2 4f9","",221,5.864,"","+3","Solid",1629,3503,8.23,"Lanthanide",1843 +66,"Dy","Dysprosium",162.500,"1FFFC7","[Xe]6s2 4f10",1.22,229,5.939,"","+3","Solid",1685,2840,8.55,"Lanthanide",1886 +67,"Ho","Holmium",164.93033,"00FF9C","[Xe]6s2 4f11",1.23,216,6.022,"","+3","Solid",1747,2973,8.80,"Lanthanide",1878 +68,"Er","Erbium",167.26,"","[Xe]6s2 4f12",1.24,235,6.108,"","+3","Solid",1802,3141,9.07,"Lanthanide",1843 +69,"Tm","Thulium",168.93422,"00D452","[Xe]6s2 4f13",1.25,227,6.184,"","+3","Solid",1818,2223,9.32,"Lanthanide",1879 +70,"Yb","Ytterbium",173.05,"00BF38","[Xe]6s2 4f14","",242,6.254,"","+3, +2","Solid",1092,1469,6.90,"Lanthanide",1878 +71,"Lu","Lutetium",174.9667,"00AB24","[Xe]6s2 4f14 5d1",1.27,221,5.426,"","+3","Solid",1936,3675,9.84,"Lanthanide",1907 +72,"Hf","Hafnium",178.49,"4DC2FF","[Xe]6s2 4f14 5d2",1.3,212,6.825,"","+4","Solid",2506,4876,13.3,"Transition metal",1923 +73,"Ta","Tantalum",180.9479,"4DA6FF","[Xe]6s2 4f14 5d3",1.5,217,7.89,0.322,"+5","Solid",3290,5731,16.4,"Transition metal",1802 +74,"W","Tungsten",183.84,"2194D6","[Xe]6s2 4f14 5d4",2.36,210,7.98,0.815,"+6","Solid",3695,5828,19.3,"Transition metal",1783 +75,"Re","Rhenium",186.207,"267DAB","[Xe]6s2 4f14 5d5",1.9,217,7.88,0.15,"+7, +6, +4","Solid",3459,5869,20.8,"Transition metal",1925 +76,"Os","Osmium",190.2,"266696","[Xe]6s2 4f14 5d6",2.2,216,8.7,1.1,"+4, +3","Solid",3306,5285,22.57,"Transition metal",1803 +77,"Ir","Iridium",192.22,"175487","[Xe]6s2 4f14 5d7",2.2,202,9.1,1.565,"+4, +3","Solid",2719,4701,22.42,"Transition metal",1803 +78,"Pt","Platinum",195.08,"D0D0E0","[Xe]6s1 4f14 5d9",2.28,209,9,2.128,"+4, +2","Solid",2041.55,4098,21.46,"Transition metal",1735 +79,"Au","Gold",196.96657,"FFD123","[Xe]6s1 4f14 5d10",2.54,166,9.226,2.309,"+3, +1","Solid",1337.33,3129,19.282,"Transition metal","Ancient" +80,"Hg","Mercury",200.59,"B8B8D0","[Xe]6s2 4f14 5d10",2,209,10.438,"","+2, +1","Liquid",234.32,629.88,13.5336,"Transition metal","Ancient" +81,"Tl","Thallium",204.383,"A6544D","[Xe]6s2 4f14 5d10 6p1",1.62,196,6.108,0.2,"+3, +1","Solid",577,1746,11.8,"Post-transition metal",1861 +82,"Pb","Lead",207,"575961","[Xe]6s2 4f14 5d10 6p2",2.33,202,7.417,0.36,"+4, +2","Solid",600.61,2022,11.342,"Post-transition metal","Ancient" +83,"Bi","Bismuth",208.98040,"9E4FB5","[Xe]6s2 4f14 5d10 6p3",2.02,207,7.289,0.946,"+5, +3","Solid",544.55,1837,9.807,"Post-transition metal",1753 +84,"Po","Polonium",208.98243,"AB5C00","[Xe]6s2 4f14 5d10 6p4",2,197,8.417,1.9,"+4, +2","Solid",527,1235,9.32,"Metalloid",1898 +85,"At","Astatine",209.98715,"754F45","[Xe]6s2 4f14 5d10 6p5",2.2,202,9.5,2.8,"7, 5, 3, 1, -1","Solid",575,"",7,"Halogen",1940 +86,"Rn","Radon",222.01758,"428296","[Xe]6s2 4f14 5d10 6p6","",220,10.745,"","0","Gas",202,211.45,0.00973,"Noble gas",1900 +87,"Fr","Francium",223.01973,"420066","[Rn]7s1",0.7,348,3.9,0.47,"+1","Solid",300,"","","Alkali metal",1939 +88,"Ra","Radium",226.02541,"007D00","[Rn]7s2",0.9,283,5.279,"","+2","Solid",973,1413,5,"Alkaline earth metal",1898 +89,"Ac","Actinium",227.02775,"70ABFA","[Rn]7s2 6d1",1.1,260,5.17,"","+3","Solid",1324,3471,10.07,"Actinide",1899 +90,"Th","Thorium",232.038,"00BAFF","[Rn]7s2 6d2",1.3,237,6.08,"","+4","Solid",2023,5061,11.72,"Actinide",1828 +91,"Pa","Protactinium",231.03588,"00A1FF","[Rn]7s2 5f2 6d1",1.5,243,5.89,"","+5, +4","Solid",1845,"",15.37,"Actinide",1913 +92,"U","Uranium",238.0289,"008FFF","[Rn]7s2 5f3 6d1",1.38,240,6.194,"","+6, +5, +4, +3","Solid",1408,4404,18.95,"Actinide",1789 +93,"Np","Neptunium",237.048172,"0080FF","[Rn]7s2 5f4 6d1",1.36,221,6.266,"","+6, +5, +4, +3","Solid",917,4175,20.25,"Actinide",1940 +94,"Pu","Plutonium",244.06420,"006BFF","[Rn]7s2 5f6",1.28,243,6.06,"","+6, +5, +4, +3","Solid",913,3501,19.84,"Actinide",1940 +95,"Am","Americium",243.061380,"545CF2","[Rn]7s2 5f7",1.3,244,5.993,"","+6, +5, +4, +3","Solid",1449,2284,13.69,"Actinide",1944 +96,"Cm","Curium",247.07035,"785CE3","[Rn]7s2 5f7 6d1",1.3,245,6.02,"","+3","Solid",1618,3400,13.51,"Actinide",1944 +97,"Bk","Berkelium",247.07031,"8A4FE3","[Rn]7s2 5f9",1.3,244,6.23,"","+4, +3","Solid",1323,"",14,"Actinide",1949 +98,"Cf","Californium",251.07959,"A136D4","[Rn]7s2 5f10",1.3,245,6.30,"","+3","Solid",1173,"","","Actinide",1950 +99,"Es","Einsteinium",252.0830,"B31FD4","[Rn]7s2 5f11",1.3,245,6.42,"","+3","Solid",1133,"","","Actinide",1952 +100,"Fm","Fermium",257.09511,"B31FBA","[Rn] 5f12 7s2",1.3,"",6.50,"","+3","Solid",1800,"","","Actinide",1952 +101,"Md","Mendelevium",258.09843,"B30DA6","[Rn]7s2 5f13",1.3,"",6.58,"","+3, +2","Solid",1100,"","","Actinide",1955 +102,"No","Nobelium",259.10100,"BD0D87","[Rn]7s2 5f14",1.3,"",6.65,"","+3, +2","Solid",1100,"","","Actinide",1957 +103,"Lr","Lawrencium",266.120,"C70066","[Rn]7s2 5f14 6d1",1.3,"","","","+3","Solid",1900,"","","Actinide",1961 +104,"Rf","Rutherfordium",267.122,"CC0059","[Rn]7s2 5f14 6d2","","","","","+4","Solid","","","","Transition metal",1964 +105,"Db","Dubnium",268.126,"D1004F","[Rn]7s2 5f14 6d3","","","","","5, 4, 3","Solid","","","","Transition metal",1967 +106,"Sg","Seaborgium",269.128,"D90045","[Rn]7s2 5f14 6d4","","","","","6, 5, 4, 3, 0","Solid","","","","Transition metal",1974 +107,"Bh","Bohrium",270.133,"E00038","[Rn]7s2 5f14 6d5","","","","","7, 5, 4, 3","Solid","","","","Transition metal",1976 +108,"Hs","Hassium",269.1336,"E6002E","[Rn]7s2 5f14 6d6","","","","","8, 6, 5, 4, 3, 2","Solid","","","","Transition metal",1984 +109,"Mt","Meitnerium",277.154,"EB0026","[Rn]7s2 5f14 6d7 (calculated)","","","","","9, 8, 6, 4, 3, 1","Solid","","","","Transition metal",1982 +110,"Ds","Darmstadtium",282.166,"","[Rn]7s2 5f14 6d8 (predicted)","","","","","8, 6, 4, 2, 0","Expected to be a Solid","","","","Transition metal",1994 +111,"Rg","Roentgenium",282.169,"","[Rn]7s2 5f14 6d9 (predicted)","","","","","5, 3, 1, -1","Expected to be a Solid","","","","Transition metal",1994 +112,"Cn","Copernicium",286.179,"","[Rn]7s2 5f14 6d10 (predicted)","","","","","2, 1, 0","Expected to be a Solid","","","","Transition metal",1996 +113,"Nh","Nihonium",286.182,"","[Rn]5f14 6d10 7s2 7p1 (predicted)","","","","","","Expected to be a Solid","","","","Post-transition metal",2004 +114,"Fl","Flerovium",290.192,"","[Rn]7s2 7p2 5f14 6d10 (predicted)","","","","","6, 4,2, 1, 0","Expected to be a Solid","","","","Post-transition metal",1998 +115,"Mc","Moscovium",290.196,"","[Rn]7s2 7p3 5f14 6d10 (predicted)","","","","","3, 1","Expected to be a Solid","","","","Post-transition metal",2003 +116,"Lv","Livermorium",293.205,"","[Rn]7s2 7p4 5f14 6d10 (predicted)","","","","","+4, +2, -2","Expected to be a Solid","","","","Post-transition metal",2000 +117,"Ts","Tennessine",294.211,"","[Rn]7s2 7p5 5f14 6d10 (predicted)","","","","","+5, +3, +1, -1","Expected to be a Solid","","","","Halogen",2010 +118,"Og","Oganesson",295.216,"","[Rn]7s2 7p6 5f14 6d10 (predicted)","","","","","+6, +4, +2, +1, 0, -1","Expected to be a Gas","","","","Noble gas",2006 diff --git a/root/specialists/chemistry/verdict_dev.json b/root/specialists/chemistry/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..3eddcbac810ad3c73bd5d1bef8e3dc247cb81a58 --- /dev/null +++ b/root/specialists/chemistry/verdict_dev.json @@ -0,0 +1,110 @@ +{ + "id": "chemistry", + "name": "Oracle7 Chemistry", + "tier": "A", + "split": "dev", + "head": "oracle_release_runtime_w363", + "time": "2026-09-29T00:54:15Z", + "domain": { + "head": { + "correct": 19, + "false_yes": 4, + "n": 225, + "p50_ms": 410.5, + "fails": [ + [ + "molar_mass", + "What is the molar mass of CO2?", + "corpus_query:property_of", + "[ev:unknown] EXAMPLE 9.22 Determining Molar Mass Using Graham\u2019s Law An unknown gas effuses" + ], + [ + "g2mol", + "How many moles are in 100 g of CO2?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mol2g", + "How many grams is 0.5 mol of CO2?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "percent", + "What is the percent of carbon in CO2?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "molar_mass", + "What is the molar mass of NaCl?", + "corpus_query:property_of", + "[ev:unknown] Calculate the empirical or molecular formula mass and the molar mass of each " + ], + [ + "g2mol", + "How many moles are in 10 g of NaCl?", + "factoid:fts", + "[ev:direct] Thus, it requires 769 kJ to separate one mole of solid NaCl into gaseous Na+ a" + ], + [ + "mol2g", + "How many grams is 3 mol of NaCl?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "percent", + "What is the percent of sodium in NaCl?", + "corpus_query:property_of", + "[ev:unknown] Examples of hypertonic solutions include 3 percent sodium chloride (3 percent" + ] + ] + }, + "spec": { + "correct": 225, + "false_yes": 0, + "n": 225, + "p50_ms": 0.03, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.02, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/chemistry/verdict_heldout.json b/root/specialists/chemistry/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..3825af6184f808330e23dda752f496f2300a152f --- /dev/null +++ b/root/specialists/chemistry/verdict_heldout.json @@ -0,0 +1,159 @@ +{ + "id": "chemistry", + "name": "Oracle7 Chemistry", + "tier": "A", + "split": "heldout", + "head": "oracle_release_runtime_w363", + "time": "2026-09-29T01:00:03Z", + "domain": { + "head": { + "correct": 9, + "false_yes": 4, + "n": 281, + "p50_ms": 424.35, + "fails": [ + [ + "molar_mass", + "Give me the molecular weight of H2O.", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "g2mol", + "Convert 50 g of H2O to moles.", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mol2g", + "What mass is 3 mol of H2O in grams?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "percent", + "What percentage by mass of H2O is oxygen?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "molar_mass", + "Give me the molecular weight of HCl.", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "g2mol", + "Convert 2.5 g of HCl to moles.", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mol2g", + "What mass is 0.25 mol of HCl in grams?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "percent", + "What percentage by mass of HCl is hydrogen?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 223, + "false_yes": 0, + "n": 281, + "p50_ms": 0.06, + "fails": [ + [ + "percent", + "What percentage by mass of H2O is oxygen?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "percent", + "What percentage by mass of HCl is hydrogen?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "percent", + "What percentage by mass of NH3 is nitrogen?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "percent", + "What percentage by mass of CH4 is hydrogen?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "percent", + "What percentage by mass of C2H6 is carbon?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "percent", + "What percentage by mass of C2H5OH is carbon?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "percent", + "What percentage by mass of C6H12O6 is hydrogen?", + "organ:math>word:percent_of_total", + "[ev:derived] 50%. Read as percent of total: percent = part / whole x 100 = 6 / 12 x 100. C" + ], + [ + "percent", + "What percentage by mass of C12H22O11 is oxygen?", + "organ:math>word:percent_of_total", + "[ev:derived] 50%. Read as percent of total: percent = part / whole x 100 = 11 / 22 x 100. " + ] + ] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.02, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/coldchain-v2/coldchain_panel_v1.json b/root/specialists/coldchain-v2/coldchain_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..7ded230fb1f36797e30384580582defe6da4ba44 --- /dev/null +++ b/root/specialists/coldchain-v2/coldchain_panel_v1.json @@ -0,0 +1,422 @@ +[ + { + "split": "dev", + "kind": "cool1", + "valid": true, + "q": "I cooled soup from 135 F to 70 F in 1.5 hours. Does that meet the Food Code?", + "expect": "Yes" + }, + { + "split": "dev", + "kind": "cool2", + "valid": true, + "q": "Chili was cooled from 70 F to 41 F in 6 hours. Is that compliant?", + "expect": "No" + }, + { + "split": "dev", + "kind": "cold", + "valid": true, + "q": "Is 43 F okay for cold holding in the walk-in cooler?", + "expect": "No" + }, + { + "split": "dev", + "kind": "hot", + "valid": true, + "q": "Our steam table is holding food at 130 F. Does that meet hot holding?", + "expect": "No" + }, + { + "split": "dev", + "kind": "cook", + "valid": true, + "q": "What is the minimum cooking temperature for ground beef?", + "expect": 155 + }, + { + "split": "dev", + "kind": "reheat", + "valid": true, + "q": "What temperature must leftovers reach when reheating for hot holding?", + "expect": 165 + }, + { + "split": "dev", + "kind": "tphc", + "valid": true, + "q": "Food has been out of temperature control for 6 hours under time as a public health control. Is it within the limit?", + "expect": "Past" + }, + { + "split": "dev", + "kind": "date", + "valid": true, + "q": "Potato salad was made on Thursday. When must it be discarded under date marking?", + "expect": "Wednesday" + }, + { + "split": "dev", + "kind": "cool1", + "valid": true, + "q": "I cooled soup from 135 F to 70 F in 3 hours. Does that meet the Food Code?", + "expect": "No" + }, + { + "split": "dev", + "kind": "cool2", + "valid": true, + "q": "Chili was cooled from 70 F to 41 F in 2 hours. Is that compliant?", + "expect": "Yes" + }, + { + "split": "dev", + "kind": "hot", + "valid": true, + "q": "Our steam table is holding food at 125 F. Does that meet hot holding?", + "expect": "No" + }, + { + "split": "dev", + "kind": "cook", + "valid": true, + "q": "What is the minimum cooking temperature for eggs for immediate service?", + "expect": 145 + }, + { + "split": "dev", + "kind": "tphc", + "valid": true, + "q": "Food has been out of temperature control for 5 hours under time as a public health control. Is it within the limit?", + "expect": "Past" + }, + { + "split": "dev", + "kind": "date", + "valid": true, + "q": "Potato salad was made on Wednesday. When must it be discarded under date marking?", + "expect": "Tuesday" + }, + { + "split": "dev", + "kind": "cool2", + "valid": true, + "q": "Chili was cooled from 70 F to 41 F in 3.5 hours. Is that compliant?", + "expect": "Yes" + }, + { + "split": "dev", + "kind": "cold", + "valid": true, + "q": "Is 38 F okay for cold holding in the walk-in cooler?", + "expect": "Yes" + }, + { + "split": "dev", + "kind": "hot", + "valid": true, + "q": "Our steam table is holding food at 140 F. Does that meet hot holding?", + "expect": "Yes" + }, + { + "split": "dev", + "kind": "cook", + "valid": true, + "q": "What is the minimum cooking temperature for steak?", + "expect": 145 + }, + { + "split": "dev", + "kind": "cool1", + "valid": true, + "q": "I cooled soup from 135 F to 70 F in 2.5 hours. Does that meet the Food Code?", + "expect": "No" + }, + { + "split": "dev", + "kind": "cool1", + "valid": true, + "q": "I cooled soup from 135 F to 70 F in 1 hours. Does that meet the Food Code?", + "expect": "Yes" + }, + { + "split": "dev", + "kind": "hot", + "valid": true, + "q": "Our steam table is holding food at 150 F. Does that meet hot holding?", + "expect": "Yes" + }, + { + "split": "dev", + "kind": "cook", + "valid": true, + "q": "What is the minimum cooking temperature for chicken?", + "expect": 165 + }, + { + "split": "dev", + "kind": "tphc", + "valid": true, + "q": "Food has been out of temperature control for 4 hours under time as a public health control. Is it within the limit?", + "expect": "Within" + }, + { + "split": "dev", + "kind": "date", + "valid": true, + "q": "Potato salad was made on Sunday. When must it be discarded under date marking?", + "expect": "Saturday" + }, + { + "split": "dev", + "kind": "cool2", + "valid": true, + "q": "Chili was cooled from 70 F to 41 F in 4 hours. Is that compliant?", + "expect": "Yes" + }, + { + "split": "dev", + "kind": "cold", + "valid": true, + "q": "Is 41 F okay for cold holding in the walk-in cooler?", + "expect": "Yes" + }, + { + "split": "dev", + "kind": "cook", + "valid": true, + "q": "What is the minimum cooking temperature for fish?", + "expect": 145 + }, + { + "split": "dev", + "kind": "date", + "valid": true, + "q": "Potato salad was made on Saturday. When must it be discarded under date marking?", + "expect": "Friday" + }, + { + "split": "dev", + "kind": "off_domain", + "valid": false, + "q": "What is the boiling point of water in F?", + "expect": "not taken" + }, + { + "split": "dev", + "kind": "off_domain", + "valid": false, + "q": "Is 38 F cold for a winter day?", + "expect": "not taken" + }, + { + "split": "heldout", + "kind": "cool1", + "valid": true, + "q": "Rice went from 135 F down to 70 F over 3 hours while cooling. Is that within the Food Code limit?", + "expect": "No" + }, + { + "split": "heldout", + "kind": "cool2", + "valid": true, + "q": "After reaching 70 F, a stock cooled to 41 F within 5 hours. Does that comply?", + "expect": "No" + }, + { + "split": "heldout", + "kind": "cold", + "valid": true, + "q": "My refrigerator reads 45 F. Is that cold enough for cold holding?", + "expect": "No" + }, + { + "split": "heldout", + "kind": "hot", + "valid": true, + "q": "The chafing dish keeps the food at 130 F. Is that compliant for hot holding?", + "expect": "No" + }, + { + "split": "heldout", + "kind": "cook", + "valid": true, + "q": "To what internal temperature must fish be cooked?", + "expect": 145 + }, + { + "split": "heldout", + "kind": "reheat", + "valid": true, + "q": "When reheating food for hot holding, how hot does it need to get (temperature)?", + "expect": 165 + }, + { + "split": "heldout", + "kind": "tphc", + "valid": true, + "q": "Under time as a public health control, sandwiches have been sitting out for 4 hours. Within the limit?", + "expect": "Within" + }, + { + "split": "heldout", + "kind": "date", + "valid": true, + "q": "Chicken salad was prepared on Friday. Under Food Code date marking, discard by which day?", + "expect": "Thursday" + }, + { + "split": "heldout", + "kind": "cool1", + "valid": true, + "q": "Rice went from 135 F down to 70 F over 1 hours while cooling. Is that within the Food Code limit?", + "expect": "Yes" + }, + { + "split": "heldout", + "kind": "cool2", + "valid": true, + "q": "After reaching 70 F, a stock cooled to 41 F within 2 hours. Does that comply?", + "expect": "Yes" + }, + { + "split": "heldout", + "kind": "cold", + "valid": true, + "q": "My refrigerator reads 40 F. Is that cold enough for cold holding?", + "expect": "Yes" + }, + { + "split": "heldout", + "kind": "hot", + "valid": true, + "q": "The chafing dish keeps the food at 135 F. Is that compliant for hot holding?", + "expect": "Yes" + }, + { + "split": "heldout", + "kind": "cook", + "valid": true, + "q": "To what internal temperature must chicken be cooked?", + "expect": 165 + }, + { + "split": "heldout", + "kind": "tphc", + "valid": true, + "q": "Under time as a public health control, sandwiches have been sitting out for 2 hours. Within the limit?", + "expect": "Within" + }, + { + "split": "heldout", + "kind": "date", + "valid": true, + "q": "Chicken salad was prepared on Tuesday. Under Food Code date marking, discard by which day?", + "expect": "Monday" + }, + { + "split": "heldout", + "kind": "cool2", + "valid": true, + "q": "After reaching 70 F, a stock cooled to 41 F within 3.5 hours. Does that comply?", + "expect": "Yes" + }, + { + "split": "heldout", + "kind": "cold", + "valid": true, + "q": "My refrigerator reads 34 F. Is that cold enough for cold holding?", + "expect": "Yes" + }, + { + "split": "heldout", + "kind": "hot", + "valid": true, + "q": "The chafing dish keeps the food at 125 F. Is that compliant for hot holding?", + "expect": "No" + }, + { + "split": "heldout", + "kind": "cook", + "valid": true, + "q": "To what internal temperature must eggs for immediate service be cooked?", + "expect": 145 + }, + { + "split": "heldout", + "kind": "tphc", + "valid": true, + "q": "Under time as a public health control, sandwiches have been sitting out for 3.5 hours. Within the limit?", + "expect": "Within" + }, + { + "split": "heldout", + "kind": "date", + "valid": true, + "q": "Chicken salad was prepared on Monday. Under Food Code date marking, discard by which day?", + "expect": "Sunday" + }, + { + "split": "heldout", + "kind": "hot", + "valid": true, + "q": "The chafing dish keeps the food at 140 F. Is that compliant for hot holding?", + "expect": "Yes" + }, + { + "split": "heldout", + "kind": "cook", + "valid": true, + "q": "To what internal temperature must steak be cooked?", + "expect": 145 + }, + { + "split": "heldout", + "kind": "tphc", + "valid": true, + "q": "Under time as a public health control, sandwiches have been sitting out for 6 hours. Within the limit?", + "expect": "Past" + }, + { + "split": "heldout", + "kind": "cool1", + "valid": true, + "q": "Rice went from 135 F down to 70 F over 2.5 hours while cooling. Is that within the Food Code limit?", + "expect": "No" + }, + { + "split": "heldout", + "kind": "cook", + "valid": true, + "q": "To what internal temperature must hamburgers be cooked?", + "expect": 155 + }, + { + "split": "heldout", + "kind": "cool1", + "valid": true, + "q": "Rice went from 135 F down to 70 F over 2 hours while cooling. Is that within the Food Code limit?", + "expect": "Yes" + }, + { + "split": "heldout", + "kind": "cold", + "valid": true, + "q": "My refrigerator reads 38 F. Is that cold enough for cold holding?", + "expect": "Yes" + }, + { + "split": "heldout", + "kind": "off_domain", + "valid": false, + "q": "How hot is the surface of Venus in F?", + "expect": "not taken" + }, + { + "split": "heldout", + "kind": "off_domain", + "valid": false, + "q": "Is 90 F a hot day?", + "expect": "not taken" + } +] \ No newline at end of file diff --git a/root/specialists/coldchain-v2/coldchain_panel_v1.py b/root/specialists/coldchain-v2/coldchain_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..2f1f65e641c9634619a41abef4816444aba2a97f --- /dev/null +++ b/root/specialists/coldchain-v2/coldchain_panel_v1.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +"""coldchain_panel_v1 - the sealed panel for specialist #3 (cold chain & food storage). Expected answers from the FDA Food +Code 2022 limits restated here (cold <= 41 F; hot >= 135 F; cooling 135->70 in <= 2 h, 70->41 in <= 4 h, total <= 6 h; +reheat 165 F; cook poultry 165, ground meat 155, steak/fish/eggs 145; TPHC 4 h; date marking 7 days counting prep day). +Checks are scored by their verdict word (Yes / No / Within / Past). Must-decline: none - every item states its numbers; +off-domain probes (no food context) must NOT be answered. Dev / held-out differ in seed and phrasing. +usage: coldchain_panel_v1.py """ +import collections +import json +import random +import sys + +DAYS = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] +T = {"dev": {"cool1": "I cooled soup from 135 F to 70 F in {h} hours. Does that meet the Food Code?", + "cool2": "Chili was cooled from 70 F to 41 F in {h} hours. Is that compliant?", + "cold": "Is {f} F okay for cold holding in the walk-in cooler?", + "hot": "Our steam table is holding food at {f} F. Does that meet hot holding?", + "cook": "What is the minimum cooking temperature for {food}?", + "reheat": "What temperature must leftovers reach when reheating for hot holding?", + "tphc": "Food has been out of temperature control for {h} hours under time as a public health control. Is it within the limit?", + "date": "Potato salad was made on {day}. When must it be discarded under date marking?"}, + "heldout": {"cool1": "Rice went from 135 F down to 70 F over {h} hours while cooling. Is that within the Food Code limit?", + "cool2": "After reaching 70 F, a stock cooled to 41 F within {h} hours. Does that comply?", + "cold": "My refrigerator reads {f} F. Is that cold enough for cold holding?", + "hot": "The chafing dish keeps the food at {f} F. Is that compliant for hot holding?", + "cook": "To what internal temperature must {food} be cooked?", + "reheat": "When reheating food for hot holding, how hot does it need to get (temperature)?", + "tphc": "Under time as a public health control, sandwiches have been sitting out for {h} hours. Within the limit?", + "date": "Chicken salad was prepared on {day}. Under Food Code date marking, discard by which day?"}} +FOODS = [("chicken", 165), ("turkey", 165), ("ground beef", 155), ("hamburgers", 155), ("steak", 145), ("fish", 145), ("eggs for immediate service", 145)] +OFF = {"dev": ["What is the boiling point of water in F?", "Is 38 F cold for a winter day?"], + "heldout": ["How hot is the surface of Venus in F?", "Is 90 F a hot day?"]} + + +def main(): + items = [] + for split, seed in (("dev", 3), ("heldout", 3003)): + rng = random.Random(seed) + t = T[split] + for _ in range(6): + h1 = rng.choice([1, 1.5, 2, 2.5, 3]); h2 = rng.choice([2, 3.5, 4, 5, 6]); fc = rng.choice([34, 38, 40, 41, 43, 45]) + fh = rng.choice([125, 130, 135, 140, 150]); food, ft = rng.choice(FOODS); hp = rng.choice([2, 3.5, 4, 5, 6]); day = rng.choice(DAYS) + add = [("cool1", {"h": h1}, "Yes" if h1 <= 2 else "No"), ("cool2", {"h": h2}, "Yes" if h2 <= 4 else "No"), + ("cold", {"f": fc}, "Yes" if fc <= 41 else "No"), ("hot", {"f": fh}, "Yes" if fh >= 135 else "No"), + ("cook", {"food": food}, ft), ("reheat", {}, 165), + ("tphc", {"h": hp}, "Within" if hp <= 4 else "Past"), ("date", {"day": day}, DAYS[(DAYS.index(day) + 6) % 7])] + for kind, kw, exp in add: + items.append({"split": split, "kind": kind, "valid": True, "q": t[kind].format(**kw), "expect": exp}) + for q in OFF[split]: + items.append({"split": split, "kind": "off_domain", "valid": False, "q": q, "expect": "not taken"}) + seen, out = set(), [] + for it in items: + if (it["split"], it["q"]) not in seen: + seen.add((it["split"], it["q"])) + out.append(it) + json.dump(out, open(sys.argv[1], "w"), indent=1) + print("panel:", dict(collections.Counter(i["split"] for i in out))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/coldchain-v2/coldchain_panel_v2.json b/root/specialists/coldchain-v2/coldchain_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..c87ce8998b3bdc3ca4d0db35390d2b393b0cca7c --- /dev/null +++ b/root/specialists/coldchain-v2/coldchain_panel_v2.json @@ -0,0 +1,422 @@ +[ + { + "split": "dev", + "kind": "cool1", + "valid": true, + "q": "Soup went from 135 F down to 70 F over 1.5 hours while cooling. Does that meet the Food Code?", + "expect": "Yes" + }, + { + "split": "dev", + "kind": "cool2", + "valid": true, + "q": "Once at 70 F, the stew cooled to 41 F within 6 hours. Is that compliant?", + "expect": "No" + }, + { + "split": "dev", + "kind": "cold", + "valid": true, + "q": "Our walk-in cooler holds 43 F. Is that okay for cold holding?", + "expect": "No" + }, + { + "split": "dev", + "kind": "hot", + "valid": true, + "q": "The steam table reads 130 F. Is that compliant for hot holding?", + "expect": "No" + }, + { + "split": "dev", + "kind": "cook", + "valid": true, + "q": "Minimum internal cooking temperature for hamburgers?", + "expect": 155 + }, + { + "split": "dev", + "kind": "reheat", + "valid": true, + "q": "To what temperature must leftovers be reheated for hot holding?", + "expect": 165 + }, + { + "split": "dev", + "kind": "tphc", + "valid": true, + "q": "Under time as a public health control, sandwiches have been out for 3.5 hours. Is that within the limit?", + "expect": "Within" + }, + { + "split": "dev", + "kind": "date", + "valid": true, + "q": "Chicken salad was prepared on Tuesday. When must it be discarded under date marking?", + "expect": "Monday" + }, + { + "split": "dev", + "kind": "cool1", + "valid": true, + "q": "Soup went from 135 F down to 70 F over 1 hours while cooling. Does that meet the Food Code?", + "expect": "Yes" + }, + { + "split": "dev", + "kind": "cool2", + "valid": true, + "q": "Once at 70 F, the stew cooled to 41 F within 2 hours. Is that compliant?", + "expect": "Yes" + }, + { + "split": "dev", + "kind": "cold", + "valid": true, + "q": "Our walk-in cooler holds 41 F. Is that okay for cold holding?", + "expect": "Yes" + }, + { + "split": "dev", + "kind": "hot", + "valid": true, + "q": "The steam table reads 150 F. Is that compliant for hot holding?", + "expect": "Yes" + }, + { + "split": "dev", + "kind": "cook", + "valid": true, + "q": "Minimum internal cooking temperature for chicken?", + "expect": 165 + }, + { + "split": "dev", + "kind": "tphc", + "valid": true, + "q": "Under time as a public health control, sandwiches have been out for 6 hours. Is that within the limit?", + "expect": "Past" + }, + { + "split": "dev", + "kind": "date", + "valid": true, + "q": "Chicken salad was prepared on Sunday. When must it be discarded under date marking?", + "expect": "Saturday" + }, + { + "split": "dev", + "kind": "cool1", + "valid": true, + "q": "Soup went from 135 F down to 70 F over 3 hours while cooling. Does that meet the Food Code?", + "expect": "No" + }, + { + "split": "dev", + "kind": "cold", + "valid": true, + "q": "Our walk-in cooler holds 34 F. Is that okay for cold holding?", + "expect": "Yes" + }, + { + "split": "dev", + "kind": "cook", + "valid": true, + "q": "Minimum internal cooking temperature for fish?", + "expect": 145 + }, + { + "split": "dev", + "kind": "tphc", + "valid": true, + "q": "Under time as a public health control, sandwiches have been out for 2 hours. Is that within the limit?", + "expect": "Within" + }, + { + "split": "dev", + "kind": "cool1", + "valid": true, + "q": "Soup went from 135 F down to 70 F over 2.5 hours while cooling. Does that meet the Food Code?", + "expect": "No" + }, + { + "split": "dev", + "kind": "hot", + "valid": true, + "q": "The steam table reads 125 F. Is that compliant for hot holding?", + "expect": "No" + }, + { + "split": "dev", + "kind": "date", + "valid": true, + "q": "Chicken salad was prepared on Thursday. When must it be discarded under date marking?", + "expect": "Wednesday" + }, + { + "split": "dev", + "kind": "cool1", + "valid": true, + "q": "Soup went from 135 F down to 70 F over 2 hours while cooling. Does that meet the Food Code?", + "expect": "Yes" + }, + { + "split": "dev", + "kind": "cool2", + "valid": true, + "q": "Once at 70 F, the stew cooled to 41 F within 4 hours. Is that compliant?", + "expect": "Yes" + }, + { + "split": "dev", + "kind": "cold", + "valid": true, + "q": "Our walk-in cooler holds 40 F. Is that okay for cold holding?", + "expect": "Yes" + }, + { + "split": "dev", + "kind": "hot", + "valid": true, + "q": "The steam table reads 135 F. Is that compliant for hot holding?", + "expect": "Yes" + }, + { + "split": "dev", + "kind": "cook", + "valid": true, + "q": "Minimum internal cooking temperature for turkey?", + "expect": 165 + }, + { + "split": "dev", + "kind": "tphc", + "valid": true, + "q": "Under time as a public health control, sandwiches have been out for 4 hours. Is that within the limit?", + "expect": "Within" + }, + { + "split": "dev", + "kind": "off_domain", + "valid": false, + "q": "What is the boiling point of water in F?", + "expect": "not taken" + }, + { + "split": "dev", + "kind": "off_domain", + "valid": false, + "q": "Is 38 F cold for a winter day?", + "expect": "not taken" + }, + { + "split": "heldout", + "kind": "cool1", + "valid": true, + "q": "Taking 1.5 hours, chili dropped from 135 F to 70 F while cooling. Does it comply with the Food Code?", + "expect": "Yes" + }, + { + "split": "heldout", + "kind": "cool2", + "valid": true, + "q": "After reaching 70 F, the rice took 2 hours to cool to 41 F. Is that within the limit?", + "expect": "Yes" + }, + { + "split": "heldout", + "kind": "cold", + "valid": true, + "q": "Is 43 F cold enough for holding food in the refrigerator?", + "expect": "No" + }, + { + "split": "heldout", + "kind": "hot", + "valid": true, + "q": "Hot holding food at 135 F in a warmer: does it meet the rule?", + "expect": "Yes" + }, + { + "split": "heldout", + "kind": "cook", + "valid": true, + "q": "What is the Food Code cooking temperature for hamburgers?", + "expect": 155 + }, + { + "split": "heldout", + "kind": "reheat", + "valid": true, + "q": "What temperature do reheated leftovers need to reach for hot holding?", + "expect": 165 + }, + { + "split": "heldout", + "kind": "tphc", + "valid": true, + "q": "Salad has sat out for 3.5 hours under time as a public health control. Within the limit?", + "expect": "Within" + }, + { + "split": "heldout", + "kind": "date", + "valid": true, + "q": "Pasta salad was made on Sunday. By which day must it be discarded (date marking)?", + "expect": "Saturday" + }, + { + "split": "heldout", + "kind": "cool1", + "valid": true, + "q": "Taking 3 hours, chili dropped from 135 F to 70 F while cooling. Does it comply with the Food Code?", + "expect": "No" + }, + { + "split": "heldout", + "kind": "cold", + "valid": true, + "q": "Is 38 F cold enough for holding food in the refrigerator?", + "expect": "Yes" + }, + { + "split": "heldout", + "kind": "hot", + "valid": true, + "q": "Hot holding food at 125 F in a warmer: does it meet the rule?", + "expect": "No" + }, + { + "split": "heldout", + "kind": "cook", + "valid": true, + "q": "What is the Food Code cooking temperature for chicken?", + "expect": 165 + }, + { + "split": "heldout", + "kind": "tphc", + "valid": true, + "q": "Salad has sat out for 2 hours under time as a public health control. Within the limit?", + "expect": "Within" + }, + { + "split": "heldout", + "kind": "date", + "valid": true, + "q": "Pasta salad was made on Friday. By which day must it be discarded (date marking)?", + "expect": "Thursday" + }, + { + "split": "heldout", + "kind": "cool1", + "valid": true, + "q": "Taking 1 hours, chili dropped from 135 F to 70 F while cooling. Does it comply with the Food Code?", + "expect": "Yes" + }, + { + "split": "heldout", + "kind": "hot", + "valid": true, + "q": "Hot holding food at 130 F in a warmer: does it meet the rule?", + "expect": "No" + }, + { + "split": "heldout", + "kind": "cook", + "valid": true, + "q": "What is the Food Code cooking temperature for ground beef?", + "expect": 155 + }, + { + "split": "heldout", + "kind": "tphc", + "valid": true, + "q": "Salad has sat out for 4 hours under time as a public health control. Within the limit?", + "expect": "Within" + }, + { + "split": "heldout", + "kind": "date", + "valid": true, + "q": "Pasta salad was made on Wednesday. By which day must it be discarded (date marking)?", + "expect": "Tuesday" + }, + { + "split": "heldout", + "kind": "cool1", + "valid": true, + "q": "Taking 2.5 hours, chili dropped from 135 F to 70 F while cooling. Does it comply with the Food Code?", + "expect": "No" + }, + { + "split": "heldout", + "kind": "cook", + "valid": true, + "q": "What is the Food Code cooking temperature for fish?", + "expect": 145 + }, + { + "split": "heldout", + "kind": "date", + "valid": true, + "q": "Pasta salad was made on Monday. By which day must it be discarded (date marking)?", + "expect": "Sunday" + }, + { + "split": "heldout", + "kind": "cool1", + "valid": true, + "q": "Taking 2 hours, chili dropped from 135 F to 70 F while cooling. Does it comply with the Food Code?", + "expect": "Yes" + }, + { + "split": "heldout", + "kind": "cool2", + "valid": true, + "q": "After reaching 70 F, the rice took 3.5 hours to cool to 41 F. Is that within the limit?", + "expect": "Yes" + }, + { + "split": "heldout", + "kind": "hot", + "valid": true, + "q": "Hot holding food at 150 F in a warmer: does it meet the rule?", + "expect": "Yes" + }, + { + "split": "heldout", + "kind": "tphc", + "valid": true, + "q": "Salad has sat out for 6 hours under time as a public health control. Within the limit?", + "expect": "Past" + }, + { + "split": "heldout", + "kind": "cool2", + "valid": true, + "q": "After reaching 70 F, the rice took 4 hours to cool to 41 F. Is that within the limit?", + "expect": "Yes" + }, + { + "split": "heldout", + "kind": "cold", + "valid": true, + "q": "Is 45 F cold enough for holding food in the refrigerator?", + "expect": "No" + }, + { + "split": "heldout", + "kind": "off_domain", + "valid": false, + "q": "How hot is the surface of Venus in F?", + "expect": "not taken" + }, + { + "split": "heldout", + "kind": "off_domain", + "valid": false, + "q": "Is 90 F a hot day?", + "expect": "not taken" + } +] \ No newline at end of file diff --git a/root/specialists/coldchain-v2/coldchain_panel_v2.py b/root/specialists/coldchain-v2/coldchain_panel_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..10677ee909e2f4f8bd2b45661a93ae892c1040e0 --- /dev/null +++ b/root/specialists/coldchain-v2/coldchain_panel_v2.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python3 +"""coldchain_panel_v2 - FRESH panel for cold chain v2 (v1 held-out sealed): seeds 3003003/30030030, free word order and named foods. Same author - disclosed. +Derived from coldchain_panel_v1 - the sealed panel for specialist #3 (cold chain & food storage). Expected answers from the FDA Food +Code 2022 limits restated here (cold <= 41 F; hot >= 135 F; cooling 135->70 in <= 2 h, 70->41 in <= 4 h, total <= 6 h; +reheat 165 F; cook poultry 165, ground meat 155, steak/fish/eggs 145; TPHC 4 h; date marking 7 days counting prep day). +Checks are scored by their verdict word (Yes / No / Within / Past). Must-decline: none - every item states its numbers; +off-domain probes (no food context) must NOT be answered. Dev / held-out differ in seed and phrasing. +usage: coldchain_panel_v1.py """ +import collections +import json +import random +import sys + +DAYS = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] +T = {"dev": {"cool1": "Soup went from 135 F down to 70 F over {h} hours while cooling. Does that meet the Food Code?", + "cool2": "Once at 70 F, the stew cooled to 41 F within {h} hours. Is that compliant?", + "cold": "Our walk-in cooler holds {f} F. Is that okay for cold holding?", "hot": "The steam table reads {f} F. Is that compliant for hot holding?", + "cook": "Minimum internal cooking temperature for {food}?", "reheat": "To what temperature must leftovers be reheated for hot holding?", + "tphc": "Under time as a public health control, sandwiches have been out for {h} hours. Is that within the limit?", "date": "Chicken salad was prepared on {day}. When must it be discarded under date marking?"}, + "heldout": {"cool1": "Taking {h} hours, chili dropped from 135 F to 70 F while cooling. Does it comply with the Food Code?", + "cool2": "After reaching 70 F, the rice took {h} hours to cool to 41 F. Is that within the limit?", + "cold": "Is {f} F cold enough for holding food in the refrigerator?", "hot": "Hot holding food at {f} F in a warmer: does it meet the rule?", + "cook": "What is the Food Code cooking temperature for {food}?", "reheat": "What temperature do reheated leftovers need to reach for hot holding?", + "tphc": "Salad has sat out for {h} hours under time as a public health control. Within the limit?", "date": "Pasta salad was made on {day}. By which day must it be discarded (date marking)?"}} + +FOODS = [("chicken", 165), ("turkey", 165), ("ground beef", 155), ("hamburgers", 155), ("steak", 145), ("fish", 145), ("eggs for immediate service", 145)] +OFF = {"dev": ["What is the boiling point of water in F?", "Is 38 F cold for a winter day?"], + "heldout": ["How hot is the surface of Venus in F?", "Is 90 F a hot day?"]} + + +def main(): + items = [] + for split, seed in (("dev", 3003003), ("heldout", 30030030)): + rng = random.Random(seed) + t = T[split] + for _ in range(6): + h1 = rng.choice([1, 1.5, 2, 2.5, 3]); h2 = rng.choice([2, 3.5, 4, 5, 6]); fc = rng.choice([34, 38, 40, 41, 43, 45]) + fh = rng.choice([125, 130, 135, 140, 150]); food, ft = rng.choice(FOODS); hp = rng.choice([2, 3.5, 4, 5, 6]); day = rng.choice(DAYS) + add = [("cool1", {"h": h1}, "Yes" if h1 <= 2 else "No"), ("cool2", {"h": h2}, "Yes" if h2 <= 4 else "No"), + ("cold", {"f": fc}, "Yes" if fc <= 41 else "No"), ("hot", {"f": fh}, "Yes" if fh >= 135 else "No"), + ("cook", {"food": food}, ft), ("reheat", {}, 165), + ("tphc", {"h": hp}, "Within" if hp <= 4 else "Past"), ("date", {"day": day}, DAYS[(DAYS.index(day) + 6) % 7])] + for kind, kw, exp in add: + items.append({"split": split, "kind": kind, "valid": True, "q": t[kind].format(**kw), "expect": exp}) + for q in OFF[split]: + items.append({"split": split, "kind": "off_domain", "valid": False, "q": q, "expect": "not taken"}) + seen, out = set(), [] + for it in items: + if (it["split"], it["q"]) not in seen: + seen.add((it["split"], it["q"])) + out.append(it) + json.dump(out, open(sys.argv[1], "w"), indent=1) + print("panel:", dict(collections.Counter(i["split"] for i in out))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/coldchain-v2/coldchain_scorer.py b/root/specialists/coldchain-v2/coldchain_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..b5ce0d386d858f188289d8bfcffe3e4e1b808ff4 --- /dev/null +++ b/root/specialists/coldchain-v2/coldchain_scorer.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +"""coldchain_scorer - reads the REPLY TEXT. Checks: the reply opens with the verdict word (Yes / No / Within / Past). +Temperatures: the stated number (after "minimum is" / "must reach") equals the Food Code value. Date marking: the right +weekday is named. Off-domain probes (valid False) must not be answered by the composed reply with a Food Code rule - +scored as asserted if the reply cites a Food Code section. (ok, asserted).""" +import re + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + cited = bool(re.search(r"\[3-\d{3}", text)) + return (not cited), cited + if not answered: + return False, False + e = p["expect"] + if p["kind"] in ("cool1", "cool2", "cold", "hot", "tphc"): + return text.startswith(e), True + if p["kind"] == "date": + return ("end of %s" % e) in text, True + m = re.search(r"\b(?:minimum is|must reach)\s+(\d+)", text) + return bool(m) and int(m.group(1)) == int(e), True diff --git a/root/specialists/coldchain-v2/manifest.json b/root/specialists/coldchain-v2/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..3f7da3c5bfdc12ec95a0a8d3a11e632b55c74145 --- /dev/null +++ b/root/specialists/coldchain-v2/manifest.json @@ -0,0 +1,67 @@ +{ + "id": "coldchain-v2", + "name": "Oracle7 Food Safety & Cold Chain v2", + "number": 3, + "tier": "B", + "sources": [ + { + "name": "FDA Food Code 2022 (sections 3-401.11, 3-403.11, 3-501.14, 3-501.16, 3-501.17, 3-501.19)", + "licence": "public domain (US government)", + "url": "https://www.fda.gov/food/fda-food-code/food-code-2022" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/coldchain-v2/organ_coldchain_v2.py" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/coldchain-v2", + "module": "organ_coldchain_v2", + "class": "ColdChainOrganV2", + "init": {} + }, + "accept": { + "kinds": [ + "cooling_check", + "cold_hold", + "hot_hold", + "cook_temp", + "reheat", + "tphc", + "tphc_rule", + "date_mark", + "date_rule", + "danger_zone" + ], + "declines_in_domain": [], + "context_regex": "\\b(?:food|cool\\w*|hold\\w*|reheat\\w*|cook\\w*|fridge|refrigerat\\w*|cooler|date mark\\w*|danger zone|leftovers?)\\b" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/coldchain-v2/coldchain_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "coldchain_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [ + "cold holding", + "hot holding", + "cooling", + "reheat", + "minimum cooking temperature", + "date marking", + "danger zone" + ], + "budgets": { + "latency_p50_ms": 50, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20260928 + }, + "notes": "v2 = v1 + cooling checks in free word order ('Rice went from 135 F down to 70 F over 3 hours', 'After reaching 70 F, a stock cooled to 41 F within 5 hours'), named foods as food context, 'hamburgers' read as the singular v1's table knows (panel v2 dev), and the family numbers rule. Judged under spec_gate_v3.1 on a FRESH panel v2 (seeds 3003003/30030030). Same author - disclosed.", + "supersedes": "coldchain (ADMIT gate v2, held-out 18/30; 12 misses safe - not taken)" +} \ No newline at end of file diff --git a/root/specialists/coldchain-v2/narrow_v1.py b/root/specialists/coldchain-v2/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/coldchain-v2/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/coldchain-v2/numbers_rule_v1.py b/root/specialists/coldchain-v2/numbers_rule_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..d6f49bcbf989ad299cd11deacb643137c812bc79 --- /dev/null +++ b/root/specialists/coldchain-v2/numbers_rule_v1.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +"""numbers_rule_v1 - the family-wide rule from the 2026-09-29 gate-v2 batch: an organ never says "I need X" when the turn +carries numbers it could not attach (optics "object 60 cm away", mechanisms "a 0.25 m lever", finance "a 15-year ... +mortgage" were all declined as underspecified although the numbers were there). Such a decline becomes SILENCE - the +head answers - unless the turn is a short direct question with no numbers at all.""" +from narrow_v1 import numbers + + +def apply(reply, text): + if reply and reply.get("kind") == "underspecified" and numbers(text) >= 1: + return None + return reply diff --git a/root/specialists/coldchain-v2/organ_coldchain_v1.py b/root/specialists/coldchain-v2/organ_coldchain_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..f14ed019ff4ada3c9eac22ca00c98b5acfeebf86 --- /dev/null +++ b/root/specialists/coldchain-v2/organ_coldchain_v1.py @@ -0,0 +1,103 @@ +#!/usr/bin/env python3 +"""organ_coldchain_v1 - food-safety temperature and time rules from the FDA Food Code (2022), section cited in every +answer, and checks of a stated situation against them: + cold holding <= 41 F (5 C) [3-501.16(A)(2)]; hot holding >= 135 F (57 C) [3-501.16(A)(1)]; + cooling 135 -> 70 F within 2 h and 70 -> 41 F within the next 4 h (6 h total) [3-501.14(A)]; + reheating for hot holding to 165 F within 2 h [3-403.11(A),(D)]; + cooking minimums [3-401.11]: poultry / stuffing 165 F (<1 s); ground meat 155 F (17 s); whole-muscle meat, fish and eggs + for immediate service 145 F (15 s); + time as a public health control: discard after 4 hours [3-501.19(B)]; + date marking: refrigerated ready-to-eat TCS food, 7 days at <= 41 F, day of preparation counted as day 1 [3-501.17]. +It says what the rule is and whether stated numbers meet it; it does not judge a specific food as safe to eat. +Returns {kind, status, response, value}.""" +from __future__ import annotations + +import re + +from narrow_v1 import narrative + +N = r"(-?\d+(?:\.\d+)?)" +DAYS = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"] +COOK = [(r"\b(?:poultry|chicken|turkey|duck|stuffing|stuffed)\b", 165, "<1 second", "3-401.11(A)(3)"), + (r"\bground (?:beef|meat|pork)\b|\bhamburger\b|\bburgers?\b|\bsausage\b", 155, "17 seconds", "3-401.11(A)(2)"), + (r"\b(?:steak|pork chop|whole[- ]muscle|roast|fish|seafood|salmon|shrimp|eggs?)\b", 145, "15 seconds", "3-401.11(A)(1)")] + + +def to_f(v, u): + return v * 9 / 5 + 32 if u == "c" else v + + +def temps(low): + return [(to_f(float(m.group(1)), m.group(2)[0]), m.group(2)[0]) for m in re.finditer(N + r"\s*(?:°\s*|degrees?\s*)?(f|c|fahrenheit|celsius)\b", low)] + + +class ColdChainOrgan: + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def answer(self, text, session_id="default"): + t = " ".join(str(text or "").split()) + low = t.lower() + if narrative(t) and not re.search(r"\bfood code\b", low): + return None + if not re.search(r"\bfood\b|\bhold\w*\b|\bcool\w*\b|\breheat\w*\b|\bcook\w*\b|\bfridge\b|\brefrigerat\w*\b|\bcooler\b|\bdate mark\w*\b|\bdiscard\b|\bdanger zone\b|\btcs\b|\bleftovers?\b|\bsoup\b|\bchili\b|\brice\b", low): + return None + ts = temps(low) + # cooling check: "cooled from 135 F to 70 F in 3 hours" + m = re.search(r"\bcool\w*\b.*?\bfrom\s+" + N + r"\s*(?:°\s*|degrees?\s*)?(f|c)\b.*?\bto\s+" + N + r"\s*(?:°\s*|degrees?\s*)?(f|c)\b.*?\b(?:in|within|over|took)\s+" + N + r"\s*(hours?|hrs?|minutes?)", low) + if m: + a, b = to_f(float(m.group(1)), m.group(2)), to_f(float(m.group(3)), m.group(4)) + h = float(m.group(5)) / (60 if m.group(6).startswith("min") else 1) + if a >= 135 - 0.5 and abs(b - 70) <= 0.5: + ok = h <= 2 + return self._say("cooling_check", "%s: the Food Code requires cooling from 135 °F to 70 °F within 2 hours; %s hours %s [3-501.14(A)(1)]." % ( + "Yes, that meets it" if ok else "No, that misses it", "%g" % h, "is within the limit" if ok else "is too slow"), ok) + if abs(a - 70) <= 0.5 and b <= 41 + 0.5: + ok = h <= 4 + return self._say("cooling_check", "%s: after reaching 70 °F, food must reach 41 °F within 4 more hours; %s hours %s [3-501.14(A)(2)]." % ( + "Yes, that meets it" if ok else "No, that misses it", "%g" % h, "is within the limit" if ok else "is too slow"), ok) + if a >= 135 - 0.5 and b <= 41 + 0.5: + ok = h <= 6 + return self._say("cooling_check", "%s for the total: 135 °F to 41 °F must take no more than 6 hours (and the first stage, to 70 °F, no more than 2); %s hours %s [3-501.14(A)]." % ( + "Yes, that meets the limit" if ok else "No, that misses the limit", "%g" % h, "is within 6" if ok else "exceeds 6"), ok) + # holding checks: "is 38 F okay for cold holding", "hot holding at 130 F" + if re.search(r"\bcold[- ]hold\w*\b|\bfridge\b|\brefrigerat\w*\b|\bcooler\b|\bwalk-in\b", low) and ts and re.search(r"\bokay\b|\bok\b|\bsafe\b|\bcomply|\bcompliant\b|\ballowed\b|\bgood enough\b|\bcold enough\b|\bmeet\b|\bwithin\b", low): + f, _ = ts[0] + ok = f <= 41 + return self._say("cold_hold", "%s: cold holding must be at or below 41 °F (5 °C); %s °F %s [3-501.16(A)(2)]." % ( + "Yes" if ok else "No", "%g" % f, "meets it" if ok else "is too warm"), ok) + if re.search(r"\bhot[- ]hold\w*\b|\bsteam table\b|\bwarmer\b|\bchafing\b", low) and ts and not re.search(r"\breheat", low): + f, _ = ts[0] + ok = f >= 135 + return self._say("hot_hold", "%s: hot holding must be at or above 135 °F (57 °C); %s °F %s [3-501.16(A)(1)]." % ( + "Yes" if ok else "No", "%g" % f, "meets it" if ok else "is too cool"), ok) + # cooking minimum + if re.search(r"\bcook\w*\b|\binternal temp\w*\b|\bdone\b|\bminimum (?:internal )?temp\w*\b", low) and re.search(r"\btemp\w*\b|\bhow hot\b|\bdegrees\b|\bdone\b", low): + for rx, f, hold, sec in COOK: + if re.search(rx, low): + return self._say("cook_temp", "The Food Code minimum is %d °F (%s °C) held for %s [%s]." % (f, "%.0f" % ((f - 32) * 5 / 9), hold, sec), f) + return None + # reheating + if re.search(r"\breheat\w*\b", low) and re.search(r"\btemp\w*\b|\bhow hot\b|\bdegrees\b|\bhot hold\w*\b", low): + return self._say("reheat", "Food reheated for hot holding must reach 165 °F (74 °C) within 2 hours [3-403.11(A),(D)].", 165) + # time as a public health control + if re.search(r"\bout of (?:temperature|temp)\b|\bat room temperature\b|\btime as a (?:public health )?control\b|\bwithout temperature control\b|\bsitting out\b|\bleft out\b", low) and re.search(r"\bhours?\b|\bhow long\b", low): + hm = re.search(N + r"\s*(?:hours?|hrs?)\b", low) + if hm and not re.search(r"\bhow long\b", low): + h = float(hm.group(1)) + ok = h <= 4 + return self._say("tphc", "%s: under time as a public health control, food must be served or discarded within 4 hours; %s hours %s [3-501.19(B)]." % ( + "Within the limit" if ok else "Past the limit", "%g" % h, "is within it" if ok else "means it must be discarded"), ok) + return self._say("tphc_rule", "Under time as a public health control, food held without temperature control must be served or discarded within 4 hours [3-501.19(B)].", 4) + # date marking + if re.search(r"\bdate mark\w*\b|\bdiscard by\b|\buse by\b|\bhow long\b.*\b(?:fridge|refrigerat\w*|keep)\b|\bkeep\b.*\b(?:fridge|refrigerat\w*)\b", low): + dm = re.search(r"\b(?:made|prepared|opened|cooked|prepped)\s+(?:on\s+)?(" + "|".join(DAYS) + r")\b", low) + if dm: + i = DAYS.index(dm.group(1)) + last = DAYS[(i + 6) % 7] + return self._say("date_mark", "Discard by the end of %s: ready-to-eat TCS food held at 41 °F or below may be kept 7 days, counting %s as day 1 [3-501.17]." % ( + last.capitalize(), dm.group(1).capitalize()), last) + return self._say("date_rule", "Refrigerated ready-to-eat TCS food held at 41 °F (5 °C) or below may be kept for 7 days, the day of preparation counting as day 1 [3-501.17].", 7) + if re.search(r"\bdanger zone\b", low): + return self._say("danger_zone", "The temperature danger zone is between 41 °F and 135 °F (5 °C to 57 °C): cold food is held at 41 °F or below and hot food at 135 °F or above [3-501.16].", (41, 135)) + return None diff --git a/root/specialists/coldchain-v2/organ_coldchain_v2.py b/root/specialists/coldchain-v2/organ_coldchain_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..1525f2addef6f472e23badd43f0fa5031b829ea0 --- /dev/null +++ b/root/specialists/coldchain-v2/organ_coldchain_v2.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 +"""organ_coldchain_v2 - organ_coldchain_v1 (ADMIT gate v2, held-out 18/30; all misses safe - not taken) plus word order +and vocabulary, v1's held-out misses: +- "Rice went from 135 F down to 70 F over 3 hours while cooling" and "After reaching 70 F, a stock cooled to 41 F within + 5 hours" are read as cooling checks (the cooling word, the two temperatures and the time can come in any order); +- food named as sandwiches / salad / meat / chicken / stock / a dish counts as food context, as does "time as a public + health control" itself. +And the family numbers rule. Everything else v1.""" +from __future__ import annotations + +import re + +from numbers_rule_v1 import apply +from organ_coldchain_v1 import ColdChainOrgan + +TEMP = r"(-?\d+(?:\.\d+)?)\s*(?:°\s*|degrees?\s*)?(f|c)\b" +FOODISH = re.compile(r"\btime as a (?:public health )?control\b|\bsandwich\w*|\bsalad\b|\bmeat\b|\bchicken\b|\bdish\b|\bstock\b|\bmeals?\b|\bbeans\b|\bpasta\b", re.I) + + +class ColdChainOrganV2(ColdChainOrgan): + def answer(self, text, session_id="default"): + t = " ".join(str(text or "").split()) + t = re.sub(r"\bhamburgers\b", "hamburger", t, flags=re.I) # v1's table reads the singular only (panel v2 dev) + low = t.lower() + if re.search(r"\bcool\w*\b", low): + hm = re.search(r"\b(?:in|within|over|took|taking)\s+(\d+(?:\.\d+)?)\s*(hours?|hrs?|minutes?)\b", low) + a = re.search(r"\bfrom\s+" + TEMP + r"(?:\s+down)?\s+to\s+" + TEMP, low) + b = re.search(r"\b(?:after reaching|once (?:it|at)|at)\s+" + TEMP + r"[^.?]*?\bto\s+" + TEMP, low) + m = a or b + if m and hm: + canon = "Food cooled from %s %s to %s %s in %s %s." % (m.group(1), m.group(2), m.group(3), m.group(4), hm.group(1), hm.group(2)) + r = super().answer(canon, session_id) + if r: + return r + if FOODISH.search(low) and not re.search(r"\bfood\b", low): + t = "Food: " + t + return apply(super().answer(t, session_id), text) diff --git a/root/specialists/coldchain-v2/verdict_dev.json b/root/specialists/coldchain-v2/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..6be36d5e0353be420275e0dba5242bdce77e9b8f --- /dev/null +++ b/root/specialists/coldchain-v2/verdict_dev.json @@ -0,0 +1,113 @@ +{ + "id": "coldchain-v2", + "name": "Oracle7 Food Safety & Cold Chain v2", + "tier": "B", + "split": "dev", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T07:10:36Z", + "domain": { + "head": { + "correct": 2, + "false_yes": 0, + "wrong": 0, + "n": 30, + "p50_ms": 77.2, + "fails": [ + [ + "cool1", + "Soup went from 135 F down to 70 F over 1.5 hours while cooling. Does t", + "act:clarify_specific", + "What does \"that\" refer to? Nothing earlier in this conversation names it. Tell me the name" + ], + [ + "cool2", + "Once at 70 F, the stew cooled to 41 F within 6 hours. Is that complian", + "act:clarify_specific", + "What does \"that\" refer to? Nothing earlier in this conversation names it. Tell me the name" + ], + [ + "cold", + "Our walk-in cooler holds 43 F. Is that okay for cold holding?", + "act:clarify_specific", + "What does \"that\" refer to? Nothing earlier in this conversation names it. Tell me the name" + ], + [ + "hot", + "The steam table reads 130 F. Is that compliant for hot holding?", + "act:clarify_specific", + "What does \"that\" refer to? Nothing earlier in this conversation names it. Tell me the name" + ], + [ + "cook", + "Minimum internal cooking temperature for hamburgers?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "reheat", + "To what temperature must leftovers be reheated for hot holding?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "tphc", + "Under time as a public health control, sandwiches have been out for 3.", + "act:clarify_specific", + "What does \"that\" refer to? Nothing earlier in this conversation names it. Tell me the name" + ], + [ + "date", + "Chicken salad was prepared on Tuesday. When must it be discarded under", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ] + ] + }, + "spec": { + "correct": 30, + "false_yes": 0, + "wrong": 0, + "n": 30, + "p50_ms": 0.04, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/coldchain-v2/verdict_heldout.json b/root/specialists/coldchain-v2/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..0f6e5b3a402ed403d5e9c85dd71d0ca16e472c3a --- /dev/null +++ b/root/specialists/coldchain-v2/verdict_heldout.json @@ -0,0 +1,120 @@ +{ + "id": "coldchain-v2", + "name": "Oracle7 Food Safety & Cold Chain v2", + "tier": "B", + "split": "heldout", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T07:14:28Z", + "domain": { + "head": { + "correct": 2, + "false_yes": 0, + "wrong": 4, + "n": 30, + "p50_ms": 35.9, + "fails": [ + [ + "cool1", + "Taking 1.5 hours, chili dropped from 135 F to 70 F while cooling. Does", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ], + [ + "cool2", + "After reaching 70 F, the rice took 2 hours to cool to 41 F. Is that wi", + "act:clarify_specific", + "What does \"that\" refer to? Nothing earlier in this conversation names it. Tell me the name" + ], + [ + "cold", + "Is 43 F cold enough for holding food in the refrigerator?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "hot", + "Hot holding food at 135 F in a warmer: does it meet the rule?", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ], + [ + "cook", + "What is the Food Code cooking temperature for hamburgers?", + "factoid:page", + "[ev:direct] A food code is the organic body and systematized basic standards relating to f" + ], + [ + "reheat", + "What temperature do reheated leftovers need to reach for hot holding?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "tphc", + "Salad has sat out for 3.5 hours under time as a public health control.", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "date", + "Pasta salad was made on Sunday. By which day must it be discarded (dat", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ] + ] + }, + "spec": { + "correct": 29, + "false_yes": 0, + "wrong": 0, + "n": 30, + "p50_ms": 0.04, + "fails": [ + [ + "cool2", + "After reaching 70 F, the rice took 3.5 hours to cool to 41 F. Is that ", + "act:clarify_specific", + "What does \"that\" refer to? Nothing earlier in this conversation names it. Tell me the name" + ] + ] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/cooking-v3-r2/build_nutrition_store_v1.py b/root/specialists/cooking-v3-r2/build_nutrition_store_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..76a7a7cd76e530daad8d55b509f32926f42c3a17 --- /dev/null +++ b/root/specialists/cooking-v3-r2/build_nutrition_store_v1.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python3 +"""build_nutrition_store_v1 - USDA FoodData Central SR Legacy (public domain) -> a compact nutrition store. +foods(fdc_id, description, category); nut(fdc_id, key, amount per 100 g); portions(fdc_id, label, grams). +usage: build_nutrition_store_v1.py """ +import csv +import os +import sqlite3 +import sys + +KEYS = {1008: ("calories", "kcal"), 1003: ("protein", "g"), 1004: ("fat", "g"), 1005: ("carbohydrate", "g"), + 1079: ("fiber", "g"), 2000: ("sugar", "g"), 1093: ("sodium", "mg"), 1087: ("calcium", "mg"), + 1089: ("iron", "mg"), 1162: ("vitamin c", "mg"), 1092: ("potassium", "mg"), 1253: ("cholesterol", "mg"), + 1258: ("saturated fat", "g")} + + +def main(): + src, out = sys.argv[1], sys.argv[2] + if os.path.exists(out): + os.remove(out) + db = sqlite3.connect(out) + db.executescript("""CREATE TABLE foods(fdc_id INTEGER PRIMARY KEY, description TEXT, category TEXT); + CREATE TABLE nut(fdc_id INTEGER, key TEXT, unit TEXT, amount REAL, PRIMARY KEY(fdc_id, key)); + CREATE TABLE portions(fdc_id INTEGER, label TEXT, grams REAL); + CREATE TABLE meta(key TEXT PRIMARY KEY, value TEXT);""") + cats = {r["id"]: r["description"] for r in csv.DictReader(open(os.path.join(src, "food_category.csv"), encoding="utf-8"))} + n = 0 + for r in csv.DictReader(open(os.path.join(src, "food.csv"), encoding="utf-8")): + db.execute("INSERT INTO foods VALUES(?,?,?)", (int(r["fdc_id"]), r["description"], cats.get(r["food_category_id"], ""))) + n += 1 + units = {r["id"]: r["name"] for r in csv.DictReader(open(os.path.join(src, "measure_unit.csv"), encoding="utf-8"))} + m = 0 + for r in csv.DictReader(open(os.path.join(src, "food_nutrient.csv"), encoding="utf-8")): + k = KEYS.get(int(r["nutrient_id"])) + if k and r["amount"] != "": + db.execute("INSERT OR REPLACE INTO nut VALUES(?,?,?,?)", (int(r["fdc_id"]), k[0], k[1], float(r["amount"]))) + m += 1 + p = 0 + for r in csv.DictReader(open(os.path.join(src, "food_portion.csv"), encoding="utf-8")): + try: + g = float(r["gram_weight"]) + except ValueError: + continue + amt = r.get("amount") or "1" + unit = units.get(r.get("measure_unit_id"), "") if r.get("measure_unit_id") not in ("9999", "", None) else "" + label = " ".join(x for x in (amt, unit, r.get("modifier", "")) if x and x != "undetermined").strip() + db.execute("INSERT INTO portions VALUES(?,?,?)", (int(r["fdc_id"]), label, g)) + p += 1 + db.execute("INSERT INTO meta VALUES('source','USDA FoodData Central SR Legacy 2018-04 (public domain)')") + db.execute("CREATE INDEX nut_f ON nut(fdc_id)") + db.execute("CREATE INDEX por_f ON portions(fdc_id)") + db.commit() + db.execute("VACUUM") + print("foods %d | nutrient values %d | portions %d | %.1f MB" % (n, m, p, os.path.getsize(out) / 1e6)) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/cooking-v3-r2/cooking_scorer.py b/root/specialists/cooking-v3-r2/cooking_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..051bf41265322bb1114036ae4b5132629b0965a0 --- /dev/null +++ b/root/specialists/cooking-v3-r2/cooking_scorer.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +"""cooking_scorer - answer identity in the REPLY TEXT: the number the reply states for the nutrient must be within 5% +(or 0.15 absolute, for small values) of the value computed from the target USDA entry. A clarifying question is not an +answer; a must-decline item answered is a false yes. (ok, asserted).""" +import re + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + m = re.search(r"\bhas (\d+(?:\.\d+)?) (?:kcal|g|mg)\b", text) + if not m: + return False, True + got, want = float(m.group(1)), float(p["expect"]) + return abs(got - want) <= max(0.05 * want, 0.15), True diff --git a/root/specialists/cooking-v3-r2/manifest.json b/root/specialists/cooking-v3-r2/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..85ba4fc5c6ddc21a490454d16d71ed81635dd6ac --- /dev/null +++ b/root/specialists/cooking-v3-r2/manifest.json @@ -0,0 +1,74 @@ +{ + "id": "cooking-v3-r2", + "name": "Oracle7 Cooking & Nutrition v3", + "number": 61, + "tier": "A", + "sources": [ + { + "name": "USDA FoodData Central SR Legacy 2018-04", + "licence": "public domain (US government work)", + "url": "https://fdc.nal.usda.gov/" + }, + { + "name": "Project Gutenberg cookbooks (2,533 recipes, already in the core via the conversation organ)", + "licence": "public domain", + "url": "https://www.gutenberg.org/" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/cooking-v3-r2/nutrition_v1.sqlite3" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/cooking-v3-r2", + "module": "organ_cooking_v3_r2", + "class": "NutritionOrganV3Boundary", + "init": { + "db_path": "__ORACLE7_ROOT__/specialists/cooking-v3-r2/nutrition_v1.sqlite3" + } + }, + "accept": { + "kinds": [ + "nutrient" + ], + "declines_in_domain": [ + "unknown_food", + "no_value", + "no_portion", + "clarify" + ], + "context_regex": "\\b(?:\\d+(?:\\.\\d+)?\\s*(?:g|grams?|kg|oz|ounces?|lbs?|pounds?)|a cup of|cups? of|tbsp|tsp|tablespoons?|teaspoons?|servings?|nutrition\\w*|nutrient\\w*)\\b" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/cooking-v3/nutrition_panel_v3.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "cooking_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [ + "calories", + "protein", + "fat", + "carbs", + "fiber", + "sugar", + "sodium", + "vitamin", + "grams of", + "cup of", + "nutrition" + ], + "budgets": { + "latency_p50_ms": 150, + "store_mb": 10 + }, + "core_sample": { + "n": 400, + "seed": 20260928 + }, + "notes": "v3 = v2 + 'What is' restored when frame stripping leaves no question word. Judged under spec_gate_v2 on a FRESH panel (new seeds, new phrasings both splits including the class). Same author - disclosed. Earlier notes: v2 = v1 + one defect-class fix found by v1's held-out verdict: the question frame (contractions, content/amount/level/value, polite frames) leaked into the food name and v1 declined (59 held-out misses, all safe declines). Judged on a FRESH panel v2: seed 6161, a different food partition, new frame-heavy phrasings for both splits, new invented foods. v1's held-out stays sealed. Same author wrote the organ and the fresh phrasings - disclosed. cooking-v3-r2 (2026-09-30): boundary patch - silent on turns with another domain's markers and none of its own (family census).", + "supersedes": "cooking-v2 (ADMIT gate v2, 155/210; misses = 'Can you give me the X content of ...' lost its question word)" +} \ No newline at end of file diff --git a/root/specialists/cooking-v3-r2/narrow_v1.py b/root/specialists/cooking-v3-r2/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/cooking-v3-r2/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/cooking-v3-r2/nutrition_panel_v1.json b/root/specialists/cooking-v3-r2/nutrition_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..e7d2813b449881e0744101201d69fc8fde96be48 --- /dev/null +++ b/root/specialists/cooking-v3-r2/nutrition_panel_v1.json @@ -0,0 +1,4142 @@ +[ + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates is in 2 oz of raw chayote?", + "fdc_id": 170402, + "target": "Chayote, fruit, raw", + "nutrient": "carbohydrate", + "expect": 2.5571 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much sodium is in 150 g of goji berry?", + "fdc_id": 173032, + "target": "Goji berries, dried", + "nutrient": "sodium", + "expect": 447.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much sugar does 2 oz of sauerkraut have?", + "fdc_id": 169279, + "target": "Sauerkraut, canned, solids and liquids", + "nutrient": "sugar", + "expect": 1.0092 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much potassium is in 100 g of dehydrated onion?", + "fdc_id": 170002, + "target": "Onions, dehydrated flakes", + "nutrient": "potassium", + "expect": 1622.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the calcium content of a cup of spanish raw peanut?", + "fdc_id": 174263, + "target": "Peanuts, spanish, raw", + "nutrient": "calcium", + "expect": 154.76 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much iron does 100 g of green raw plantain have?", + "fdc_id": 168215, + "target": "Plantains, green, raw", + "nutrient": "iron", + "expect": 0.75 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Calories in 100 g of tomatillo?", + "fdc_id": 168566, + "target": "Tomatillos, raw", + "nutrient": "calories", + "expect": 32.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much fiber does 2 oz of pomegranate juice have?", + "fdc_id": 167787, + "target": "Pomegranate juice, bottled", + "nutrient": "fiber", + "expect": 0.0567 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much fiber is in 150 g of raw arrowroot?", + "fdc_id": 168490, + "target": "Arrowroot, raw", + "nutrient": "fiber", + "expect": 1.95 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the protein content of 2 oz of mashed home margarine potato?", + "fdc_id": 170037, + "target": "Potatoes, mashed, home-prepared, whole milk and margarine added", + "nutrient": "protein", + "expect": 1.1113 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many iron are in 2 oz of liver raw veal?", + "fdc_id": 172534, + "target": "Veal, variety meats and by-products, liver, raw", + "nutrient": "iron", + "expect": 3.6287 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much protein does 150 g of clam moist mollusk have?", + "fdc_id": 171975, + "target": "Mollusks, clam, mixed species, cooked, moist heat", + "nutrient": "protein", + "expect": 38.325 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much protein is in 100 g of brien home potato?", + "fdc_id": 170498, + "target": "Potatoes, o'brien, home-prepared", + "nutrient": "protein", + "expect": 2.35 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much calories does 150 g of horse cooked game meat have?", + "fdc_id": 175087, + "target": "Game meat, horse, cooked, roasted", + "nutrient": "calories", + "expect": 262.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Sodium in 150 g of ground raw emu?", + "fdc_id": 172832, + "target": "Emu, ground, raw", + "nutrient": "sodium", + "expect": 84.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calories is in 2 oz of poppy spice?", + "fdc_id": 171330, + "target": "Spices, poppy seed", + "nutrient": "calories", + "expect": 297.6697 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the vitamin C in 2 oz of oriental raw radish.", + "fdc_id": 168451, + "target": "Radishes, oriental, raw", + "nutrient": "vitamin c", + "expect": 12.4738 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many sodium are in 150 g of abalone raw mollusk?", + "fdc_id": 174212, + "target": "Mollusks, abalone, mixed species, raw", + "nutrient": "sodium", + "expect": 451.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Iron in 150 g of macadamia dry nut?", + "fdc_id": 168598, + "target": "Nuts, macadamia nuts, dry roasted, with salt added", + "nutrient": "iron", + "expect": 3.975 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Protein in 100 g of sun packed tomato?", + "fdc_id": 169384, + "target": "Tomatoes, sun-dried, packed in oil, drained", + "nutrient": "protein", + "expect": 5.06 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the sugar content of 150 g of white frozen egg?", + "fdc_id": 172203, + "target": "Egg, white, raw, frozen, pasteurized", + "nutrient": "sugar", + "expect": 0.375 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the fat content of 150 g of creamed large cheese?", + "fdc_id": 172179, + "target": "Cheese, cottage, creamed, large or small curd", + "nutrient": "fat", + "expect": 6.45 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Sodium in 150 g of mechanically beef?", + "fdc_id": 168630, + "target": "Beef, variety meats and by-products, mechanically separated beef, raw", + "nutrient": "sodium", + "expect": 85.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many fat are in a cup of skin cooked goose?", + "fdc_id": 172412, + "target": "Goose, domesticated, meat and skin, cooked, roasted", + "nutrient": "fat", + "expect": 30.688 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much iron does 2 oz of balsamic vinegar have?", + "fdc_id": 172241, + "target": "Vinegar, balsamic", + "nutrient": "iron", + "expect": 0.4082 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the fiber content of 100 g of white radish?", + "fdc_id": 170081, + "target": "Radishes, white icicle, raw", + "nutrient": "fiber", + "expect": 1.4 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much sodium does 150 g of english nut have?", + "fdc_id": 170187, + "target": "Nuts, walnuts, english", + "nutrient": "sodium", + "expect": 3.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the sugar in 100 g of heavy cream.", + "fdc_id": 170859, + "target": "Cream, fluid, heavy whipping", + "nutrient": "sugar", + "expect": 2.92 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the sodium content of 150 g of stick fish?", + "fdc_id": 174195, + "target": "Fish, fish sticks, frozen, prepared", + "nutrient": "sodium", + "expect": 603.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many carbohydrates are in 100 g of store cake?", + "fdc_id": 174934, + "target": "Cake, chocolate, commercially prepared with chocolate frosting, in-store bakery", + "nutrient": "carbohydrate", + "expect": 52.84 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much sodium does 2 oz of sablefish smoked fish have?", + "fdc_id": 173685, + "target": "Fish, sablefish, smoked", + "nutrient": "sodium", + "expect": 417.8716 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the fat content of 100 g of scup cooked fish?", + "fdc_id": 174241, + "target": "Fish, scup, cooked, dry heat", + "nutrient": "fat", + "expect": 3.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the calories in 2 oz of medjool date.", + "fdc_id": 168191, + "target": "Dates, medjool", + "nutrient": "calories", + "expect": 157.0562 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the calories in 150 g of vegetable dry macaroni.", + "fdc_id": 168903, + "target": "Macaroni, vegetable, enriched, dry", + "nutrient": "calories", + "expect": 550.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much vitamin C is in 150 g of chilled orange juice?", + "fdc_id": 169920, + "target": "Orange juice, chilled, includes from concentrate, with added calcium", + "nutrient": "vitamin c", + "expect": 50.4 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the calcium in a cup of whole stabilized egg.", + "fdc_id": 173425, + "target": "Egg, whole, dried, stabilized, glucose reduced", + "nutrient": "calcium", + "expect": 188.7 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the sodium content of 2 oz of raw watermelon?", + "fdc_id": 167765, + "target": "Watermelon, raw", + "nutrient": "sodium", + "expect": 0.567 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the calories content of 2 oz of roughy cooked fish?", + "fdc_id": 174251, + "target": "Fish, roughy, orange, cooked, dry heat", + "nutrient": "calories", + "expect": 59.5339 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the calories content of 2 oz of liquid mollusk?", + "fdc_id": 171977, + "target": "Mollusks, clam, mixed species, canned, liquid", + "nutrient": "calories", + "expect": 1.134 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the fat content of 150 g of liquid sweet potato?", + "fdc_id": 170083, + "target": "Sweet potato, canned, syrup pack, solids and liquids", + "nutrient": "fat", + "expect": 0.3 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much protein does 2 oz of dry pie crust have?", + "fdc_id": 175023, + "target": "Pie crust, standard-type, dry mix, prepared, baked", + "nutrient": "protein", + "expect": 3.7988 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the calcium content of 100 g of cisco raw fish?", + "fdc_id": 171953, + "target": "Fish, cisco, raw", + "nutrient": "calcium", + "expect": 12.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much sugar does a cup of red pear have?", + "fdc_id": 167777, + "target": "Pears, raw, red anjou", + "nutrient": "sugar", + "expect": 13.356 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many potassium are in 2 oz of cottage vegetable cheese?", + "fdc_id": 167716, + "target": "Cheese, cottage, lowfat, 1% milkfat, with vegetables", + "nutrient": "potassium", + "expect": 48.7611 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much sodium does 150 g of raw mothbean have?", + "fdc_id": 172425, + "target": "Mothbeans, mature seeds, raw", + "nutrient": "sodium", + "expect": 45.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the fat in 100 g of cooked drumstick leave.", + "fdc_id": 168417, + "target": "Drumstick leaves, cooked, boiled, drained, without salt", + "nutrient": "fat", + "expect": 0.93 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much sugar is in 2 oz of low soy flour?", + "fdc_id": 172444, + "target": "Soy flour, low-fat", + "nutrient": "sugar", + "expect": 5.29 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the carbohydrates in 100 g of all wheat flour.", + "fdc_id": 168895, + "target": "Wheat flour, white, all-purpose, self-rising, enriched", + "nutrient": "carbohydrate", + "expect": 74.22 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Carbohydrates in 2 oz of raw lambsquarter?", + "fdc_id": 169244, + "target": "Lambsquarters, raw", + "nutrient": "carbohydrate", + "expect": 4.139 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the iron in 100 g of glutinou cooked rice.", + "fdc_id": 169711, + "target": "Rice, white, glutinous, unenriched, cooked", + "nutrient": "iron", + "expect": 0.14 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the iron in 150 g of farmed raw crustacean.", + "fdc_id": 175169, + "target": "Crustaceans, crayfish, mixed species, farmed, raw", + "nutrient": "iron", + "expect": 0.825 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the iron content of 100 g of green turtle?", + "fdc_id": 167745, + "target": "Turtle, green, raw", + "nutrient": "iron", + "expect": 1.4 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many fat are in a cup of degermed cornmeal?", + "fdc_id": 168870, + "target": "Cornmeal, yellow, self-rising, degermed, enriched", + "nutrient": "fat", + "expect": 2.3736 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many sodium are in 100 g of variety yogurt?", + "fdc_id": 169898, + "target": "Yogurt, fruit variety, nonfat", + "nutrient": "sodium", + "expect": 58.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much potassium is in a cup of mature salted soybean?", + "fdc_id": 172440, + "target": "Soybeans, mature seeds, roasted, salted", + "nutrient": "potassium", + "expect": 2528.4 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Sodium in 100 g of calcium grapefruit juice?", + "fdc_id": 173038, + "target": "Grapefruit juice, pink or red, with added calcium", + "nutrient": "sodium", + "expect": 2.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much sodium does 2 oz of intermuscular raw beef have?", + "fdc_id": 173083, + "target": "Beef, New Zealand, imported, intermuscular fat, raw", + "nutrient": "sodium", + "expect": 18.1437 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much protein does 2 oz of margarine cooky have?", + "fdc_id": 174955, + "target": "Cookies, chocolate chip, prepared from recipe, made with margarine", + "nutrient": "protein", + "expect": 3.2318 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calories is in 150 g of fenugreek spice?", + "fdc_id": 171324, + "target": "Spices, fenugreek seed", + "nutrient": "calories", + "expect": 484.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much protein does 150 g of dry prepared muffin have?", + "fdc_id": 175003, + "target": "Muffins, corn, dry mix, prepared", + "nutrient": "protein", + "expect": 11.1 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates is in 150 g of seeded raisin?", + "fdc_id": 168166, + "target": "Raisins, seeded", + "nutrient": "carbohydrate", + "expect": 117.705 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the sodium content of 150 g of fig cooky?", + "fdc_id": 172721, + "target": "Cookies, fig bars", + "nutrient": "sodium", + "expect": 525.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many fat are in a cup of dried uncooked peach?", + "fdc_id": 169934, + "target": "Peaches, dried, sulfured, uncooked", + "nutrient": "fat", + "expect": 1.216 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Fiber in a cup of pod bean?", + "fdc_id": 168574, + "target": "Beans, fava, in pod, raw", + "nutrient": "fiber", + "expect": 9.45 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many calories are in 100 g of flat emu?", + "fdc_id": 174478, + "target": "Emu, flat fillet, raw", + "nutrient": "calories", + "expect": 102.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Iron in 100 g of sprouted raw pea?", + "fdc_id": 170422, + "target": "Peas, mature seeds, sprouted, raw", + "nutrient": "iron", + "expect": 2.26 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the sodium in 100 g of raw ginger root.", + "fdc_id": 169231, + "target": "Ginger root, raw", + "nutrient": "sodium", + "expect": 13.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the carbohydrates in 2 oz of raw turnip green.", + "fdc_id": 170061, + "target": "Turnip greens, raw", + "nutrient": "carbohydrate", + "expect": 4.0426 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calcium is in 150 g of crude wheat bran?", + "fdc_id": 169722, + "target": "Wheat bran, crude", + "nutrient": "calcium", + "expect": 109.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the iron content of 100 g of chocolate sugared doughnut?", + "fdc_id": 174993, + "target": "Doughnuts, cake-type, chocolate, sugared or glazed", + "nutrient": "iron", + "expect": 2.27 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the calcium in 100 g of quince.", + "fdc_id": 168163, + "target": "Quinces, raw", + "nutrient": "calcium", + "expect": 11.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the sodium in a cup of dried radish.", + "fdc_id": 168453, + "target": "Radishes, oriental, dried", + "nutrient": "sodium", + "expect": 322.48 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many protein are in 2 oz of dried persimmon?", + "fdc_id": 169942, + "target": "Persimmons, japanese, dried", + "nutrient": "protein", + "expect": 0.7824 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the calcium in 100 g of salt tortilla.", + "fdc_id": 173241, + "target": "Tortillas, ready-to-bake or -fry, corn, without added salt", + "nutrient": "calcium", + "expect": 175.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the carbohydrates content of 100 g of crushed tomato?", + "fdc_id": 170501, + "target": "Tomatoes, crushed, canned", + "nutrient": "carbohydrate", + "expect": 7.29 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates does 150 g of european currant have?", + "fdc_id": 173963, + "target": "Currants, european black, raw", + "nutrient": "carbohydrate", + "expect": 23.07 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the carbohydrates in 2 oz of gluten lemon cooky.", + "fdc_id": 171859, + "target": "Cookies, gluten-free, lemon wafer", + "nutrient": "carbohydrate", + "expect": 42.1784 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the protein in 150 g of white california grapefruit.", + "fdc_id": 174677, + "target": "Grapefruit, raw, white, California", + "nutrient": "protein", + "expect": 1.32 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Calcium in 100 g of refrigerated unbaked pie crust?", + "fdc_id": 167932, + "target": "Pie crust, refrigerated, regular, unbaked", + "nutrient": "calcium", + "expect": 10.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the fat in 100 g of cos lettuce.", + "fdc_id": 169247, + "target": "Lettuce, cos or romaine, raw", + "nutrient": "fat", + "expect": 0.3 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the calories in 100 g of mackerel canned fish.", + "fdc_id": 175121, + "target": "Fish, mackerel, jack, canned, drained solids", + "nutrient": "calories", + "expect": 156.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the sodium content of 100 g of fordhook unprepared lima bean?", + "fdc_id": 169953, + "target": "Lima beans, immature seeds, frozen, fordhook, unprepared", + "nutrient": "sodium", + "expect": 58.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the fat in 100 g of asadero cheese.", + "fdc_id": 173437, + "target": "Cheese, mexican, queso asadero", + "nutrient": "fat", + "expect": 25.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the vitamin C content of 150 g of pecan dry nut?", + "fdc_id": 170183, + "target": "Nuts, pecans, dry roasted, without salt added", + "nutrient": "vitamin c", + "expect": 1.05 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many carbohydrates are in 100 g of triticale?", + "fdc_id": 169718, + "target": "Triticale", + "nutrient": "carbohydrate", + "expect": 72.13 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much fiber is in a cup of enoki mushroom?", + "fdc_id": 169382, + "target": "Mushrooms, enoki, raw", + "nutrient": "fiber", + "expect": 1.728 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many fiber are in 2 oz of sour raw cherry?", + "fdc_id": 173954, + "target": "Cherries, sour, red, raw", + "nutrient": "fiber", + "expect": 0.9072 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much iron is in 150 g of shiitake raw mushroom?", + "fdc_id": 169242, + "target": "Mushrooms, shiitake, raw", + "nutrient": "iron", + "expect": 0.615 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many protein are in 100 g of seco cheese?", + "fdc_id": 172222, + "target": "Cheese, dry white, queso seco", + "nutrient": "protein", + "expect": 24.51 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much vitamin C does a cup of spanish tomato product have?", + "fdc_id": 170085, + "target": "Tomato products, canned, sauce, spanish style", + "nutrient": "vitamin c", + "expect": 20.984 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the protein in 100 g of prepared hush puppy.", + "fdc_id": 174999, + "target": "Hush puppies, prepared from recipe", + "nutrient": "protein", + "expect": 7.7 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much vitamin C is in 150 g of uncooked rhubarb?", + "fdc_id": 168168, + "target": "Rhubarb, frozen, uncooked", + "nutrient": "vitamin c", + "expect": 7.2 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many sodium are in 150 g of new kidney raw lamb?", + "fdc_id": 174442, + "target": "Lamb, New Zealand, imported, kidney, raw", + "nutrient": "sodium", + "expect": 252.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many potassium are in 100 g of added guava nectar?", + "fdc_id": 167784, + "target": "Guava nectar, canned, with added ascorbic acid", + "nutrient": "potassium", + "expect": 39.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many calcium are in 2 oz of amaranth leave?", + "fdc_id": 169202, + "target": "Amaranth leaves, cooked, boiled, drained, without salt", + "nutrient": "calcium", + "expect": 118.5009 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many iron are in 100 g of agar raw seaweed?", + "fdc_id": 169280, + "target": "Seaweed, agar, raw", + "nutrient": "iron", + "expect": 1.86 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Sugar in a cup of unenriched rice flour?", + "fdc_id": 169714, + "target": "Rice flour, white, unenriched", + "nutrient": "sugar", + "expect": 0.1896 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the protein in 2 oz of coffeecake cheese cake.", + "fdc_id": 172699, + "target": "Cake, coffeecake, cheese", + "nutrient": "protein", + "expect": 3.9689 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much potassium is in 150 g of unprepared cauliflower?", + "fdc_id": 170398, + "target": "Cauliflower, frozen, unprepared", + "nutrient": "potassium", + "expect": 289.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the potassium content of 100 g of feet chicken?", + "fdc_id": 171119, + "target": "Chicken, feet, boiled", + "nutrient": "potassium", + "expect": 31.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the fiber in a cup of canned drained vegetable.", + "fdc_id": 170065, + "target": "Vegetables, mixed, canned, drained solids", + "nutrient": "fiber", + "expect": 4.89 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many iron are in 150 g of coffeecake creme cake?", + "fdc_id": 174936, + "target": "Cake, coffeecake, creme-filled with chocolate frosting", + "nutrient": "iron", + "expect": 0.765 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the sugar content of 100 g of reduced wheat bread?", + "fdc_id": 174921, + "target": "Bread, reduced-calorie, wheat", + "nutrient": "sugar", + "expect": 3.71 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the fiber in 150 g of sweetened cranberry sauce.", + "fdc_id": 173961, + "target": "Cranberry sauce, canned, sweetened", + "nutrient": "fiber", + "expect": 1.65 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many carbohydrates are in 150 g of chervil spice?", + "fdc_id": 171318, + "target": "Spices, chervil, dried", + "nutrient": "carbohydrate", + "expect": 73.65 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calories is in 2 oz of unprepared onion ring?", + "fdc_id": 170414, + "target": "Onion rings, breaded, par fried, frozen, unprepared", + "nutrient": "calories", + "expect": 146.2834 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much potassium is in 100 g of sirloin fat raw veal?", + "fdc_id": 175286, + "target": "Veal, sirloin, separable lean and fat, raw", + "nutrient": "potassium", + "expect": 329.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much protein does 2 oz of wild raw game meat have?", + "fdc_id": 174347, + "target": "Game meat, rabbit, wild, raw", + "nutrient": "protein", + "expect": 12.3547 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Carbohydrates in 100 g of raw litchi?", + "fdc_id": 169086, + "target": "Litchis, raw", + "nutrient": "carbohydrate", + "expect": 16.53 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many iron are in 150 g of snackwell nabisco?", + "fdc_id": 167924, + "target": "Nabisco, Nabisco Snackwell's Fat Free Devil's Food Cookie Cakes", + "nutrient": "iron", + "expect": 4.17 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the fat in 2 oz of clove spice.", + "fdc_id": 171321, + "target": "Spices, cloves, ground", + "nutrient": "fat", + "expect": 7.3709 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the carbohydrates in a cup of uncooked fig.", + "fdc_id": 174665, + "target": "Figs, dried, uncooked", + "nutrient": "carbohydrate", + "expect": 95.1663 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Calories in 2 oz of wheat sandwich cracker?", + "fdc_id": 172748, + "target": "Crackers, wheat, sandwich, with peanut butter filling", + "nutrient": "calories", + "expect": 280.66 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many fat are in 150 g of frozen fiddlehead fern?", + "fdc_id": 168584, + "target": "Fiddlehead ferns, frozen, unprepared", + "nutrient": "fat", + "expect": 0.525 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many vitamin C are in 100 g of seedless raspberry?", + "fdc_id": 167808, + "target": "Raspberries, puree, seedless", + "nutrient": "vitamin c", + "expect": 6.4 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many protein are in 2 oz of drained sweet potato?", + "fdc_id": 170084, + "target": "Sweet potato, canned, syrup pack, drained solids", + "nutrient": "protein", + "expect": 0.7257 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the protein in a cup of poi.", + "fdc_id": 170431, + "target": "Poi", + "nutrient": "protein", + "expect": 0.912 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many protein are in 150 g of chinese jujube?", + "fdc_id": 168152, + "target": "Jujube, Chinese, fresh, dried", + "nutrient": "protein", + "expect": 7.08 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the potassium content of 150 g of semisoft cheese?", + "fdc_id": 173433, + "target": "Cheese, goat, semisoft type", + "nutrient": "potassium", + "expect": 237.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the iron in 2 oz of naan whole bread.", + "fdc_id": 174077, + "target": "Bread, naan, whole wheat, commercially prepared, refrigerated", + "nutrient": "iron", + "expect": 0.9809 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Fat in 100 g of ritz nabisco?", + "fdc_id": 173258, + "target": "Nabisco, Nabisco Ritz Crackers", + "nutrient": "fat", + "expect": 23.21 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much protein is in a cup of all dry peanut?", + "fdc_id": 173806, + "target": "Peanuts, all types, dry-roasted, without salt", + "nutrient": "protein", + "expect": 35.551 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates is in 2 oz of white canned bean?", + "fdc_id": 175204, + "target": "Beans, white, mature seeds, canned", + "nutrient": "carbohydrate", + "expect": 12.0202 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the calories in 100 g of uncooked pear.", + "fdc_id": 169121, + "target": "Pears, dried, sulfured, uncooked", + "nutrient": "calories", + "expect": 262.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much sugar does 2 oz of dark whole raw turkey have?", + "fdc_id": 174509, + "target": "Turkey, dark meat from whole, meat and skin, with added solution, raw", + "nutrient": "sugar", + "expect": 0.0567 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Fiber in 150 g of baby carrot?", + "fdc_id": 168568, + "target": "Carrots, baby, raw", + "nutrient": "fiber", + "expect": 4.35 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the calories content of 100 g of petite raw pork?", + "fdc_id": 168369, + "target": "Pork, Shoulder petite tender, boneless, separable lean and fat, raw", + "nutrient": "calories", + "expect": 128.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the calcium content of 2 oz of bluefish raw fish?", + "fdc_id": 171949, + "target": "Fish, bluefish, raw", + "nutrient": "calcium", + "expect": 3.9689 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Potassium in a cup of steamed rice?", + "fdc_id": 169712, + "target": "Rice, white, steamed, Chinese restaurant", + "nutrient": "potassium", + "expect": 26.4 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many potassium are in 150 g of acorn raw squash?", + "fdc_id": 168472, + "target": "Squash, winter, acorn, raw", + "nutrient": "potassium", + "expect": 520.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many calories are in 150 g of cooked mothbean?", + "fdc_id": 172426, + "target": "Mothbeans, mature seeds, cooked, boiled, without salt", + "nutrient": "calories", + "expect": 175.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much sugar does 100 g of shiitake cooked mushroom have?", + "fdc_id": 170097, + "target": "Mushrooms, shiitake, cooked, with salt", + "nutrient": "sugar", + "expect": 3.84 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Calcium in 100 g of muscadine grape?", + "fdc_id": 173040, + "target": "Grapes, muscadine, raw", + "nutrient": "calcium", + "expect": 37.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much calcium does 2 oz of vanilla lemon yogurt have?", + "fdc_id": 173445, + "target": "Yogurt, vanilla or lemon flavor, nonfat milk, sweetened with low-calorie sweetener", + "nutrient": "calcium", + "expect": 81.0796 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the potassium in 150 g of cured unprepared pork.", + "fdc_id": 168277, + "target": "Pork, cured, bacon, unprepared", + "nutrient": "potassium", + "expect": 301.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many fiber are in 2 oz of matzo whole cracker?", + "fdc_id": 172742, + "target": "Crackers, matzo, whole-wheat", + "nutrient": "fiber", + "expect": 6.6905 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates is in 150 g of undiluted grapefruit juice?", + "fdc_id": 174680, + "target": "Grapefruit juice, white, frozen concentrate, unsweetened, undiluted", + "nutrient": "carbohydrate", + "expect": 51.84 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the sodium in 100 g of mace spice.", + "fdc_id": 170927, + "target": "Spices, mace, ground", + "nutrient": "sodium", + "expect": 80.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calories is in 150 g of canned raspberry?", + "fdc_id": 167756, + "target": "Raspberries, canned, red, heavy syrup pack, solids and liquids", + "nutrient": "calories", + "expect": 136.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many potassium are in 2 oz of mullet cooked fish?", + "fdc_id": 175124, + "target": "Fish, mullet, striped, cooked, dry heat", + "nutrient": "potassium", + "expect": 259.6814 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much fiber does 150 g of extra plum have?", + "fdc_id": 169133, + "target": "Plums, canned, purple, extra heavy syrup pack, solids and liquids", + "nutrient": "fiber", + "expect": 1.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many fat are in a cup of shrimp canned crustacean?", + "fdc_id": 171972, + "target": "Crustaceans, shrimp, mixed species, canned", + "nutrient": "fat", + "expect": 1.7408 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the protein in a cup of canned hominy.", + "fdc_id": 169701, + "target": "Hominy, canned, white", + "nutrient": "protein", + "expect": 2.442 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much potassium does 2 oz of taro shoot have?", + "fdc_id": 169309, + "target": "Taro shoots, cooked, without salt", + "nutrient": "potassium", + "expect": 195.0446 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much potassium does 150 g of pasilla pepper have?", + "fdc_id": 168579, + "target": "Peppers, pasilla, dried", + "nutrient": "potassium", + "expect": 3333.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Iron in 2 oz of peanut from cooky?", + "fdc_id": 174964, + "target": "Cookies, peanut butter, prepared from recipe", + "nutrient": "iron", + "expect": 1.2644 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much iron does 2 oz of broiled veal have?", + "fdc_id": 175291, + "target": "Veal, ground, cooked, broiled", + "nutrient": "iron", + "expect": 0.5613 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates does 150 g of coated doughnut have?", + "fdc_id": 174991, + "target": "Doughnuts, cake-type, plain, chocolate-coated or frosted", + "nutrient": "carbohydrate", + "expect": 76.995 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Fiber in 150 g of mashed water potato?", + "fdc_id": 170042, + "target": "Potatoes, mashed, dehydrated, prepared from granules with milk, water and margarine added", + "nutrient": "fiber", + "expect": 1.95 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much calories does 2 oz of blueberry toasted muffin have?", + "fdc_id": 175045, + "target": "Muffins, blueberry, toaster-type, toasted", + "nutrient": "calories", + "expect": 188.8077 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much calcium does a cup of navy sprouted raw bean have?", + "fdc_id": 169139, + "target": "Beans, navy, mature seeds, sprouted, raw", + "nutrient": "calcium", + "expect": 15.6 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many fat are in 150 g of frozen brussel sprout?", + "fdc_id": 169972, + "target": "Brussels sprouts, frozen, unprepared", + "nutrient": "fat", + "expect": 0.615 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calcium is in 2 oz of variety tongue raw lamb?", + "fdc_id": 174366, + "target": "Lamb, variety meats and by-products, tongue, raw", + "nutrient": "calcium", + "expect": 5.1029 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the sodium in 150 g of herring atlantic cooked fish.", + "fdc_id": 175117, + "target": "Fish, herring, Atlantic, cooked, dry heat", + "nutrient": "sodium", + "expect": 172.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the sodium in 100 g of yellow microwaved corn.", + "fdc_id": 169217, + "target": "Corn, yellow, whole kernel, frozen, microwaved", + "nutrient": "sodium", + "expect": 4.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many fiber are in a cup of almond dry nut?", + "fdc_id": 170158, + "target": "Nuts, almonds, dry roasted, without salt added", + "nutrient": "fiber", + "expect": 15.042 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates is in 150 g of pacific cooked mollusk?", + "fdc_id": 174250, + "target": "Mollusks, oyster, Pacific, cooked, moist heat", + "nutrient": "carbohydrate", + "expect": 14.85 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Iron in 150 g of gluten whole roll?", + "fdc_id": 171864, + "target": "Rolls, gluten-free, whole grain, made with tapioca starch and brown rice flour", + "nutrient": "iron", + "expect": 2.46 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many fat are in a cup of sweet fluid whey?", + "fdc_id": 171282, + "target": "Whey, sweet, fluid", + "nutrient": "fat", + "expect": 0.8856 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the carbohydrates in 150 g of white toasted bread.", + "fdc_id": 174925, + "target": "Bread, white, commercially prepared, toasted", + "nutrient": "carbohydrate", + "expect": 81.75 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much potassium is in 150 g of cooked macaroni?", + "fdc_id": 168904, + "target": "Macaroni, vegetable, enriched, cooked", + "nutrient": "potassium", + "expect": 46.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the protein content of 150 g of bacon bit?", + "fdc_id": 169893, + "target": "Bacon bits, meatless", + "nutrient": "protein", + "expect": 48.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much fiber does a cup of raw parsnip have?", + "fdc_id": 170417, + "target": "Parsnips, raw", + "nutrient": "fiber", + "expect": 6.517 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the sugar in a cup of flat noodle.", + "fdc_id": 169735, + "target": "Noodles, flat, crunchy, Chinese restaurant", + "nutrient": "sugar", + "expect": 0.1125 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many protein are in 150 g of celery spice?", + "fdc_id": 170920, + "target": "Spices, celery seed", + "nutrient": "protein", + "expect": 27.105 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates does a cup of mature cooked winged bean have?", + "fdc_id": 172477, + "target": "Winged beans, mature seeds, cooked, boiled, with salt", + "nutrient": "carbohydrate", + "expect": 25.6968 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much potassium does 100 g of peel cucumber have?", + "fdc_id": 168409, + "target": "Cucumber, with peel, raw", + "nutrient": "potassium", + "expect": 147.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much protein is in 150 g of raw lotu root?", + "fdc_id": 169250, + "target": "Lotus root, raw", + "nutrient": "protein", + "expect": 3.9 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Fiber in 2 oz of standard unbaked pie crust?", + "fdc_id": 172814, + "target": "Pie crust, standard-type, prepared from recipe, unbaked", + "nutrient": "fiber", + "expect": 1.9278 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much iron does 100 g of cooked sesbania flower have?", + "fdc_id": 169281, + "target": "Sesbania flower, cooked, steamed, without salt", + "nutrient": "iron", + "expect": 0.56 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the sodium content of 2 oz of port cheese?", + "fdc_id": 170849, + "target": "Cheese, port de salut", + "nutrient": "sodium", + "expect": 302.7727 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many fat are in 2 oz of squirrel cooked game meat?", + "fdc_id": 172524, + "target": "Game meat, squirrel, cooked, roasted", + "nutrient": "fat", + "expect": 2.6592 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much potassium is in 150 g of golden raisin?", + "fdc_id": 168164, + "target": "Raisins, golden, seedless", + "nutrient": "potassium", + "expect": 1119.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the calcium content of 150 g of leg only raw chicken?", + "fdc_id": 173619, + "target": "Chicken, broilers or fryers, leg, meat only, raw", + "nutrient": "calcium", + "expect": 15.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the vitamin C content of a cup of oil seed?", + "fdc_id": 168593, + "target": "Seeds, sunflower seed kernels, oil roasted, with salt added", + "nutrient": "vitamin c", + "expect": 1.485 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the calories content of 2 oz of cooked arrowhead?", + "fdc_id": 168493, + "target": "Arrowhead, cooked, boiled, drained, with salt", + "nutrient": "calories", + "expect": 44.2252 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many potassium are in a cup of rye grain?", + "fdc_id": 168884, + "target": "Rye grain", + "nutrient": "potassium", + "expect": 861.9 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many fat are in 100 g of opossum game meat?", + "fdc_id": 172520, + "target": "Game meat, opossum, cooked, roasted", + "nutrient": "fat", + "expect": 10.2 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the vitamin C in 100 g of arugula.", + "fdc_id": 169387, + "target": "Arugula, raw", + "nutrient": "vitamin c", + "expect": 15.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many fiber are in 150 g of gingersnap cooky?", + "fdc_id": 174956, + "target": "Cookies, gingersnaps", + "nutrient": "fiber", + "expect": 3.3 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many calories are in 100 g of almond honey nut?", + "fdc_id": 168592, + "target": "Nuts, almonds, honey roasted, unblanched", + "nutrient": "calories", + "expect": 594.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much potassium is in 2 oz of ginkgo raw nut?", + "fdc_id": 170584, + "target": "Nuts, ginkgo nuts, raw", + "nutrient": "potassium", + "expect": 289.1649 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much potassium does 2 oz of bread wheat flour have?", + "fdc_id": 168913, + "target": "Wheat flours, bread, unenriched", + "nutrient": "potassium", + "expect": 56.699 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Fiber in 2 oz of nonfat bread?", + "fdc_id": 174926, + "target": "Bread, white, prepared from recipe, made with nonfat dry milk", + "nutrient": "fiber", + "expect": 1.134 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much sodium does 100 g of cooked wild rice have?", + "fdc_id": 168897, + "target": "Wild rice, cooked", + "nutrient": "sodium", + "expect": 3.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Vitamin C in 2 oz of moose raw game meat?", + "fdc_id": 174344, + "target": "Game meat, moose, raw", + "nutrient": "vitamin c", + "expect": 2.268 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the iron content of 2 oz of abalone cooked mollusk?", + "fdc_id": 174213, + "target": "Mollusks, abalone, mixed species, cooked, fried", + "nutrient": "iron", + "expect": 2.1546 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much potassium does 2 oz of cornish cooked chicken have?", + "fdc_id": 171109, + "target": "Chicken, cornish game hens, meat only, cooked, roasted", + "nutrient": "potassium", + "expect": 141.7475 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the calcium content of 2 oz of tail raw pork?", + "fdc_id": 168291, + "target": "Pork, fresh, variety meats and by-products, tail, raw", + "nutrient": "calcium", + "expect": 10.2058 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the iron content of 100 g of clementine?", + "fdc_id": 168195, + "target": "Clementines, raw", + "nutrient": "iron", + "expect": 0.14 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Sodium in 100 g of extra cooky?", + "fdc_id": 172720, + "target": "Cookies, chocolate sandwich, with extra creme filling", + "nutrient": "sodium", + "expect": 351.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much calcium does 150 g of ginkgo dried nut have?", + "fdc_id": 170175, + "target": "Nuts, ginkgo nuts, dried", + "nutrient": "calcium", + "expect": 30.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much iron does 150 g of raw drumstick pod have?", + "fdc_id": 170483, + "target": "Drumstick pods, raw", + "nutrient": "iron", + "expect": 0.54 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much fat is in 100 g of cooked pumpkin leave?", + "fdc_id": 170120, + "target": "Pumpkin leaves, cooked, boiled, drained, with salt", + "nutrient": "fat", + "expect": 0.22 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the iron content of 100 g of mature boiled soybean?", + "fdc_id": 174299, + "target": "Soybeans, mature seeds, cooked, boiled, with salt", + "nutrient": "iron", + "expect": 5.14 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much protein does 100 g of raw lupin have?", + "fdc_id": 172423, + "target": "Lupins, mature seeds, raw", + "nutrient": "protein", + "expect": 36.17 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much iron is in 100 g of raw chive?", + "fdc_id": 169994, + "target": "Chives, raw", + "nutrient": "iron", + "expect": 1.6 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much sodium is in 2 oz of skin simmered chicken?", + "fdc_id": 173622, + "target": "Chicken, broilers or fryers, neck, meat and skin, cooked simmered", + "nutrient": "sodium", + "expect": 29.4835 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the calories content of a cup of broth turkey?", + "fdc_id": 171101, + "target": "Turkey, canned, meat only, with broth", + "nutrient": "calories", + "expect": 228.15 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Calories in 100 g of cooked spelt?", + "fdc_id": 169746, + "target": "Spelt, cooked", + "nutrient": "calories", + "expect": 127.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much potassium does 100 g of almond butter nut have?", + "fdc_id": 168603, + "target": "Nuts, almond butter, plain, with salt added", + "nutrient": "potassium", + "expect": 748.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the fat in 150 g of meatless sausage.", + "fdc_id": 174269, + "target": "Sausage, meatless", + "nutrient": "fat", + "expect": 27.24 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many calories are in 100 g of neufchatel cheese?", + "fdc_id": 171246, + "target": "Cheese, neufchatel", + "nutrient": "calories", + "expect": 253.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much iron is in 100 g of royal raw bean?", + "fdc_id": 175196, + "target": "Beans, kidney, royal red, mature seeds, raw", + "nutrient": "iron", + "expect": 8.7 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many calcium are in 150 g of pasteurized low fat cheese?", + "fdc_id": 169080, + "target": "Cheese, pasteurized process, American, low fat", + "nutrient": "calcium", + "expect": 1026.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many iron are in 100 g of mature lentil?", + "fdc_id": 175254, + "target": "Lentils, mature seeds, cooked, boiled, with salt", + "nutrient": "iron", + "expect": 3.33 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much iron does 100 g of coconut cookie have?", + "fdc_id": 171835, + "target": "Cookie, vanilla with caramel, coconut, and chocolate coating", + "nutrient": "iron", + "expect": 3.2 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Vitamin C in 150 g of cashew oil nut?", + "fdc_id": 169422, + "target": "Nuts, cashew nuts, oil roasted, with salt added", + "nutrient": "vitamin c", + "expect": 0.45 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much calories does 150 g of composite only cooked veal have?", + "fdc_id": 175265, + "target": "Veal, composite of trimmed retail cuts, separable lean only, cooked", + "nutrient": "calories", + "expect": 294.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the fiber in 2 oz of chocolate unfortified soymilk.", + "fdc_id": 174293, + "target": "Soymilk, chocolate, unfortified", + "nutrient": "fiber", + "expect": 0.2268 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Fat in 2 oz of tamarind nectar?", + "fdc_id": 167786, + "target": "Tamarind nectar, canned", + "nutrient": "fat", + "expect": 0.068 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates is in 100 g of mission food?", + "fdc_id": 175082, + "target": "Mission Foods, Mission Flour Tortillas, Soft Taco, 8 inch", + "nutrient": "carbohydrate", + "expect": 49.6 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the sodium content of 100 g of raw borage?", + "fdc_id": 170481, + "target": "Borage, raw", + "nutrient": "sodium", + "expect": 80.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the vitamin C in 100 g of brain raw veal.", + "fdc_id": 174351, + "target": "Veal, variety meats and by-products, brain, raw", + "nutrient": "vitamin c", + "expect": 14.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much potassium does 150 g of diluted grapefruit juice have?", + "fdc_id": 174681, + "target": "Grapefruit juice, white, frozen concentrate, unsweetened, diluted with 3 volume water", + "nutrient": "potassium", + "expect": 204.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much iron does 100 g of for select raw beef have?", + "fdc_id": 170809, + "target": "Beef, chuck for stew, separable lean and fat, select, raw", + "nutrient": "iron", + "expect": 2.2 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much iron does 150 g of cooked salt tomato have?", + "fdc_id": 170137, + "target": "Tomatoes, red, ripe, cooked, with salt", + "nutrient": "iron", + "expect": 1.02 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much sodium is in a cup of straw mushroom?", + "fdc_id": 168582, + "target": "Mushrooms, straw, canned, drained solids", + "nutrient": "sodium", + "expect": 698.88 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much potassium does 100 g of boiled cauliflower have?", + "fdc_id": 170397, + "target": "Cauliflower, cooked, boiled, drained, without salt", + "nutrient": "potassium", + "expect": 142.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the sodium content of 150 g of teste lamb?", + "fdc_id": 172619, + "target": "Lamb, New Zealand, imported, testes, raw", + "nutrient": "sodium", + "expect": 178.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the iron content of 2 oz of stewed bean?", + "fdc_id": 169885, + "target": "Beans, liquid from stewed kidney beans", + "nutrient": "iron", + "expect": 1.1113 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the calories content of a cup of swiss low fat cheese?", + "fdc_id": 168141, + "target": "Cheese, swiss, low fat", + "nutrient": "calories", + "expect": 236.28 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many calories are in 100 g of cherry commercially pie?", + "fdc_id": 172780, + "target": "Pie, cherry, commercially prepared", + "nutrient": "calories", + "expect": 260.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much sugar does 2 oz of canned apple juice have?", + "fdc_id": 173933, + "target": "Apple juice, canned or bottled, unsweetened, without added ascorbic acid", + "nutrient": "sugar", + "expect": 5.4544 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the iron in a cup of all avocado.", + "fdc_id": 171705, + "target": "Avocados, raw, all commercial varieties", + "nutrient": "iron", + "expect": 0.825 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Calcium in 100 g of chicory green?", + "fdc_id": 169992, + "target": "Chicory greens, raw", + "nutrient": "calcium", + "expect": 100.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calories is in 150 g of raw burdock root?", + "fdc_id": 169974, + "target": "Burdock root, raw", + "nutrient": "calories", + "expect": 108.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the sodium content of 150 g of diluted apple juice?", + "fdc_id": 173935, + "target": "Apple juice, frozen concentrate, unsweetened, diluted with 3 volume water without added ascorbic acid", + "nutrient": "sodium", + "expect": 10.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the carbohydrates in 100 g of escarole.", + "fdc_id": 168413, + "target": "Escarole, cooked, boiled, drained, no salt added", + "nutrient": "carbohydrate", + "expect": 3.07 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many sodium are in 2 oz of leg skin raw chicken?", + "fdc_id": 172378, + "target": "Chicken, broilers or fryers, leg, meat and skin, raw", + "nutrient": "sodium", + "expect": 47.6272 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the fiber content of 100 g of cardamom spice?", + "fdc_id": 170919, + "target": "Spices, cardamom", + "nutrient": "fiber", + "expect": 28.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many iron are in 100 g of coconut cake?", + "fdc_id": 172698, + "target": "Cake, white, prepared from recipe with coconut frosting", + "nutrient": "iron", + "expect": 1.16 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the iron content of 100 g of cooked stewed tomato?", + "fdc_id": 170089, + "target": "Tomatoes, red, ripe, cooked, stewed", + "nutrient": "iron", + "expect": 1.06 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Calories in 100 g of bass fresh fish?", + "fdc_id": 174184, + "target": "Fish, bass, fresh water, mixed species, raw", + "nutrient": "calories", + "expect": 114.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many iron are in 150 g of canada goose?", + "fdc_id": 173634, + "target": "Canada Goose, breast meat only, skinless, raw", + "nutrient": "iron", + "expect": 8.865 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the fiber content of 100 g of catfish breaded fish?", + "fdc_id": 174187, + "target": "Fish, catfish, channel, cooked, breaded and fried", + "nutrient": "fiber", + "expect": 0.7 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much potassium does 2 oz of baked sweet roll have?", + "fdc_id": 172799, + "target": "Sweet rolls, cinnamon, refrigerated dough with frosting, baked", + "nutrient": "potassium", + "expect": 35.7204 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the iron content of 100 g of raw lemon juice?", + "fdc_id": 167747, + "target": "Lemon juice, raw", + "nutrient": "iron", + "expect": 0.08 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the sodium in 2 oz of halibut atlantic cooked fish.", + "fdc_id": 174201, + "target": "Fish, halibut, Atlantic and Pacific, cooked, dry heat", + "nutrient": "sodium", + "expect": 46.4932 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much sodium is in 100 g of non milk?", + "fdc_id": 167730, + "target": "Milk, imitation, non-soy", + "nutrient": "sodium", + "expect": 55.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much protein is in 2 oz of sponge commercially cake?", + "fdc_id": 172706, + "target": "Cake, sponge, commercially prepared", + "nutrient": "protein", + "expect": 3.0617 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much fiber is in 100 g of cooked rice noodle?", + "fdc_id": 168914, + "target": "Rice noodles, cooked", + "nutrient": "fiber", + "expect": 1.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates is in 2 oz of salt peanut butter?", + "fdc_id": 172470, + "target": "Peanut butter, smooth style, without salt", + "nutrient": "carbohydrate", + "expect": 12.6495 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many potassium are in a cup of raw barley?", + "fdc_id": 170284, + "target": "Barley, pearled, raw", + "nutrient": "potassium", + "expect": 560.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calories is in 2 oz of cooked lotu root?", + "fdc_id": 168430, + "target": "Lotus root, cooked, boiled, drained, without salt", + "nutrient": "calories", + "expect": 37.4213 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Protein in 100 g of no potato?", + "fdc_id": 169084, + "target": "Potatoes, canned, drained solids, no salt added", + "nutrient": "protein", + "expect": 1.4 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the carbohydrates content of 2 oz of gluten brown bread?", + "fdc_id": 174101, + "target": "Bread, gluten-free, white, made with tapioca starch and brown rice flour", + "nutrient": "carbohydrate", + "expect": 29.0015 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much iron does a cup of shell seed have?", + "fdc_id": 169417, + "target": "Seeds, sunflower seed kernels from shell, dry roasted, with salt added", + "nutrient": "iron", + "expect": 4.864 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the calcium in 2 oz of composite lean raw veal.", + "fdc_id": 173815, + "target": "Veal, composite of trimmed retail cuts, separable lean and fat, raw", + "nutrient": "calcium", + "expect": 8.5048 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the carbohydrates in 150 g of filled milk.", + "fdc_id": 170861, + "target": "Milk, filled, fluid, with blend of hydrogenated vegetable oils", + "nutrient": "carbohydrate", + "expect": 7.11 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many iron are in 150 g of caribou cooked game meat?", + "fdc_id": 173854, + "target": "Game meat, caribou, cooked, roasted", + "nutrient": "iron", + "expect": 9.255 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much sugar does 2 oz of lowfat cooky have?", + "fdc_id": 174083, + "target": "Cookies, graham crackers, plain or honey, lowfat", + "nutrient": "sugar", + "expect": 12.9614 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much protein does 2 oz of paprika spice have?", + "fdc_id": 171329, + "target": "Spices, paprika", + "nutrient": "protein", + "expect": 8.0172 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many vitamin C are in 100 g of canned thompson grape?", + "fdc_id": 174684, + "target": "Grapes, canned, thompson seedless, water pack, solids and liquids", + "nutrient": "vitamin c", + "expect": 1.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much potassium is in 100 g of spleen raw beef?", + "fdc_id": 169454, + "target": "Beef, variety meats and by-products, spleen, raw", + "nutrient": "potassium", + "expect": 429.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the carbohydrates in 2 oz of cashew dry nut.", + "fdc_id": 169421, + "target": "Nuts, cashew nuts, dry roasted, with salt added", + "nutrient": "carbohydrate", + "expect": 18.5349 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Iron in 100 g of original unfortified soymilk?", + "fdc_id": 172446, + "target": "Soymilk, original and vanilla, unfortified", + "nutrient": "iron", + "expect": 0.64 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Protein in 150 g of breadfruit raw seed?", + "fdc_id": 170144, + "target": "Seeds, breadfruit seeds, raw", + "nutrient": "protein", + "expect": 11.1 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the protein in 100 g of fluid half cream.", + "fdc_id": 171255, + "target": "Cream, fluid, half and half", + "nutrient": "protein", + "expect": 3.13 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much calories does 100 g of salted fish have?", + "fdc_id": 168149, + "target": "Fish, mackerel, salted", + "nutrient": "calories", + "expect": 305.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Calcium in 150 g of pickled fish?", + "fdc_id": 175118, + "target": "Fish, herring, Atlantic, pickled", + "nutrient": "calcium", + "expect": 115.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many fiber are in 2 oz of apple pear juice?", + "fdc_id": 168198, + "target": "Juice, apple, grape and pear blend, with added ascorbic acid and calcium", + "nutrient": "fiber", + "expect": 0.1134 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the calories content of a cup of almond oil nut?", + "fdc_id": 170159, + "target": "Nuts, almonds, oil roasted, without salt added", + "nutrient": "calories", + "expect": 952.99 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much iron does 2 oz of pancake van have?", + "fdc_id": 167601, + "target": "Van's, Gluten Free, Totally Original Pancakes", + "nutrient": "iron", + "expect": 0.3969 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the protein in 100 g of red baked potato.", + "fdc_id": 170435, + "target": "Potatoes, red, flesh and skin, baked", + "nutrient": "protein", + "expect": 2.3 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the protein in 100 g of roasting skin cooked chicken.", + "fdc_id": 173635, + "target": "Chicken, roasting, meat and skin, cooked, roasted", + "nutrient": "protein", + "expect": 23.97 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Vitamin C in a cup of corn pudding?", + "fdc_id": 170492, + "target": "Corn pudding, home prepared", + "nutrient": "vitamin c", + "expect": 9.25 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the potassium in 150 g of raw water convolvulu.", + "fdc_id": 169301, + "target": "Water convolvulus,raw", + "nutrient": "potassium", + "expect": 468.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Protein in 150 g of irishmoss seaweed?", + "fdc_id": 168456, + "target": "Seaweed, irishmoss, raw", + "nutrient": "protein", + "expect": 2.265 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the vitamin C in 150 g of dry calcium milk.", + "fdc_id": 171273, + "target": "Milk, dry, nonfat, calcium reduced", + "nutrient": "vitamin c", + "expect": 10.05 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the fat content of 150 g of liver duck?", + "fdc_id": 174467, + "target": "Duck, domesticated, liver, raw", + "nutrient": "fat", + "expect": 6.96 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Sodium in 150 g of guava nectar?", + "fdc_id": 168210, + "target": "Guava nectar, with sucralose, canned", + "nutrient": "sodium", + "expect": 9.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the fat content of 150 g of wheat regular cracker?", + "fdc_id": 174985, + "target": "Crackers, wheat, regular", + "nutrient": "fat", + "expect": 24.6 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Sugar in 150 g of spinach souffle?", + "fdc_id": 170494, + "target": "Spinach souffle", + "nutrient": "sugar", + "expect": 2.775 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much iron does 2 oz of ruffed grouse have?", + "fdc_id": 172831, + "target": "Ruffed Grouse, breast meat, skinless, raw", + "nutrient": "iron", + "expect": 0.3289 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the calories in 2 oz of taco seasoning mix.", + "fdc_id": 172243, + "target": "Seasoning mix, dry, taco, original", + "nutrient": "calories", + "expect": 182.5708 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Potassium in 150 g of herring kippered fish?", + "fdc_id": 173668, + "target": "Fish, herring, Atlantic, kippered", + "nutrient": "potassium", + "expect": 670.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many iron are in 150 g of canned jackfruit?", + "fdc_id": 168190, + "target": "Jackfruit, canned, syrup pack", + "nutrient": "iron", + "expect": 0.435 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Sodium in 100 g of pistachio raw nut?", + "fdc_id": 170184, + "target": "Nuts, pistachio nuts, raw", + "nutrient": "sodium", + "expect": 1.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much calories does 2 oz of leaf pork have?", + "fdc_id": 167861, + "target": "Pork, fresh, variety meats and by-products, leaf fat, raw", + "nutrient": "calories", + "expect": 485.9104 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much sodium is in 2 oz of edible raw pea?", + "fdc_id": 170010, + "target": "Peas, edible-podded, raw", + "nutrient": "sodium", + "expect": 2.268 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the vitamin C in 100 g of liver cooked turkey.", + "fdc_id": 171487, + "target": "Turkey, all classes, liver, cooked, simmered", + "nutrient": "vitamin c", + "expect": 22.6 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much fat does 2 oz of marshmallow rice cooky have?", + "fdc_id": 174097, + "target": "Cookies, marshmallow, with rice cereal and chocolate chips", + "nutrient": "fat", + "expect": 10.3079 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the calcium in 100 g of dill pickle.", + "fdc_id": 168563, + "target": "Pickles, cucumber, dill, reduced sodium", + "nutrient": "calcium", + "expect": 57.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the protein content of 150 g of dried peeled nut?", + "fdc_id": 170167, + "target": "Nuts, chestnuts, european, dried, peeled", + "nutrient": "protein", + "expect": 7.515 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the fiber in 150 g of light pack apricot.", + "fdc_id": 173939, + "target": "Apricots, canned, light syrup pack, with skin, solids and liquids", + "nutrient": "fiber", + "expect": 2.4 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the protein in 150 g of only quail.", + "fdc_id": 172419, + "target": "Quail, meat only, raw", + "nutrient": "protein", + "expect": 32.64 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much calcium does 100 g of frozen nance have?", + "fdc_id": 167789, + "target": "Nance, frozen, unsweetened", + "nutrient": "calcium", + "expect": 46.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much calcium does 150 g of strawberry nonfat yogurt have?", + "fdc_id": 170901, + "target": "Yogurt, Greek, strawberry, nonfat", + "nutrient": "calcium", + "expect": 145.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates is in a cup of california orange?", + "fdc_id": 169916, + "target": "Oranges, raw, California, valencias", + "nutrient": "carbohydrate", + "expect": 21.402 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the calories in 150 g of cooked dock.", + "fdc_id": 169371, + "target": "Dock, cooked, boiled, drained, with salt", + "nutrient": "calories", + "expect": 30.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much calories does 100 g of oat flour have?", + "fdc_id": 169741, + "target": "Oat flour, partially debranned", + "nutrient": "calories", + "expect": 404.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the sugar content of 150 g of chocolate refrigerated cooky?", + "fdc_id": 174953, + "target": "Cookies, chocolate chip, refrigerated dough", + "nutrient": "sugar", + "expect": 57.06 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much fat is in 2 oz of soft white wheat?", + "fdc_id": 169720, + "target": "Wheat, soft white", + "nutrient": "fat", + "expect": 1.1283 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many calcium are in 2 oz of cornish only raw chicken?", + "fdc_id": 171108, + "target": "Chicken, cornish game hens, meat only, raw", + "nutrient": "calcium", + "expect": 6.8039 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Calories in 2 oz of yellow from cake?", + "fdc_id": 172710, + "target": "Cake, yellow, prepared from recipe without frosting", + "nutrient": "calories", + "expect": 204.6834 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the sodium in 2 oz of refrigerated baked biscuit.", + "fdc_id": 174905, + "target": "Biscuits, plain or buttermilk, refrigerated dough, lower fat, baked", + "nutrient": "sodium", + "expect": 545.4444 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates does a cup of fresco cheese have?", + "fdc_id": 172223, + "target": "Cheese, fresh, queso fresco", + "nutrient": "carbohydrate", + "expect": 3.6356 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the fiber in 100 g of raw nopale.", + "fdc_id": 168571, + "target": "Nopales, raw", + "nutrient": "fiber", + "expect": 2.2 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much sodium is in 150 g of surimi fish?", + "fdc_id": 173702, + "target": "Fish, surimi", + "nutrient": "sodium", + "expect": 214.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the calories in 100 g of white raw mushroom.", + "fdc_id": 169251, + "target": "Mushrooms, white, raw", + "nutrient": "calories", + "expect": 22.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Calories in 150 g of cooked lupin?", + "fdc_id": 172424, + "target": "Lupins, mature seeds, cooked, boiled, without salt", + "nutrient": "calories", + "expect": 178.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the protein content of 2 oz of green fried plantain?", + "fdc_id": 168199, + "target": "Plantains, green, fried", + "nutrient": "protein", + "expect": 0.8505 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much protein does a cup of all wheat flour have?", + "fdc_id": 169761, + "target": "Wheat flour, white, all-purpose, unenriched", + "nutrient": "protein", + "expect": 12.9125 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calories is in 150 g of mixture egg?", + "fdc_id": 169904, + "target": "Eggs, scrambled, frozen mixture", + "nutrient": "calories", + "expect": 196.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much protein is in 150 g of latino plantain?", + "fdc_id": 168200, + "target": "Plantains, yellow, fried, Latino restaurant", + "nutrient": "protein", + "expect": 2.13 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Fat in 150 g of fried pie?", + "fdc_id": 173240, + "target": "Pie, fried pies, cherry", + "nutrient": "fat", + "expect": 24.15 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates does 150 g of pecan oil nut have?", + "fdc_id": 169425, + "target": "Nuts, pecans, oil roasted, with salt added", + "nutrient": "carbohydrate", + "expect": 19.515 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much vitamin C is in 150 g of anise spice?", + "fdc_id": 171316, + "target": "Spices, anise seed", + "nutrient": "vitamin c", + "expect": 31.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many fiber are in 2 oz of uncooked chicken patty?", + "fdc_id": 171512, + "target": "Chicken patty, frozen, uncooked", + "nutrient": "fiber", + "expect": 0.6804 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the sugar content of 100 g of portabella raw mushroom?", + "fdc_id": 170143, + "target": "Mushrooms, portabella, exposed to ultraviolet light, raw", + "nutrient": "sugar", + "expect": 2.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much iron is in 100 g of raw pumpkin flower?", + "fdc_id": 169270, + "target": "Pumpkin flowers, raw", + "nutrient": "iron", + "expect": 0.7 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Sugar in a cup of crouton?", + "fdc_id": 172752, + "target": "Croutons, seasoned", + "nutrient": "sugar", + "expect": 1.764 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much potassium is in 150 g of immature raw winged bean?", + "fdc_id": 170476, + "target": "Winged beans, immature seeds, raw", + "nutrient": "potassium", + "expect": 334.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many iron are in a cup of chunky peanut butter?", + "fdc_id": 172460, + "target": "Peanut butter, chunky, vitamin and mineral fortified", + "nutrient": "iron", + "expect": 45.15 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many potassium are in 100 g of chanterelle mushroom?", + "fdc_id": 168422, + "target": "Mushrooms, Chanterelle, raw", + "nutrient": "potassium", + "expect": 506.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the protein in 2 oz of chocolate fortified yogurt.", + "fdc_id": 172221, + "target": "Yogurt, chocolate, nonfat milk, fortified with vitamin D", + "nutrient": "protein", + "expect": 2.0015 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the sodium content of 100 g of boiled salt sweet potato?", + "fdc_id": 170541, + "target": "Sweet potato, cooked, boiled, without skin, with salt", + "nutrient": "sodium", + "expect": 263.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calories is in 2 oz of kidney raw pork?", + "fdc_id": 168270, + "target": "Pork, fresh, variety meats and by-products, kidneys, raw", + "nutrient": "calories", + "expect": 56.699 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many calcium are in a cup of almond dry nut?", + "fdc_id": 168596, + "target": "Nuts, almonds, dry roasted, with salt added", + "nutrient": "calcium", + "expect": 369.84 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the fiber in 2 oz of soft wheat.", + "fdc_id": 168891, + "target": "Wheat, soft red winter", + "nutrient": "fiber", + "expect": 7.0874 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the iron in 100 g of free raw turkey.", + "fdc_id": 172847, + "target": "Turkey, ground, fat free, raw", + "nutrient": "iron", + "expect": 0.77 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Iron in 150 g of raw grapefruit juice?", + "fdc_id": 167774, + "target": "Grapefruit juice, pink, raw", + "nutrient": "iron", + "expect": 0.3 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much fiber does 150 g of wheat cheese cracker have?", + "fdc_id": 172747, + "target": "Crackers, wheat, sandwich, with cheese filling", + "nutrient": "fiber", + "expect": 4.65 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much fat does 2 oz of seed raspberry have?", + "fdc_id": 167809, + "target": "Raspberries, puree, with seeds", + "nutrient": "fat", + "expect": 0.55 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Calories in 2 oz of solid blueberry?", + "fdc_id": 173948, + "target": "Blueberries, canned, heavy syrup, solids and liquids", + "nutrient": "calories", + "expect": 49.8951 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates does 100 g of croaker cooked fish have?", + "fdc_id": 171957, + "target": "Fish, croaker, Atlantic, cooked, breaded and fried", + "nutrient": "carbohydrate", + "expect": 7.54 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the calories content of 2 oz of white spice?", + "fdc_id": 170933, + "target": "Spices, pepper, white", + "nutrient": "calories", + "expect": 167.829 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Calories in 150 g of florida orange?", + "fdc_id": 169918, + "target": "Oranges, raw, Florida", + "nutrient": "calories", + "expect": 69.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much calories does 100 g of sardine atlantic fish have?", + "fdc_id": 175139, + "target": "Fish, sardine, Atlantic, canned in oil, drained solids with bone", + "nutrient": "calories", + "expect": 208.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many iron are in 2 oz of baobab powder?", + "fdc_id": 167806, + "target": "Baobab powder", + "nutrient": "iron", + "expect": 4.7741 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the fiber in a cup of sweet green raw pepper.", + "fdc_id": 170427, + "target": "Peppers, sweet, green, raw", + "nutrient": "fiber", + "expect": 1.564 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Calories in 150 g of chocolate waffle?", + "fdc_id": 167524, + "target": "Waffles, chocolate chip, frozen, ready-to-heat", + "nutrient": "calories", + "expect": 445.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much fiber is in 100 g of red spice?", + "fdc_id": 170932, + "target": "Spices, pepper, red or cayenne", + "nutrient": "fiber", + "expect": 27.2 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the protein in 2 oz of microwave apple.", + "fdc_id": 173929, + "target": "Apples, raw, without skin, cooked, microwave", + "nutrient": "protein", + "expect": 0.1588 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the iron content of a cup of canned fig?", + "fdc_id": 173023, + "target": "Figs, canned, light syrup pack, solids and liquids", + "nutrient": "iron", + "expect": 0.7308 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the calcium content of 100 g of cream canned nut?", + "fdc_id": 170171, + "target": "Nuts, coconut cream, canned, sweetened", + "nutrient": "calcium", + "expect": 4.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the carbohydrates content of 100 g of sodium peanut butter?", + "fdc_id": 169869, + "target": "Peanut butter, reduced sodium", + "nutrient": "carbohydrate", + "expect": 21.83 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Potassium in 2 oz of endive?", + "fdc_id": 168412, + "target": "Endive, raw", + "nutrient": "potassium", + "expect": 178.0349 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many calcium are in 2 oz of blueberry commercially pie?", + "fdc_id": 172778, + "target": "Pie, blueberry, commercially prepared", + "nutrient": "calcium", + "expect": 4.5359 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Sodium in 2 oz of roasting light chicken?", + "fdc_id": 172398, + "target": "Chicken, roasting, light meat, meat only, raw", + "nutrient": "sodium", + "expect": 28.9165 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much potassium does 100 g of milkfish cooked fish have?", + "fdc_id": 171995, + "target": "Fish, milkfish, cooked, dry heat", + "nutrient": "potassium", + "expect": 374.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many calcium are in a cup of wild raw mollusk?", + "fdc_id": 171978, + "target": "Mollusks, oyster, eastern, wild, raw", + "nutrient": "calcium", + "expect": 146.32 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many calories are in 2 oz of walnut dry nut?", + "fdc_id": 170594, + "target": "Nuts, walnuts, dry roasted, with salt added", + "nutrient": "calories", + "expect": 364.5746 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much protein is in 100 g of yellow onion?", + "fdc_id": 170004, + "target": "Onions, yellow, sauteed", + "nutrient": "protein", + "expect": 0.95 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much calcium does 100 g of buckwheat flour have?", + "fdc_id": 170687, + "target": "Buckwheat flour, whole-groat", + "nutrient": "calcium", + "expect": 41.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Protein in 100 g of yellow french potato?", + "fdc_id": 169764, + "target": "Potatoes, yellow fleshed, french fried, frozen, unprepared", + "nutrient": "protein", + "expect": 2.47 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the protein in 2 oz of sharp cheese.", + "fdc_id": 170899, + "target": "Cheese, cheddar, sharp, sliced", + "nutrient": "protein", + "expect": 13.7495 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many potassium are in 150 g of japanese roasted nut?", + "fdc_id": 168590, + "target": "Nuts, chestnuts, japanese, roasted", + "nutrient": "potassium", + "expect": 640.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Sodium in 100 g of sirloin roasted veal?", + "fdc_id": 175288, + "target": "Veal, sirloin, separable lean and fat, cooked, roasted", + "nutrient": "sodium", + "expect": 83.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the calcium in 2 oz of kidney cooked veal.", + "fdc_id": 174357, + "target": "Veal, variety meats and by-products, kidneys, cooked, braised", + "nutrient": "calcium", + "expect": 16.4427 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many fat are in 2 oz of caraway spice?", + "fdc_id": 170918, + "target": "Spices, caraway seed", + "nutrient": "fat", + "expect": 8.2724 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much calories does 2 oz of boar raw game meat have?", + "fdc_id": 175297, + "target": "Game meat, boar, wild, raw", + "nutrient": "calories", + "expect": 69.1728 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many potassium are in 100 g of thin cracker?", + "fdc_id": 171854, + "target": "Crackers, toast thins, low sodium", + "nutrient": "potassium", + "expect": 306.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the fat content of 100 g of new brain raw lamb?", + "fdc_id": 174437, + "target": "Lamb, New Zealand, imported, brains, raw", + "nutrient": "fat", + "expect": 8.03 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the sodium content of 100 g of deep unbaked pie crust?", + "fdc_id": 167523, + "target": "Pie crust, deep dish, frozen, unbaked, made with enriched flour", + "nutrient": "sodium", + "expect": 353.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much calories does 100 g of canned grape leave have?", + "fdc_id": 169393, + "target": "Grape leaves, canned", + "nutrient": "calories", + "expect": 69.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Sodium in 100 g of white raw potato?", + "fdc_id": 170028, + "target": "Potatoes, white, flesh and skin, raw", + "nutrient": "sodium", + "expect": 16.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Calories in 100 g of raw kohlrabi?", + "fdc_id": 168424, + "target": "Kohlrabi, raw", + "nutrient": "calories", + "expect": 27.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many carbohydrates are in 150 g of egg cooked noodle?", + "fdc_id": 169732, + "target": "Noodles, egg, enriched, cooked", + "nutrient": "carbohydrate", + "expect": 37.74 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the calories in 2 oz of smelt cooked fish.", + "fdc_id": 175147, + "target": "Fish, smelt, rainbow, cooked, dry heat", + "nutrient": "calories", + "expect": 70.3068 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the calories content of 2 oz of homemade pasta?", + "fdc_id": 168901, + "target": "Pasta, homemade, made with egg, cooked", + "nutrient": "calories", + "expect": 73.7087 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the sodium in 150 g of cooked canadian bacon.", + "fdc_id": 168383, + "target": "Canadian bacon, cooked, pan-fried", + "nutrient": "sodium", + "expect": 1489.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much fiber does 150 g of millet flour have?", + "fdc_id": 172023, + "target": "Millet flour", + "nutrient": "fiber", + "expect": 5.25 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many fat are in 150 g of steamed taro?", + "fdc_id": 170544, + "target": "Taro, leaves, cooked, steamed, with salt", + "nutrient": "fat", + "expect": 0.615 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much potassium is in 2 oz of smoke nut?", + "fdc_id": 169420, + "target": "Nuts, almonds, oil roasted, with salt added, smoke flavor", + "nutrient": "potassium", + "expect": 384.9862 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the protein in a cup of breadnut dried seed.", + "fdc_id": 170553, + "target": "Seeds, breadnut tree seeds, dried", + "nutrient": "protein", + "expect": 13.792 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates does 100 g of crookneck unprepared squash have?", + "fdc_id": 168467, + "target": "Squash, summer, crookneck and straightneck, frozen, unprepared", + "nutrient": "carbohydrate", + "expect": 4.8 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Calories in 100 g of haddock raw fish?", + "fdc_id": 171964, + "target": "Fish, haddock, raw", + "nutrient": "calories", + "expect": 74.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Potassium in a cup of cooked water convolvulu?", + "fdc_id": 170132, + "target": "Water convolvulus, cooked, boiled, drained, with salt", + "nutrient": "potassium", + "expect": 278.32 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many fat are in 100 g of traditional refried bean?", + "fdc_id": 174298, + "target": "Refried beans, canned, traditional, reduced sodium", + "nutrient": "fat", + "expect": 2.01 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the potassium in 2 oz of mashed home butter potato.", + "fdc_id": 168555, + "target": "Potatoes, mashed, home-prepared, whole milk and butter added", + "nutrient": "potassium", + "expect": 161.0252 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calories is in 2 oz of soba dry noodle?", + "fdc_id": 168906, + "target": "Noodles, japanese, soba, dry", + "nutrient": "calories", + "expect": 190.5086 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the potassium content of 100 g of tart cherry juice?", + "fdc_id": 167807, + "target": "Cherry juice, tart", + "nutrient": "potassium", + "expect": 161.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many vitamin C are in 150 g of cooked water convolvulu?", + "fdc_id": 169302, + "target": "Water convolvulus, cooked, boiled, drained, without salt", + "nutrient": "vitamin c", + "expect": 24.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many sugar are in 2 oz of cooked kale?", + "fdc_id": 169238, + "target": "Kale, cooked, boiled, drained, without salt", + "nutrient": "sugar", + "expect": 0.6861 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much potassium does 2 oz of fat refried bean have?", + "fdc_id": 172465, + "target": "Refried beans, canned, fat-free", + "nutrient": "potassium", + "expect": 195.0446 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Protein in 2 oz of yolk dried egg?", + "fdc_id": 173428, + "target": "Egg, yolk, dried", + "nutrient": "protein", + "expect": 19.0679 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the calcium in 100 g of italian bread.", + "fdc_id": 174913, + "target": "Bread, Italian", + "nutrient": "calcium", + "expect": 105.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the potassium in 2 oz of raw shallot.", + "fdc_id": 170499, + "target": "Shallots, raw", + "nutrient": "potassium", + "expect": 189.3747 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much calcium does 100 g of mince pie have?", + "fdc_id": 175019, + "target": "Pie, mince, prepared from recipe", + "nutrient": "calcium", + "expect": 22.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much fiber does 2 oz of stove kraft have?", + "fdc_id": 175079, + "target": "Kraft, Stove Top Stuffing Mix Chicken Flavor", + "nutrient": "fiber", + "expect": 1.4175 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many carbohydrates are in 2 oz of whole cornmeal?", + "fdc_id": 169750, + "target": "Cornmeal, whole-grain, white", + "nutrient": "carbohydrate", + "expect": 43.5959 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much fat is in 2 oz of skin only stewed chicken?", + "fdc_id": 171056, + "target": "Chicken, broilers or fryers, skin only, cooked, stewed", + "nutrient": "fat", + "expect": 18.7333 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "How much calcium does 2 oz of spiny cooked crustacean have?", + "fdc_id": 172009, + "target": "Crustaceans, spiny lobster, mixed species, cooked, moist heat", + "nutrient": "calcium", + "expect": 35.7204 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much fat is in 2 oz of chopped onion?", + "fdc_id": 170410, + "target": "Onions, frozen, chopped, unprepared", + "nutrient": "fat", + "expect": 0.0567 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the protein in 100 g of dried litchi.", + "fdc_id": 169087, + "target": "Litchis, dried", + "nutrient": "protein", + "expect": 3.8 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calcium is in 150 g of oat roll?", + "fdc_id": 175028, + "target": "Rolls, dinner, oat bran", + "nutrient": "calcium", + "expect": 127.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many calcium are in 2 oz of raw pineapple?", + "fdc_id": 169124, + "target": "Pineapple, raw, all varieties", + "nutrient": "calcium", + "expect": 7.3709 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the fat content of 100 g of banana mix pie?", + "fdc_id": 175013, + "target": "Pie, banana cream, prepared from mix, no-bake type", + "nutrient": "fat", + "expect": 12.9 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Iron in 150 g of brick cheese?", + "fdc_id": 172176, + "target": "Cheese, brick", + "nutrient": "iron", + "expect": 0.645 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Tell me the sodium in 2 oz of pita white bread.", + "fdc_id": 174915, + "target": "Bread, pita, white, enriched", + "nutrient": "sodium", + "expect": 303.9066 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much fat is in 100 g of undiluted apple juice?", + "fdc_id": 173934, + "target": "Apple juice, frozen concentrate, unsweetened, undiluted, without added ascorbic acid", + "nutrient": "fat", + "expect": 0.37 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Potassium in 150 g of hemp seed?", + "fdc_id": 170148, + "target": "Seeds, hemp seed, hulled", + "nutrient": "potassium", + "expect": 1800.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much fat is in 100 g of oat bagel?", + "fdc_id": 172666, + "target": "Bagels, oat bran", + "nutrient": "fat", + "expect": 1.2 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calcium is in 2 oz of feijoa?", + "fdc_id": 168176, + "target": "Feijoa, raw", + "nutrient": "calcium", + "expect": 9.6388 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many fiber are in 2 oz of masa corn flour?", + "fdc_id": 169696, + "target": "Corn flour, masa, unenriched, white", + "nutrient": "fiber", + "expect": 3.6287 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much sodium is in 2 oz of carrot cake?", + "fdc_id": 174932, + "target": "Cake, pudding-type, carrot, dry mix", + "nutrient": "sodium", + "expect": 321.4833 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How many carbohydrates are in 150 g of curry spice?", + "fdc_id": 170924, + "target": "Spices, curry powder", + "nutrient": "carbohydrate", + "expect": 83.745 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Sugar in 2 oz of yellow peach?", + "fdc_id": 169928, + "target": "Peaches, yellow, raw", + "nutrient": "sugar", + "expect": 4.757 + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "fat in 100 g of unicorn steak?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "How much fat does 100 g of unicorn steak have?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "How much sugar is in 100 g of moon cheese?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "Tell me the sugar in 100 g of moon cheese.", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "sugar in 100 g of dragon eggs?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "Tell me the sodium in 100 g of dragon eggs.", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "How much carbohydrates is in 100 g of phoenix wings?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "How much carbohydrates does 100 g of phoenix wings have?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "How many protein are in 100 g of purple widget stew?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "How much calcium does 100 g of purple widget stew have?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "How many sodium are in 100 g of cloud bread from Mars?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "How much sodium does 100 g of cloud bread from Mars have?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "calories in 100 g of griffin jerky?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "Tell me the iron in 100 g of griffin jerky.", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "How many calories are in 100 g of kraken tentacles?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "Tell me the fiber in 100 g of kraken tentacles.", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "How much fat is in 100 g of yeti milk?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "What's the carbohydrates content of 100 g of yeti milk?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "How much carbohydrates is in 100 g of mermaid scales?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "How much sodium does 100 g of mermaid scales have?", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/cooking-v3-r2/nutrition_panel_v1.py b/root/specialists/cooking-v3-r2/nutrition_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..e89b484d8e20cac49cb74bce13000625858e2029 --- /dev/null +++ b/root/specialists/cooking-v3-r2/nutrition_panel_v1.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python3 +"""nutrition_panel_v1 - the sealed panel for specialist #61 (cooking & nutrition), built from USDA directly, never from +the organ. For each target entry the question names the food with just enough of the entry's OWN words to determine the +answer: the fewest segment words such that every USDA entry containing them agrees on the nutrient within 5%. The +expected value is computed from the target entry (and its own household weight for cup / count questions). Foods are +split dev / held-out by fdc_id; the two splits use different phrasings. Must-decline items: invented foods. +usage: nutrition_panel_v1.py """ +import itertools +import json +import random +import re +import sqlite3 +import sys + +NUTS = ["calories", "protein", "fat", "carbohydrate", "fiber", "sugar", "sodium", "calcium", "iron", "potassium", "vitamin c"] +SAY = {"calories": "calories", "carbohydrate": "carbohydrates", "vitamin c": "vitamin C"} +CATS = ("Vegetables and Vegetable Products", "Fruits and Fruit Juices", "Legumes and Legume Products", "Dairy and Egg Products", + "Nut and Seed Products", "Cereal Grains and Pasta", "Finfish and Shellfish Products", "Poultry Products", "Beef Products", + "Pork Products", "Lamb, Veal, and Game Products", "Spices and Herbs", "Baked Products") +DEV_T = ["How much {n} is in {a} {f}?", "How many {n} are in {a} {f}?", "{n} in {a} {f}?"] +HELD_T = ["What's the {n} content of {a} {f}?", "Tell me the {n} in {a} {f}.", "How much {n} does {a} {f} have?"] +FAKE = ["unicorn steak", "moon cheese", "dragon eggs", "phoenix wings", "purple widget stew", "cloud bread from Mars", + "griffin jerky", "kraken tentacles", "yeti milk", "mermaid scales"] + + +def _sing(w): + # the same word normalisation as the organ, so "unambiguous" means the same thing on both sides + if len(w) > 4 and w.endswith("ies"): + return w[:-3] + "y" + if len(w) > 4 and w.endswith("oes"): + return w[:-2] + if len(w) > 3 and w.endswith("es") and w[-3] in "shx": + return w[:-2] + if len(w) > 3 and w.endswith("s") and not w.endswith("ss"): + return w[:-1] + return w + + +def tok(s): + return [_sing(w) for w in re.findall(r"[a-z]+", s.lower()) if len(w) > 1] + + +def main(): + db = sqlite3.connect(sys.argv[1]) + foods = {fid: (desc, cat) for fid, desc, cat in db.execute("SELECT fdc_id, description, category FROM foods")} + toks = {fid: set(tok(d)) for fid, (d, _) in foods.items()} + val = {} + for fid, k, a in db.execute("SELECT fdc_id, key, amount FROM nut"): + val[(fid, k)] = a + rng = random.Random(61) + items = [] + targets = [f for f, (d, c) in foods.items() if c in CATS and not re.search(r"\b[A-Z]{3,}\b", d.replace("USDA", "")) + and "(" not in d and d.count(",") <= 4] + rng.shuffle(targets) + for fid in targets: + if len([i for i in items if i["kind"] == "nutrient"]) >= 400: + break + desc = foods[fid][0] + segs = [s.strip() for s in desc.split(",")] + head = tok(segs[0]) + if not head or len(head) > 2: + continue + n = rng.choice([k for k in NUTS if (fid, k) in val]) if any((fid, k) in val for k in NUTS) else None + if not n or val[(fid, n)] <= 0: + continue + extra = [w for s in segs[1:] for w in tok(s) if w not in ("and", "with", "without", "or", "of", "to", "in")] + chosen = None + for r in range(0, min(4, len(extra)) + 1): + for comb in itertools.combinations(extra, r): + q = set(head) | set(comb) + match = [g for g, t in toks.items() if q <= t and (g, n) in val] + vs = [val[(g, n)] for g in match] + if match and fid in match and max(vs) > 0 and (max(vs) - min(vs)) / max(vs) <= 0.05: + chosen = comb + break + if chosen is not None: + break + if chosen is None: + continue + name = " ".join(list(chosen) + head) + split = "dev" if fid % 2 == 0 else "heldout" + amounts = [("100 g", 100.0), ("150 g", 150.0), ("2 oz", 2 * 28.3495)] + cup = db.execute("SELECT grams FROM portions WHERE fdc_id=? AND label LIKE '1 cup%' ORDER BY length(label)", (fid,)).fetchone() + if cup: + amounts.append(("a cup of", cup[0])) + a_txt, grams = rng.choice(amounts) + a_say = a_txt if a_txt.endswith("of") else a_txt + " of" + t = rng.choice(DEV_T if split == "dev" else HELD_T) + q = t.format(n=SAY.get(n, n), a=a_say.replace(" of of", " of"), f=name).replace(" ", " ") + q = q[0].upper() + q[1:] + items.append({"split": split, "kind": "nutrient", "valid": True, "q": q, "fdc_id": fid, "target": desc, "nutrient": n, + "expect": round(val[(fid, n)] * grams / 100.0, 4)}) + for i, f in enumerate(FAKE): + for split in ("dev", "heldout"): + n = rng.choice(NUTS) + t = rng.choice(DEV_T if split == "dev" else HELD_T) + items.append({"split": split, "kind": "unknown_food", "valid": False, "q": t.format(n=SAY.get(n, n), a="100 g of", f=f), "expect": "decline"}) + json.dump(items, open(sys.argv[2], "w"), indent=1) + import collections + print("panel:", collections.Counter((i["split"], i["kind"]) for i in items)) + for i in items[:6]: + print(" ", i["q"], "->", i.get("expect"), "|", i.get("target")) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/cooking-v3-r2/nutrition_panel_v2.json b/root/specialists/cooking-v3-r2/nutrition_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..2fe8b709f8a2aba8624ffc5634dc7766790944bd --- /dev/null +++ b/root/specialists/cooking-v3-r2/nutrition_panel_v2.json @@ -0,0 +1,4142 @@ +[ + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total potassium in 150 g of bar chocolate ice cream?", + "fdc_id": 173466, + "target": "Ice cream, bar or stick, chocolate covered", + "nutrient": "potassium", + "expect": 457.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total fat in 2 oz of guava sauce?", + "fdc_id": 174686, + "target": "Guava sauce, cooked", + "nutrient": "fat", + "expect": 0.0794 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much protein is in 150 g of strudel?", + "fdc_id": 175032, + "target": "Strudel, apple", + "nutrient": "protein", + "expect": 4.95 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of fiber in 2 oz of yellow microwaved corn?", + "fdc_id": 169217, + "target": "Corn, yellow, whole kernel, frozen, microwaved", + "nutrient": "fiber", + "expect": 1.4742 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much fat is in 100 g of blue raw crustacean?", + "fdc_id": 174204, + "target": "Crustaceans, crab, blue, raw", + "nutrient": "fat", + "expect": 1.08 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sugar content of 2 oz of crosscut sweet potato?", + "fdc_id": 168015, + "target": "Sweet Potatoes, french fried, crosscut, frozen, unprepared", + "nutrient": "sugar", + "expect": 3.6628 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much calcium 100 g of glutinou cooked rice has.", + "fdc_id": 169711, + "target": "Rice, white, glutinous, unenriched, cooked", + "nutrient": "calcium", + "expect": 2.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much protein 150 g of raw arrowroot has.", + "fdc_id": 168490, + "target": "Arrowroot, raw", + "nutrient": "protein", + "expect": 6.36 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much sodium is in 150 g of oat roll?", + "fdc_id": 175028, + "target": "Rolls, dinner, oat bran", + "nutrient": "sodium", + "expect": 619.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calcium is in 2 oz of corn toaster muffin?", + "fdc_id": 175004, + "target": "Muffins, corn, toaster-type", + "nutrient": "calcium", + "expect": 10.7728 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the fiber value for 2 oz of honeydew melon?", + "fdc_id": 169911, + "target": "Melons, honeydew, raw", + "nutrient": "fiber", + "expect": 0.4536 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of potassium in 2 oz of spleen cooked veal?", + "fdc_id": 172541, + "target": "Veal, variety meats and by-products, spleen, cooked, braised", + "nutrient": "potassium", + "expect": 121.9029 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much vitamin C is in 100 g of steamed taro?", + "fdc_id": 170544, + "target": "Taro, leaves, cooked, steamed, with salt", + "nutrient": "vitamin c", + "expect": 35.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much calories is in 150 g of anejo cheese?", + "fdc_id": 172201, + "target": "Cheese, mexican, queso anejo", + "nutrient": "calories", + "expect": 559.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the calories level in a cup of canned raspberry?", + "fdc_id": 167756, + "target": "Raspberries, canned, red, heavy syrup pack, solids and liquids", + "nutrient": "calories", + "expect": 232.96 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much fat is in a cup of liquid spinach?", + "fdc_id": 169285, + "target": "Spinach, canned, regular pack, solids and liquids", + "nutrient": "fat", + "expect": 0.8658 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much iron 2 oz of catfish breaded fish has.", + "fdc_id": 174187, + "target": "Fish, catfish, channel, cooked, breaded and fried", + "nutrient": "iron", + "expect": 0.8108 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much calories 100 g of young turkey has.", + "fdc_id": 171499, + "target": "Turkey, young hen, skin only, cooked, roasted", + "nutrient": "calories", + "expect": 482.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much carbohydrates 2 oz of wheat cheese cracker has.", + "fdc_id": 172747, + "target": "Crackers, wheat, sandwich, with cheese filling", + "nutrient": "carbohydrate", + "expect": 32.9988 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of iron in a cup of steamed rice?", + "fdc_id": 169712, + "target": "Rice, white, steamed, Chinese restaurant", + "nutrient": "iron", + "expect": 0.5148 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total calories in 150 g of cuttlefish cooked mollusk?", + "fdc_id": 172010, + "target": "Mollusks, cuttlefish, mixed species, cooked, moist heat", + "nutrient": "calories", + "expect": 237.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the calcium value for 100 g of raw rhubarb?", + "fdc_id": 167758, + "target": "Rhubarb, raw", + "nutrient": "calcium", + "expect": 86.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total potassium in 100 g of dry pie crust?", + "fdc_id": 175023, + "target": "Pie crust, standard-type, dry mix, prepared, baked", + "nutrient": "potassium", + "expect": 62.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the carbohydrates value for a cup of cooked mungo bean?", + "fdc_id": 172427, + "target": "Mungo beans, mature seeds, cooked, boiled, without salt", + "nutrient": "carbohydrate", + "expect": 33.012 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates is in 150 g of tahitian taro?", + "fdc_id": 170136, + "target": "Taro, tahitian, cooked, with salt", + "nutrient": "carbohydrate", + "expect": 10.275 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much fiber is in 100 g of low soy flour?", + "fdc_id": 172444, + "target": "Soy flour, low-fat", + "nutrient": "fiber", + "expect": 16.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calcium is in 100 g of mixture egg?", + "fdc_id": 169904, + "target": "Eggs, scrambled, frozen mixture", + "nutrient": "calcium", + "expect": 17.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much potassium is in 150 g of tomato powder?", + "fdc_id": 170461, + "target": "Tomato powder", + "nutrient": "potassium", + "expect": 2890.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much potassium 100 g of refined sorghum flour has.", + "fdc_id": 173262, + "target": "Sorghum flour, refined, unenriched", + "nutrient": "potassium", + "expect": 145.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much sodium is in 150 g of bison ground raw game meat?", + "fdc_id": 174421, + "target": "Game meat , bison, ground, raw", + "nutrient": "sodium", + "expect": 99.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much sugar is in 150 g of milk cracker?", + "fdc_id": 174980, + "target": "Crackers, milk", + "nutrient": "sugar", + "expect": 15.48 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of protein in a cup of strawberry lowfat yogurt?", + "fdc_id": 171300, + "target": "Yogurt, Greek, strawberry, lowfat", + "nutrient": "protein", + "expect": 20.0165 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calories is in a cup of grain cooked pasta?", + "fdc_id": 168916, + "target": "Pasta, whole grain, 51% whole wheat, remaining unenriched semolina, cooked", + "nutrient": "calories", + "expect": 154.23 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much sugar 150 g of pita white bread has.", + "fdc_id": 174915, + "target": "Bread, pita, white, enriched", + "nutrient": "sugar", + "expect": 1.95 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the iron level in 100 g of cooked drumstick pod?", + "fdc_id": 170484, + "target": "Drumstick pods, cooked, boiled, drained, without salt", + "nutrient": "iron", + "expect": 0.45 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of iron in 100 g of sweetbread beef?", + "fdc_id": 173093, + "target": "Beef, New Zealand, imported, sweetbread, raw", + "nutrient": "iron", + "expect": 1.15 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the vitamin C content of 2 oz of rambutan?", + "fdc_id": 168167, + "target": "Rambutan, canned, syrup pack", + "nutrient": "vitamin c", + "expect": 2.7783 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the iron content of 2 oz of diluted orange juice?", + "fdc_id": 169102, + "target": "Orange juice, frozen concentrate, unsweetened, diluted with 3 volume water", + "nutrient": "iron", + "expect": 0.0454 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the carbohydrates level in 2 oz of vanilla lemon yogurt?", + "fdc_id": 173445, + "target": "Yogurt, vanilla or lemon flavor, nonfat milk, sweetened with low-calorie sweetener", + "nutrient": "carbohydrate", + "expect": 4.2524 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sodium content of 100 g of soba dry noodle?", + "fdc_id": 168906, + "target": "Noodles, japanese, soba, dry", + "nutrient": "sodium", + "expect": 792.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much fat is in 2 oz of japanese boiled nut?", + "fdc_id": 168589, + "target": "Nuts, chestnuts, japanese, boiled and steamed", + "nutrient": "fat", + "expect": 0.1077 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of calcium in 150 g of amaranth leave?", + "fdc_id": 168385, + "target": "Amaranth leaves, raw", + "nutrient": "calcium", + "expect": 322.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much fat is in 2 oz of frozen chicken patty?", + "fdc_id": 171513, + "target": "Chicken patty, frozen, cooked", + "nutrient": "fat", + "expect": 11.1017 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calories is in 2 oz of cooked mountain yam?", + "fdc_id": 168433, + "target": "Mountain yam, hawaii, cooked, steamed, without salt", + "nutrient": "calories", + "expect": 46.4932 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the carbohydrates content of 150 g of european dried nut?", + "fdc_id": 170167, + "target": "Nuts, chestnuts, european, dried, peeled", + "nutrient": "carbohydrate", + "expect": 117.645 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sodium content of 100 g of tamarind nectar?", + "fdc_id": 167786, + "target": "Tamarind nectar, canned", + "nutrient": "sodium", + "expect": 7.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much carbohydrates a cup of dried uncooked peach has.", + "fdc_id": 169934, + "target": "Peaches, dried, sulfured, uncooked", + "nutrient": "carbohydrate", + "expect": 98.128 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calcium content of 2 oz of poultry spice?", + "fdc_id": 171331, + "target": "Spices, poultry seasoning", + "nutrient": "calcium", + "expect": 564.722 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the calcium level in 150 g of cooky chocolate glutino?", + "fdc_id": 167592, + "target": "Glutino, Gluten Free Cookies, Chocolate Vanilla Creme", + "nutrient": "calcium", + "expect": 28.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the sugar value for 150 g of virginia peanut?", + "fdc_id": 172434, + "target": "Peanuts, virginia, raw", + "nutrient": "sugar", + "expect": 5.925 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the calories value for 2 oz of lauric cream substitute?", + "fdc_id": 171262, + "target": "Cream substitute, liquid, with lauric acid oil and sodium caseinate", + "nutrient": "calories", + "expect": 77.1106 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much vitamin C 100 g of heart cooked veal has.", + "fdc_id": 172530, + "target": "Veal, variety meats and by-products, heart, cooked, braised", + "nutrient": "vitamin c", + "expect": 10.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the fat level in 100 g of canned drained carrot?", + "fdc_id": 170396, + "target": "Carrots, canned, regular pack, drained solids", + "nutrient": "fat", + "expect": 0.19 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the fiber level in a cup of pumpkin leave?", + "fdc_id": 170120, + "target": "Pumpkin leaves, cooked, boiled, drained, with salt", + "nutrient": "fiber", + "expect": 1.917 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of potassium in 150 g of fungi?", + "fdc_id": 168581, + "target": "Fungi, Cloud ears, dried", + "nutrient": "potassium", + "expect": 1131.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much potassium is in 100 g of sockeye cooked fish?", + "fdc_id": 173692, + "target": "Fish, salmon, sockeye, cooked, dry heat", + "nutrient": "potassium", + "expect": 436.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of protein in a cup of steamed soybean?", + "fdc_id": 168460, + "target": "Soybeans, mature seeds, sprouted, cooked, steamed", + "nutrient": "protein", + "expect": 7.9618 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the fat content of 2 oz of flour nut?", + "fdc_id": 170566, + "target": "Nuts, acorn flour, full fat", + "nutrient": "fat", + "expect": 17.1061 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calcium content of 150 g of fruit calorie yogurt?", + "fdc_id": 173451, + "target": "Yogurt, fruit, lowfat, with low calorie sweetener", + "nutrient": "calcium", + "expect": 228.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the fat content of a cup of cooked amaranth leave?", + "fdc_id": 169202, + "target": "Amaranth leaves, cooked, boiled, drained, without salt", + "nutrient": "fat", + "expect": 0.2376 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calories is in 2 oz of uncooked rice?", + "fdc_id": 168881, + "target": "Rice, white, short-grain, enriched, uncooked", + "nutrient": "calories", + "expect": 202.9824 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much fat is in 150 g of gluten chocolate sandwich cooky?", + "fdc_id": 171857, + "target": "Cookies, gluten-free, chocolate sandwich, with creme filling", + "nutrient": "fat", + "expect": 26.835 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of fat in 150 g of cooked borage?", + "fdc_id": 168509, + "target": "Borage, cooked, boiled, drained, with salt", + "nutrient": "fat", + "expect": 1.215 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much fiber 150 g of fat pancake has.", + "fdc_id": 174086, + "target": "Pancakes, plain, reduced fat", + "nutrient": "fiber", + "expect": 1.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the potassium level in 2 oz of caviar fish?", + "fdc_id": 174188, + "target": "Fish, caviar, black and red, granular", + "nutrient": "potassium", + "expect": 102.6252 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the fat value for 100 g of deliciou udi?", + "fdc_id": 167598, + "target": "Udi's, Gluten Free, Soft & Delicious White Sandwich Bread", + "nutrient": "fat", + "expect": 8.02 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much calcium 2 oz of cod dried fish has.", + "fdc_id": 174190, + "target": "Fish, cod, Atlantic, dried and salted", + "nutrient": "calcium", + "expect": 90.7184 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much fiber is in 150 g of sweet water cherry?", + "fdc_id": 173957, + "target": "Cherries, sweet, canned, water pack, solids and liquids", + "nutrient": "fiber", + "expect": 2.25 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much fiber is in a cup of sunflower flour seed?", + "fdc_id": 170156, + "target": "Seeds, sunflower seed flour, partially defatted", + "nutrient": "fiber", + "expect": 3.328 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the fiber value for 100 g of sauerkraut?", + "fdc_id": 169279, + "target": "Sauerkraut, canned, solids and liquids", + "nutrient": "fiber", + "expect": 2.9 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the sodium level in 2 oz of chilled orange juice?", + "fdc_id": 169100, + "target": "Orange juice, chilled, includes from concentrate", + "nutrient": "sodium", + "expect": 1.134 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of iron in 150 g of catsup?", + "fdc_id": 168556, + "target": "Catsup", + "nutrient": "iron", + "expect": 0.525 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total sodium in 100 g of self degermed cornmeal?", + "fdc_id": 168870, + "target": "Cornmeal, yellow, self-rising, degermed, enriched", + "nutrient": "sodium", + "expect": 1348.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of calcium in 2 oz of jowl pork?", + "fdc_id": 168269, + "target": "Pork, fresh, variety meats and by-products, jowl, raw", + "nutrient": "calcium", + "expect": 2.268 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much carbohydrates is in a cup of raw drumstick leave?", + "fdc_id": 168416, + "target": "Drumstick leaves, raw", + "nutrient": "carbohydrate", + "expect": 1.7388 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much iron 100 g of ling raw fish has.", + "fdc_id": 173670, + "target": "Fish, ling, raw", + "nutrient": "iron", + "expect": 0.65 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much sodium 100 g of heavy pack pear has.", + "fdc_id": 169939, + "target": "Pears, canned, heavy syrup pack, solids and liquids", + "nutrient": "sodium", + "expect": 5.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calories is in 2 oz of red raw cabbage?", + "fdc_id": 169977, + "target": "Cabbage, red, raw", + "nutrient": "calories", + "expect": 17.5767 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the calories value for 150 g of new inside beef?", + "fdc_id": 174726, + "target": "Beef, New Zealand, imported, inside, raw", + "nutrient": "calories", + "expect": 192.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total sodium in 100 g of native persimmon?", + "fdc_id": 169943, + "target": "Persimmons, native, raw", + "nutrient": "sodium", + "expect": 1.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of carbohydrates in 100 g of chip special cooky?", + "fdc_id": 172732, + "target": "Cookies, chocolate chip, commercially prepared, special dietary", + "nutrient": "carbohydrate", + "expect": 73.4 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much vitamin C is in a cup of reduced cultured cream?", + "fdc_id": 171256, + "target": "Cream, sour, reduced fat, cultured", + "nutrient": "vitamin c", + "expect": 2.178 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the fat content of 100 g of regular asparagu?", + "fdc_id": 169206, + "target": "Asparagus, canned, regular pack, solids and liquids", + "nutrient": "fat", + "expect": 0.18 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of protein in 2 oz of pickled olive?", + "fdc_id": 169096, + "target": "Olives, pickled, canned or bottled, green", + "nutrient": "protein", + "expect": 0.584 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the calories level in 2 oz of belly pork?", + "fdc_id": 167812, + "target": "Pork, fresh, belly, raw", + "nutrient": "calories", + "expect": 293.7008 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much sodium is in 100 g of composite only veal?", + "fdc_id": 173817, + "target": "Veal, composite of trimmed retail cuts, separable lean only, raw", + "nutrient": "sodium", + "expect": 86.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calories content of 100 g of oyster breaded mollusk?", + "fdc_id": 171979, + "target": "Mollusks, oyster, eastern, cooked, breaded and fried", + "nutrient": "calories", + "expect": 199.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calcium is in 150 g of cold cheese food?", + "fdc_id": 170856, + "target": "Cheese food, cold pack, American", + "nutrient": "calcium", + "expect": 745.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much carbohydrates 2 oz of raw ginger root has.", + "fdc_id": 169231, + "target": "Ginger root, raw", + "nutrient": "carbohydrate", + "expect": 10.0754 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the calcium level in 2 oz of all unbleached wheat flour?", + "fdc_id": 168936, + "target": "Wheat flour, white, all-purpose, enriched, unbleached", + "nutrient": "calcium", + "expect": 8.5048 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much fiber 2 oz of green raw plantain has.", + "fdc_id": 168215, + "target": "Plantains, green, raw", + "nutrient": "fiber", + "expect": 1.2474 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of calcium in 150 g of chapati plain bread?", + "fdc_id": 171844, + "target": "Bread, chapati or roti, plain, commercially prepared", + "nutrient": "calcium", + "expect": 139.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much sodium 2 oz of shad cooked fish has.", + "fdc_id": 174243, + "target": "Fish, shad, american, cooked, dry heat", + "nutrient": "sodium", + "expect": 36.8543 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the iron level in 150 g of shiitake cooked mushroom?", + "fdc_id": 170097, + "target": "Mushrooms, shiitake, cooked, with salt", + "nutrient": "iron", + "expect": 0.66 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the calcium value for 100 g of pound fat cake?", + "fdc_id": 173243, + "target": "Cake, pound, commercially prepared, fat-free", + "nutrient": "calcium", + "expect": 43.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much sodium 100 g of ground lean raw pork has.", + "fdc_id": 169190, + "target": "Pork, ground, 96% lean / 4% fat, raw", + "nutrient": "sodium", + "expect": 67.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the potassium value for 2 oz of rowal?", + "fdc_id": 167783, + "target": "Rowal, raw", + "nutrient": "potassium", + "expect": 74.2757 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calcium content of 100 g of all oil peanut?", + "fdc_id": 175258, + "target": "Peanuts, all types, oil-roasted, without salt", + "nutrient": "calcium", + "expect": 61.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much sugar a cup of butternut raw squash has.", + "fdc_id": 169295, + "target": "Squash, winter, butternut, raw", + "nutrient": "sugar", + "expect": 3.08 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much calories 150 g of oyster raw ostrich has.", + "fdc_id": 174487, + "target": "Ostrich, oyster, raw", + "nutrient": "calories", + "expect": 187.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much sodium is in 150 g of ground meat raw beef?", + "fdc_id": 174036, + "target": "Beef, ground, 80% lean meat / 20% fat, raw", + "nutrient": "sodium", + "expect": 99.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total calories in 150 g of neck raw turkey?", + "fdc_id": 171086, + "target": "Turkey, whole, neck, meat only, raw", + "nutrient": "calories", + "expect": 187.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much potassium is in 150 g of dried mushroom?", + "fdc_id": 168436, + "target": "Mushrooms, shiitake, dried", + "nutrient": "potassium", + "expect": 2301.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of potassium in 150 g of white raw potato?", + "fdc_id": 170028, + "target": "Potatoes, white, flesh and skin, raw", + "nutrient": "potassium", + "expect": 610.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much potassium 150 g of flavored powdered cream substitute has.", + "fdc_id": 172214, + "target": "Cream substitute, flavored, powdered", + "nutrient": "potassium", + "expect": 135.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the protein content of a cup of heavy cream?", + "fdc_id": 170859, + "target": "Cream, fluid, heavy whipping", + "nutrient": "protein", + "expect": 3.408 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total fat in 2 oz of skim yogurt?", + "fdc_id": 170887, + "target": "Yogurt, plain, skim milk", + "nutrient": "fat", + "expect": 0.1021 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the calcium level in 2 oz of triticale flour?", + "fdc_id": 168888, + "target": "Triticale flour, whole-grain", + "nutrient": "calcium", + "expect": 19.8446 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sugar content of a cup of drained mushroom?", + "fdc_id": 169254, + "target": "Mushrooms, canned, drained solids", + "nutrient": "sugar", + "expect": 3.6504 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much carbohydrates 150 g of pacific raw mollusk has.", + "fdc_id": 174219, + "target": "Mollusks, oyster, Pacific, raw", + "nutrient": "carbohydrate", + "expect": 7.425 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the fiber value for 100 g of green cauliflower?", + "fdc_id": 169390, + "target": "Cauliflower, green, cooked, no salt added", + "nutrient": "fiber", + "expect": 3.3 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total calcium in 2 oz of apple enriched pie?", + "fdc_id": 175011, + "target": "Pie, apple, commercially prepared, enriched flour", + "nutrient": "calcium", + "expect": 6.2369 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much calories 150 g of baked flesh salt potato has.", + "fdc_id": 170111, + "target": "Potatoes, baked, flesh and skin, with salt", + "nutrient": "calories", + "expect": 139.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the iron level in 100 g of gingersnap cooky?", + "fdc_id": 174956, + "target": "Cookies, gingersnaps", + "nutrient": "iron", + "expect": 6.4 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the potassium level in 2 oz of swiss cheese food?", + "fdc_id": 171253, + "target": "Cheese food, pasteurized process, swiss", + "nutrient": "potassium", + "expect": 161.0252 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the potassium level in 100 g of breadnut dried seed?", + "fdc_id": 170553, + "target": "Seeds, breadnut tree seeds, dried", + "nutrient": "potassium", + "expect": 2011.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much sodium is in 100 g of marshmallow rice cooky?", + "fdc_id": 174097, + "target": "Cookies, marshmallow, with rice cereal and chocolate chips", + "nutrient": "sodium", + "expect": 341.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much sugar is in 150 g of cinnamon pillsbury?", + "fdc_id": 167513, + "target": "Pillsbury, Cinnamon Rolls with Icing, refrigerated dough", + "nutrient": "sugar", + "expect": 32.01 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates is in 150 g of apple from pie?", + "fdc_id": 175012, + "target": "Pie, apple, prepared from recipe", + "nutrient": "carbohydrate", + "expect": 55.65 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of iron in 150 g of boston cake?", + "fdc_id": 172696, + "target": "Cake, boston cream pie, commercially prepared", + "nutrient": "iron", + "expect": 0.57 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of calcium in 150 g of ground raw chicken?", + "fdc_id": 171116, + "target": "Chicken, ground, raw", + "nutrient": "calcium", + "expect": 9.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of calcium in 150 g of composite lean fat cooked veal?", + "fdc_id": 173816, + "target": "Veal, composite of trimmed retail cuts, separable lean and fat, cooked", + "nutrient": "calcium", + "expect": 33.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the iron value for 2 oz of cooked goose?", + "fdc_id": 172414, + "target": "Goose, domesticated, meat only, cooked, roasted", + "nutrient": "iron", + "expect": 1.6273 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of carbohydrates in a cup of durian?", + "fdc_id": 168192, + "target": "Durian, raw or frozen", + "nutrient": "carbohydrate", + "expect": 65.8287 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the calcium value for 150 g of free raw turkey?", + "fdc_id": 172847, + "target": "Turkey, ground, fat free, raw", + "nutrient": "calcium", + "expect": 4.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the calcium value for 150 g of cusk cooked fish?", + "fdc_id": 171991, + "target": "Fish, cusk, cooked, dry heat", + "nutrient": "calcium", + "expect": 19.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total fiber in 150 g of pudding white cake?", + "fdc_id": 175054, + "target": "Cake, pudding-type, white, unenriched, dry mix", + "nutrient": "fiber", + "expect": 1.05 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sugar content of 100 g of made cracker?", + "fdc_id": 174103, + "target": "Crackers, gluten-free, multigrain and vegetable, made with corn starch and white rice flour", + "nutrient": "sugar", + "expect": 3.9 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much carbohydrates a cup of red lettuce has.", + "fdc_id": 168431, + "target": "Lettuce, red leaf, raw", + "nutrient": "carbohydrate", + "expect": 0.6328 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much protein is in 150 g of drained sweet potato?", + "fdc_id": 170084, + "target": "Sweet potato, canned, syrup pack, drained solids", + "nutrient": "protein", + "expect": 1.92 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of fiber in 150 g of wheat regular cracker?", + "fdc_id": 174985, + "target": "Crackers, wheat, regular", + "nutrient": "fiber", + "expect": 10.35 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the iron value for 150 g of dried milk?", + "fdc_id": 171274, + "target": "Milk, buttermilk, dried", + "nutrient": "iron", + "expect": 0.45 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total protein in a cup of fluid half cream?", + "fdc_id": 171255, + "target": "Cream, fluid, half and half", + "nutrient": "protein", + "expect": 7.5746 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much carbohydrates is in 100 g of au water potato?", + "fdc_id": 170448, + "target": "Potatoes, au gratin, dry mix, prepared with water, whole milk and butter", + "nutrient": "carbohydrate", + "expect": 12.84 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total iron in 100 g of home bean?", + "fdc_id": 173731, + "target": "Beans, baked, home prepared", + "nutrient": "iron", + "expect": 1.99 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total calories in 100 g of meatless frankfurter?", + "fdc_id": 169887, + "target": "Frankfurter, meatless", + "nutrient": "calories", + "expect": 233.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the sodium level in 2 oz of rib braised veal?", + "fdc_id": 173829, + "target": "Veal, rib, separable lean only, cooked, braised", + "nutrient": "sodium", + "expect": 56.132 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total potassium in a cup of dry whole added milk?", + "fdc_id": 173454, + "target": "Milk, dry, whole, without added vitamin D", + "nutrient": "potassium", + "expect": 1702.4 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much carbohydrates is in 150 g of sugar regular cooky?", + "fdc_id": 172736, + "target": "Cookies, sugar wafers with creme filling, regular", + "nutrient": "carbohydrate", + "expect": 105.96 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total calcium in 2 oz of raw mango?", + "fdc_id": 169910, + "target": "Mangos, raw", + "nutrient": "calcium", + "expect": 6.2369 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calcium content of 2 oz of perch mixed cooked fish?", + "fdc_id": 173679, + "target": "Fish, perch, mixed species, cooked, dry heat", + "nutrient": "calcium", + "expect": 57.833 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much sodium is in 2 oz of pecan pie?", + "fdc_id": 175021, + "target": "Pie, pecan, commercially prepared", + "nutrient": "sodium", + "expect": 155.9222 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much fat is in 100 g of durum wheat?", + "fdc_id": 169721, + "target": "Wheat, durum", + "nutrient": "fat", + "expect": 2.47 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much protein is in 2 oz of frozen fiddlehead fern?", + "fdc_id": 168584, + "target": "Fiddlehead ferns, frozen, unprepared", + "nutrient": "protein", + "expect": 2.4437 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much protein is in 100 g of drumstick pod?", + "fdc_id": 168532, + "target": "Drumstick pods, cooked, boiled, drained, with salt", + "nutrient": "protein", + "expect": 2.09 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates is in 150 g of whole tortilla?", + "fdc_id": 174081, + "target": "Tortillas, ready-to-bake or -fry, whole wheat", + "nutrient": "carbohydrate", + "expect": 68.835 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates is in 150 g of scallop breaded mollusk?", + "fdc_id": 174221, + "target": "Mollusks, scallop, mixed species, cooked, breaded and fried", + "nutrient": "carbohydrate", + "expect": 15.195 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calcium content of 2 oz of other soymilk?", + "fdc_id": 173767, + "target": "Soymilk, chocolate and other flavors, light, with added calcium, vitamins A and D", + "nutrient": "calcium", + "expect": 69.7398 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the carbohydrates value for 2 oz of mozzarella whole cheese?", + "fdc_id": 170846, + "target": "Cheese, mozzarella, whole milk, low moisture", + "nutrient": "carbohydrate", + "expect": 1.4005 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total carbohydrates in a cup of raw grape leave?", + "fdc_id": 168575, + "target": "Grape leaves, raw", + "nutrient": "carbohydrate", + "expect": 2.4234 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total protein in a cup of flaxseed seed?", + "fdc_id": 169414, + "target": "Seeds, flaxseed", + "nutrient": "protein", + "expect": 30.7272 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the protein content of 2 oz of pancrea cooked veal?", + "fdc_id": 174363, + "target": "Veal, variety meats and by-products, pancreas, cooked, braised", + "nutrient": "protein", + "expect": 16.4994 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of potassium in 150 g of red spice?", + "fdc_id": 170932, + "target": "Spices, pepper, red or cayenne", + "nutrient": "potassium", + "expect": 3021.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total iron in a cup of carob flour?", + "fdc_id": 173755, + "target": "Carob flour", + "nutrient": "iron", + "expect": 3.0282 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total iron in 100 g of cooked rutabaga?", + "fdc_id": 168455, + "target": "Rutabagas, cooked, boiled, drained, without salt", + "nutrient": "iron", + "expect": 0.18 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much potassium 150 g of raw unpeeled nut has.", + "fdc_id": 170574, + "target": "Nuts, chestnuts, european, raw, unpeeled", + "nutrient": "potassium", + "expect": 777.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the iron level in a cup of mussel raw mollusk?", + "fdc_id": 174216, + "target": "Mollusks, mussel, blue, raw", + "nutrient": "iron", + "expect": 5.925 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total calcium in 2 oz of spinach souffle?", + "fdc_id": 170494, + "target": "Spinach souffle", + "nutrient": "calcium", + "expect": 93.5533 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the protein content of 2 oz of cheese danish pastry?", + "fdc_id": 172754, + "target": "Danish pastry, cheese", + "nutrient": "protein", + "expect": 4.5359 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the sodium level in 100 g of lemon commercially pie?", + "fdc_id": 172785, + "target": "Pie, lemon meringue, commercially prepared", + "nutrient": "sodium", + "expect": 172.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much potassium 2 oz of summer all raw squash has.", + "fdc_id": 170487, + "target": "Squash, summer, all varieties, raw", + "nutrient": "potassium", + "expect": 148.5514 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the fat value for 100 g of hard tofu?", + "fdc_id": 174291, + "target": "Tofu, hard, prepared with nigari", + "nutrient": "fat", + "expect": 9.99 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the sugar level in 150 g of sour drained cherry?", + "fdc_id": 167769, + "target": "Cherries, sour, canned, water pack, drained", + "nutrient": "sugar", + "expect": 10.485 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much carbohydrates 2 oz of quince has.", + "fdc_id": 168163, + "target": "Quinces, raw", + "nutrient": "carbohydrate", + "expect": 8.6749 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much potassium 100 g of canned drained pear has.", + "fdc_id": 168182, + "target": "Pears, canned, heavy syrup, drained", + "nutrient": "potassium", + "expect": 66.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much fat 100 g of mackerel atlantic raw fish has.", + "fdc_id": 175119, + "target": "Fish, mackerel, Atlantic, raw", + "nutrient": "fat", + "expect": 13.89 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calcium content of 150 g of fruitcake cake?", + "fdc_id": 174939, + "target": "Cake, fruitcake, commercially prepared", + "nutrient": "calcium", + "expect": 49.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of fat in 2 oz of crayfish raw crustacean?", + "fdc_id": 175169, + "target": "Crustaceans, crayfish, mixed species, farmed, raw", + "nutrient": "fat", + "expect": 0.55 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the sodium value for 2 oz of portabella raw mushroom?", + "fdc_id": 169255, + "target": "Mushrooms, portabella, raw", + "nutrient": "sodium", + "expect": 5.1029 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the protein value for 100 g of heavy prune?", + "fdc_id": 168159, + "target": "Prunes, canned, heavy syrup pack, solids and liquids", + "nutrient": "protein", + "expect": 0.87 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the carbohydrates content of 2 oz of whole corn flour?", + "fdc_id": 170290, + "target": "Corn flour, whole-grain, yellow", + "nutrient": "carbohydrate", + "expect": 43.5732 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the calcium value for 2 oz of oatmeal baked cooky?", + "fdc_id": 174962, + "target": "Cookies, oatmeal, refrigerated dough, baked", + "nutrient": "calcium", + "expect": 19.8446 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much sugar is in 150 g of cooked rutabaga?", + "fdc_id": 170528, + "target": "Rutabagas, cooked, boiled, drained, with salt", + "nutrient": "sugar", + "expect": 5.925 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of sodium in 100 g of diluted grapefruit juice?", + "fdc_id": 174681, + "target": "Grapefruit juice, white, frozen concentrate, unsweetened, diluted with 3 volume water", + "nutrient": "sodium", + "expect": 1.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much potassium 2 oz of phyllo dough has.", + "fdc_id": 172791, + "target": "Phyllo dough", + "nutrient": "potassium", + "expect": 41.9573 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much calcium is in 100 g of leave broccoli?", + "fdc_id": 169329, + "target": "Broccoli, leaves, raw", + "nutrient": "calcium", + "expect": 48.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much fat is in 2 oz of heart turkey?", + "fdc_id": 171485, + "target": "Turkey, all classes, heart, cooked, simmered", + "nutrient": "fat", + "expect": 4.2638 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of calories in 100 g of mature cooked winged bean?", + "fdc_id": 172477, + "target": "Winged beans, mature seeds, cooked, boiled, with salt", + "nutrient": "calories", + "expect": 147.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of calories in 150 g of abalone raw mollusk?", + "fdc_id": 174212, + "target": "Mollusks, abalone, mixed species, raw", + "nutrient": "calories", + "expect": 157.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total sugar in 100 g of welsh onion?", + "fdc_id": 170007, + "target": "Onions, welsh, raw", + "nutrient": "sugar", + "expect": 2.18 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much calories a cup of spirulina dried seaweed has.", + "fdc_id": 170495, + "target": "Seaweed, spirulina, dried", + "nutrient": "calories", + "expect": 324.8 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much protein is in 150 g of wing only raw chicken?", + "fdc_id": 173632, + "target": "Chicken, broilers or fryers, wing, meat only, raw", + "nutrient": "protein", + "expect": 32.955 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much calcium 150 g of pasilla pepper has.", + "fdc_id": 168579, + "target": "Peppers, pasilla, dried", + "nutrient": "calcium", + "expect": 145.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calcium content of 2 oz of canned carrot juice?", + "fdc_id": 170491, + "target": "Carrot juice, canned", + "nutrient": "calcium", + "expect": 13.6078 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the carbohydrates value for 150 g of reduced white bread?", + "fdc_id": 174922, + "target": "Bread, reduced-calorie, white", + "nutrient": "carbohydrate", + "expect": 66.45 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much fiber is in 2 oz of sprouted raw mung bean?", + "fdc_id": 169957, + "target": "Mung beans, mature seeds, sprouted, raw", + "nutrient": "fiber", + "expect": 1.0206 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the fiber content of a cup of added noodle?", + "fdc_id": 168926, + "target": "Noodles, egg, unenriched, cooked, without added salt", + "nutrient": "fiber", + "expect": 1.92 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calcium is in 150 g of spot cooked fish?", + "fdc_id": 174244, + "target": "Fish, spot, cooked, dry heat", + "nutrient": "calcium", + "expect": 27.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the sodium value for a cup of black nut?", + "fdc_id": 170186, + "target": "Nuts, walnuts, black, dried", + "nutrient": "sodium", + "expect": 2.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of calories in 2 oz of irish bread?", + "fdc_id": 174912, + "target": "Bread, irish soda, prepared from recipe", + "nutrient": "calories", + "expect": 164.4271 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the iron level in 150 g of hock pork?", + "fdc_id": 169157, + "target": "Pork, pickled pork hocks", + "nutrient": "iron", + "expect": 1.71 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the calories level in 150 g of virginia peanut?", + "fdc_id": 174264, + "target": "Peanuts, virginia, oil-roasted, with salt", + "nutrient": "calories", + "expect": 867.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much vitamin C is in 2 oz of endive?", + "fdc_id": 168412, + "target": "Endive, raw", + "nutrient": "vitamin c", + "expect": 3.6854 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much sodium 150 g of ground meat raw beef has.", + "fdc_id": 171790, + "target": "Beef, ground, 95% lean meat / 5% fat, raw", + "nutrient": "sodium", + "expect": 99.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much fat 100 g of whelk raw mollusk has.", + "fdc_id": 171983, + "target": "Mollusks, whelk, unspecified, raw", + "nutrient": "fat", + "expect": 0.4 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the vitamin C level in 150 g of raw fiddlehead fern?", + "fdc_id": 169405, + "target": "Fiddlehead ferns, raw", + "nutrient": "vitamin c", + "expect": 39.9 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calories content of 2 oz of mission food?", + "fdc_id": 175082, + "target": "Mission Foods, Mission Flour Tortillas, Soft Taco, 8 inch", + "nutrient": "calories", + "expect": 162.7261 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the calories level in 100 g of wheat sandwich cracker?", + "fdc_id": 172748, + "target": "Crackers, wheat, sandwich, with peanut butter filling", + "nutrient": "calories", + "expect": 495.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total potassium in 2 oz of cheshire cheese?", + "fdc_id": 173415, + "target": "Cheese, cheshire", + "nutrient": "potassium", + "expect": 53.864 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the protein level in 100 g of inside cooked emu?", + "fdc_id": 172836, + "target": "Emu, inside drums, cooked, broiled", + "nutrient": "protein", + "expect": 32.38 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the protein content of a cup of raw tamarind?", + "fdc_id": 167763, + "target": "Tamarinds, raw", + "nutrient": "protein", + "expect": 3.36 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much potassium is in 150 g of monkfish cooked fish?", + "fdc_id": 171996, + "target": "Fish, monkfish, cooked, dry heat", + "nutrient": "potassium", + "expect": 769.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much fat 2 oz of pecan from pie has.", + "fdc_id": 172786, + "target": "Pie, pecan, prepared from recipe", + "nutrient": "fat", + "expect": 12.5872 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much potassium is in 150 g of acorn raw squash?", + "fdc_id": 168472, + "target": "Squash, winter, acorn, raw", + "nutrient": "potassium", + "expect": 520.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much fat is in 100 g of for select raw beef?", + "fdc_id": 170809, + "target": "Beef, chuck for stew, separable lean and fat, select, raw", + "nutrient": "fat", + "expect": 3.99 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much carbohydrates is in 2 oz of diluted pineapple juice?", + "fdc_id": 169128, + "target": "Pineapple juice, frozen concentrate, unsweetened, diluted with 3 volume water", + "nutrient": "carbohydrate", + "expect": 7.1838 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much sodium is in 100 g of lung cooked beef?", + "fdc_id": 168629, + "target": "Beef, variety meats and by-products, lungs, cooked, braised", + "nutrient": "sodium", + "expect": 101.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the potassium value for 100 g of peanut baked cooky?", + "fdc_id": 172730, + "target": "Cookies, peanut butter, refrigerated dough, baked", + "nutrient": "potassium", + "expect": 338.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much protein is in 150 g of raw longan?", + "fdc_id": 169089, + "target": "Longans, raw", + "nutrient": "protein", + "expect": 1.965 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much protein is in 100 g of muscadine grape?", + "fdc_id": 173040, + "target": "Grapes, muscadine, raw", + "nutrient": "protein", + "expect": 0.81 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sugar content of a cup of white raw corn?", + "fdc_id": 168538, + "target": "Corn, sweet, white, raw", + "nutrient": "sugar", + "expect": 4.9588 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the sodium level in 2 oz of mechanically pork?", + "fdc_id": 168272, + "target": "Pork, fresh, variety meats and by-products, mechanically separated, raw", + "nutrient": "sodium", + "expect": 28.3495 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the calcium value for 150 g of squid cooked mollusk?", + "fdc_id": 171982, + "target": "Mollusks, squid, mixed species, cooked, fried", + "nutrient": "calcium", + "expect": 58.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much iron is in 2 oz of spiny cooked crustacean?", + "fdc_id": 172009, + "target": "Crustaceans, spiny lobster, mixed species, cooked, moist heat", + "nutrient": "iron", + "expect": 0.7995 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much calories a cup of sprouted lentil has.", + "fdc_id": 168427, + "target": "Lentils, sprouted, raw", + "nutrient": "calories", + "expect": 81.62 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much potassium is in 150 g of watercress?", + "fdc_id": 170068, + "target": "Watercress, raw", + "nutrient": "potassium", + "expect": 495.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total calcium in 100 g of cos lettuce?", + "fdc_id": 169247, + "target": "Lettuce, cos or romaine, raw", + "nutrient": "calcium", + "expect": 33.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total protein in a cup of european currant?", + "fdc_id": 173963, + "target": "Currants, european black, raw", + "nutrient": "protein", + "expect": 1.568 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much potassium is in 2 oz of balsamic vinegar?", + "fdc_id": 172241, + "target": "Vinegar, balsamic", + "nutrient": "potassium", + "expect": 63.5029 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total iron in a cup of raw millet?", + "fdc_id": 169702, + "target": "Millet, raw", + "nutrient": "iron", + "expect": 6.02 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the iron level in 100 g of rye grain?", + "fdc_id": 168884, + "target": "Rye grain", + "nutrient": "iron", + "expect": 2.63 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of fiber in 2 oz of frank bean?", + "fdc_id": 175184, + "target": "Beans, baked, canned, with franks", + "nutrient": "fiber", + "expect": 3.9122 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the calories value for 150 g of cooked quail?", + "fdc_id": 169902, + "target": "Quail, cooked, total edible", + "nutrient": "calories", + "expect": 340.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of vitamin C in 150 g of cooked arrowhead?", + "fdc_id": 169204, + "target": "Arrowhead, cooked, boiled, drained, without salt", + "nutrient": "vitamin c", + "expect": 0.45 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total vitamin C in 2 oz of snapper fish?", + "fdc_id": 173698, + "target": "Fish, snapper, mixed species, raw", + "nutrient": "vitamin c", + "expect": 0.9072 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much fat is in 100 g of rye toasted bread?", + "fdc_id": 172685, + "target": "Bread, rye, toasted", + "nutrient": "fat", + "expect": 3.6 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much iron is in a cup of northern cooked crustacean?", + "fdc_id": 174209, + "target": "Crustaceans, lobster, northern, cooked, moist heat", + "nutrient": "iron", + "expect": 0.4205 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the potassium content of a cup of masa white corn flour?", + "fdc_id": 169694, + "target": "Corn flour, masa, enriched, white", + "nutrient": "potassium", + "expect": 298.68 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the calories value for 150 g of shoot cooked taro?", + "fdc_id": 170135, + "target": "Taro, shoots, cooked, with salt", + "nutrient": "calories", + "expect": 21.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of potassium in 2 oz of lung raw beef?", + "fdc_id": 168628, + "target": "Beef, variety meats and by-products, lungs, raw", + "nutrient": "potassium", + "expect": 192.7766 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the carbohydrates level in 2 oz of extra pack peach?", + "fdc_id": 169113, + "target": "Peaches, canned, extra heavy syrup pack, solids and liquids", + "nutrient": "carbohydrate", + "expect": 14.7758 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the potassium level in 100 g of regular lima bean?", + "fdc_id": 169136, + "target": "Lima beans, immature seeds, canned, regular pack, solids and liquids", + "nutrient": "potassium", + "expect": 285.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sodium content of 150 g of white medium raw rice?", + "fdc_id": 168879, + "target": "Rice, white, medium-grain, raw, enriched", + "nutrient": "sodium", + "expect": 1.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the iron level in 100 g of cheese sweet roll?", + "fdc_id": 175033, + "target": "Sweet rolls, cheese", + "nutrient": "iron", + "expect": 0.76 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total carbohydrates in 150 g of white toasted bread?", + "fdc_id": 172826, + "target": "Bread, white, commercially prepared, toasted, low sodium no salt", + "nutrient": "carbohydrate", + "expect": 81.6 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much calories 2 oz of haddock cooked fish has.", + "fdc_id": 174198, + "target": "Fish, haddock, cooked, dry heat", + "nutrient": "calories", + "expect": 51.0291 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the potassium level in 100 g of cooked peanut?", + "fdc_id": 174260, + "target": "Peanuts, all types, cooked, boiled, with salt", + "nutrient": "potassium", + "expect": 180.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the iron level in 2 oz of tongue raw veal?", + "fdc_id": 174368, + "target": "Veal, variety meats and by-products, tongue, raw", + "nutrient": "iron", + "expect": 1.5422 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the fat value for 2 oz of fennel spice?", + "fdc_id": 171323, + "target": "Spices, fennel seed", + "nutrient": "fat", + "expect": 8.4311 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much sugar 2 oz of oat bagel has.", + "fdc_id": 172666, + "target": "Bagels, oat bran", + "nutrient": "sugar", + "expect": 0.9242 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of iron in 100 g of vegetarian fillet?", + "fdc_id": 169068, + "target": "Vegetarian fillets", + "nutrient": "iron", + "expect": 2.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the vitamin C value for 100 g of raisin soft cooky?", + "fdc_id": 174966, + "target": "Cookies, raisin, soft-type", + "nutrient": "vitamin c", + "expect": 0.4 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the calories level in 2 oz of mahimahi cooked fish?", + "fdc_id": 171992, + "target": "Fish, mahimahi, cooked, dry heat", + "nutrient": "calories", + "expect": 61.8019 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the sugar value for 2 oz of canned drained asparagu?", + "fdc_id": 169207, + "target": "Asparagus, canned, drained solids", + "nutrient": "sugar", + "expect": 0.601 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much potassium is in 100 g of added guava nectar?", + "fdc_id": 167784, + "target": "Guava nectar, canned, with added ascorbic acid", + "nutrient": "potassium", + "expect": 39.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sodium content of 2 oz of kidney raw pork?", + "fdc_id": 168270, + "target": "Pork, fresh, variety meats and by-products, kidneys, raw", + "nutrient": "sodium", + "expect": 68.6058 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much iron 150 g of dry prepared muffin has.", + "fdc_id": 175003, + "target": "Muffins, corn, dry mix, prepared", + "nutrient": "iron", + "expect": 2.91 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the iron value for 2 oz of spanish oil peanut?", + "fdc_id": 172431, + "target": "Peanuts, spanish, oil-roasted, with salt", + "nutrient": "iron", + "expect": 1.2927 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the iron level in 100 g of blueberry pancake?", + "fdc_id": 172773, + "target": "Pancakes, blueberry, prepared from recipe", + "nutrient": "iron", + "expect": 1.72 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the iron content of 100 g of freeze shallot?", + "fdc_id": 170082, + "target": "Shallots, freeze-dried", + "nutrient": "iron", + "expect": 6.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much iron 2 oz of ritz nabisco has.", + "fdc_id": 173258, + "target": "Nabisco, Nabisco Ritz Crackers", + "nutrient": "iron", + "expect": 2.5344 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the potassium content of a cup of raw sesbania flower?", + "fdc_id": 168459, + "target": "Sesbania flower, raw", + "nutrient": "potassium", + "expect": 36.8 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sodium content of 150 g of elk pan game meat?", + "fdc_id": 174426, + "target": "Game meat, elk, ground, cooked, pan-broiled", + "nutrient": "sodium", + "expect": 127.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much calories is in 2 oz of bass striped raw fish?", + "fdc_id": 171948, + "target": "Fish, bass, striped, raw", + "nutrient": "calories", + "expect": 54.998 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the sugar value for 2 oz of fat colby cheese?", + "fdc_id": 173439, + "target": "Cheese, low fat, cheddar or colby", + "nutrient": "sugar", + "expect": 0.2948 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of fat in 150 g of sweet canned pepper?", + "fdc_id": 170429, + "target": "Peppers, sweet, green, canned, solids and liquids", + "nutrient": "fat", + "expect": 0.45 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much calcium is in 100 g of round ostrich?", + "fdc_id": 172844, + "target": "Ostrich, round, raw", + "nutrient": "calcium", + "expect": 5.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the potassium level in 100 g of whiting raw fish?", + "fdc_id": 173713, + "target": "Fish, whiting, mixed species, raw", + "nutrient": "potassium", + "expect": 249.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the iron content of a cup of cheese regular cracker?", + "fdc_id": 174975, + "target": "Crackers, cheese, regular", + "nutrient": "iron", + "expect": 3.5136 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the sugar level in 150 g of raw barley?", + "fdc_id": 170284, + "target": "Barley, pearled, raw", + "nutrient": "sugar", + "expect": 1.2 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the fat level in 150 g of spanish tomato product?", + "fdc_id": 170085, + "target": "Tomato products, canned, sauce, spanish style", + "nutrient": "fat", + "expect": 0.405 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sodium content of 150 g of prepared graham pie crust?", + "fdc_id": 172811, + "target": "Pie crust, cookie-type, prepared from recipe, graham cracker, chilled", + "nutrient": "sodium", + "expect": 840.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the sodium value for 150 g of sharp cheese?", + "fdc_id": 170899, + "target": "Cheese, cheddar, sharp, sliced", + "nutrient": "sodium", + "expect": 966.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the fiber content of 150 g of brien prepared potato?", + "fdc_id": 170454, + "target": "Potatoes, o'brien, frozen, prepared", + "nutrient": "fiber", + "expect": 2.55 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of calories in 2 oz of tilsit cheese?", + "fdc_id": 170852, + "target": "Cheese, tilsit", + "nutrient": "calories", + "expect": 192.7766 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much potassium is in a cup of blanched nut?", + "fdc_id": 170568, + "target": "Nuts, almonds, blanched", + "nutrient": "potassium", + "expect": 955.55 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the fat content of 2 oz of yellowfin raw fish?", + "fdc_id": 175159, + "target": "Fish, tuna, fresh, yellowfin, raw", + "nutrient": "fat", + "expect": 0.2778 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much sodium is in 100 g of candied fruit?", + "fdc_id": 167781, + "target": "Candied fruit", + "nutrient": "sodium", + "expect": 98.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much calories 100 g of active leavening agent has.", + "fdc_id": 175043, + "target": "Leavening agents, yeast, baker's, active dry", + "nutrient": "calories", + "expect": 325.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much protein is in 150 g of oil seed?", + "fdc_id": 168593, + "target": "Seeds, sunflower seed kernels, oil roasted, with salt added", + "nutrient": "protein", + "expect": 30.09 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much calories 150 g of skin quail has.", + "fdc_id": 172418, + "target": "Quail, meat and skin, raw", + "nutrient": "calories", + "expect": 288.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the calcium level in 2 oz of extra heavy pack apricot?", + "fdc_id": 171701, + "target": "Apricots, canned, extra heavy syrup pack, without skin, solids and liquids", + "nutrient": "calcium", + "expect": 4.5359 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of calories in 150 g of sesame meal seed?", + "fdc_id": 170561, + "target": "Seeds, sesame meal, partially defatted", + "nutrient": "calories", + "expect": 850.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much sodium is in 150 g of chinese broccoli?", + "fdc_id": 169392, + "target": "Broccoli, chinese, cooked", + "nutrient": "sodium", + "expect": 10.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much fat is in 150 g of spanish fish?", + "fdc_id": 173673, + "target": "Fish, mackerel, spanish, raw", + "nutrient": "fat", + "expect": 9.45 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much carbohydrates is in 100 g of fluid milk substitute?", + "fdc_id": 171264, + "target": "Milk substitutes, fluid, with lauric acid oil", + "nutrient": "carbohydrate", + "expect": 6.16 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much calories 150 g of salmon wild raw fish has.", + "fdc_id": 173686, + "target": "Fish, salmon, Atlantic, wild, raw", + "nutrient": "calories", + "expect": 213.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much vitamin C is in 100 g of raw mountain yam?", + "fdc_id": 168432, + "target": "Mountain yam, hawaii, raw", + "nutrient": "vitamin c", + "expect": 2.6 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the vitamin C content of 100 g of raw chrysanthemum?", + "fdc_id": 169995, + "target": "Chrysanthemum, garland, raw", + "nutrient": "vitamin c", + "expect": 1.4 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much sodium is in 100 g of fruit pie?", + "fdc_id": 172784, + "target": "Pie, fried pies, fruit", + "nutrient": "sodium", + "expect": 333.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of fat in 150 g of frozen lowfat yogurt?", + "fdc_id": 170908, + "target": "Yogurt, frozen, flavors other than chocolate, lowfat", + "nutrient": "fat", + "expect": 3.75 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total vitamin C in 100 g of meringue pie?", + "fdc_id": 175018, + "target": "Pie, lemon meringue, prepared from recipe", + "nutrient": "vitamin c", + "expect": 3.3 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much protein is in 150 g of gluten frozen waffle?", + "fdc_id": 174105, + "target": "Waffles, gluten-free, frozen, ready-to-heat", + "nutrient": "protein", + "expect": 4.08 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much fiber 100 g of light rye flour has.", + "fdc_id": 168887, + "target": "Rye flour, light", + "nutrient": "fiber", + "expect": 8.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total calcium in 100 g of heart raw pork?", + "fdc_id": 168267, + "target": "Pork, fresh, variety meats and by-products, heart, raw", + "nutrient": "calcium", + "expect": 5.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of fiber in 150 g of asian pear?", + "fdc_id": 168177, + "target": "Pears, asian, raw", + "nutrient": "fiber", + "expect": 5.4 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of fat in 100 g of shortcake cake?", + "fdc_id": 174941, + "target": "Cake, shortcake, biscuit-type, prepared from recipe", + "nutrient": "fat", + "expect": 14.2 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much calories is in 100 g of bluefish cooked fish?", + "fdc_id": 174229, + "target": "Fish, bluefish, cooked, dry heat", + "nutrient": "calories", + "expect": 159.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the calories level in 100 g of refrigerated baked biscuit?", + "fdc_id": 172669, + "target": "Biscuits, plain or buttermilk, refrigerated dough, higher fat, baked", + "nutrient": "calories", + "expect": 324.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of fat in 150 g of bear raw game meat?", + "fdc_id": 173845, + "target": "Game meat, bear, raw", + "nutrient": "fat", + "expect": 12.45 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much protein 100 g of stone seed has.", + "fdc_id": 169410, + "target": "Seeds, sesame butter, tahini, from raw and stone ground kernels", + "nutrient": "protein", + "expect": 17.81 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the iron content of 2 oz of hearty udi?", + "fdc_id": 167599, + "target": "Udi's, Gluten Free, Soft & Hearty Whole Grain Bread", + "nutrient": "iron", + "expect": 0.4309 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the fat content of 100 g of raw chayote?", + "fdc_id": 170402, + "target": "Chayote, fruit, raw", + "nutrient": "fat", + "expect": 0.13 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much calories 100 g of giblet raw turkey has.", + "fdc_id": 171083, + "target": "Turkey, whole, giblets, raw", + "nutrient": "calories", + "expect": 124.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much fiber is in 150 g of cooked beet green?", + "fdc_id": 168508, + "target": "Beet greens, cooked, boiled, drained, with salt", + "nutrient": "fiber", + "expect": 4.35 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the sodium value for 2 oz of sweet canned pepper?", + "fdc_id": 168546, + "target": "Peppers, sweet, red, canned, solids and liquids", + "nutrient": "sodium", + "expect": 776.2093 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the carbohydrates level in a cup of cheese low cracker?", + "fdc_id": 175060, + "target": "Crackers, cheese, low sodium", + "nutrient": "carbohydrate", + "expect": 41.904 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much sodium is in 2 oz of unspecified seed?", + "fdc_id": 168604, + "target": "Seeds, sesame butter, tahini, type of kernels unspecified", + "nutrient": "sodium", + "expect": 19.8446 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the iron level in 150 g of pout raw fish?", + "fdc_id": 173677, + "target": "Fish, pout, ocean, raw", + "nutrient": "iron", + "expect": 0.42 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much sugar is in 2 oz of brown toaster pastry?", + "fdc_id": 172801, + "target": "Toaster pastries, brown-sugar-cinnamon", + "nutrient": "sugar", + "expect": 15.4448 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much fat 2 oz of sunfish raw fish has.", + "fdc_id": 175151, + "target": "Fish, sunfish, pumpkin seed, raw", + "nutrient": "fat", + "expect": 0.3969 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of fat in 2 oz of canned strawberry?", + "fdc_id": 168172, + "target": "Strawberries, canned, heavy syrup pack, solids and liquids", + "nutrient": "fat", + "expect": 0.1474 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the carbohydrates value for 2 oz of coconut cooky?", + "fdc_id": 171847, + "target": "Cookies, coconut macaroon", + "nutrient": "carbohydrate", + "expect": 34.7111 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the potassium level in 2 oz of fruit cheese?", + "fdc_id": 172180, + "target": "Cheese, cottage, creamed, with fruit", + "nutrient": "potassium", + "expect": 51.0291 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the fat value for 2 oz of spaghetti raw squash?", + "fdc_id": 169298, + "target": "Squash, winter, spaghetti, raw", + "nutrient": "fat", + "expect": 0.3232 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the sodium level in 2 oz of sweet pickle relish?", + "fdc_id": 168561, + "target": "Pickle relish, sweet", + "nutrient": "sodium", + "expect": 459.8289 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the carbohydrates content of 150 g of whole cornmeal?", + "fdc_id": 169750, + "target": "Cornmeal, whole-grain, white", + "nutrient": "carbohydrate", + "expect": 115.335 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total calories in 150 g of papaya nectar?", + "fdc_id": 169107, + "target": "Papaya nectar, canned", + "nutrient": "calories", + "expect": 85.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the sodium value for 150 g of undiluted orange juice?", + "fdc_id": 169923, + "target": "Orange juice, frozen concentrate, unsweetened, undiluted", + "nutrient": "sodium", + "expect": 10.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the protein value for 2 oz of raw garlic?", + "fdc_id": 169230, + "target": "Garlic, raw", + "nutrient": "protein", + "expect": 3.6061 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total fat in 150 g of liver raw pork?", + "fdc_id": 167862, + "target": "Pork, fresh, variety meats and by-products, liver, raw", + "nutrient": "fat", + "expect": 5.475 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the protein value for 2 oz of goat raw game meat?", + "fdc_id": 175303, + "target": "Game meat, goat, raw", + "nutrient": "protein", + "expect": 11.68 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the fat level in 2 oz of raw cassava?", + "fdc_id": 169985, + "target": "Cassava, raw", + "nutrient": "fat", + "expect": 0.1588 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much calcium is in 150 g of buttermilk reduced milk?", + "fdc_id": 167697, + "target": "Milk, buttermilk, fluid, cultured, reduced fat", + "nutrient": "calcium", + "expect": 214.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much iron 150 g of ricotta whole cheese has.", + "fdc_id": 170851, + "target": "Cheese, ricotta, whole milk", + "nutrient": "iron", + "expect": 0.195 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much fiber is in a cup of yellow tomato?", + "fdc_id": 170096, + "target": "Tomatoes, yellow, raw", + "nutrient": "fiber", + "expect": 0.973 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of sugar in 150 g of raw kohlrabi?", + "fdc_id": 168424, + "target": "Kohlrabi, raw", + "nutrient": "sugar", + "expect": 3.9 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much fiber is in 150 g of vanilla lower cooky?", + "fdc_id": 174973, + "target": "Cookies, vanilla wafers, lower fat", + "nutrient": "fiber", + "expect": 2.85 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much carbohydrates 2 oz of dried pepeao has.", + "fdc_id": 168418, + "target": "Pepeao, dried", + "nutrient": "carbohydrate", + "expect": 45.9432 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the calories value for 150 g of beaver raw game meat?", + "fdc_id": 175294, + "target": "Game meat, beaver, raw", + "nutrient": "calories", + "expect": 219.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of carbohydrates in 2 oz of chinese raw nut?", + "fdc_id": 170164, + "target": "Nuts, chestnuts, chinese, raw", + "nutrient": "carbohydrate", + "expect": 27.8222 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much fat is in 100 g of chum cooked fish?", + "fdc_id": 172000, + "target": "Fish, salmon, chum, cooked, dry heat", + "nutrient": "fat", + "expect": 4.83 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the protein content of 2 oz of weight heinz?", + "fdc_id": 167922, + "target": "Heinz, Weight Watcher, Chocolate Eclair, frozen", + "nutrient": "protein", + "expect": 2.4948 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the vitamin C level in 2 oz of gizzard turkey?", + "fdc_id": 171085, + "target": "Turkey, gizzard, all classes, raw", + "nutrient": "vitamin c", + "expect": 3.5153 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much vitamin C is in a cup of mixed oil salt nut?", + "fdc_id": 168600, + "target": "Nuts, mixed nuts, oil roasted, with peanuts, with salt added", + "nutrient": "vitamin c", + "expect": 0.67 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the fat value for 2 oz of boiled flesh potato?", + "fdc_id": 170438, + "target": "Potatoes, boiled, cooked in skin, flesh, without salt", + "nutrient": "fat", + "expect": 0.0567 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the iron content of 100 g of french raw bean?", + "fdc_id": 173738, + "target": "Beans, french, mature seeds, raw", + "nutrient": "iron", + "expect": 3.4 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the iron content of 2 oz of cooked drumstick leave?", + "fdc_id": 168531, + "target": "Drumstick leaves, cooked, boiled, drained, with salt", + "nutrient": "iron", + "expect": 1.3154 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total sodium in a cup of baked plantain?", + "fdc_id": 169131, + "target": "Plantains, yellow, baked", + "nutrient": "sodium", + "expect": 2.78 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates is in a cup of japanese dried nut?", + "fdc_id": 169408, + "target": "Nuts, chestnuts, japanese, dried", + "nutrient": "carbohydrate", + "expect": 126.2165 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much calcium 150 g of dark from only turkey has.", + "fdc_id": 174507, + "target": "Turkey, dark meat from whole, meat only, with added solution, raw", + "nutrient": "calcium", + "expect": 22.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much protein is in 150 g of english wheat muffin?", + "fdc_id": 172761, + "target": "Muffins, English, wheat", + "nutrient": "protein", + "expect": 13.05 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much protein is in 150 g of mustard spice?", + "fdc_id": 170929, + "target": "Spices, mustard seed, ground", + "nutrient": "protein", + "expect": 39.12 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total potassium in 150 g of pink drained fish?", + "fdc_id": 175175, + "target": "Fish, salmon, pink, canned, drained solids", + "nutrient": "potassium", + "expect": 499.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the carbohydrates value for 2 oz of sucralose guava nectar?", + "fdc_id": 168210, + "target": "Guava nectar, with sucralose, canned", + "nutrient": "carbohydrate", + "expect": 7.541 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates is in 150 g of white english muffin?", + "fdc_id": 174093, + "target": "English muffins, whole grain white", + "nutrient": "carbohydrate", + "expect": 75.255 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the calcium value for 150 g of mince pie?", + "fdc_id": 175019, + "target": "Pie, mince, prepared from recipe", + "nutrient": "calcium", + "expect": 33.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much vitamin C a cup of roselle has.", + "fdc_id": 168170, + "target": "Roselle, raw", + "nutrient": "vitamin c", + "expect": 6.84 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total potassium in a cup of stewing only cooked chicken?", + "fdc_id": 172403, + "target": "Chicken, stewing, meat only, cooked, stewed", + "nutrient": "potassium", + "expect": 282.8 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calories is in 150 g of giblet cooked turkey?", + "fdc_id": 171084, + "target": "Turkey, whole, giblets, cooked, simmered", + "nutrient": "calories", + "expect": 259.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much calories is in 2 oz of crumble chicken?", + "fdc_id": 171117, + "target": "Chicken, ground, crumbles, cooked, pan-browned", + "nutrient": "calories", + "expect": 107.1611 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of fat in 150 g of savory spice?", + "fdc_id": 170936, + "target": "Spices, savory, ground", + "nutrient": "fat", + "expect": 8.865 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calcium content of 100 g of lowfat milk yogurt?", + "fdc_id": 173463, + "target": "Yogurt, vanilla flavor, lowfat milk, sweetened with low calorie sweetener", + "nutrient": "calcium", + "expect": 171.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calcium content of 150 g of epazote?", + "fdc_id": 169398, + "target": "Epazote, raw", + "nutrient": "calcium", + "expect": 412.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much potassium is in 2 oz of canned bamboo shoot?", + "fdc_id": 169212, + "target": "Bamboo shoots, canned, drained solids", + "nutrient": "potassium", + "expect": 45.3592 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much calcium is in 150 g of seedless raspberry?", + "fdc_id": 167808, + "target": "Raspberries, puree, seedless", + "nutrient": "calcium", + "expect": 21.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of protein in a cup of cooked lambsquarter?", + "fdc_id": 169245, + "target": "Lambsquarters, cooked, boiled, drained, without salt", + "nutrient": "protein", + "expect": 5.76 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much calcium 150 g of adzuki raw bean has.", + "fdc_id": 173727, + "target": "Beans, adzuki, mature seeds, raw", + "nutrient": "calcium", + "expect": 99.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much sugar is in 2 oz of raw mustard green?", + "fdc_id": 169256, + "target": "Mustard greens, raw", + "nutrient": "sugar", + "expect": 0.7484 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much fiber 150 g of pink grapefruit juice has.", + "fdc_id": 173038, + "target": "Grapefruit juice, pink or red, with added calcium", + "nutrient": "fiber", + "expect": 0.45 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total calcium in 100 g of pacific cooked mollusk?", + "fdc_id": 174250, + "target": "Mollusks, oyster, Pacific, cooked, moist heat", + "nutrient": "calcium", + "expect": 16.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much fat 2 oz of medjool date has.", + "fdc_id": 168191, + "target": "Dates, medjool", + "nutrient": "fat", + "expect": 0.085 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much sugar 2 oz of raw rutabaga has.", + "fdc_id": 168454, + "target": "Rutabagas, raw", + "nutrient": "sugar", + "expect": 2.5288 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total calories in 150 g of seco cheese?", + "fdc_id": 172222, + "target": "Cheese, dry white, queso seco", + "nutrient": "calories", + "expect": 487.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the fat level in a cup of almond honey nut?", + "fdc_id": 168592, + "target": "Nuts, almonds, honey roasted, unblanched", + "nutrient": "fat", + "expect": 71.856 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much protein is in 100 g of shiitake cooked mushroom?", + "fdc_id": 168437, + "target": "Mushrooms, shiitake, cooked, without salt", + "nutrient": "protein", + "expect": 1.56 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much fat is in 100 g of green raw bean?", + "fdc_id": 169961, + "target": "Beans, snap, green, raw", + "nutrient": "fat", + "expect": 0.22 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total calcium in 100 g of stir mung bean?", + "fdc_id": 169138, + "target": "Mung beans, mature seeds, sprouted, cooked, stir-fried", + "nutrient": "calcium", + "expect": 13.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much sugar is in 150 g of semi dessert topping?", + "fdc_id": 170868, + "target": "Dessert topping, semi solid, frozen", + "nutrient": "sugar", + "expect": 34.575 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much sodium is in 2 oz of juice skin apricot?", + "fdc_id": 173937, + "target": "Apricots, canned, juice pack, with skin, solids and liquids", + "nutrient": "sodium", + "expect": 2.268 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the fiber level in 2 oz of only potato?", + "fdc_id": 170113, + "target": "Potatoes, baked, skin only, with salt", + "nutrient": "fiber", + "expect": 4.4792 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much calcium is in a cup of acid fluid whey?", + "fdc_id": 170885, + "target": "Whey, acid, fluid", + "nutrient": "calcium", + "expect": 253.38 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the calcium value for 2 oz of turtle raw bean?", + "fdc_id": 175186, + "target": "Beans, black turtle, mature seeds, raw", + "nutrient": "calcium", + "expect": 90.7184 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sodium content of 100 g of chocolate baked cooky?", + "fdc_id": 174954, + "target": "Cookies, chocolate chip, refrigerated dough, baked", + "nutrient": "sodium", + "expect": 232.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total fiber in 2 oz of tofu yogurt?", + "fdc_id": 167722, + "target": "Tofu yogurt", + "nutrient": "fiber", + "expect": 0.1134 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the vitamin C value for 2 oz of chili spice?", + "fdc_id": 171319, + "target": "Spices, chili powder", + "nutrient": "vitamin c", + "expect": 0.3969 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the sodium level in 2 oz of cooked stewed tomato?", + "fdc_id": 170089, + "target": "Tomatoes, red, ripe, cooked, stewed", + "nutrient": "sodium", + "expect": 257.9804 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What is the protein value for 100 g of cashew dry nut?", + "fdc_id": 170571, + "target": "Nuts, cashew nuts, dry roasted, without salt added", + "nutrient": "protein", + "expect": 15.31 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much calories is in 100 g of french doughnut?", + "fdc_id": 172756, + "target": "Doughnuts, french crullers, glazed", + "nutrient": "calories", + "expect": 412.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much sugar is in 100 g of light plum?", + "fdc_id": 169952, + "target": "Plums, canned, purple, light syrup pack, solids and liquids", + "nutrient": "sugar", + "expect": 15.35 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much calories is in a cup of raw parsnip?", + "fdc_id": 170417, + "target": "Parsnips, raw", + "nutrient": "calories", + "expect": 99.75 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much sodium is in 100 g of unprepared asparagu?", + "fdc_id": 169208, + "target": "Asparagus, frozen, unprepared", + "nutrient": "sodium", + "expect": 8.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total sodium in 150 g of mixed unprepared vegetable?", + "fdc_id": 170471, + "target": "Vegetables, mixed, frozen, unprepared", + "nutrient": "sodium", + "expect": 70.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates is in 2 oz of vegetarian refried bean?", + "fdc_id": 174296, + "target": "Refried beans, canned, vegetarian", + "nutrient": "carbohydrate", + "expect": 7.6544 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total carbohydrates in 2 oz of red sauteed pepper?", + "fdc_id": 168550, + "target": "Peppers, sweet, red, sauteed", + "nutrient": "carbohydrate", + "expect": 3.7251 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the potassium level in 2 oz of crushed tomato?", + "fdc_id": 170501, + "target": "Tomatoes, crushed, canned", + "nutrient": "potassium", + "expect": 166.1281 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much calcium is in a cup of immature pigeonpea?", + "fdc_id": 170025, + "target": "Pigeonpeas, immature seeds, raw", + "nutrient": "calcium", + "expect": 64.68 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much fat is in 100 g of corn bran?", + "fdc_id": 170289, + "target": "Corn bran, crude", + "nutrient": "fat", + "expect": 0.92 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sodium content of 2 oz of giblet stewed chicken?", + "fdc_id": 171446, + "target": "Chicken, broilers or fryers, meat and skin and giblets and neck, stewed", + "nutrient": "sodium", + "expect": 37.4213 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of fat in 150 g of boiled plantain?", + "fdc_id": 168216, + "target": "Plantains, green, boiled", + "nutrient": "fat", + "expect": 0.12 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "How much carbohydrates is in 150 g of chilled orange juice?", + "fdc_id": 169101, + "target": "Orange juice, chilled, includes from concentrate, with added calcium and vitamin D", + "nutrient": "carbohydrate", + "expect": 16.905 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calories content of 2 oz of tomatillo?", + "fdc_id": 168566, + "target": "Tomatillos, raw", + "nutrient": "calories", + "expect": 18.1437 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much calories 150 g of chocolate creme pie has.", + "fdc_id": 175014, + "target": "Pie, chocolate creme, commercially prepared", + "nutrient": "calories", + "expect": 529.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much carbohydrates is in a cup of mulberry?", + "fdc_id": 169913, + "target": "Mulberries, raw", + "nutrient": "carbohydrate", + "expect": 13.72 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sugar content of 150 g of cumin spice?", + "fdc_id": 170923, + "target": "Spices, cumin seed", + "nutrient": "sugar", + "expect": 3.375 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the potassium level in 2 oz of white radish?", + "fdc_id": 170081, + "target": "Radishes, white icicle, raw", + "nutrient": "potassium", + "expect": 158.7572 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the vitamin C level in 100 g of clove spice?", + "fdc_id": 171321, + "target": "Spices, cloves, ground", + "nutrient": "vitamin c", + "expect": 0.2 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of sodium in 2 oz of sturgeon cooked fish?", + "fdc_id": 175148, + "target": "Fish, sturgeon, mixed species, cooked, dry heat", + "nutrient": "sodium", + "expect": 39.1223 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total sodium in 2 oz of coconut custard pie?", + "fdc_id": 172782, + "target": "Pie, coconut custard, commercially prepared", + "nutrient": "sodium", + "expect": 189.9417 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total calories in 2 oz of mixed oil nut?", + "fdc_id": 170587, + "target": "Nuts, mixed nuts, oil roasted, with peanuts, without salt added", + "nutrient": "calories", + "expect": 344.1629 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much protein 150 g of thyme spice has.", + "fdc_id": 170938, + "target": "Spices, thyme, dried", + "nutrient": "protein", + "expect": 13.665 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me how much calories is in 2 oz of heavy blackberry?", + "fdc_id": 171709, + "target": "Blackberries, canned, heavy syrup, solids and liquids", + "nutrient": "calories", + "expect": 52.1631 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sugar content of a cup of puree tomato product?", + "fdc_id": 170546, + "target": "Tomato products, canned, puree, with salt added", + "nutrient": "sugar", + "expect": 12.075 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total fat in 150 g of cooked cardoon?", + "fdc_id": 169982, + "target": "Cardoon, cooked, boiled, drained, without salt", + "nutrient": "fat", + "expect": 0.165 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calories content of 150 g of paste seed?", + "fdc_id": 170191, + "target": "Seeds, sesame butter, paste", + "nutrient": "calories", + "expect": 879.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total fat in a cup of unprepared mustard green?", + "fdc_id": 169258, + "target": "Mustard greens, frozen, unprepared", + "nutrient": "fat", + "expect": 0.3942 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "What's the total iron in 150 g of capon giblet roasted chicken?", + "fdc_id": 172407, + "target": "Chicken, capons, meat and skin and giblets and neck, cooked, roasted", + "nutrient": "iron", + "expect": 2.685 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the fat content of 150 g of blackberry juice?", + "fdc_id": 173947, + "target": "Blackberry juice, canned", + "nutrient": "fat", + "expect": 0.9 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "What's the amount of fat in 2 oz of winter all raw squash?", + "fdc_id": 170489, + "target": "Squash, winter, all varieties, raw", + "nutrient": "fat", + "expect": 0.0737 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "I'd like to know how much sodium 2 oz of au unprepared potato has.", + "fdc_id": 170447, + "target": "Potatoes, au gratin, dry mix, unprepared", + "nutrient": "sodium", + "expect": 1187.844 + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "What's the protein level in 100 g of basilisk bacon?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "What's the total vitamin C in 100 g of basilisk bacon?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "How much sugar is in 100 g of hobbit bread?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "What's the total calories in 100 g of hobbit bread?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "What's the amount of calcium in 100 g of star fruit from Venus?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "Can you give me the protein content of 100 g of star fruit from Venus?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "What's the amount of iron in 100 g of sphinx pudding?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "I'd like to know how much iron 100 g of sphinx pudding has.", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "Could you tell me how much calories is in 100 g of chimera chops?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "What's the total fat in 100 g of chimera chops?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "How much sugar is in 100 g of nebula noodles?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "What's the total fiber in 100 g of nebula noodles?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "Could you tell me how much sugar is in 100 g of wyvern wings?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "What's the total iron in 100 g of wyvern wings?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "How much sodium is in 100 g of centaur cheese?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "What's the total carbohydrates in 100 g of centaur cheese?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "Could you tell me how much fiber is in 100 g of golem granola?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "Can you give me the potassium content of 100 g of golem granola?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "What's the amount of fat in 100 g of sprite soup?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "What's the total carbohydrates in 100 g of sprite soup?", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/cooking-v3-r2/nutrition_panel_v2.py b/root/specialists/cooking-v3-r2/nutrition_panel_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..d772c84e4eb8d612f56cc0d8a576a053078c55fd --- /dev/null +++ b/root/specialists/cooking-v3-r2/nutrition_panel_v2.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python3 +"""nutrition_panel_v2 - FRESH panel for cooking v2 (v1 held-out is sealed and immutable): new seed 6161, a different +food partition (fdc_id // 2 parity), new phrasings for both splits written before v2 was run on them - frame-heavy +questions (contractions, "content/amount/level/value", polite frames). Same author as the organ - disclosed. +Derived from nutrition_panel_v1 - the sealed panel for specialist #61 (cooking & nutrition), built from USDA directly, never from +the organ. For each target entry the question names the food with just enough of the entry's OWN words to determine the +answer: the fewest segment words such that every USDA entry containing them agrees on the nutrient within 5%. The +expected value is computed from the target entry (and its own household weight for cup / count questions). Foods are +split dev / held-out by fdc_id; the two splits use different phrasings. Must-decline items: invented foods. +usage: nutrition_panel_v1.py """ +import itertools +import json +import random +import re +import sqlite3 +import sys + +NUTS = ["calories", "protein", "fat", "carbohydrate", "fiber", "sugar", "sodium", "calcium", "iron", "potassium", "vitamin c"] +SAY = {"calories": "calories", "carbohydrate": "carbohydrates", "vitamin c": "vitamin C"} +CATS = ("Vegetables and Vegetable Products", "Fruits and Fruit Juices", "Legumes and Legume Products", "Dairy and Egg Products", + "Nut and Seed Products", "Cereal Grains and Pasta", "Finfish and Shellfish Products", "Poultry Products", "Beef Products", + "Pork Products", "Lamb, Veal, and Game Products", "Spices and Herbs", "Baked Products") +DEV_T = ["What's the amount of {n} in {a} {f}?", "What's the {n} level in {a} {f}?", "Could you tell me how much {n} is in {a} {f}?", + "How much {n} is in {a} {f}?"] +HELD_T = ["Can you give me the {n} content of {a} {f}?", "What is the {n} value for {a} {f}?", + "I'd like to know how much {n} {a} {f} has.", "What's the total {n} in {a} {f}?"] +FAKE = ["basilisk bacon", "hobbit bread", "star fruit from Venus", "sphinx pudding", "chimera chops", "nebula noodles", + "wyvern wings", "centaur cheese", "golem granola", "sprite soup"] + + +def _sing(w): + # the same word normalisation as the organ, so "unambiguous" means the same thing on both sides + if len(w) > 4 and w.endswith("ies"): + return w[:-3] + "y" + if len(w) > 4 and w.endswith("oes"): + return w[:-2] + if len(w) > 3 and w.endswith("es") and w[-3] in "shx": + return w[:-2] + if len(w) > 3 and w.endswith("s") and not w.endswith("ss"): + return w[:-1] + return w + + +def tok(s): + return [_sing(w) for w in re.findall(r"[a-z]+", s.lower()) if len(w) > 1] + + +def main(): + db = sqlite3.connect(sys.argv[1]) + foods = {fid: (desc, cat) for fid, desc, cat in db.execute("SELECT fdc_id, description, category FROM foods")} + toks = {fid: set(tok(d)) for fid, (d, _) in foods.items()} + val = {} + for fid, k, a in db.execute("SELECT fdc_id, key, amount FROM nut"): + val[(fid, k)] = a + rng = random.Random(6161) + items = [] + targets = [f for f, (d, c) in foods.items() if c in CATS and not re.search(r"\b[A-Z]{3,}\b", d.replace("USDA", "")) + and "(" not in d and d.count(",") <= 4] + rng.shuffle(targets) + for fid in targets: + if len([i for i in items if i["kind"] == "nutrient"]) >= 400: + break + desc = foods[fid][0] + segs = [s.strip() for s in desc.split(",")] + head = tok(segs[0]) + if not head or len(head) > 2: + continue + n = rng.choice([k for k in NUTS if (fid, k) in val]) if any((fid, k) in val for k in NUTS) else None + if not n or val[(fid, n)] <= 0: + continue + extra = [w for s in segs[1:] for w in tok(s) if w not in ("and", "with", "without", "or", "of", "to", "in")] + chosen = None + for r in range(0, min(4, len(extra)) + 1): + for comb in itertools.combinations(extra, r): + q = set(head) | set(comb) + match = [g for g, t in toks.items() if q <= t and (g, n) in val] + vs = [val[(g, n)] for g in match] + if match and fid in match and max(vs) > 0 and (max(vs) - min(vs)) / max(vs) <= 0.05: + chosen = comb + break + if chosen is not None: + break + if chosen is None: + continue + name = " ".join(list(chosen) + head) + split = "dev" if (fid // 2) % 2 == 0 else "heldout" + amounts = [("100 g", 100.0), ("150 g", 150.0), ("2 oz", 2 * 28.3495)] + cup = db.execute("SELECT grams FROM portions WHERE fdc_id=? AND label LIKE '1 cup%' ORDER BY length(label)", (fid,)).fetchone() + if cup: + amounts.append(("a cup of", cup[0])) + a_txt, grams = rng.choice(amounts) + a_say = a_txt if a_txt.endswith("of") else a_txt + " of" + t = rng.choice(DEV_T if split == "dev" else HELD_T) + q = t.format(n=SAY.get(n, n), a=a_say.replace(" of of", " of"), f=name).replace(" ", " ") + q = q[0].upper() + q[1:] + items.append({"split": split, "kind": "nutrient", "valid": True, "q": q, "fdc_id": fid, "target": desc, "nutrient": n, + "expect": round(val[(fid, n)] * grams / 100.0, 4)}) + for i, f in enumerate(FAKE): + for split in ("dev", "heldout"): + n = rng.choice(NUTS) + t = rng.choice(DEV_T if split == "dev" else HELD_T) + items.append({"split": split, "kind": "unknown_food", "valid": False, "q": t.format(n=SAY.get(n, n), a="100 g of", f=f), "expect": "decline"}) + json.dump(items, open(sys.argv[2], "w"), indent=1) + import collections + print("panel:", collections.Counter((i["split"], i["kind"]) for i in items)) + for i in items[:6]: + print(" ", i["q"], "->", i.get("expect"), "|", i.get("target")) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/cooking-v3-r2/nutrition_panel_v3.json b/root/specialists/cooking-v3-r2/nutrition_panel_v3.json new file mode 100644 index 0000000000000000000000000000000000000000..0d5b96541b0b057a95c01fa91dcf95a5add0add5 --- /dev/null +++ b/root/specialists/cooking-v3-r2/nutrition_panel_v3.json @@ -0,0 +1,4142 @@ +[ + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of fat in a cup of frozen peach.", + "fdc_id": 169116, + "target": "Peaches, frozen, sliced, sweetened", + "nutrient": "fat", + "expect": 0.325 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the sodium value for 150 g of puff pastry?", + "fdc_id": 172738, + "target": "Puff pastry, frozen, ready-to-bake, baked", + "nutrient": "sodium", + "expect": 379.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the sodium level of a cup of wheat low cracker?", + "fdc_id": 175059, + "target": "Crackers, wheat, low salt", + "nutrient": "sodium", + "expect": 157.7 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much calories is in 100 g of heart raw turkey?", + "fdc_id": 171484, + "target": "Turkey, all classes, heart, raw", + "nutrient": "calories", + "expect": 140.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of fat in 2 oz of pecan commercially pie.", + "fdc_id": 175021, + "target": "Pie, pecan, commercially prepared", + "nutrient": "fat", + "expect": 9.4631 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of potassium in 100 g of grouper fish.", + "fdc_id": 171962, + "target": "Fish, grouper, mixed species, raw", + "nutrient": "potassium", + "expect": 483.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the carbohydrates in 100 g of jelly doughnut?", + "fdc_id": 172759, + "target": "Doughnuts, yeast-leavened, with jelly filling", + "nutrient": "carbohydrate", + "expect": 39.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calories level of 150 g of whiting cooked fish?", + "fdc_id": 175161, + "target": "Fish, whiting, mixed species, cooked, dry heat", + "nutrient": "calories", + "expect": 174.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the iron in 150 g of gluten lemon cooky?", + "fdc_id": 171859, + "target": "Cookies, gluten-free, lemon wafer", + "nutrient": "iron", + "expect": 0.27 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the iron value for 100 g of plain as pasta?", + "fdc_id": 169727, + "target": "Pasta, fresh-refrigerated, plain, as purchased", + "nutrient": "iron", + "expect": 3.35 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much calcium is in 100 g of drained mollusk?", + "fdc_id": 171976, + "target": "Mollusks, clam, mixed species, canned, drained solids", + "nutrient": "calcium", + "expect": 65.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the vitamin C in 100 g of immature raw lima bean?", + "fdc_id": 168396, + "target": "Lima beans, immature seeds, raw", + "nutrient": "vitamin c", + "expect": 23.4 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calories content of 150 g of thompson heavy grape?", + "fdc_id": 174685, + "target": "Grapes, canned, thompson seedless, heavy syrup pack, solids and liquids", + "nutrient": "calories", + "expect": 114.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the fat level of 150 g of garlic bread?", + "fdc_id": 167939, + "target": "Garlic bread, frozen", + "nutrient": "fat", + "expect": 24.915 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much potassium is in 150 g of sweetened raspberry?", + "fdc_id": 167757, + "target": "Raspberries, frozen, red, sweetened", + "nutrient": "potassium", + "expect": 171.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calcium level of 100 g of shellie bean?", + "fdc_id": 169960, + "target": "Beans, shellie, canned, solids and liquids", + "nutrient": "calcium", + "expect": 29.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of potassium in 100 g of whole unprepared onion.", + "fdc_id": 170412, + "target": "Onions, frozen, whole, unprepared", + "nutrient": "potassium", + "expect": 142.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calcium level of 150 g of dill seed spice?", + "fdc_id": 170925, + "target": "Spices, dill seed", + "nutrient": "calcium", + "expect": 2274.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the sugar value for 2 oz of protein yogurt?", + "fdc_id": 170889, + "target": "Yogurt, fruit, low fat,9 g protein/8 oz", + "nutrient": "sugar", + "expect": 10.5687 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calcium level of 150 g of plain unprepared potato?", + "fdc_id": 170043, + "target": "Potatoes, hash brown, frozen, plain, unprepared", + "nutrient": "calcium", + "expect": 15.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the sodium in 100 g of leafy raw cowpea?", + "fdc_id": 169224, + "target": "Cowpeas, leafy tips, raw", + "nutrient": "sodium", + "expect": 7.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of vitamin C in 2 oz of from cheese sauce.", + "fdc_id": 172200, + "target": "Cheese sauce, prepared from recipe", + "nutrient": "vitamin c", + "expect": 0.3402 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the vitamin C value for 2 oz of raw cress?", + "fdc_id": 168407, + "target": "Cress, garden, raw", + "nutrient": "vitamin c", + "expect": 39.1223 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the calories value for 2 oz of white spice?", + "fdc_id": 170933, + "target": "Spices, pepper, white", + "nutrient": "calories", + "expect": 167.829 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much iron is in 150 g of canned turnip green?", + "fdc_id": 168119, + "target": "Turnip greens, canned, no salt added", + "nutrient": "iron", + "expect": 2.265 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much protein is in 2 oz of kidney cooked beef?", + "fdc_id": 169450, + "target": "Beef, variety meats and by-products, kidneys, cooked, simmered", + "nutrient": "protein", + "expect": 15.4618 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much calcium is in 100 g of raw tamarind?", + "fdc_id": 167763, + "target": "Tamarinds, raw", + "nutrient": "calcium", + "expect": 74.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the fat value for 2 oz of standard cheese cracker?", + "fdc_id": 174983, + "target": "Crackers, standard snack-type, sandwich, with cheese filling", + "nutrient": "fat", + "expect": 11.9635 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sodium content of a cup of vegetarian refried bean?", + "fdc_id": 174296, + "target": "Refried beans, canned, vegetarian", + "nutrient": "sodium", + "expect": 1040.6 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much iron is in 2 oz of raw mothbean?", + "fdc_id": 172425, + "target": "Mothbeans, mature seeds, raw", + "nutrient": "iron", + "expect": 6.1518 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the carbohydrates value for 2 oz of frozen whipped topping?", + "fdc_id": 167687, + "target": "Whipped topping, frozen, low fat", + "nutrient": "carbohydrate", + "expect": 13.381 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of calcium in 100 g of pancrea raw veal.", + "fdc_id": 174362, + "target": "Veal, variety meats and by-products, pancreas, raw", + "nutrient": "calcium", + "expect": 19.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much calcium is in a cup of degermed corn flour?", + "fdc_id": 169695, + "target": "Corn flour, yellow, degermed, unenriched", + "nutrient": "calcium", + "expect": 2.52 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the vitamin C in 2 oz of reduced rye bread?", + "fdc_id": 174920, + "target": "Bread, reduced-calorie, rye", + "nutrient": "vitamin c", + "expect": 0.2268 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much potassium is in 2 oz of mahimahi raw fish?", + "fdc_id": 171959, + "target": "Fish, mahimahi, raw", + "nutrient": "potassium", + "expect": 235.8678 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much calories is in 100 g of sweetbread beef?", + "fdc_id": 173093, + "target": "Beef, New Zealand, imported, sweetbread, raw", + "nutrient": "calories", + "expect": 303.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much calories is in 2 oz of breast raw pork?", + "fdc_id": 169187, + "target": "Pork, Shoulder breast, boneless, separable lean and fat, raw", + "nutrient": "calories", + "expect": 72.0077 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much potassium is in 100 g of pita white bread?", + "fdc_id": 174915, + "target": "Bread, pita, white, enriched", + "nutrient": "potassium", + "expect": 120.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calcium content of a cup of royal raw bean?", + "fdc_id": 175196, + "target": "Beans, kidney, royal red, mature seeds, raw", + "nutrient": "calcium", + "expect": 241.04 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the fiber level of 100 g of crude rice bran?", + "fdc_id": 169713, + "target": "Rice bran, crude", + "nutrient": "fiber", + "expect": 21.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of iron in 150 g of chum canned fish.", + "fdc_id": 175135, + "target": "Fish, salmon, chum, canned, drained solids with bone", + "nutrient": "iron", + "expect": 1.05 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the iron value for 100 g of prepared hush puppy?", + "fdc_id": 174999, + "target": "Hush puppies, prepared from recipe", + "nutrient": "iron", + "expect": 3.04 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the vitamin C value for 2 oz of pecan oil nut?", + "fdc_id": 169425, + "target": "Nuts, pecans, oil roasted, with salt added", + "nutrient": "vitamin c", + "expect": 0.3969 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of sugar in 100 g of filled milk.", + "fdc_id": 170862, + "target": "Milk, filled, fluid, with lauric acid oil", + "nutrient": "sugar", + "expect": 4.74 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of fat in 150 g of cooked cardoon.", + "fdc_id": 169338, + "target": "Cardoon, cooked, boiled, drained, with salt", + "nutrient": "fat", + "expect": 0.165 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the protein content of 2 oz of half lowfat cream?", + "fdc_id": 171308, + "target": "Cream, half and half, lowfat", + "nutrient": "protein", + "expect": 1.8881 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the fat content of a cup of degermed cornmeal?", + "fdc_id": 168925, + "target": "Cornmeal, white, self-rising, degermed, enriched", + "nutrient": "fat", + "expect": 2.3736 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the fiber in 100 g of laver seaweed?", + "fdc_id": 168458, + "target": "Seaweed, laver, raw", + "nutrient": "fiber", + "expect": 0.3 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the fiber value for 2 oz of low leavening agent?", + "fdc_id": 172805, + "target": "Leavening agents, baking powder, low-sodium", + "nutrient": "fiber", + "expect": 1.2474 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the sodium in 2 oz of other soymilk?", + "fdc_id": 173767, + "target": "Soymilk, chocolate and other flavors, light, with added calcium, vitamins A and D", + "nutrient": "sodium", + "expect": 26.0815 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the sugar in a cup of glutinou rice?", + "fdc_id": 169711, + "target": "Rice, white, glutinous, unenriched, cooked", + "nutrient": "sugar", + "expect": 0.087 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the iron value for 150 g of green raw plantain?", + "fdc_id": 168215, + "target": "Plantains, green, raw", + "nutrient": "iron", + "expect": 1.125 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of sugar in 150 g of hamburger plain roll.", + "fdc_id": 172796, + "target": "Rolls, hamburger or hotdog, plain", + "nutrient": "sugar", + "expect": 10.92 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the potassium in 100 g of canned raspberry?", + "fdc_id": 167756, + "target": "Raspberries, canned, red, heavy syrup pack, solids and liquids", + "nutrient": "potassium", + "expect": 94.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the carbohydrates value for 150 g of stalk broccoli?", + "fdc_id": 169331, + "target": "Broccoli, stalks, raw", + "nutrient": "carbohydrate", + "expect": 7.86 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the sodium level of 100 g of grass raw bison?", + "fdc_id": 175293, + "target": "Bison, ground, grass-fed, raw", + "nutrient": "sodium", + "expect": 70.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much protein is in 100 g of fluid half cream?", + "fdc_id": 171255, + "target": "Cream, fluid, half and half", + "nutrient": "protein", + "expect": 3.13 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of calcium in 150 g of surimi fish.", + "fdc_id": 173702, + "target": "Fish, surimi", + "nutrient": "calcium", + "expect": 13.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calcium content of 150 g of caraway cheese?", + "fdc_id": 173413, + "target": "Cheese, caraway", + "nutrient": "calcium", + "expect": 1009.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the sodium level of 2 oz of chum cooked fish?", + "fdc_id": 172000, + "target": "Fish, salmon, chum, cooked, dry heat", + "nutrient": "sodium", + "expect": 36.2874 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of potassium in 100 g of cornish only raw chicken.", + "fdc_id": 171108, + "target": "Chicken, cornish game hens, meat only, raw", + "nutrient": "potassium", + "expect": 269.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the iron value for 100 g of lung cooked beef?", + "fdc_id": 168629, + "target": "Beef, variety meats and by-products, lungs, cooked, braised", + "nutrient": "iron", + "expect": 5.4 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the protein value for 100 g of spinach dry spaghetti?", + "fdc_id": 168911, + "target": "Spaghetti, spinach, dry", + "nutrient": "protein", + "expect": 13.35 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much sodium is in 100 g of yellow unenriched cake?", + "fdc_id": 175055, + "target": "Cake, yellow, unenriched, dry mix", + "nutrient": "sodium", + "expect": 657.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calories level of 2 oz of feet raw pork?", + "fdc_id": 167859, + "target": "Pork, fresh, variety meats and by-products, feet, raw", + "nutrient": "calories", + "expect": 120.2019 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the protein value for 2 oz of cherry from pie?", + "fdc_id": 172781, + "target": "Pie, cherry, prepared from recipe", + "nutrient": "protein", + "expect": 1.5876 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much fiber is in 150 g of oatmeal soft cooky?", + "fdc_id": 172726, + "target": "Cookies, oatmeal, commercially prepared, soft-type", + "nutrient": "fiber", + "expect": 4.05 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the sodium in 2 oz of fried cherry pie?", + "fdc_id": 173240, + "target": "Pie, fried pies, cherry", + "nutrient": "sodium", + "expect": 212.0543 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the iron value for 150 g of brain cooked beef?", + "fdc_id": 168623, + "target": "Beef, variety meats and by-products, brain, cooked, pan-fried", + "nutrient": "iron", + "expect": 3.33 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the carbohydrates value for 150 g of crab imitation crustacean?", + "fdc_id": 174203, + "target": "Crustaceans, crab, alaska king, imitation, made from surimi", + "nutrient": "carbohydrate", + "expect": 22.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much carbohydrates is in 2 oz of almond butter nut?", + "fdc_id": 168603, + "target": "Nuts, almond butter, plain, with salt added", + "nutrient": "carbohydrate", + "expect": 10.6708 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the fiber in 100 g of peach pie?", + "fdc_id": 175020, + "target": "Pie, peach", + "nutrient": "fiber", + "expect": 0.8 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the sodium in 100 g of sweet light cherry?", + "fdc_id": 173959, + "target": "Cherries, sweet, canned, light syrup pack, solids and liquids", + "nutrient": "sodium", + "expect": 3.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much sodium is in 100 g of raw jute?", + "fdc_id": 168419, + "target": "Jute, potherb, raw", + "nutrient": "sodium", + "expect": 8.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of calcium in 150 g of pecan dry nut.", + "fdc_id": 169424, + "target": "Nuts, pecans, dry roasted, with salt added", + "nutrient": "calcium", + "expect": 108.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much potassium is in 2 oz of rudi?", + "fdc_id": 167597, + "target": "Rudi's, Gluten-Free Bakery, Original Sandwich Bread", + "nutrient": "potassium", + "expect": 52.1631 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much fat is in 2 oz of english wheat muffin?", + "fdc_id": 172761, + "target": "Muffins, English, wheat", + "nutrient": "fat", + "expect": 1.134 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sodium content of 150 g of drained papaya?", + "fdc_id": 169927, + "target": "Papaya, canned, heavy syrup, drained", + "nutrient": "sodium", + "expect": 13.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the potassium content of 150 g of raw apricot?", + "fdc_id": 171697, + "target": "Apricots, raw", + "nutrient": "potassium", + "expect": 388.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the iron level of 2 oz of heavy plum?", + "fdc_id": 169132, + "target": "Plums, canned, purple, heavy syrup pack, solids and liquids", + "nutrient": "iron", + "expect": 0.4763 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the protein content of 2 oz of chily tomato?", + "fdc_id": 170053, + "target": "Tomatoes, red, ripe, canned, with green chilies", + "nutrient": "protein", + "expect": 0.3912 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sodium content of a cup of heavy pack pear?", + "fdc_id": 169939, + "target": "Pears, canned, heavy syrup pack, solids and liquids", + "nutrient": "sodium", + "expect": 13.3 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the sodium in 150 g of cornsalad?", + "fdc_id": 169219, + "target": "Cornsalad, raw", + "nutrient": "sodium", + "expect": 6.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the sugar in 100 g of standard peanut cracker?", + "fdc_id": 174984, + "target": "Crackers, standard snack-type, sandwich, with peanut butter filling", + "nutrient": "sugar", + "expect": 10.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the potassium in 150 g of angelfood commercially cake?", + "fdc_id": 172694, + "target": "Cake, angelfood, commercially prepared", + "nutrient": "potassium", + "expect": 139.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the calories in 150 g of mussel cooked mollusk?", + "fdc_id": 174217, + "target": "Mollusks, mussel, blue, cooked, moist heat", + "nutrient": "calories", + "expect": 258.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much calcium is in 100 g of tilefish fish?", + "fdc_id": 173705, + "target": "Fish, tilefish, raw", + "nutrient": "calcium", + "expect": 26.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the potassium content of 150 g of american cheese spread?", + "fdc_id": 171254, + "target": "Cheese spread, pasteurized process, American", + "nutrient": "potassium", + "expect": 363.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the sodium value for 2 oz of shark raw fish?", + "fdc_id": 173697, + "target": "Fish, shark, mixed species, raw", + "nutrient": "sodium", + "expect": 44.7922 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of potassium in 2 oz of savory spice.", + "fdc_id": 170936, + "target": "Spices, savory, ground", + "nutrient": "potassium", + "expect": 595.9065 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calcium content of 2 oz of edible unprepared pea?", + "fdc_id": 170012, + "target": "Peas, edible-podded, frozen, unprepared", + "nutrient": "calcium", + "expect": 28.3495 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of fiber in 150 g of cooky chocolate glutino.", + "fdc_id": 167592, + "target": "Glutino, Gluten Free Cookies, Chocolate Vanilla Creme", + "nutrient": "fiber", + "expect": 3.75 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much iron is in 2 oz of semisoft cheese?", + "fdc_id": 173433, + "target": "Cheese, goat, semisoft type", + "nutrient": "iron", + "expect": 0.9185 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much protein is in 2 oz of chocolate fortified yogurt?", + "fdc_id": 172221, + "target": "Yogurt, chocolate, nonfat milk, fortified with vitamin D", + "nutrient": "protein", + "expect": 2.0015 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the sodium value for 100 g of graham chocolate cooky?", + "fdc_id": 174958, + "target": "Cookies, graham crackers, chocolate-coated", + "nutrient": "sodium", + "expect": 265.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the fat value for 100 g of caribou cooked game meat?", + "fdc_id": 173854, + "target": "Game meat, caribou, cooked, roasted", + "nutrient": "fat", + "expect": 4.42 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calcium level of 2 oz of not yogurt?", + "fdc_id": 173464, + "target": "Yogurt, frozen, flavors not chocolate, nonfat milk, with low-calorie sweetener", + "nutrient": "calcium", + "expect": 90.1514 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much vitamin C is in 2 oz of welsh onion?", + "fdc_id": 170007, + "target": "Onions, welsh, raw", + "nutrient": "vitamin c", + "expect": 15.3087 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the calcium value for 2 oz of apple enriched pie?", + "fdc_id": 175011, + "target": "Pie, apple, commercially prepared, enriched flour", + "nutrient": "calcium", + "expect": 6.2369 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much sodium is in 2 oz of manufacturing raw beef?", + "fdc_id": 173086, + "target": "Beef, New Zealand, imported, manufacturing beef, raw", + "nutrient": "sodium", + "expect": 31.1844 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of calories in 100 g of harvard beet.", + "fdc_id": 170479, + "target": "Beets, harvard, canned, solids and liquids", + "nutrient": "calories", + "expect": 73.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the calcium value for 2 oz of raw rhubarb?", + "fdc_id": 167758, + "target": "Rhubarb, raw", + "nutrient": "calcium", + "expect": 48.7611 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of protein in 2 oz of kidney raw lamb.", + "fdc_id": 174354, + "target": "Lamb, variety meats and by-products, kidneys, raw", + "nutrient": "protein", + "expect": 8.9244 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much carbohydrates is in a cup of seco cheese?", + "fdc_id": 172222, + "target": "Cheese, dry white, queso seco", + "nutrient": "carbohydrate", + "expect": 1.9788 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the vitamin C content of a cup of sheep milk?", + "fdc_id": 170882, + "target": "Milk, sheep, fluid", + "nutrient": "vitamin c", + "expect": 10.29 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the sodium in 150 g of wheat toaster muffin?", + "fdc_id": 175046, + "target": "Muffins, wheat bran, toaster-type with raisins, toasted", + "nutrient": "sodium", + "expect": 790.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calories content of 100 g of bison ground raw game meat?", + "fdc_id": 174421, + "target": "Game meat , bison, ground, raw", + "nutrient": "calories", + "expect": 223.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much iron is in 150 g of california grapefruit?", + "fdc_id": 174677, + "target": "Grapefruit, raw, white, California", + "nutrient": "iron", + "expect": 0.12 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the sodium level of 100 g of wing raw chicken?", + "fdc_id": 173632, + "target": "Chicken, broilers or fryers, wing, meat only, raw", + "nutrient": "sodium", + "expect": 81.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calories level of 2 oz of cashew dry nut?", + "fdc_id": 169421, + "target": "Nuts, cashew nuts, dry roasted, with salt added", + "nutrient": "calories", + "expect": 325.4523 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of iron in a cup of catsup.", + "fdc_id": 169381, + "target": "Catsup, low sodium", + "nutrient": "iron", + "expect": 0.84 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the potassium in 2 oz of stew raw beef?", + "fdc_id": 171206, + "target": "Beef, chuck for stew, separable lean and fat, all grades, raw", + "nutrient": "potassium", + "expect": 208.0853 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much carbohydrates is in 100 g of filled milk?", + "fdc_id": 170861, + "target": "Milk, filled, fluid, with blend of hydrogenated vegetable oils", + "nutrient": "carbohydrate", + "expect": 4.74 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the fat value for 100 g of ginkgo dried nut?", + "fdc_id": 170175, + "target": "Nuts, ginkgo nuts, dried", + "nutrient": "fat", + "expect": 2.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of potassium in 100 g of white medium cooked rice.", + "fdc_id": 168930, + "target": "Rice, white, medium-grain, cooked, unenriched", + "nutrient": "potassium", + "expect": 29.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calories level of 2 oz of home potato salad?", + "fdc_id": 169269, + "target": "Potato salad, home-prepared", + "nutrient": "calories", + "expect": 81.0796 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the protein value for 150 g of sirloin roasted veal?", + "fdc_id": 173842, + "target": "Veal, sirloin, separable lean only, cooked, roasted", + "nutrient": "protein", + "expect": 39.48 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the fat level of 100 g of broiler drumstick skin raw chicken?", + "fdc_id": 172373, + "target": "Chicken, broilers or fryers, drumstick, meat and skin, raw", + "nutrient": "fat", + "expect": 9.2 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the potassium level of 2 oz of fresh thyme?", + "fdc_id": 173470, + "target": "Thyme, fresh", + "nutrient": "potassium", + "expect": 345.2969 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sugar content of 2 oz of canned carrot juice?", + "fdc_id": 170491, + "target": "Carrot juice, canned", + "nutrient": "sugar", + "expect": 2.2169 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calories content of 100 g of raisin toasted bread?", + "fdc_id": 172681, + "target": "Bread, raisin, enriched, toasted", + "nutrient": "calories", + "expect": 297.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the carbohydrates in 2 oz of standard unbaked pie crust?", + "fdc_id": 172814, + "target": "Pie crust, standard-type, prepared from recipe, unbaked", + "nutrient": "carbohydrate", + "expect": 23.9837 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calories level of 100 g of dried persimmon?", + "fdc_id": 169942, + "target": "Persimmons, japanese, dried", + "nutrient": "calories", + "expect": 274.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the carbohydrates content of 2 oz of catjang raw cowpea?", + "fdc_id": 175208, + "target": "Cowpeas, catjang, mature seeds, raw", + "nutrient": "carbohydrate", + "expect": 33.8153 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much potassium is in 100 g of breast quail?", + "fdc_id": 172829, + "target": "Quail, breast, meat only, raw", + "nutrient": "potassium", + "expect": 260.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the fat in 150 g of cooked amaranth leave?", + "fdc_id": 169202, + "target": "Amaranth leaves, cooked, boiled, drained, without salt", + "nutrient": "fat", + "expect": 0.27 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the potassium value for 150 g of falafel?", + "fdc_id": 172455, + "target": "Falafel, home-prepared", + "nutrient": "potassium", + "expect": 877.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much sugar is in 100 g of pumpkin flower?", + "fdc_id": 169271, + "target": "Pumpkin flowers, cooked, boiled, drained, without salt", + "nutrient": "sugar", + "expect": 2.4 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much protein is in 150 g of feet chicken?", + "fdc_id": 171119, + "target": "Chicken, feet, boiled", + "nutrient": "protein", + "expect": 29.1 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the calcium value for 100 g of mashed home butter potato?", + "fdc_id": 168555, + "target": "Potatoes, mashed, home-prepared, whole milk and butter added", + "nutrient": "calcium", + "expect": 24.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the fat level of 100 g of scallop breaded mollusk?", + "fdc_id": 174221, + "target": "Mollusks, scallop, mixed species, cooked, breaded and fried", + "nutrient": "fat", + "expect": 10.94 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the potassium value for 150 g of baby carrot?", + "fdc_id": 168568, + "target": "Carrots, baby, raw", + "nutrient": "potassium", + "expect": 355.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calories level of 2 oz of unenriched corn flour?", + "fdc_id": 169696, + "target": "Corn flour, masa, unenriched, white", + "nutrient": "calories", + "expect": 205.8174 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the calcium in 2 oz of matzo onion cracker?", + "fdc_id": 172812, + "target": "Crackers, matzo, egg and onion", + "nutrient": "calcium", + "expect": 20.4116 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the carbohydrates level of 150 g of raw arrowroot?", + "fdc_id": 168490, + "target": "Arrowroot, raw", + "nutrient": "carbohydrate", + "expect": 20.085 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the potassium content of 2 oz of extra prepared tofu?", + "fdc_id": 174290, + "target": "Tofu, extra firm, prepared with nigari", + "nutrient": "potassium", + "expect": 73.7087 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the iron in 2 oz of cod atlantic raw fish?", + "fdc_id": 171955, + "target": "Fish, cod, Atlantic, raw", + "nutrient": "iron", + "expect": 0.2155 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the protein in 150 g of pumpkin from pie?", + "fdc_id": 172788, + "target": "Pie, pumpkin, prepared from recipe", + "nutrient": "protein", + "expect": 6.75 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the carbohydrates value for 2 oz of shortbread reduced cooky?", + "fdc_id": 174087, + "target": "Cookies, shortbread, reduced fat", + "nutrient": "carbohydrate", + "expect": 43.0856 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the vitamin C content of 150 g of section juice grapefruit?", + "fdc_id": 173036, + "target": "Grapefruit, sections, canned, juice pack, solids and liquids", + "nutrient": "vitamin c", + "expect": 50.85 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the carbohydrates level of 2 oz of white english muffin?", + "fdc_id": 174093, + "target": "English muffins, whole grain white", + "nutrient": "carbohydrate", + "expect": 28.4459 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the protein in 2 oz of deliciou udi?", + "fdc_id": 167598, + "target": "Udi's, Gluten Free, Soft & Delicious White Sandwich Bread", + "nutrient": "protein", + "expect": 3.0617 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the iron in 2 oz of ling cooked fish?", + "fdc_id": 174234, + "target": "Fish, ling, cooked, dry heat", + "nutrient": "iron", + "expect": 0.4706 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the protein value for 150 g of cooked celeriac?", + "fdc_id": 169341, + "target": "Celeriac, cooked, boiled, drained, with salt", + "nutrient": "protein", + "expect": 1.44 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much fat is in 150 g of anchovy canned fish?", + "fdc_id": 174183, + "target": "Fish, anchovy, european, canned in oil, drained solids", + "nutrient": "fat", + "expect": 14.565 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of vitamin C in a cup of raw collard.", + "fdc_id": 170406, + "target": "Collards, raw", + "nutrient": "vitamin c", + "expect": 12.708 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much calcium is in 2 oz of oatmeal toasted bread?", + "fdc_id": 172679, + "target": "Bread, oatmeal, toasted", + "nutrient": "calcium", + "expect": 40.8233 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the protein level of 100 g of fordhook unprepared lima bean?", + "fdc_id": 169953, + "target": "Lima beans, immature seeds, frozen, fordhook, unprepared", + "nutrient": "protein", + "expect": 6.4 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much potassium is in 2 oz of baked sweet roll?", + "fdc_id": 172799, + "target": "Sweet rolls, cinnamon, refrigerated dough with frosting, baked", + "nutrient": "potassium", + "expect": 35.7204 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much sugar is in 150 g of traditional refried bean?", + "fdc_id": 172438, + "target": "Refried beans, canned, traditional style", + "nutrient": "sugar", + "expect": 0.81 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the sodium value for 150 g of mackerel atlantic raw fish?", + "fdc_id": 175119, + "target": "Fish, mackerel, Atlantic, raw", + "nutrient": "sodium", + "expect": 135.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much fat is in 150 g of gluten chocolate sandwich cooky?", + "fdc_id": 171857, + "target": "Cookies, gluten-free, chocolate sandwich, with creme filling", + "nutrient": "fat", + "expect": 26.835 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of calories in 2 oz of intermuscular raw lamb.", + "fdc_id": 174434, + "target": "Lamb, New Zealand, imported, Intermuscular fat, raw", + "nutrient": "calories", + "expect": 362.8736 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the potassium in 100 g of chocolate creme pie?", + "fdc_id": 175014, + "target": "Pie, chocolate creme, commercially prepared", + "nutrient": "potassium", + "expect": 161.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sugar content of a cup of pear nectar?", + "fdc_id": 169940, + "target": "Pear nectar, canned, without added ascorbic acid", + "nutrient": "sugar", + "expect": 37.9 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much fiber is in 100 g of pumpkin kernel roasted seed?", + "fdc_id": 169415, + "target": "Seeds, pumpkin and squash seed kernels, roasted, with salt added", + "nutrient": "fiber", + "expect": 6.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the calcium value for a cup of added pasta?", + "fdc_id": 169737, + "target": "Pasta, cooked, enriched, without added salt", + "nutrient": "calcium", + "expect": 7.49 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the fat value for 2 oz of juice skin apricot?", + "fdc_id": 173937, + "target": "Apricots, canned, juice pack, with skin, solids and liquids", + "nutrient": "fat", + "expect": 0.0227 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the calories value for 100 g of mackerel atlantic cooked fish?", + "fdc_id": 175120, + "target": "Fish, mackerel, Atlantic, cooked, dry heat", + "nutrient": "calories", + "expect": 262.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the iron value for 2 oz of parmesan dry cheese?", + "fdc_id": 173452, + "target": "Cheese, parmesan, dry grated, reduced fat", + "nutrient": "iron", + "expect": 0.5103 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the protein in 100 g of ricotta whole cheese?", + "fdc_id": 170851, + "target": "Cheese, ricotta, whole milk", + "nutrient": "protein", + "expect": 7.54 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much potassium is in 2 oz of brain raw veal?", + "fdc_id": 174351, + "target": "Veal, variety meats and by-products, brain, raw", + "nutrient": "potassium", + "expect": 178.6018 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the calories in 150 g of external raw veal?", + "fdc_id": 174882, + "target": "Veal, external fat only, raw", + "nutrient": "calories", + "expect": 754.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the sugar value for 150 g of basil spice?", + "fdc_id": 171317, + "target": "Spices, basil, dried", + "nutrient": "sugar", + "expect": 2.565 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much calories is in 150 g of sirloin only braised veal?", + "fdc_id": 173841, + "target": "Veal, sirloin, separable lean only, cooked, braised", + "nutrient": "calories", + "expect": 306.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sodium content of 100 g of brain simmered beef?", + "fdc_id": 168624, + "target": "Beef, variety meats and by-products, brain, cooked, simmered", + "nutrient": "sodium", + "expect": 108.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the calories value for a cup of raw parsnip?", + "fdc_id": 170417, + "target": "Parsnips, raw", + "nutrient": "calories", + "expect": 99.75 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calories level of 100 g of teste raw lamb?", + "fdc_id": 172619, + "target": "Lamb, New Zealand, imported, testes, raw", + "nutrient": "calories", + "expect": 68.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the sugar in 150 g of pickled beet?", + "fdc_id": 170480, + "target": "Beets, pickled, canned, solids and liquids", + "nutrient": "sugar", + "expect": 16.575 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the potassium content of 150 g of whole dinner udi?", + "fdc_id": 167600, + "target": "Udi's, Gluten Free, Whole Grain Dinner Rolls", + "nutrient": "potassium", + "expect": 409.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much potassium is in 150 g of only cooked goose?", + "fdc_id": 172414, + "target": "Goose, domesticated, meat only, cooked, roasted", + "nutrient": "potassium", + "expect": 582.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the protein in 150 g of roasting light raw chicken?", + "fdc_id": 172398, + "target": "Chicken, roasting, light meat, meat only, raw", + "nutrient": "protein", + "expect": 33.3 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the protein in 2 oz of saltine fat cracker?", + "fdc_id": 175068, + "target": "Crackers, saltines, fat-free, low-sodium", + "nutrient": "protein", + "expect": 5.9534 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the potassium level of 100 g of cooked dandelion green?", + "fdc_id": 169227, + "target": "Dandelion greens, cooked, boiled, drained, without salt", + "nutrient": "potassium", + "expect": 232.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the protein in 2 oz of sapote?", + "fdc_id": 167760, + "target": "Sapote, mamey, raw", + "nutrient": "protein", + "expect": 0.8221 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the potassium value for 2 oz of defatted peanut flour?", + "fdc_id": 174267, + "target": "Peanut flour, defatted", + "nutrient": "potassium", + "expect": 731.4171 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much fiber is in 100 g of pink grapefruit juice?", + "fdc_id": 173038, + "target": "Grapefruit juice, pink or red, with added calcium", + "nutrient": "fiber", + "expect": 0.3 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much carbohydrates is in 100 g of red spice?", + "fdc_id": 170932, + "target": "Spices, pepper, red or cayenne", + "nutrient": "carbohydrate", + "expect": 56.63 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the iron level of 150 g of cooked unenriched noodle?", + "fdc_id": 169762, + "target": "Noodles, egg, cooked, unenriched, with added salt", + "nutrient": "iron", + "expect": 0.9 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calories content of 2 oz of uncooked rhubarb?", + "fdc_id": 168168, + "target": "Rhubarb, frozen, uncooked", + "nutrient": "calories", + "expect": 11.9068 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calcium level of 2 oz of dill pickle?", + "fdc_id": 168563, + "target": "Pickles, cucumber, dill, reduced sodium", + "nutrient": "calcium", + "expect": 32.3184 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the potassium level of 150 g of wolffish raw fish?", + "fdc_id": 175162, + "target": "Fish, wolffish, Atlantic, raw", + "nutrient": "potassium", + "expect": 450.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the vitamin C value for a cup of serrano pepper?", + "fdc_id": 169395, + "target": "Peppers, serrano, raw", + "nutrient": "vitamin c", + "expect": 47.145 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the iron in 2 oz of dinner egg roll?", + "fdc_id": 175027, + "target": "Rolls, dinner, egg", + "nutrient": "iron", + "expect": 1.9958 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much iron is in a cup of cooked salsify?", + "fdc_id": 170529, + "target": "Salsify, cooked, boiled, drained, with salt", + "nutrient": "iron", + "expect": 0.7425 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the sodium in 100 g of mature raw winged bean?", + "fdc_id": 174283, + "target": "Winged beans, mature seeds, raw", + "nutrient": "sodium", + "expect": 38.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calcium content of 2 oz of higher baked biscuit?", + "fdc_id": 172669, + "target": "Biscuits, plain or buttermilk, refrigerated dough, higher fat, baked", + "nutrient": "calcium", + "expect": 15.3087 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sugar content of a cup of light sour cream?", + "fdc_id": 173443, + "target": "Sour cream, light", + "nutrient": "sugar", + "expect": 0.506 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of fat in 2 oz of blackberry juice.", + "fdc_id": 173947, + "target": "Blackberry juice, canned", + "nutrient": "fat", + "expect": 0.3402 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much protein is in 150 g of spirulina dried seaweed?", + "fdc_id": 170495, + "target": "Seaweed, spirulina, dried", + "nutrient": "protein", + "expect": 86.205 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the fat value for 100 g of beefalo cooked game meat?", + "fdc_id": 173848, + "target": "Game meat, beefalo, composite of cuts, cooked, roasted", + "nutrient": "fat", + "expect": 6.32 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the potassium in 2 oz of elk roasted game meat?", + "fdc_id": 175302, + "target": "Game meat, elk, cooked, roasted", + "nutrient": "potassium", + "expect": 185.9727 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the iron content of 150 g of scalloped unprepared potato?", + "fdc_id": 170449, + "target": "Potatoes, scalloped, dry mix, unprepared", + "nutrient": "iron", + "expect": 3.015 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much fat is in 150 g of hubbard baked squash?", + "fdc_id": 170537, + "target": "Squash, winter, hubbard, baked, with salt", + "nutrient": "fat", + "expect": 0.93 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the iron content of 150 g of raw chayote?", + "fdc_id": 170402, + "target": "Chayote, fruit, raw", + "nutrient": "iron", + "expect": 0.51 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the sugar value for 150 g of french wedge potato?", + "fdc_id": 168946, + "target": "Potatoes, french fried, wedge cut, frozen, unprepared", + "nutrient": "sugar", + "expect": 0.51 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the protein level of 150 g of native persimmon?", + "fdc_id": 169943, + "target": "Persimmons, native, raw", + "nutrient": "protein", + "expect": 1.2 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the calcium value for 150 g of scalloped home potato?", + "fdc_id": 170525, + "target": "Potatoes, scalloped, home-prepared with margarine", + "nutrient": "calcium", + "expect": 85.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the sugar level of 100 g of green cauliflower?", + "fdc_id": 169390, + "target": "Cauliflower, green, cooked, no salt added", + "nutrient": "sugar", + "expect": 3.12 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much vitamin C is in a cup of raw watermelon?", + "fdc_id": 167765, + "target": "Watermelon, raw", + "nutrient": "vitamin c", + "expect": 12.474 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calories level of 100 g of lauric cream substitute?", + "fdc_id": 171262, + "target": "Cream substitute, liquid, with lauric acid oil and sodium caseinate", + "nutrient": "calories", + "expect": 136.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of potassium in 100 g of original pepperidge farm.", + "fdc_id": 167594, + "target": "Pepperidge Farm, Goldfish, Baked Snack Crackers, Original", + "nutrient": "potassium", + "expect": 169.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sodium content of 2 oz of raw drumstick leave?", + "fdc_id": 168416, + "target": "Drumstick leaves, raw", + "nutrient": "sodium", + "expect": 5.1029 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of potassium in a cup of goat milk.", + "fdc_id": 171278, + "target": "Milk, goat, fluid, with added vitamin D", + "nutrient": "potassium", + "expect": 497.76 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much carbohydrates is in 150 g of toasted waffle?", + "fdc_id": 167517, + "target": "Waffle, buttermilk, frozen, ready-to-heat, toasted", + "nutrient": "carbohydrate", + "expect": 72.585 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the sodium value for 2 oz of paprika spice?", + "fdc_id": 171329, + "target": "Spices, paprika", + "nutrient": "sodium", + "expect": 38.5553 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the fat in 100 g of white medium raw rice?", + "fdc_id": 169760, + "target": "Rice, white, medium-grain, raw, unenriched", + "nutrient": "fat", + "expect": 0.58 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the protein level of 150 g of broiler giblet raw chicken?", + "fdc_id": 171057, + "target": "Chicken, broilers or fryers, giblets, raw", + "nutrient": "protein", + "expect": 26.82 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much protein is in 2 oz of hickorynut nut?", + "fdc_id": 170177, + "target": "Nuts, hickorynuts, dried", + "nutrient": "protein", + "expect": 7.2121 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calcium level of 100 g of swiss nonfat cheese?", + "fdc_id": 170897, + "target": "Cheese, Swiss, nonfat or fat free", + "nutrient": "calcium", + "expect": 961.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the potassium level of 2 oz of rosemary spice?", + "fdc_id": 171333, + "target": "Spices, rosemary, dried", + "nutrient": "potassium", + "expect": 541.4755 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of vitamin C in 2 oz of only potato.", + "fdc_id": 170113, + "target": "Potatoes, baked, skin only, with salt", + "nutrient": "vitamin c", + "expect": 7.6544 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calcium content of 2 oz of chocolate soft cooky?", + "fdc_id": 172717, + "target": "Cookies, chocolate chip, commercially prepared, soft-type", + "nutrient": "calcium", + "expect": 9.6388 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the protein in 100 g of green fried plantain?", + "fdc_id": 168199, + "target": "Plantains, green, fried", + "nutrient": "protein", + "expect": 1.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much sodium is in 150 g of rinsed pea?", + "fdc_id": 170015, + "target": "Peas, green, canned, drained solids, rinsed in tap water", + "nutrient": "sodium", + "expect": 346.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the potassium value for 100 g of subcutaneou cooked lamb?", + "fdc_id": 172613, + "target": "Lamb, New Zealand, imported, subcutaneous fat, cooked", + "nutrient": "potassium", + "expect": 164.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the protein content of 150 g of grass strip beef?", + "fdc_id": 169429, + "target": "Beef, grass-fed, strip steaks, lean only, raw", + "nutrient": "protein", + "expect": 34.605 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the potassium value for 2 oz of full emu?", + "fdc_id": 174479, + "target": "Emu, full rump, raw", + "nutrient": "potassium", + "expect": 187.1067 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the sodium in 150 g of nopale?", + "fdc_id": 168571, + "target": "Nopales, raw", + "nutrient": "sodium", + "expect": 31.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much carbohydrates is in 2 oz of hard tofu?", + "fdc_id": 174291, + "target": "Tofu, hard, prepared with nigari", + "nutrient": "carbohydrate", + "expect": 2.4891 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the fiber content of 2 oz of spinach cooked noodle?", + "fdc_id": 169734, + "target": "Noodles, egg, spinach, enriched, cooked", + "nutrient": "fiber", + "expect": 1.3041 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much calories is in 150 g of raw arrowhead?", + "fdc_id": 169203, + "target": "Arrowhead, raw", + "nutrient": "calories", + "expect": 148.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the iron level of 100 g of milkfish raw fish?", + "fdc_id": 173675, + "target": "Fish, milkfish, raw", + "nutrient": "iron", + "expect": 0.32 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the vitamin C in 2 oz of elderberry?", + "fdc_id": 171727, + "target": "Elderberries, raw", + "nutrient": "vitamin c", + "expect": 20.4116 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calcium level of 100 g of summer unprepared squash?", + "fdc_id": 168467, + "target": "Squash, summer, crookneck and straightneck, frozen, unprepared", + "nutrient": "calcium", + "expect": 18.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the protein in 2 oz of oatmeal dry cooky?", + "fdc_id": 174960, + "target": "Cookies, oatmeal, dry mix", + "nutrient": "protein", + "expect": 3.6854 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the carbohydrates level of 150 g of strawberry guava?", + "fdc_id": 173045, + "target": "Guavas, strawberry, raw", + "nutrient": "carbohydrate", + "expect": 26.04 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of protein in 100 g of peanut soft cooky.", + "fdc_id": 172728, + "target": "Cookies, peanut butter, commercially prepared, soft-type", + "nutrient": "protein", + "expect": 5.3 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the sodium level of 150 g of jalapeno canned pepper?", + "fdc_id": 170080, + "target": "Peppers, jalapeno, canned, solids and liquids", + "nutrient": "sodium", + "expect": 2506.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the sodium in 150 g of eggnog?", + "fdc_id": 171258, + "target": "Eggnog", + "nutrient": "sodium", + "expect": 81.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calories level of 100 g of apple croissant?", + "fdc_id": 174988, + "target": "Croissants, apple", + "nutrient": "calories", + "expect": 254.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calcium content of 100 g of raw taro leave?", + "fdc_id": 168487, + "target": "Taro leaves, raw", + "nutrient": "calcium", + "expect": 107.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much calories is in 150 g of chinook cooked fish?", + "fdc_id": 171999, + "target": "Fish, salmon, chinook, cooked, dry heat", + "nutrient": "calories", + "expect": 346.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much potassium is in 100 g of new ground raw lamb?", + "fdc_id": 172617, + "target": "Lamb, New Zealand, imported, ground lamb, raw", + "nutrient": "potassium", + "expect": 281.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of calories in 2 oz of tahitian taro.", + "fdc_id": 170455, + "target": "Taro, tahitian, cooked, without salt", + "nutrient": "calories", + "expect": 24.9476 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the iron content of 150 g of unsweetened grape juice?", + "fdc_id": 173041, + "target": "Grape juice, canned or bottled, unsweetened, with added ascorbic acid", + "nutrient": "iron", + "expect": 0.375 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calcium level of 2 oz of from toasted bread?", + "fdc_id": 172691, + "target": "Bread, whole-wheat, prepared from recipe, toasted", + "nutrient": "calcium", + "expect": 20.4116 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calories level of 2 oz of batter fish?", + "fdc_id": 175143, + "target": "Fish, shark, mixed species, cooked, batter-dipped and fried", + "nutrient": "calories", + "expect": 129.2737 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the calcium in 100 g of brain braised lamb?", + "fdc_id": 172526, + "target": "Lamb, variety meats and by-products, brain, cooked, braised", + "nutrient": "calcium", + "expect": 12.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the fat content of 2 oz of giblet cooked turkey?", + "fdc_id": 171084, + "target": "Turkey, whole, giblets, cooked, simmered", + "nutrient": "fat", + "expect": 3.7478 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of calcium in 2 oz of whelk cooked mollusk.", + "fdc_id": 171984, + "target": "Mollusks, whelk, unspecified, cooked, moist heat", + "nutrient": "calcium", + "expect": 64.0699 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much carbohydrates is in 100 g of reduced wheat bread?", + "fdc_id": 174921, + "target": "Bread, reduced-calorie, wheat", + "nutrient": "carbohydrate", + "expect": 42.47 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the iron in 2 oz of shell seed?", + "fdc_id": 169417, + "target": "Seeds, sunflower seed kernels from shell, dry roasted, with salt added", + "nutrient": "iron", + "expect": 2.1546 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sodium content of 2 oz of cake crustacean?", + "fdc_id": 171967, + "target": "Crustaceans, crab, blue, crab cakes, home recipe", + "nutrient": "sodium", + "expect": 187.1067 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sugar content of 100 g of non yogurt?", + "fdc_id": 170906, + "target": "Yogurt, vanilla, non-fat", + "nutrient": "sugar", + "expect": 5.88 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of vitamin C in 2 oz of salad fish.", + "fdc_id": 175160, + "target": "Fish, tuna salad", + "nutrient": "vitamin c", + "expect": 1.2474 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the carbohydrates level of 100 g of safflower meal seed?", + "fdc_id": 170559, + "target": "Seeds, safflower seed meal, partially defatted", + "nutrient": "carbohydrate", + "expect": 48.73 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the sodium level of 100 g of all light turkey?", + "fdc_id": 171491, + "target": "Turkey, all classes, light meat, cooked, roasted", + "nutrient": "sodium", + "expect": 99.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of fiber in 100 g of chilled orange juice.", + "fdc_id": 169920, + "target": "Orange juice, chilled, includes from concentrate, with added calcium", + "nutrient": "fiber", + "expect": 0.3 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of potassium in 100 g of frozen fiddlehead fern.", + "fdc_id": 168584, + "target": "Fiddlehead ferns, frozen, unprepared", + "nutrient": "potassium", + "expect": 129.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the protein value for a cup of canned nonfat milk?", + "fdc_id": 170878, + "target": "Milk, canned, evaporated, nonfat, with added vitamin A and vitamin D", + "nutrient": "protein", + "expect": 19.328 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the carbohydrates level of 100 g of graham pie crust?", + "fdc_id": 172811, + "target": "Pie crust, cookie-type, prepared from recipe, graham cracker, chilled", + "nutrient": "carbohydrate", + "expect": 63.9 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the carbohydrates in 100 g of filled cracker?", + "fdc_id": 171848, + "target": "Crackers, sandwich-type, peanut butter filled, reduced fat", + "nutrient": "carbohydrate", + "expect": 63.49 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much vitamin C is in 2 oz of clove spice?", + "fdc_id": 171321, + "target": "Spices, cloves, ground", + "nutrient": "vitamin c", + "expect": 0.1134 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the protein value for 100 g of chopped onion?", + "fdc_id": 170410, + "target": "Onions, frozen, chopped, unprepared", + "nutrient": "protein", + "expect": 0.79 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the protein value for 150 g of raw peanut?", + "fdc_id": 174263, + "target": "Peanuts, spanish, raw", + "nutrient": "protein", + "expect": 39.225 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the fiber level of 2 oz of raw kohlrabi?", + "fdc_id": 168424, + "target": "Kohlrabi, raw", + "nutrient": "fiber", + "expect": 2.0412 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the fiber value for 2 oz of almond dry nut?", + "fdc_id": 170158, + "target": "Nuts, almonds, dry roasted, without salt added", + "nutrient": "fiber", + "expect": 6.1802 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the calories in 2 oz of fresh peppermint?", + "fdc_id": 173474, + "target": "Peppermint, fresh", + "nutrient": "calories", + "expect": 39.6893 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much fat is in 150 g of shelf tortilla?", + "fdc_id": 167535, + "target": "Tortillas, ready-to-bake or -fry, flour, shelf stable", + "nutrient": "fat", + "expect": 11.37 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the potassium level of 150 g of chocolate waffle?", + "fdc_id": 167524, + "target": "Waffles, chocolate chip, frozen, ready-to-heat", + "nutrient": "potassium", + "expect": 111.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the calories in 150 g of sprouted raw soybean?", + "fdc_id": 169284, + "target": "Soybeans, mature seeds, sprouted, raw", + "nutrient": "calories", + "expect": 183.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the sugar value for 150 g of whole wing raw turkey?", + "fdc_id": 171497, + "target": "Turkey, whole, wing, meat only, raw", + "nutrient": "sugar", + "expect": 0.075 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of calcium in 2 oz of savoy raw cabbage.", + "fdc_id": 170388, + "target": "Cabbage, savoy, raw", + "nutrient": "calcium", + "expect": 19.8446 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the carbohydrates level of 150 g of endive?", + "fdc_id": 168412, + "target": "Endive, raw", + "nutrient": "carbohydrate", + "expect": 5.025 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of calories in 2 oz of sharp cheese.", + "fdc_id": 170899, + "target": "Cheese, cheddar, sharp, sliced", + "nutrient": "calories", + "expect": 232.4659 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the calories in 150 g of home hummu?", + "fdc_id": 172454, + "target": "Hummus, home prepared", + "nutrient": "calories", + "expect": 265.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the iron value for 100 g of tip raw pork?", + "fdc_id": 168371, + "target": "Pork, Leg sirloin tip roast, boneless, separable lean and fat, raw", + "nutrient": "iron", + "expect": 0.8 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the carbohydrates content of 150 g of intermuscular cooked beef?", + "fdc_id": 173082, + "target": "Beef, New Zealand, imported, intermuscular fat, cooked", + "nutrient": "carbohydrate", + "expect": 5.085 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the protein in 2 oz of poppy spice?", + "fdc_id": 171330, + "target": "Spices, poppy seed", + "nutrient": "protein", + "expect": 10.2002 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much vitamin C is in 100 g of witloof chicory?", + "fdc_id": 170404, + "target": "Chicory, witloof, raw", + "nutrient": "vitamin c", + "expect": 2.8 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the protein in a cup of pink grapefruit juice?", + "fdc_id": 167774, + "target": "Grapefruit juice, pink, raw", + "nutrient": "protein", + "expect": 1.235 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much carbohydrates is in 2 oz of natto?", + "fdc_id": 172443, + "target": "Natto", + "nutrient": "carbohydrate", + "expect": 7.1894 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of fat in 150 g of pumpernickel roll.", + "fdc_id": 168126, + "target": "Rolls, pumpernickel", + "nutrient": "fat", + "expect": 4.2 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the fat in 100 g of mechanically turkey?", + "fdc_id": 171504, + "target": "Turkey, mechanically deboned, from turkey frames, raw", + "nutrient": "fat", + "expect": 15.96 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the fat value for a cup of cooked beet green?", + "fdc_id": 168508, + "target": "Beet greens, cooked, boiled, drained, with salt", + "nutrient": "fat", + "expect": 0.288 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the sodium in 150 g of nonfat instant milk?", + "fdc_id": 171272, + "target": "Milk, dry, nonfat, instant, with added vitamin A and vitamin D", + "nutrient": "sodium", + "expect": 823.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the fiber level of 100 g of honeydew melon?", + "fdc_id": 169911, + "target": "Melons, honeydew, raw", + "nutrient": "fiber", + "expect": 0.8 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the fat level of a cup of seasoned pea?", + "fdc_id": 170014, + "target": "Peas, green, canned, seasoned, solids and liquids", + "nutrient": "fat", + "expect": 0.6129 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the vitamin C level of 2 oz of chocolate from cake?", + "fdc_id": 172697, + "target": "Cake, chocolate, prepared from recipe without frosting", + "nutrient": "vitamin c", + "expect": 0.1134 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much carbohydrates is in a cup of indian milk?", + "fdc_id": 171280, + "target": "Milk, indian buffalo, fluid", + "nutrient": "carbohydrate", + "expect": 12.6392 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much protein is in a cup of chunk peanut butter?", + "fdc_id": 172469, + "target": "Peanut butter, chunk style, without salt", + "nutrient": "protein", + "expect": 62.0748 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of sodium in 150 g of yellow onion.", + "fdc_id": 170004, + "target": "Onions, yellow, sauteed", + "nutrient": "sodium", + "expect": 18.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of potassium in 100 g of sucker cooked fish.", + "fdc_id": 172002, + "target": "Fish, sucker, white, cooked, dry heat", + "nutrient": "potassium", + "expect": 487.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the calcium value for 150 g of fresh spearmint?", + "fdc_id": 173475, + "target": "Spearmint, fresh", + "nutrient": "calcium", + "expect": 298.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much calories is in 150 g of pacific cooked mollusk?", + "fdc_id": 174250, + "target": "Mollusks, oyster, Pacific, cooked, moist heat", + "nutrient": "calories", + "expect": 244.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of vitamin C in 150 g of fruit pie.", + "fdc_id": 172784, + "target": "Pie, fried pies, fruit", + "nutrient": "vitamin c", + "expect": 1.95 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the iron content of 150 g of made cooky?", + "fdc_id": 174096, + "target": "Cookies, chocolate, made with rice cereal", + "nutrient": "iron", + "expect": 3.735 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the protein level of 150 g of colby cheese?", + "fdc_id": 173439, + "target": "Cheese, low fat, cheddar or colby", + "nutrient": "protein", + "expect": 36.525 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of fat in 100 g of monkfish cooked fish.", + "fdc_id": 171996, + "target": "Fish, monkfish, cooked, dry heat", + "nutrient": "fat", + "expect": 1.95 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of vitamin C in a cup of canned bamboo shoot.", + "fdc_id": 169212, + "target": "Bamboo shoots, canned, drained solids", + "nutrient": "vitamin c", + "expect": 1.441 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the protein value for 150 g of drained plum?", + "fdc_id": 168183, + "target": "Plums, canned, heavy syrup, drained", + "nutrient": "protein", + "expect": 0.66 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of sodium in 100 g of diluted orange juice.", + "fdc_id": 169921, + "target": "Orange juice, frozen concentrate, unsweetened, diluted with 3 volume water, with added calcium", + "nutrient": "sodium", + "expect": 4.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of fat in 150 g of seatrout cooked fish.", + "fdc_id": 174242, + "target": "Fish, seatrout, mixed species, cooked, dry heat", + "nutrient": "fat", + "expect": 6.945 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calcium level of a cup of corn rice pasta?", + "fdc_id": 173265, + "target": "Pasta, gluten-free, corn and rice flour, cooked", + "nutrient": "calcium", + "expect": 2.82 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the potassium level of 2 oz of pecan dry nut?", + "fdc_id": 170183, + "target": "Nuts, pecans, dry roasted, without salt added", + "nutrient": "potassium", + "expect": 240.4038 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calcium content of 150 g of oatmeal from cooky?", + "fdc_id": 172807, + "target": "Cookies, oatmeal, prepared from recipe, without raisins", + "nutrient": "calcium", + "expect": 157.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the iron value for 2 oz of refrigerated tortilla?", + "fdc_id": 175037, + "target": "Tortillas, ready-to-bake or -fry, flour, refrigerated", + "nutrient": "iron", + "expect": 2.0582 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calcium level of 150 g of cooked hyacinth bean?", + "fdc_id": 175211, + "target": "Hyacinth beans, mature seeds, cooked, boiled, without salt", + "nutrient": "calcium", + "expect": 60.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the fiber in 100 g of chanterelle mushroom?", + "fdc_id": 168422, + "target": "Mushrooms, Chanterelle, raw", + "nutrient": "fiber", + "expect": 3.8 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calories content of 100 g of bluefish raw fish?", + "fdc_id": 171949, + "target": "Fish, bluefish, raw", + "nutrient": "calories", + "expect": 124.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much iron is in 100 g of lower baked biscuit?", + "fdc_id": 174905, + "target": "Biscuits, plain or buttermilk, refrigerated dough, lower fat, baked", + "nutrient": "iron", + "expect": 3.09 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sodium content of a cup of yolk fresh egg?", + "fdc_id": 172184, + "target": "Egg, yolk, raw, fresh", + "nutrient": "sodium", + "expect": 116.64 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much potassium is in 2 oz of flesh sweet potato?", + "fdc_id": 170134, + "target": "Sweet potato, cooked, baked in skin, flesh, with salt", + "nutrient": "potassium", + "expect": 269.3202 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much fiber is in 100 g of pudding chocolate cake?", + "fdc_id": 174935, + "target": "Cake, pudding-type, chocolate, dry mix", + "nutrient": "fiber", + "expect": 2.3 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the iron in 2 oz of light whipping cream?", + "fdc_id": 170858, + "target": "Cream, fluid, light whipping", + "nutrient": "iron", + "expect": 0.017 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the carbohydrates value for a cup of pumpkin whole seed?", + "fdc_id": 170188, + "target": "Seeds, pumpkin and squash seeds, whole, roasted, without salt", + "nutrient": "carbohydrate", + "expect": 34.4 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of calcium in a cup of light fig.", + "fdc_id": 173023, + "target": "Figs, canned, light syrup pack, solids and liquids", + "nutrient": "calcium", + "expect": 68.04 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much carbohydrates is in 150 g of cashew oil nut?", + "fdc_id": 170572, + "target": "Nuts, cashew nuts, oil roasted, without salt added", + "nutrient": "carbohydrate", + "expect": 44.805 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the protein level of a cup of diluted grapefruit juice?", + "fdc_id": 174681, + "target": "Grapefruit juice, white, frozen concentrate, unsweetened, diluted with 3 volume water", + "nutrient": "protein", + "expect": 1.3585 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of carbohydrates in a cup of raw mustard green.", + "fdc_id": 169256, + "target": "Mustard greens, raw", + "nutrient": "carbohydrate", + "expect": 2.6152 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much fat is in 100 g of black spice?", + "fdc_id": 170931, + "target": "Spices, pepper, black", + "nutrient": "fat", + "expect": 3.26 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the carbohydrates in 150 g of mussel raw mollusk?", + "fdc_id": 174216, + "target": "Mollusks, mussel, blue, raw", + "nutrient": "carbohydrate", + "expect": 5.535 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of calcium in 2 oz of intermuscular raw beef.", + "fdc_id": 173083, + "target": "Beef, New Zealand, imported, intermuscular fat, raw", + "nutrient": "calcium", + "expect": 6.2369 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the vitamin C in 150 g of cooked water convolvulu?", + "fdc_id": 169302, + "target": "Water convolvulus, cooked, boiled, drained, without salt", + "nutrient": "vitamin c", + "expect": 24.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the calories in 2 oz of jack raw fish?", + "fdc_id": 173672, + "target": "Fish, mackerel, Pacific and jack, mixed species, raw", + "nutrient": "calories", + "expect": 89.5844 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the iron level of 2 oz of oyster mushroom?", + "fdc_id": 168580, + "target": "Mushrooms, oyster, raw", + "nutrient": "iron", + "expect": 0.7541 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calcium content of 100 g of yellowtail cooked fish?", + "fdc_id": 174248, + "target": "Fish, yellowtail, mixed species, cooked, dry heat", + "nutrient": "calcium", + "expect": 29.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the protein value for 2 oz of phyllo dough?", + "fdc_id": 172791, + "target": "Phyllo dough", + "nutrient": "protein", + "expect": 4.0256 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the vitamin C level of 100 g of red lettuce?", + "fdc_id": 168431, + "target": "Lettuce, red leaf, raw", + "nutrient": "vitamin c", + "expect": 3.7 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the sodium level of 100 g of oatmeal regular cooky?", + "fdc_id": 172725, + "target": "Cookies, oatmeal, commercially prepared, regular", + "nutrient": "sodium", + "expect": 520.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the vitamin C level of a cup of uncooked fig?", + "fdc_id": 174665, + "target": "Figs, dried, uncooked", + "nutrient": "vitamin c", + "expect": 1.788 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the iron in 2 oz of yellow from cake?", + "fdc_id": 172710, + "target": "Cake, yellow, prepared from recipe without frosting", + "nutrient": "iron", + "expect": 0.9299 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of sugar in 150 g of dinner whole wheat roll.", + "fdc_id": 172794, + "target": "Rolls, dinner, whole-wheat", + "nutrient": "sugar", + "expect": 12.69 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the calcium in 2 oz of crabapple?", + "fdc_id": 171721, + "target": "Crabapples, raw", + "nutrient": "calcium", + "expect": 10.2058 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the iron level of 2 oz of somen cooked noodle?", + "fdc_id": 168909, + "target": "Noodles, japanese, somen, cooked", + "nutrient": "iron", + "expect": 0.2948 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of potassium in 2 oz of dried uncooked peach.", + "fdc_id": 169934, + "target": "Peaches, dried, sulfured, uncooked", + "nutrient": "potassium", + "expect": 564.722 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calories level of 150 g of sweet water cherry?", + "fdc_id": 173957, + "target": "Cherries, sweet, canned, water pack, solids and liquids", + "nutrient": "calories", + "expect": 69.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much protein is in 150 g of unspecified seed?", + "fdc_id": 168604, + "target": "Seeds, sesame butter, tahini, type of kernels unspecified", + "nutrient": "protein", + "expect": 26.1 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calcium level of 100 g of macadamia dry nut?", + "fdc_id": 168598, + "target": "Nuts, macadamia nuts, dry roasted, with salt added", + "nutrient": "calcium", + "expect": 70.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calories level of 150 g of gingerbread dry cake?", + "fdc_id": 172701, + "target": "Cake, gingerbread, dry mix", + "nutrient": "calories", + "expect": 655.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of vitamin C in 150 g of cooked dandelion green.", + "fdc_id": 169351, + "target": "Dandelion greens, cooked, boiled, drained, with salt", + "nutrient": "vitamin c", + "expect": 27.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the calcium in 2 oz of skin only stewed chicken?", + "fdc_id": 171056, + "target": "Chicken, broilers or fryers, skin only, cooked, stewed", + "nutrient": "calcium", + "expect": 6.8039 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much calories is in 150 g of frozen biscuit?", + "fdc_id": 172667, + "target": "Biscuits, plain or buttermilk, frozen, baked", + "nutrient": "calories", + "expect": 507.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the fat in 100 g of undiluted apple juice?", + "fdc_id": 168188, + "target": "Apple juice, frozen concentrate, unsweetened, undiluted, with added ascorbic acid", + "nutrient": "fat", + "expect": 0.37 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the fat content of 100 g of egg pie?", + "fdc_id": 172783, + "target": "Pie, egg custard, commercially prepared", + "nutrient": "fat", + "expect": 11.6 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of sugar in 100 g of chilled orange juice.", + "fdc_id": 169100, + "target": "Orange juice, chilled, includes from concentrate", + "nutrient": "sugar", + "expect": 8.31 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the fat in 150 g of rib fat roasted veal?", + "fdc_id": 173827, + "target": "Veal, rib, separable lean and fat, cooked, roasted", + "nutrient": "fat", + "expect": 20.94 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the fat content of a cup of enoki mushroom?", + "fdc_id": 169382, + "target": "Mushrooms, enoki, raw", + "nutrient": "fat", + "expect": 0.1856 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much calories is in 2 oz of raw sesbania flower?", + "fdc_id": 168459, + "target": "Sesbania flower, raw", + "nutrient": "calories", + "expect": 15.3087 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the calories content of 100 g of chunk peanut butter?", + "fdc_id": 174265, + "target": "Peanut butter, chunk style, with salt", + "nutrient": "calories", + "expect": 589.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of fiber in 2 oz of hamburger pickle relish.", + "fdc_id": 169386, + "target": "Pickle relish, hamburger", + "nutrient": "fiber", + "expect": 1.8144 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the sugar value for 150 g of undiluted pineapple juice?", + "fdc_id": 169948, + "target": "Pineapple juice, frozen concentrate, unsweetened, undiluted", + "nutrient": "sugar", + "expect": 65.4 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much carbohydrates is in 150 g of parmesan hard cheese?", + "fdc_id": 170848, + "target": "Cheese, parmesan, hard", + "nutrient": "carbohydrate", + "expect": 4.83 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the calcium in 150 g of home bean?", + "fdc_id": 173731, + "target": "Beans, baked, home prepared", + "nutrient": "calcium", + "expect": 91.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the sugar content of 150 g of original unfortified soymilk?", + "fdc_id": 172446, + "target": "Soymilk, original and vanilla, unfortified", + "nutrient": "sugar", + "expect": 5.985 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of protein in 100 g of retail thigh only raw turkey.", + "fdc_id": 174518, + "target": "Turkey, retail parts, thigh, meat only, raw", + "nutrient": "protein", + "expect": 20.6 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the fiber content of 2 oz of raw kale?", + "fdc_id": 168421, + "target": "Kale, raw", + "nutrient": "fiber", + "expect": 2.3247 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of calcium in 2 oz of melba wheat cracker.", + "fdc_id": 174979, + "target": "Crackers, melba toast, wheat", + "nutrient": "calcium", + "expect": 24.3806 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the fat level of 2 oz of stove kraft?", + "fdc_id": 175079, + "target": "Kraft, Stove Top Stuffing Mix Chicken Flavor", + "nutrient": "fat", + "expect": 2.3247 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much carbohydrates is in 150 g of celtuce?", + "fdc_id": 169990, + "target": "Celtuce, raw", + "nutrient": "carbohydrate", + "expect": 5.475 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much fat is in 100 g of mackerel salted fish?", + "fdc_id": 168149, + "target": "Fish, mackerel, salted", + "nutrient": "fat", + "expect": 25.1 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the potassium in 150 g of parsnip?", + "fdc_id": 170508, + "target": "Parsnips, cooked, boiled, drained, with salt", + "nutrient": "potassium", + "expect": 550.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the iron content of a cup of deglet date?", + "fdc_id": 171726, + "target": "Dates, deglet noor", + "nutrient": "iron", + "expect": 1.4994 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the sodium level of 150 g of uncooked spelt?", + "fdc_id": 169745, + "target": "Spelt, uncooked", + "nutrient": "sodium", + "expect": 12.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the fat in 2 oz of variety brain raw lamb?", + "fdc_id": 172525, + "target": "Lamb, variety meats and by-products, brain, raw", + "nutrient": "fat", + "expect": 4.8648 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the fiber level of a cup of no potato?", + "fdc_id": 169084, + "target": "Potatoes, canned, drained solids, no salt added", + "nutrient": "fiber", + "expect": 4.32 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much fiber is in a cup of mashed home potato?", + "fdc_id": 170037, + "target": "Potatoes, mashed, home-prepared, whole milk and margarine added", + "nutrient": "fiber", + "expect": 3.15 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the fiber in 150 g of dry soybean?", + "fdc_id": 172441, + "target": "Soybeans, mature seeds, dry roasted", + "nutrient": "fiber", + "expect": 12.15 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of potassium in 2 oz of sprouted raw lentil.", + "fdc_id": 168427, + "target": "Lentils, sprouted, raw", + "nutrient": "potassium", + "expect": 182.5708 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the calories in 100 g of radish seed?", + "fdc_id": 170095, + "target": "Radish seeds, sprouted, raw", + "nutrient": "calories", + "expect": 43.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calcium level of 100 g of herring pacific cooked fish?", + "fdc_id": 174233, + "target": "Fish, herring, Pacific, cooked, dry heat", + "nutrient": "calcium", + "expect": 106.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much carbohydrates is in 2 oz of chapati bread?", + "fdc_id": 174075, + "target": "Bread, chapati or roti, whole wheat, commercially prepared, frozen", + "nutrient": "carbohydrate", + "expect": 26.1552 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the carbohydrates level of 100 g of flavored liquid cream substitute?", + "fdc_id": 173453, + "target": "Cream substitute, flavored, liquid", + "nutrient": "carbohydrate", + "expect": 35.07 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much fat is in a cup of breadnut dried seed?", + "fdc_id": 170553, + "target": "Seeds, breadnut tree seeds, dried", + "nutrient": "fat", + "expect": 2.688 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the fiber content of 150 g of cooked salt tomato?", + "fdc_id": 170137, + "target": "Tomatoes, red, ripe, cooked, with salt", + "nutrient": "fiber", + "expect": 1.05 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the carbohydrates level of a cup of raw asparagu?", + "fdc_id": 168389, + "target": "Asparagus, raw", + "nutrient": "carbohydrate", + "expect": 5.1992 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of iron in 2 oz of raw dandelion green.", + "fdc_id": 169226, + "target": "Dandelion greens, raw", + "nutrient": "iron", + "expect": 1.7577 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calories level of 2 oz of flaxseed seed?", + "fdc_id": 169414, + "target": "Seeds, flaxseed", + "nutrient": "calories", + "expect": 302.7727 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the potassium value for 100 g of cardamom spice?", + "fdc_id": 170919, + "target": "Spices, cardamom", + "nutrient": "potassium", + "expect": 1119.0 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the carbohydrates level of 100 g of all dry peanut?", + "fdc_id": 174262, + "target": "Peanuts, all types, dry-roasted, with salt", + "nutrient": "carbohydrate", + "expect": 21.26 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much protein is in 150 g of fennel spice?", + "fdc_id": 171323, + "target": "Spices, fennel seed", + "nutrient": "protein", + "expect": 23.7 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of fiber in 100 g of roll bread.", + "fdc_id": 174078, + "target": "Bread, roll, Mexican, bollilo", + "nutrient": "fiber", + "expect": 2.2 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the carbohydrates level of 2 oz of cured patty pork?", + "fdc_id": 167873, + "target": "Pork, cured, ham, patties, unheated", + "nutrient": "carbohydrate", + "expect": 0.9582 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of protein in 2 oz of farmed raw mollusk.", + "fdc_id": 175172, + "target": "Mollusks, oyster, eastern, farmed, raw", + "nutrient": "protein", + "expect": 2.9597 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the iron in 100 g of hot pickle relish?", + "fdc_id": 168560, + "target": "Pickle relish, hot dog", + "nutrient": "iron", + "expect": 1.25 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the potassium content of a cup of golden raisin?", + "fdc_id": 168164, + "target": "Raisins, golden, seedless", + "nutrient": "potassium", + "expect": 1230.9 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the sodium level of 150 g of northern raw crustacean?", + "fdc_id": 174208, + "target": "Crustaceans, lobster, northern, raw", + "nutrient": "sodium", + "expect": 634.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the fiber in 2 oz of canned hominy?", + "fdc_id": 169752, + "target": "Hominy, canned, yellow", + "nutrient": "fiber", + "expect": 1.4175 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the protein level of 2 oz of spinach souffle?", + "fdc_id": 170494, + "target": "Spinach souffle", + "nutrient": "protein", + "expect": 4.4736 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much potassium is in 150 g of aluminum leavening agent?", + "fdc_id": 172803, + "target": "Leavening agents, baking powder, double-acting, sodium aluminum sulfate", + "nutrient": "potassium", + "expect": 30.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Can you give me the iron content of 150 g of frozen blackberry?", + "fdc_id": 171710, + "target": "Blackberries, frozen, unsweetened", + "nutrient": "iron", + "expect": 1.2 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the carbohydrates in 2 oz of arugula?", + "fdc_id": 169387, + "target": "Arugula, raw", + "nutrient": "carbohydrate", + "expect": 2.0695 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the sodium value for 100 g of ground meat raw beef?", + "fdc_id": 171790, + "target": "Beef, ground, 95% lean meat / 5% fat, raw", + "nutrient": "sodium", + "expect": 66.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of vitamin C in 150 g of banana pepper.", + "fdc_id": 169394, + "target": "Pepper, banana, raw", + "nutrient": "vitamin c", + "expect": 124.05 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of fat in 100 g of hubbard raw squash.", + "fdc_id": 168475, + "target": "Squash, winter, hubbard, raw", + "nutrient": "fat", + "expect": 0.5 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Please give me the amount of fat in 150 g of casaba melon.", + "fdc_id": 169093, + "target": "Melons, casaba, raw", + "nutrient": "fat", + "expect": 0.15 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the carbohydrates value for a cup of jackfruit?", + "fdc_id": 168190, + "target": "Jackfruit, canned, syrup pack", + "nutrient": "carbohydrate", + "expect": 42.6132 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the calories level of 2 oz of dried milk?", + "fdc_id": 171274, + "target": "Milk, buttermilk, dried", + "nutrient": "calories", + "expect": 219.4251 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the fat level of 150 g of swordfish raw fish?", + "fdc_id": 173703, + "target": "Fish, swordfish, raw", + "nutrient": "fat", + "expect": 9.975 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the vitamin C in 150 g of kidney braised lamb?", + "fdc_id": 174355, + "target": "Lamb, variety meats and by-products, kidneys, cooked, braised", + "nutrient": "vitamin c", + "expect": 18.0 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the iron in 100 g of pecan cooky?", + "fdc_id": 174968, + "target": "Cookies, shortbread, commercially prepared, pecan", + "nutrient": "iron", + "expect": 2.43 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the vitamin C in 100 g of coconut cake?", + "fdc_id": 172698, + "target": "Cake, white, prepared from recipe with coconut frosting", + "nutrient": "vitamin c", + "expect": 0.1 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the fiber value for 100 g of deep unbaked pie crust?", + "fdc_id": 167523, + "target": "Pie crust, deep dish, frozen, unbaked, made with enriched flour", + "nutrient": "fiber", + "expect": 1.4 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Would you tell me the calcium value for 2 oz of raw cassava?", + "fdc_id": 169985, + "target": "Cassava, raw", + "nutrient": "calcium", + "expect": 9.0718 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the carbohydrates level of 100 g of kumquat?", + "fdc_id": 168154, + "target": "Kumquats, raw", + "nutrient": "carbohydrate", + "expect": 15.9 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Could you give me the fat level of 2 oz of roughy raw fish?", + "fdc_id": 175133, + "target": "Fish, roughy, orange, raw", + "nutrient": "fat", + "expect": 0.3969 + }, + { + "split": "dev", + "kind": "nutrient", + "valid": true, + "q": "Could you tell me the sugar in 2 oz of green sauteed pepper?", + "fdc_id": 170024, + "target": "Peppers, sweet, green, sauteed", + "nutrient": "sugar", + "expect": 1.2304 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much calories is in 150 g of white prepared cake?", + "fdc_id": 172709, + "target": "Cake, white, prepared from recipe without frosting", + "nutrient": "calories", + "expect": 535.5 + }, + { + "split": "heldout", + "kind": "nutrient", + "valid": true, + "q": "Can you show me how much calcium is in 100 g of french doughnut?", + "fdc_id": 172756, + "target": "Doughnuts, french crullers, glazed", + "nutrient": "calcium", + "expect": 26.0 + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "Could you tell me the calcium in 100 g of basilisk bacon?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "Can you show me how much carbohydrates is in 100 g of basilisk bacon?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "Can you give me the calcium content of 100 g of hobbit bread?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "Could you give me the iron level of 100 g of hobbit bread?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "Please give me the amount of sodium in 100 g of star fruit from Venus.", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "Would you tell me the potassium value for 100 g of star fruit from Venus?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "Can you give me the potassium content of 100 g of sphinx pudding?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "Would you tell me the fat value for 100 g of sphinx pudding?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "Could you tell me the sugar in 100 g of chimera chops?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "Would you tell me the fat value for 100 g of chimera chops?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "Please give me the amount of fat in 100 g of nebula noodles.", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "Could you give me the fiber level of 100 g of nebula noodles?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "Can you give me the calories content of 100 g of wyvern wings?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "Can you show me how much iron is in 100 g of wyvern wings?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "Can you give me the iron content of 100 g of centaur cheese?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "Would you tell me the sodium value for 100 g of centaur cheese?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "Please give me the amount of calories in 100 g of golem granola.", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "Can you show me how much carbohydrates is in 100 g of golem granola?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown_food", + "valid": false, + "q": "Can you give me the potassium content of 100 g of sprite soup?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown_food", + "valid": false, + "q": "Would you tell me the fat value for 100 g of sprite soup?", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/cooking-v3-r2/nutrition_panel_v3.py b/root/specialists/cooking-v3-r2/nutrition_panel_v3.py new file mode 100644 index 0000000000000000000000000000000000000000..3eacee82e0ee5a7ed7d41363ac91318e3150a614 --- /dev/null +++ b/root/specialists/cooking-v3-r2/nutrition_panel_v3.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python3 +"""nutrition_panel_v3 - FRESH panel for cooking v3 (v1, v2 held-outs sealed): seed 616161, food partition by (fdc_id // 3) parity, polite-frame phrasings both splits. Same author - disclosed. +Derived from nutrition_panel_v2 - FRESH panel for cooking v2 (v1 held-out is sealed and immutable): new seed 6161, a different +food partition (fdc_id // 2 parity), new phrasings for both splits written before v2 was run on them - frame-heavy +questions (contractions, "content/amount/level/value", polite frames). Same author as the organ - disclosed. +Derived from nutrition_panel_v1 - the sealed panel for specialist #61 (cooking & nutrition), built from USDA directly, never from +the organ. For each target entry the question names the food with just enough of the entry's OWN words to determine the +answer: the fewest segment words such that every USDA entry containing them agrees on the nutrient within 5%. The +expected value is computed from the target entry (and its own household weight for cup / count questions). Foods are +split dev / held-out by fdc_id; the two splits use different phrasings. Must-decline items: invented foods. +usage: nutrition_panel_v1.py """ +import itertools +import json +import random +import re +import sqlite3 +import sys + +NUTS = ["calories", "protein", "fat", "carbohydrate", "fiber", "sugar", "sodium", "calcium", "iron", "potassium", "vitamin c"] +SAY = {"calories": "calories", "carbohydrate": "carbohydrates", "vitamin c": "vitamin C"} +CATS = ("Vegetables and Vegetable Products", "Fruits and Fruit Juices", "Legumes and Legume Products", "Dairy and Egg Products", + "Nut and Seed Products", "Cereal Grains and Pasta", "Finfish and Shellfish Products", "Poultry Products", "Beef Products", + "Pork Products", "Lamb, Veal, and Game Products", "Spices and Herbs", "Baked Products") +DEV_T = ["Can you give me the {n} content of {a} {f}?", "Could you tell me the {n} in {a} {f}?", "Please give me the amount of {n} in {a} {f}."] +HELD_T = ["Would you tell me the {n} value for {a} {f}?", "Can you show me how much {n} is in {a} {f}?", "Could you give me the {n} level of {a} {f}?"] +FAKE = ["basilisk bacon", "hobbit bread", "star fruit from Venus", "sphinx pudding", "chimera chops", "nebula noodles", + "wyvern wings", "centaur cheese", "golem granola", "sprite soup"] + + +def _sing(w): + # the same word normalisation as the organ, so "unambiguous" means the same thing on both sides + if len(w) > 4 and w.endswith("ies"): + return w[:-3] + "y" + if len(w) > 4 and w.endswith("oes"): + return w[:-2] + if len(w) > 3 and w.endswith("es") and w[-3] in "shx": + return w[:-2] + if len(w) > 3 and w.endswith("s") and not w.endswith("ss"): + return w[:-1] + return w + + +def tok(s): + return [_sing(w) for w in re.findall(r"[a-z]+", s.lower()) if len(w) > 1] + + +def main(): + db = sqlite3.connect(sys.argv[1]) + foods = {fid: (desc, cat) for fid, desc, cat in db.execute("SELECT fdc_id, description, category FROM foods")} + toks = {fid: set(tok(d)) for fid, (d, _) in foods.items()} + val = {} + for fid, k, a in db.execute("SELECT fdc_id, key, amount FROM nut"): + val[(fid, k)] = a + rng = random.Random(616161) + items = [] + targets = [f for f, (d, c) in foods.items() if c in CATS and not re.search(r"\b[A-Z]{3,}\b", d.replace("USDA", "")) + and "(" not in d and d.count(",") <= 4] + rng.shuffle(targets) + for fid in targets: + if len([i for i in items if i["kind"] == "nutrient"]) >= 400: + break + desc = foods[fid][0] + segs = [s.strip() for s in desc.split(",")] + head = tok(segs[0]) + if not head or len(head) > 2: + continue + n = rng.choice([k for k in NUTS if (fid, k) in val]) if any((fid, k) in val for k in NUTS) else None + if not n or val[(fid, n)] <= 0: + continue + extra = [w for s in segs[1:] for w in tok(s) if w not in ("and", "with", "without", "or", "of", "to", "in")] + chosen = None + for r in range(0, min(4, len(extra)) + 1): + for comb in itertools.combinations(extra, r): + q = set(head) | set(comb) + match = [g for g, t in toks.items() if q <= t and (g, n) in val] + vs = [val[(g, n)] for g in match] + if match and fid in match and max(vs) > 0 and (max(vs) - min(vs)) / max(vs) <= 0.05: + chosen = comb + break + if chosen is not None: + break + if chosen is None: + continue + name = " ".join(list(chosen) + head) + split = "dev" if (fid // 3) % 2 == 0 else "heldout" + amounts = [("100 g", 100.0), ("150 g", 150.0), ("2 oz", 2 * 28.3495)] + cup = db.execute("SELECT grams FROM portions WHERE fdc_id=? AND label LIKE '1 cup%' ORDER BY length(label)", (fid,)).fetchone() + if cup: + amounts.append(("a cup of", cup[0])) + a_txt, grams = rng.choice(amounts) + a_say = a_txt if a_txt.endswith("of") else a_txt + " of" + t = rng.choice(DEV_T if split == "dev" else HELD_T) + q = t.format(n=SAY.get(n, n), a=a_say.replace(" of of", " of"), f=name).replace(" ", " ") + q = q[0].upper() + q[1:] + items.append({"split": split, "kind": "nutrient", "valid": True, "q": q, "fdc_id": fid, "target": desc, "nutrient": n, + "expect": round(val[(fid, n)] * grams / 100.0, 4)}) + for i, f in enumerate(FAKE): + for split in ("dev", "heldout"): + n = rng.choice(NUTS) + t = rng.choice(DEV_T if split == "dev" else HELD_T) + items.append({"split": split, "kind": "unknown_food", "valid": False, "q": t.format(n=SAY.get(n, n), a="100 g of", f=f), "expect": "decline"}) + json.dump(items, open(sys.argv[2], "w"), indent=1) + import collections + print("panel:", collections.Counter((i["split"], i["kind"]) for i in items)) + for i in items[:6]: + print(" ", i["q"], "->", i.get("expect"), "|", i.get("target")) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/cooking-v3-r2/organ_cooking_v3_r2.py b/root/specialists/cooking-v3-r2/organ_cooking_v3_r2.py new file mode 100644 index 0000000000000000000000000000000000000000..c8a4d16bdf528dbbccdb4ce84b6d1bd372bdd81a --- /dev/null +++ b/root/specialists/cooking-v3-r2/organ_cooking_v3_r2.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +"""cooking-v3-r2 - NARROWING-ONLY boundary patch of cooking-v3 (phase 0.5 of the specialist network, 2026-09-30). +Silent (returns None) on a turn carrying another domain's markers and none of this domain's: the family census found +cooking-v3 claiming those turns (a neighbour's question, answered or declined in this domain's terms). Nothing else changes.""" +import re + +from organ_nutrition_v3 import NutritionOrganV3 as _Parent + +NOT_MINE = re.compile(r"""\b(?:kinetic|potential energy|lifted|m/s|joules?|kJ|melt\w*|ice|specific heat|torque|force|velocity|accelerat\w*)\b""", re.I) +MINE = re.compile(r"""\b(?:cups?|tbsp|tablespoons?|teaspoons?|servings?|recipe|calories|protein|fat|carb\w*|sodium|fib(?:er|re)|USDA|food|eat)\b""", re.I) + + +class NutritionOrganV3Boundary(_Parent): + def answer(self, text, *a, **k): + t = str(text) + if NOT_MINE.search(t) and not MINE.search(t): + return None + return super().answer(text, *a, **k) diff --git a/root/specialists/cooking-v3-r2/organ_nutrition_v1.py b/root/specialists/cooking-v3-r2/organ_nutrition_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..da4b3825ccb91a6ae6964fa39ed0b1ad5e824121 --- /dev/null +++ b/root/specialists/cooking-v3-r2/organ_nutrition_v1.py @@ -0,0 +1,181 @@ +#!/usr/bin/env python3 +"""organ_nutrition_v1 - exact nutrition arithmetic from USDA FoodData Central SR Legacy (public domain), with the +entry it used named in every answer. The general model has the recipes (Gutenberg) but cannot compute "how much protein +is in 150 g of cooked lentils"; this organ can, and declines when USDA has no entry, no household weight for the +measure asked, or no value for the nutrient - never a guess. +Returns {"kind", "status", "response", "value", "fdc_id"}.""" +from __future__ import annotations + +import re +import sqlite3 + +NUTRIENTS = [("saturated fat", r"\bsaturated fats?\b|\bsat(?:urated)? fat\b"), ("calories", r"\bcalories?\b|\bkcal\b|\benergy\b"), + ("protein", r"\bproteins?\b"), ("fat", r"\b(?:total )?fats?\b"), ("carbohydrate", r"\bcarb(?:ohydrate)?s?\b"), + ("fiber", r"\bfib(?:er|re)s?\b"), ("sugar", r"\bsugars?\b"), ("sodium", r"\bsodium\b"), ("calcium", r"\bcalcium\b"), + ("iron", r"\biron\b"), ("vitamin c", r"\bvitamin c\b"), ("potassium", r"\bpotassium\b"), ("cholesterol", r"\bcholesterol\b")] +MASS = {"g": 1.0, "gram": 1.0, "grams": 1.0, "kg": 1000.0, "kilogram": 1000.0, "kilograms": 1000.0, "oz": 28.3495, + "ounce": 28.3495, "ounces": 28.3495, "lb": 453.592, "lbs": 453.592, "pound": 453.592, "pounds": 453.592} +MEASURE = {"cup": "cup", "cups": "cup", "tbsp": "tbsp", "tablespoon": "tbsp", "tablespoons": "tbsp", "tsp": "tsp", + "teaspoon": "tsp", "teaspoons": "tsp"} +AMOUNT = re.compile(r"\b(\d+(?:\.\d+)?|an?|one|two|three|half an?|half a)\s*(" + "|".join(sorted(list(MASS) + list(MEASURE), key=len, reverse=True)) + r")\b(?:\s+of)?", re.I) +WORDNUM = {"a": 1, "an": 1, "one": 1, "two": 2, "three": 3, "half a": 0.5, "half an": 0.5} +FILLER = set("how much many is are there in of does do a an the has have contain contains what whats what's per serving " + "amount total grams gram g kg oz lb cup cups tbsp tsp tablespoon tablespoons teaspoon teaspoons ounce ounces " + "pound pounds kilogram kilograms please tell me give me me about with".split()) +PRODUCT_TYPES = {"oil", "spice", "babyfood", "beverage", "candy", "candie", "snack", "fast", "restaurant", "cereal", "sauce", + "soup", "dessert", "formulated", "school", "infant", "margarine", "shortening", "salad", "flour", "gravy"} +SPECIALTY = {"sprouted", "stir", "dehydrated", "freeze", "imported", "industrial", "commercial", "prepared", "mix", + "fortified", "enriched", "unenriched", "immature", "pickled", "flavored", "sweetened", "juice", "canned", + "frozen", "dried", "instant", "peel", "zest", "rind", "yolk", "link", "sausage", "bran", "germ", "leaf", "leave", + "sheep", "goat", "buffalo", "human", "smoked", "native", "alaska", "navajo", "hopi", "apache", "shoshone", + "indian", "plains", "paste", "butter", "blanched", "imitation", "producer", "buttermilk", "dry", "evaporated", + "condensed", "powder", "duck", "goose", "quail", "chocolate", "cocoa", "beverage", "homemade", "honey", "oil", + "shake", "malted", "candied", "glazed", "breaded", "battered"} +VARIANT = {"green", "yellow", "orange", "purple", "low", "reduced", "nonfat", "lowfat", "skim", "light", "lite", "unsalted", "decaffeinated", "diet"} +DEFAULT = {"whole", "ripe", "average", "all", "commercial", "varieties", "flesh", "mature", "regular", "plain", "red"} +COUNT = re.compile(r"\b(\d+(?:\.\d+)?|an?|one|two|three)\s+(?:medium |large |small )?([a-z]+)\b", re.I) +ASK = re.compile(r"\b(?:how much|how many|what(?:'s| is)? the|amount of|content)\b", re.I) + + +def _sing(w): + w = w.lower() + if len(w) > 4 and w.endswith("ies"): + return w[:-3] + "y" + if len(w) > 4 and w.endswith("oes"): + return w[:-2] # potatoes, tomatoes + if len(w) > 3 and w.endswith("es") and w[-3] in "shx": + return w[:-2] + if len(w) > 3 and w.endswith("s") and not w.endswith("ss"): + return w[:-1] + return w + + +class NutritionOrgan: + def __init__(self, db_path): + self.db = sqlite3.connect("file:%s?mode=ro" % db_path, uri=True, check_same_thread=False) + self.foods = [] + for fid, desc in self.db.execute("SELECT fdc_id, description FROM foods"): + toks = {_sing(t) for t in re.findall(r"[a-z]+", desc.lower())} + self.foods.append((fid, desc, toks)) + + def match(self, phrase): + """the entry a person most plausibly means: every word of the question present; then a plain entry over a + branded one, the food itself over a product made from it (almond OIL for "almonds" was the dev failure), a + typical preparation over a specialist one; then the fewest extra words""" + want = {_sing(t) for t in re.findall(r"[a-z]+", phrase.lower()) if t not in FILLER and len(t) > 1} + if not want: + return None + hits = [] + for fid, desc, toks in self.foods: + if not want <= toks: + continue + first = _sing(desc.split(",")[0].strip().split(" ")[0]) + pen = 0 + if re.search(r"\b[A-Z]{3,}\b", desc.replace("USDA", "")): + pen += 6 # brand names are upper case in SR Legacy + seg0 = {_sing(w) for w in re.findall(r"[a-z]+", desc.split(",")[0].lower())} + if (seg0 & PRODUCT_TYPES) - want: + pen += 8 # a product made from the food, not the food + pen += sum(3 for w in SPECIALTY if w in toks and w not in want) + pen += sum(2 for w in VARIANT if w in toks and w not in want) + if "egg" in want and "white" in toks and "white" not in want: + pen += 3 # the white alone, not the egg + if "skin" in toks and "flesh" not in toks and "skin" not in want: + pen += 3 # the skin alone, not the food + if "salt" in toks and "without" not in toks and "salt" not in want: + pen += 1 + if not (want & {"raw", "cooked", "boiled", "roasted", "fried", "canned", "frozen", "dried", "baked", "grilled"}): + pen -= 2 if ("raw" in toks) else 0 # no preparation asked: the raw entry + elif "cooked" in want and "boiled" in toks: + pen -= 1 # "cooked" with no method: boiled is the default + head = _sing(re.findall(r"[a-z]+", phrase.lower())[-1]) if re.findall(r"[a-z]+", phrase.lower()) else '' + if head and seg0 == {head}: + pen -= 3 # the entry is ABOUT the food named ("Rice, brown" for "brown rice") + hits.append((pen, len(toks - want), len(desc), fid, desc)) + if not hits: + return None + hits.sort() + self._near = [(h[3], h[4]) for h in hits if h[0] <= hits[0][0] + 1][:6] # the readings still in play + return hits[0][3], hits[0][4] + + def answer(self, text, session_id="default"): + t = " ".join(str(text or "").split()) + # the nutrient ASKED about is the first one mentioned ("potassium in sirloin FAT raw veal" asks potassium) + found = [(mm.start(), k) for k, rx in NUTRIENTS for mm in [re.search(rx, t, re.I)] if mm] + nut = min(found)[1] if found else None + if not nut or not ASK.search(t) and not re.search(r"\bin\b", t, re.I): + return None + m = AMOUNT.search(t) + qty, unit = 100.0, "g" + if m: + q = m.group(1).lower() + qty = WORDNUM.get(q, None) if not re.match(r"\d", q) else float(q) + unit = m.group(2).lower() + rest = t + # remove only the nutrient ASKED about (its first mention); "lean and fat", "with added calcium" belong to the food + rx_asked = dict(NUTRIENTS)[nut] + rest = re.sub(rx_asked, " ", rest, count=1, flags=re.I) + if m: + rest = rest.replace(m.group(0), " ") + rest = re.sub(r"[^A-Za-z ,]", " ", rest) + hit = self.match(rest) + phrase = " ".join(w for w in re.findall(r"[A-Za-z]+", rest) if w.lower() not in FILLER) + if not hit: + return {"kind": "unknown_food", "status": "withheld", "value": None, "fdc_id": None, + "response": "I don't have a USDA entry for \"%s\", so I can't give you its %s." % (phrase.strip() or "that", nut)} + fid, desc = hit + row = self.db.execute("SELECT amount, unit FROM nut WHERE fdc_id=? AND key=?", (fid, nut)).fetchone() + if not row: + return {"kind": "no_value", "status": "withheld", "value": None, "fdc_id": fid, + "response": "USDA's entry \"%s\" has no %s value, so I won't estimate one." % (desc, nut)} + per100, u = row + # SUPERPOSED: several readings in play whose answers differ materially -> ask, never pick silently + vals = [] + for f2, d2 in getattr(self, "_near", []): + r2 = self.db.execute("SELECT amount FROM nut WHERE fdc_id=? AND key=?", (f2, nut)).fetchone() + if r2: + vals.append((r2[0], d2)) + if len(vals) > 1: + lo, hi = min(v for v, _ in vals), max(v for v, _ in vals) + if hi > 0 and (hi - lo) / hi > 0.15: + opts = sorted({d for _, d in vals}, key=len)[:3] + return {"kind": "clarify", "status": "clarify", "value": None, "fdc_id": None, + "response": "USDA has several entries that fit \"%s\", and their %s differs by more than 15%%: %s. Which one do you mean?" + % (phrase.strip().lower(), nut, "; ".join(opts))} + cm = None if m else COUNT.search(t) + if cm and _sing(cm.group(2)) in {_sing(w) for w in re.findall(r"[a-z]+", desc.lower())}: + # a COUNT of the food ("1 banana"): USDA's own household weight, medium first, or decline + port = self.db.execute("SELECT label, grams FROM portions WHERE fdc_id=? AND label NOT LIKE '%cup%' AND label NOT LIKE '%tbsp%' " + "AND label NOT LIKE '%tsp%' AND label NOT LIKE '%oz%' AND label NOT LIKE '%ml%' " + "ORDER BY (label LIKE '%medium%') DESC, (label LIKE '%large%') DESC, (label LIKE '%whole%') DESC, " + "(label LIKE '1 %') DESC, length(label)", (fid,)).fetchone() + if not port: + return {"kind": "no_portion", "status": "withheld", "value": None, "fdc_id": fid, + "response": "USDA gives no per-item weight for \"%s\", so I can't count them. Ask me in grams instead." % desc} + q = cm.group(1).lower() + qty = WORDNUM.get(q, None) if not re.match(r"\d", q) else float(q) + grams = qty * port[1] + val = per100 * grams / 100.0 + shown = ("%.0f" % val) if (u in ("kcal", "mg") and val >= 10) else ("%.1f" % val if val >= 1 else "%.2f" % val) + what = "%s kcal" % shown if nut == "calories" else "%s %s of %s" % (shown, u, nut) + return {"kind": "nutrient", "status": "answered", "value": round(val, 3), "fdc_id": fid, + "response": "%s %s (%s × %s, %g g total) has %s (USDA SR Legacy #%d: %s; %g %s per 100 g)." % ( + cm.group(1), cm.group(2), "%g" % qty, re.sub(r"^1(\.0)? ", "", port[0]), grams, what, fid, desc, per100, u)} + if unit in MASS: + grams = qty * MASS[unit] + amt = "%g %s" % (qty, unit) if m else "100 g" + else: + meas = MEASURE[unit] + port = self.db.execute("SELECT label, grams FROM portions WHERE fdc_id=? AND (label LIKE ? OR label LIKE ?) ORDER BY length(label)", + (fid, "1 %s%%" % meas, "1.0 %s%%" % meas)).fetchone() + if not port: + return {"kind": "no_portion", "status": "withheld", "value": None, "fdc_id": fid, + "response": "USDA gives no %s weight for \"%s\", so I can't convert %s %s. Ask me in grams instead." % (meas, desc, m.group(1), m.group(2))} + grams = qty * port[1] + amt = "%s %s (%g g)" % (m.group(1), m.group(2), grams) + val = per100 * grams / 100.0 + shown = ("%.0f" % val) if (u in ("kcal", "mg") and val >= 10) else ("%.1f" % val if val >= 1 else "%.2f" % val) + what = "%s kcal" % shown if nut == "calories" else "%s %s of %s" % (shown, u, nut) + return {"kind": "nutrient", "status": "answered", "value": round(val, 3), "fdc_id": fid, + "response": "%s of %s has %s (USDA SR Legacy #%d: %s; %g %s per 100 g)." % ( + amt, phrase.strip().lower() or desc, what, fid, desc, per100, u)} diff --git a/root/specialists/cooking-v3-r2/organ_nutrition_v2.py b/root/specialists/cooking-v3-r2/organ_nutrition_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..aa4edcf697b50dc5fe38b9c06a827f201030491e --- /dev/null +++ b/root/specialists/cooking-v3-r2/organ_nutrition_v2.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""organ_nutrition_v2 - v1 (frozen, admitted 2026-09-29) plus one defect-class fix found by v1's held-out verdict: +the QUESTION FRAME leaked into the food name. "What's the calcium content of ..." searched USDA for "s content spanish +raw peanut" and declined (safe, but a miss on 59 of 218 held-out items). v2 strips the frame before v1 reads the food: + +- English clitics: what's / it's / I'd / don't ('s 're 've 'll 'd n't) - the apostrophe split left a stray "s"; +- measurement nouns: content(s), level(s), value(s), amount(s), quantity, count, total ("of"/"in"/"for" after them); +- polite frames: can/could/would you tell me / give me, I'd like to know, I want to know, do you know, let me know. + +It changes no matching and no arithmetic. It adds the narrowing rule (narrow_v1): word problems are not taken and +declines answer only short direct questions. v1 is untouched (subclass). Returns v1's dict.""" +from __future__ import annotations + +import re + +from narrow_v1 import narrative, short_direct +from organ_nutrition_v1 import NutritionOrgan + +CLITIC = re.compile(r"(?i)\b(\w+)(?:'|’)(?:s|re|ve|ll|d|m)\b") +NEG = re.compile(r"(?i)\b(\w+)n(?:'|’)t\b") +FRAME = re.compile(r"(?i)\b(?:can|could|would|will) you (?:please )?(?:tell|give|show|let) me\b|\bi(?:'d| would) like to know\b|" + r"\bi (?:want|need) to know\b|\bdo you know\b|\blet me know\b|\bplease\b") +MEASURE_NOUN = re.compile(r"(?i)\b(?:contents?|levels?|values?|amounts?|quantity|quantities|count|total)\b(?:\s+(?:of|in|for))?") + + +class NutritionOrganV2(NutritionOrgan): + + @staticmethod + def normalize(text): + t = str(text or "") + t = FRAME.sub(" ", t) + t = NEG.sub(r"\1", t) + t = CLITIC.sub(r"\1", t) + # keep one "of"/"in" so v1's amount reader and ASK still see a question: "the calcium content of X" -> "the calcium of X" + t = MEASURE_NOUN.sub(" of ", t) + t = re.sub(r"(?i)\b(of|in)\s+(?:of|in)\b", r"\1", t) + return " ".join(t.split()) + + def answer(self, text, session_id="default"): + # narrowing (narrow_v1, full-core sweep 2026-09-29): rate word problems ("106 calories for 8 ounces. How many + # calories are in 12 ounces?") are proportions the core owns - not taken; declines only on short direct questions + if narrative(text): + return None + r = super().answer(self.normalize(text), session_id) + if r and r.get("status") != "answered" and not short_direct(text): + return None + return r diff --git a/root/specialists/cooking-v3-r2/organ_nutrition_v3.py b/root/specialists/cooking-v3-r2/organ_nutrition_v3.py new file mode 100644 index 0000000000000000000000000000000000000000..29f7009dee9dd0e762e3b84260a24b5867c36b39 --- /dev/null +++ b/root/specialists/cooking-v3-r2/organ_nutrition_v3.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +"""organ_nutrition_v3 - organ_nutrition_v2 (admitted 2026-09-29, held-out 155/210) plus: stripping a polite frame must not +strip the QUESTION. v2's held-out misses were "Can you give me the sugar content of 2 oz of crosscut sweet potato?" - +removing "Can you give me" left "the sugar of 2 oz of ...", which v1 no longer recognised as a question. v3 restores +"What is" when the stripped text has no question word left. Everything else v2.""" +from __future__ import annotations + +from organ_nutrition_v1 import ASK +from organ_nutrition_v2 import NutritionOrganV2 + + +class NutritionOrganV3(NutritionOrganV2): + @staticmethod + def normalize(text): + t = NutritionOrganV2.normalize(text) + if not ASK.search(t) and t[:1].isalpha() and not t.lower().startswith(("how", "what", "which")): + t = "What is " + t[0].lower() + t[1:] + return t diff --git a/root/specialists/ecology/ecology_scorer.py b/root/specialists/ecology/ecology_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..e944c1a7ad58a8fc66ff88594a48658689468d02 --- /dev/null +++ b/root/specialists/ecology/ecology_scorer.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +"""ecology_scorer - the first number after "is" in the REPLY TEXT (commas and a minus sign allowed) must be within 0.5% +(0.001 absolute near zero) of the panel's formula. (ok, asserted).""" +import re + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + m = re.search(r"\bis\s+(?:about\s+)?(-?[\d,]*\.?\d+)", text) + if not m: + return False, True + got, e = float(m.group(1).replace(",", "")), float(p["expect"]) + return abs(got - e) <= max(0.005 * abs(e), 0.001), True diff --git a/root/specialists/ecology/organ_ecology_v1.py b/root/specialists/ecology/organ_ecology_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..0f5b0fa4e99db2d3f0a610162d39212490d6c56e --- /dev/null +++ b/root/specialists/ecology/organ_ecology_v1.py @@ -0,0 +1,128 @@ +#!/usr/bin/env python3 +"""organ_ecology_v1 - population and community ecology arithmetic (OpenStax Biology / Concepts of Biology), formula +named in every answer: +- Shannon diversity H' = -sum p_i ln p_i (natural log) from species counts; evenness J = H' / ln S; richness S; +- Simpson's index D = sum n(n - 1) / (N(N - 1)); "Simpson's diversity (index)" = 1 - D; reciprocal 1 / D - the + convention is named in every answer because textbooks differ; +- exponential growth N(t) = N0 e^(r t) (continuous r) or N0 lambda^t (discrete), doubling time ln 2 / r; +- logistic growth rate dN/dt = r N (1 - N / K); logistic N(t) = K / (1 + ((K - N0) / N0) e^(-r t)). +Declines: a single-species community for evenness, N above K for a "growth" that must be positive is answered as a +negative rate (said so). Narrowed from the start (narrow_v1). Returns {kind, status, response, value}.""" +from __future__ import annotations + +import math +import re + +from narrow_v1 import last_sentence, narrative, short_direct + +N = r"(\d+(?:,\d{3})*(?:\.\d+)?)" + + +def num(v): + return float(str(v).replace(",", "")) + + +def g(x): + return ("%.4f" % x).rstrip("0").rstrip(".") if abs(x) < 1e6 else format(round(x), ",") + + +class EcologyOrgan: + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def _bad(self, why): + return self._say("impossible", why, status="withheld") + + def answer(self, text, session_id="default"): + if narrative(text): + return None + r = self._answer(text) + if r and r.get("status") != "answered" and not short_direct(text): + return None + return r + + def _counts(self, low): + m = re.search(r"\b(?:counts?|abundances?|individuals|numbers?)\b[^0-9]{0,30}?((?:\d+(?:,\d{3})*\s*(?:,|and|;)\s*)+\d+(?:,\d{3})*)", low) + if not m: + return None + vals = [num(x) for x in re.findall(r"\d+(?:,\d{3})*", re.sub(r"(\d),(\d{3})\b", r"\1\2", m.group(1)))] + return vals if len(vals) >= 2 else None + + def _answer(self, text): + t = " ".join(str(text or "").split()) + low = t.lower() + # --- diversity indices + if re.search(r"\bshannon\b|\bsimpson\w*\b|\bevenness\b|\bdiversity index\b|\bspecies richness\b", low): + c = self._counts(low) + if not c: + return None + if any(x < 0 for x in c): + return None + Ntot = sum(c) + S = sum(1 for x in c if x > 0) + if Ntot <= 0: + return None + ps = [x / Ntot for x in c if x > 0] + H = -sum(p * math.log(p) for p in ps) + if re.search(r"\bevenness\b", low): + if S < 2: + return self._bad("Evenness is undefined for a single species (ln 1 = 0).") + J = H / math.log(S) + return self._say("evenness", "The Shannon evenness J is %s (H' ÷ ln S = %s ÷ ln %d)." % (g(J), g(H), S), J) + if re.search(r"\bshannon\b", low): + return self._say("shannon", "The Shannon diversity index H' is %s (-Σ p ln p over %d species, natural log)." % (g(H), S), H) + if re.search(r"\bsimpson\w*\b", low): + if Ntot < 2: + return None + D = sum(x * (x - 1) for x in c) / (Ntot * (Ntot - 1)) + if re.search(r"\breciprocal\b|\binverse\b|\b1\s*/\s*d\b", low): + return self._say("simpson_inv", "The reciprocal Simpson index 1/D is %s (D = Σ n(n-1) / N(N-1) = %s)." % (g(1 / D), g(D)), 1 / D) + if re.search(r"\bdiversity\b|\b1\s*-\s*d\b", low): + return self._say("simpson_div", "Simpson's diversity index (1 - D) is %s (D = Σ n(n-1) / N(N-1) = %s; convention named because texts differ)." % (g(1 - D), g(D)), 1 - D) + return self._say("simpson_d", "Simpson's index D is %s (Σ n(n-1) / N(N-1), the probability two individuals drawn are the same species; diversity is 1 - D = %s)." % (g(D), g(1 - D)), D) + if re.search(r"\brichness\b", low): + return self._say("richness", "The species richness is %d (species with at least one individual)." % S, S) + # --- logistic + K = re.search(r"\bcarrying capacity\s*(?:\(k\)\s*)?(?:of|is|=)?\s*" + N + r"|\bk\s*=\s*" + N, low) + r_ = re.search(r"\b(?:intrinsic |per capita )?(?:growth )?rate\s*(?:\(r\)\s*)?(?:of|is|=)?\s*(-?\d*\.?\d+)\s*(%)?|\br\s*=\s*(-?\d*\.?\d+)", low) + n0 = re.search(r"\b(?:initial|starting|current) (?:population|size)\s*(?:of|is|=)?\s*" + N + r"|\bn0?\s*=\s*" + N + r"|\bpopulation (?:of|is)\s*" + N, low) + if r_: + rv = float(r_.group(1) or r_.group(3)) / (100 if r_.group(2) else 1) + if K and r_ and n0 and re.search(r"\blogistic\b|\bcarrying capacity\b", low): + Kv, N0 = num(K.group(1) or K.group(2)), num(n0.group(1) or n0.group(2) or n0.group(3)) + tm = re.search(r"\bafter\s+" + N + r"\s*(years?|generations?|days?|hours?|months?)\b|\bin\s+" + N + r"\s*(years?|generations?|days?|hours?|months?)\b", low) + # WHAT IS ASKED comes from the question sentence, not from givens ("growth rate 0.2" is a given - dev: a + # population question was answered with dN/dt because "growth rate" appeared among the givens) + ask = last_sentence(low) + if tm and re.search(r"\bpopulation\b|\bhow many\b|\bsize\b", ask) and not re.search(r"\bdn/dt\b|\bhow fast\b|\bgrowth rate\b", ask): + tt = num(tm.group(1) or tm.group(3)) + if N0 <= 0: + return None + Nt = Kv / (1 + (Kv - N0) / N0 * math.exp(-rv * tt)) + return self._say("logistic_n", "The population is %s (logistic: K / (1 + ((K - N0)/N0) e^(-rt)) with K %s, N0 %s, r %s, t %s)." % (g(Nt), g(Kv), g(N0), g(rv), g(tt)), Nt) + dn = rv * N0 * (1 - N0 / Kv) + return self._say("logistic_rate", "The growth rate is %s individuals per unit time (dN/dt = r N (1 - N/K) = %s × %s × (1 - %s/%s))%s." % ( + g(dn), g(rv), g(N0), g(N0), g(Kv), "; negative because N is above K" if dn < 0 else ""), dn) + # --- exponential + if r_ and n0 and re.search(r"\bexponential\w*\b|\bgrow\w*\b", low) and not K: + N0 = num(n0.group(1) or n0.group(2) or n0.group(3)) + if re.search(r"\bdoubling time\b|\bhow long to double\b|\bdouble\b", low): + if rv <= 0: + return None + return self._say("doubling", "The doubling time is %s time units (ln 2 / r = 0.6931 / %s)." % (g(math.log(2) / rv), g(rv)), math.log(2) / rv) + tm = re.search(r"\bafter\s+" + N + r"\s*(years?|generations?|days?|hours?|months?)\b|\bin\s+" + N + r"\s*(years?|generations?|days?|hours?|months?)\b", low) + if tm: + tt = num(tm.group(1) or tm.group(3)) + Nt = N0 * math.exp(rv * tt) + return self._say("exp_n", "The population is %s (N0 e^(r t) = %s × e^(%s × %s), continuous exponential growth)." % (g(Nt), g(N0), g(rv), g(tt)), Nt) + lam = re.search(r"\blambda\s*(?:\(λ\)\s*)?(?:of|is|=)?\s*(\d*\.?\d+)|\bλ\s*=\s*(\d*\.?\d+)|\bfinite rate of increase\s*(?:of|is)?\s*(\d*\.?\d+)", low) + if lam and n0: + lv = float(lam.group(1) or lam.group(2) or lam.group(3)) + N0 = num(n0.group(1) or n0.group(2) or n0.group(3)) + tm = re.search(r"\bafter\s+" + N + r"\s*(years?|generations?|days?|months?)\b|\bin\s+" + N + r"\s*(years?|generations?|days?|months?)\b", low) + if not tm: + return None + tt = num(tm.group(1) or tm.group(3)) + Nt = N0 * lv ** tt + return self._say("geometric_n", "The population is %s (N0 λ^t = %s × %s^%s, discrete growth)." % (g(Nt), g(N0), g(lv), g(tt)), Nt) + return None diff --git a/root/specialists/economics/economics_panel_v1.json b/root/specialists/economics/economics_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..9d68cd81b600aa59a8b01b3895c23486bf4fc67b --- /dev/null +++ b/root/specialists/economics/economics_panel_v1.json @@ -0,0 +1,548 @@ +[ + { + "split": "dev", + "kind": "elast", + "valid": true, + "q": "The price of a good rises from $20 to $22 and the quantity demanded falls from 1000 to 980. What is the price elasticity of demand?", + "expect": -0.21212121212121215 + }, + { + "split": "dev", + "kind": "elast", + "valid": true, + "q": "The price of a good rises from $1.5 to $2.5 and the quantity demanded falls from 90 to 70. What is the price elasticity of demand?", + "expect": -0.5 + }, + { + "split": "dev", + "kind": "elast", + "valid": true, + "q": "The price of a good rises from $4 to $5 and the quantity demanded falls from 100 to 80. What is the price elasticity of demand?", + "expect": -1.0 + }, + { + "split": "dev", + "kind": "elastp", + "valid": true, + "q": "If the price increases by 5% and quantity demanded decreases by 2%, what is the price elasticity of demand?", + "expect": -0.4 + }, + { + "split": "dev", + "kind": "elastp", + "valid": true, + "q": "If the price increases by 8% and quantity demanded decreases by 12%, what is the price elasticity of demand?", + "expect": -1.5 + }, + { + "split": "dev", + "kind": "elastp", + "valid": true, + "q": "If the price increases by 10% and quantity demanded decreases by 25%, what is the price elasticity of demand?", + "expect": -2.5 + }, + { + "split": "dev", + "kind": "infl", + "valid": true, + "q": "The CPI rose from 250 to 260. What was the inflation rate?", + "expect": 4.0 + }, + { + "split": "dev", + "kind": "infl", + "valid": true, + "q": "The CPI rose from 218.1 to 258.8. What was the inflation rate?", + "expect": 18.661164603392947 + }, + { + "split": "dev", + "kind": "infl", + "valid": true, + "q": "The CPI rose from 240 to 243.6. What was the inflation rate?", + "expect": 1.4999999999999978 + }, + { + "split": "dev", + "kind": "infl_rev", + "valid": true, + "q": "The CPI was 245 in 2020 and 230 in 2018. What was the inflation rate?", + "expect": 6.521739130434782 + }, + { + "split": "dev", + "kind": "infl_rev", + "valid": true, + "q": "The CPI was 190 in 2006 and 180 in 2004. What was the inflation rate?", + "expect": 5.555555555555555 + }, + { + "split": "dev", + "kind": "infl_rev", + "valid": true, + "q": "The CPI was 260 in 2022 and 250 in 2021. What was the inflation rate?", + "expect": 4.0 + }, + { + "split": "dev", + "kind": "realval", + "valid": true, + "q": "What is $50,000 in 2010 worth in 2020 dollars if the CPI was 218 in 2010 and 259 in 2020?", + "expect": 59403.66972477064 + }, + { + "split": "dev", + "kind": "realval", + "valid": true, + "q": "What is $100 in 1990 worth in 2020 dollars if the CPI was 130.7 in 1990 and 258.8 in 2020?", + "expect": 198.01071155317524 + }, + { + "split": "dev", + "kind": "realval", + "valid": true, + "q": "What is $75,000 in 2015 worth in 2023 dollars if the CPI was 237 in 2015 and 304.7 in 2023?", + "expect": 96424.0506329114 + }, + { + "split": "dev", + "kind": "realrate", + "valid": true, + "q": "The nominal interest rate is 4% and inflation is 1%. What is the real interest rate?", + "expect": 3 + }, + { + "split": "dev", + "kind": "realrate", + "valid": true, + "q": "The nominal interest rate is 3% and inflation is 4%. What is the real interest rate?", + "expect": -1 + }, + { + "split": "dev", + "kind": "realrate", + "valid": true, + "q": "The nominal interest rate is 8% and inflation is 6%. What is the real interest rate?", + "expect": 2 + }, + { + "split": "dev", + "kind": "growth", + "valid": true, + "q": "Real GDP grew from $20,000 billion to $20,600 billion. What was the growth rate?", + "expect": 3.0 + }, + { + "split": "dev", + "kind": "growth", + "valid": true, + "q": "Real GDP grew from $800 billion to $780 billion. What was the growth rate?", + "expect": -2.5 + }, + { + "split": "dev", + "kind": "growth_rev", + "valid": true, + "q": "GDP was $780 billion in 2017 and $750 billion in 2016. What was the growth rate?", + "expect": 4.0 + }, + { + "split": "dev", + "kind": "growth_rev", + "valid": true, + "q": "GDP was $520 billion in 2022 and $500 billion in 2021. What was the growth rate?", + "expect": 4.0 + }, + { + "split": "dev", + "kind": "mult", + "valid": true, + "q": "If the MPC is 0.6, what is the spending multiplier?", + "expect": 2.5 + }, + { + "split": "dev", + "kind": "mult", + "valid": true, + "q": "If the MPC is 0.75, what is the spending multiplier?", + "expect": 4.0 + }, + { + "split": "dev", + "kind": "mult", + "valid": true, + "q": "If the MPC is 0.8, what is the spending multiplier?", + "expect": 5.000000000000001 + }, + { + "split": "dev", + "kind": "taxmult", + "valid": true, + "q": "With an MPC of 0.8, what is the tax multiplier?", + "expect": -4.000000000000001 + }, + { + "split": "dev", + "kind": "taxmult", + "valid": true, + "q": "With an MPC of 0.6, what is the tax multiplier?", + "expect": -1.4999999999999998 + }, + { + "split": "dev", + "kind": "unemp", + "valid": true, + "q": "There are 3 million unemployed people and a labor force of 60 million. What is the unemployment rate?", + "expect": 5.0 + }, + { + "split": "dev", + "kind": "unemp", + "valid": true, + "q": "There are 6.5 million unemployed people and a labor force of 165 million. What is the unemployment rate?", + "expect": 3.939393939393939 + }, + { + "split": "dev", + "kind": "partic", + "valid": true, + "q": "The labor force is 12 million and the working-age population is 20 million. What is the labor force participation rate?", + "expect": 60.0 + }, + { + "split": "dev", + "kind": "partic", + "valid": true, + "q": "The labor force is 40 million and the working-age population is 64 million. What is the labor force participation rate?", + "expect": 62.5 + }, + { + "split": "dev", + "kind": "defl", + "valid": true, + "q": "Nominal GDP is $21 trillion and real GDP is $20 trillion. What is the GDP deflator?", + "expect": 105.0 + }, + { + "split": "dev", + "kind": "defl", + "valid": true, + "q": "Nominal GDP is $18.5 trillion and real GDP is $17.2 trillion. What is the GDP deflator?", + "expect": 107.55813953488374 + }, + { + "split": "dev", + "kind": "r70", + "valid": true, + "q": "Using the rule of 70, how long does it take for GDP to double at 7% growth?", + "expect": 10.0 + }, + { + "split": "dev", + "kind": "r70", + "valid": true, + "q": "Using the rule of 70, how long does it take for GDP to double at 1.4% growth?", + "expect": 50.0 + }, + { + "split": "dev", + "kind": "r70", + "valid": true, + "q": "Using the rule of 70, how long does it take for GDP to double at 3.5% growth?", + "expect": 20.0 + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What is the spending multiplier if the MPC is 1.2?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What is the price elasticity of demand?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "The labor force is 100 million and 120 million are unemployed. What is the unemployment rate?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "elast", + "valid": true, + "q": "Quantity demanded dropped from 60 to 30 units when the price went from $2 to $3. Find the price elasticity of demand (midpoint).", + "expect": -1.6666666666666665 + }, + { + "split": "heldout", + "kind": "elast", + "valid": true, + "q": "Quantity demanded dropped from 500 to 450 units when the price went from $10 to $12. Find the price elasticity of demand (midpoint).", + "expect": -0.5789473684210525 + }, + { + "split": "heldout", + "kind": "elast", + "valid": true, + "q": "Quantity demanded dropped from 1000 to 980 units when the price went from $20 to $22. Find the price elasticity of demand (midpoint).", + "expect": -0.21212121212121215 + }, + { + "split": "heldout", + "kind": "elastp", + "valid": true, + "q": "A 20% price cut raises quantity demanded by 20%. What is the elasticity?", + "expect": -1.0 + }, + { + "split": "heldout", + "kind": "elastp", + "valid": true, + "q": "A 5% price cut raises quantity demanded by 2%. What is the elasticity?", + "expect": -0.4 + }, + { + "split": "heldout", + "kind": "elastp", + "valid": true, + "q": "A 4% price cut raises quantity demanded by 1%. What is the elasticity?", + "expect": -0.25 + }, + { + "split": "heldout", + "kind": "infl", + "valid": true, + "q": "Find the inflation rate if the consumer price index went from 240 to 243.6.", + "expect": 1.4999999999999978 + }, + { + "split": "heldout", + "kind": "infl", + "valid": true, + "q": "Find the inflation rate if the consumer price index went from 250 to 260.", + "expect": 4.0 + }, + { + "split": "heldout", + "kind": "infl", + "valid": true, + "q": "Find the inflation rate if the consumer price index went from 218.1 to 258.8.", + "expect": 18.661164603392947 + }, + { + "split": "heldout", + "kind": "infl_rev", + "valid": true, + "q": "In 2022 the CPI stood at 260; in 2021 it was 250. Compute inflation between the two years.", + "expect": 4.0 + }, + { + "split": "heldout", + "kind": "infl_rev", + "valid": true, + "q": "In 2020 the CPI stood at 245; in 2018 it was 230. Compute inflation between the two years.", + "expect": 6.521739130434782 + }, + { + "split": "heldout", + "kind": "infl_rev", + "valid": true, + "q": "In 2006 the CPI stood at 190; in 2004 it was 180. Compute inflation between the two years.", + "expect": 5.555555555555555 + }, + { + "split": "heldout", + "kind": "realval", + "valid": true, + "q": "Express $50,000 from 2010 in 2020 dollars, given CPI 218 in 2010 and CPI 259 in 2020.", + "expect": 59403.66972477064 + }, + { + "split": "heldout", + "kind": "realval", + "valid": true, + "q": "Express $75,000 from 2015 in 2023 dollars, given CPI 237 in 2015 and CPI 304.7 in 2023.", + "expect": 96424.0506329114 + }, + { + "split": "heldout", + "kind": "realval", + "valid": true, + "q": "Express $100 from 1990 in 2020 dollars, given CPI 130.7 in 1990 and CPI 258.8 in 2020.", + "expect": 198.01071155317524 + }, + { + "split": "heldout", + "kind": "realrate", + "valid": true, + "q": "With 1% inflation and a 4% nominal rate, what is the real rate?", + "expect": 3 + }, + { + "split": "heldout", + "kind": "realrate", + "valid": true, + "q": "With 4% inflation and a 3% nominal rate, what is the real rate?", + "expect": -1 + }, + { + "split": "heldout", + "kind": "realrate", + "valid": true, + "q": "With 6% inflation and a 8% nominal rate, what is the real rate?", + "expect": 2 + }, + { + "split": "heldout", + "kind": "growth", + "valid": true, + "q": "Find the GDP growth rate when output went from $1,200 billion to $1,236 billion.", + "expect": 3.0 + }, + { + "split": "heldout", + "kind": "growth", + "valid": true, + "q": "Find the GDP growth rate when output went from $20,000 billion to $20,600 billion.", + "expect": 3.0 + }, + { + "split": "heldout", + "kind": "growth_rev", + "valid": true, + "q": "GDP was $520 billion in 2022, up from $500 billion in 2021. What is the growth rate?", + "expect": 4.0 + }, + { + "split": "heldout", + "kind": "growth_rev", + "valid": true, + "q": "GDP was $1,050 billion in 2023, up from $1,000 billion in 2019. What is the growth rate?", + "expect": 5.0 + }, + { + "split": "heldout", + "kind": "mult", + "valid": true, + "q": "Compute the spending multiplier when the marginal propensity to consume is 0.5.", + "expect": 2.0 + }, + { + "split": "heldout", + "kind": "mult", + "valid": true, + "q": "Compute the spending multiplier when the marginal propensity to consume is 0.9.", + "expect": 10.000000000000002 + }, + { + "split": "heldout", + "kind": "mult", + "valid": true, + "q": "Compute the spending multiplier when the marginal propensity to consume is 0.8.", + "expect": 5.000000000000001 + }, + { + "split": "heldout", + "kind": "taxmult", + "valid": true, + "q": "Find the tax multiplier for an MPS of 0.2.", + "expect": -4.000000000000001 + }, + { + "split": "heldout", + "kind": "taxmult", + "valid": true, + "q": "Find the tax multiplier for an MPS of 0.25.", + "expect": -3.0 + }, + { + "split": "heldout", + "kind": "unemp", + "valid": true, + "q": "Employed: 57 million. Unemployed: 3 million. What's the unemployment rate?", + "expect": 5.0 + }, + { + "split": "heldout", + "kind": "unemp", + "valid": true, + "q": "Employed: 138 million. Unemployed: 12 million. What's the unemployment rate?", + "expect": 8.0 + }, + { + "split": "heldout", + "kind": "partic", + "valid": true, + "q": "What share of the working-age population (64 million) is in the labor force (40 million)? Give the participation rate.", + "expect": 62.5 + }, + { + "split": "heldout", + "kind": "partic", + "valid": true, + "q": "What share of the working-age population (260 million) is in the labor force (160 million)? Give the participation rate.", + "expect": 61.53846153846154 + }, + { + "split": "heldout", + "kind": "defl", + "valid": true, + "q": "Real GDP $20 trillion, nominal GDP $21 trillion: compute the deflator.", + "expect": 105.0 + }, + { + "split": "heldout", + "kind": "defl", + "valid": true, + "q": "Real GDP $24 trillion, nominal GDP $30 trillion: compute the deflator.", + "expect": 125.0 + }, + { + "split": "heldout", + "kind": "r70", + "valid": true, + "q": "At 3.5% annual growth, how many years until real GDP per capita doubles (rule of 70)?", + "expect": 20.0 + }, + { + "split": "heldout", + "kind": "r70", + "valid": true, + "q": "At 7% annual growth, how many years until real GDP per capita doubles (rule of 70)?", + "expect": 10.0 + }, + { + "split": "heldout", + "kind": "r70", + "valid": true, + "q": "At 2% annual growth, how many years until real GDP per capita doubles (rule of 70)?", + "expect": 35.0 + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "Find the tax multiplier for an MPC of 1.5.", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "Compute the GDP deflator if nominal GDP is $20 trillion.", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "A labor force of 5 million with 7 million unemployed: what's the unemployment rate?", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/economics/economics_panel_v1.py b/root/specialists/economics/economics_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..545420b4f4230cb5fc01a66d7a2b63ce843f1cac --- /dev/null +++ b/root/specialists/economics/economics_panel_v1.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python3 +"""economics_panel_v1 - the sealed panel for specialist #83 (economics). Expected values from the formulas written here +(midpoint elasticity; %dQ/%dP; CPI inflation; X x CPI_to/CPI_from; Fisher i - pi; growth; 1/(1-MPC); -MPC/MPS; +U/LF; LF/pop; nominal/real x 100; 70/g). Roles are set by the template variables; half the dated items state the LATER +year first (roles from grammar and years, never order of mention). Must-decline: MPC >= 1, missing inputs, unemployed +above the labour force. Dev / held-out differ in seed and phrasing. usage: economics_panel_v1.py """ +import collections +import json +import random +import sys + +T = {"dev": {"elast": "The price of a good rises from ${p1} to ${p2} and the quantity demanded falls from {q1} to {q2}. What is the price elasticity of demand?", + "elastp": "If the price increases by {dp}% and quantity demanded decreases by {dq}%, what is the price elasticity of demand?", + "infl": "The CPI rose from {a} to {b}. What was the inflation rate?", + "infl_rev": "The CPI was {b} in {y2} and {a} in {y1}. What was the inflation rate?", + "realval": "What is ${x} in {y0} worth in {y1} dollars if the CPI was {c0} in {y0} and {c1} in {y1}?", + "realrate": "The nominal interest rate is {i}% and inflation is {p}%. What is the real interest rate?", + "growth": "Real GDP grew from ${a} billion to ${b} billion. What was the growth rate?", + "growth_rev": "GDP was ${b} billion in {y2} and ${a} billion in {y1}. What was the growth rate?", + "mult": "If the MPC is {c}, what is the spending multiplier?", "taxmult": "With an MPC of {c}, what is the tax multiplier?", + "unemp": "There are {u} million unemployed people and a labor force of {l} million. What is the unemployment rate?", + "partic": "The labor force is {l} million and the working-age population is {p} million. What is the labor force participation rate?", + "defl": "Nominal GDP is ${n} trillion and real GDP is ${r} trillion. What is the GDP deflator?", + "r70": "Using the rule of 70, how long does it take for GDP to double at {g}% growth?"}, + "heldout": {"elast": "Quantity demanded dropped from {q1} to {q2} units when the price went from ${p1} to ${p2}. Find the price elasticity of demand (midpoint).", + "elastp": "A {dp}% price cut raises quantity demanded by {dq}%. What is the elasticity?", + "infl": "Find the inflation rate if the consumer price index went from {a} to {b}.", + "infl_rev": "In {y2} the CPI stood at {b}; in {y1} it was {a}. Compute inflation between the two years.", + "realval": "Express ${x} from {y0} in {y1} dollars, given CPI {c0} in {y0} and CPI {c1} in {y1}.", + "realrate": "With {p}% inflation and a {i}% nominal rate, what is the real rate?", + "growth": "Find the GDP growth rate when output went from ${a} billion to ${b} billion.", + "growth_rev": "GDP was ${b} billion in {y2}, up from ${a} billion in {y1}. What is the growth rate?", + "mult": "Compute the spending multiplier when the marginal propensity to consume is {c}.", + "taxmult": "Find the tax multiplier for an MPS of {s}.", + "unemp": "Employed: {e} million. Unemployed: {u} million. What's the unemployment rate?", + "partic": "What share of the working-age population ({p} million) is in the labor force ({l} million)? Give the participation rate.", + "defl": "Real GDP ${r} trillion, nominal GDP ${n} trillion: compute the deflator.", + "r70": "At {g}% annual growth, how many years until real GDP per capita doubles (rule of 70)?"}} +DECLINE = {"dev": ["What is the spending multiplier if the MPC is 1.2?", "What is the price elasticity of demand?", + "The labor force is 100 million and 120 million are unemployed. What is the unemployment rate?"], + "heldout": ["Find the tax multiplier for an MPC of 1.5.", "Compute the GDP deflator if nominal GDP is $20 trillion.", + "A labor force of 5 million with 7 million unemployed: what's the unemployment rate?"]} + + +def main(): + items = [] + for split, seed in (("dev", 83), ("heldout", 8383)): + rng = random.Random(seed) + t = T[split] + add = [] + for p1, p2, q1, q2 in rng.sample([(4, 5, 100, 80), (10, 12, 500, 450), (2, 3, 60, 30), (20, 22, 1000, 980), (8, 10, 240, 200), (1.5, 2.5, 90, 70)], 3): + add.append(("elast", {"p1": p1, "p2": p2, "q1": q1, "q2": q2}, ((q2 - q1) / ((q1 + q2) / 2)) / ((p2 - p1) / ((p1 + p2) / 2)))) + for dp, dq in rng.sample([(10, 25), (5, 2), (20, 20), (8, 12), (4, 1)], 3): + add.append(("elastp", {"dp": dp, "dq": dq}, -dq / dp if split == "dev" else dq / -dp)) + for a, b in rng.sample([(250, 260), (218.1, 258.8), (100, 103.5), (300, 312), (240, 243.6)], 3): + add.append(("infl", {"a": a, "b": b}, (b - a) / a * 100)) + for a, b, y1, y2 in rng.sample([(250, 260, 2021, 2022), (230, 245, 2018, 2020), (100, 104, 2010, 2011), (180, 190, 2004, 2006)], 3): + add.append(("infl_rev", {"a": a, "b": b, "y1": y1, "y2": y2}, (b - a) / a * 100)) + for x, y0, y1, c0, c1 in rng.sample([(50000, 2010, 2020, 218, 259), (100, 1990, 2020, 130.7, 258.8), (2000, 2000, 2015, 172, 237), (75000, 2015, 2023, 237, 304.7)], 3): + add.append(("realval", {"x": format(x, ","), "y0": y0, "y1": y1, "c0": c0, "c1": c1}, x * c1 / c0)) + for i, p in rng.sample([(6, 2), (5, 3.5), (4, 1), (8, 6), (3, 4)], 3): + add.append(("realrate", {"i": i, "p": p}, i - p)) + for a, b in rng.sample([(500, 520), (20000, 20600), (1200, 1236), (800, 780)], 2): + add.append(("growth", {"a": format(a, ","), "b": format(b, ",")}, (b - a) / a * 100)) + for a, b, y1, y2 in rng.sample([(500, 520, 2021, 2022), (1000, 1050, 2019, 2023), (750, 780, 2016, 2017)], 2): + add.append(("growth_rev", {"a": format(a, ","), "b": format(b, ","), "y1": y1, "y2": y2}, (b - a) / a * 100)) + for c in rng.sample([0.8, 0.75, 0.9, 0.6, 0.5], 3): + add.append(("mult", {"c": c}, 1 / (1 - c))) + for c in rng.sample([0.8, 0.75, 0.9, 0.6], 2): + add.append(("taxmult", {"c": c, "s": round(1 - c, 2)}, -c / (1 - c))) + for u, l in rng.sample([(8, 160), (6.5, 165), (12, 150), (3, 60)], 2): + add.append(("unemp", {"u": u, "l": l, "e": round(l - u, 1)}, u / l * 100)) + for l, p in rng.sample([(160, 260), (165, 262), (40, 64), (12, 20)], 2): + add.append(("partic", {"l": l, "p": p}, l / p * 100)) + for n, r in rng.sample([(25, 22), (21, 20), (18.5, 17.2), (30, 24)], 2): + add.append(("defl", {"n": n, "r": r}, n / r * 100)) + for g in rng.sample([2, 3.5, 7, 1.4, 5], 3): + add.append(("r70", {"g": g}, 70 / g)) + for kind, kw, exp in add: + items.append({"split": split, "kind": kind, "valid": True, "q": t[kind].format(**kw), "expect": exp}) + for q in DECLINE[split]: + items.append({"split": split, "kind": "decline", "valid": False, "q": q, "expect": "decline"}) + json.dump(items, open(sys.argv[1], "w"), indent=1) + print("panel:", dict(collections.Counter(i["split"] for i in items))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/economics/economics_scorer.py b/root/specialists/economics/economics_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..3ead4e9fbc3c035de5549a741ed31c53084f8e9e --- /dev/null +++ b/root/specialists/economics/economics_scorer.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +"""economics_scorer - the first number after "is" in the REPLY TEXT ($ and commas allowed) must be within 0.5% (or 0.01 +absolute) of the panel's formula. Elasticities compare ABSOLUTE values (texts differ on reporting the sign); every +other kind compares signed values (a tax multiplier is negative). A must-decline item answered is a false yes. +(ok, asserted).""" +import re + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + m = re.search(r"\bis\s+(?:about\s+|approximately\s+)?\$?(-?[\d,]*\.?\d+)", text) + if not m: + return False, True + got, e = float(m.group(1).replace(",", "")), float(p["expect"]) + if p["kind"] in ("elast", "elastp"): + got, e = abs(got), abs(e) + return abs(got - e) <= max(0.005 * abs(e), 0.01), True diff --git a/root/specialists/economics/manifest.json b/root/specialists/economics/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..47cf3d82ea4b3ae26882c2be7af87c34ff3ecb30 --- /dev/null +++ b/root/specialists/economics/manifest.json @@ -0,0 +1,22 @@ +{ + "id": "economics", + "name": "Oracle7 Economics", + "number": 83, + "tier": "A", + "sources": [ + {"name": "OpenStax Principles of Economics 3e (elasticity midpoint method, CPI and inflation, real vs nominal, Fisher relation, multipliers, labour-market rates, GDP deflator, rule of 70)", "licence": "CC-BY 4.0", "url": "https://openstax.org/details/books/principles-economics-3e"} + ], + "store": {"path": "__ORACLE7_ROOT__/specialists/economics/organ_economics_v1.py"}, + "organ": {"dir": "__ORACLE7_ROOT__/specialists/economics", "module": "organ_economics_v1", "class": "EconomicsOrgan", "init": {}}, + "accept": { + "kinds": ["elasticity", "inflation", "real_value", "real_rate", "growth", "multiplier", "tax_multiplier", "unemployment", "participation", "deflator", "rule70"], + "declines_in_domain": ["underspecified", "impossible"], + "context_regex": "\\b(?:elasticity|elastic|cpi|consumer price index|inflation|multiplier|mpc|mps|unemploy\\w*|labou?r force|participation rate|gdp|deflator|rule of 70|real (?:interest )?rate)\\b" + }, + "panel": {"path": "__ORACLE7_ROOT__/specialists/economics/economics_panel_v1.json", "splits": ["dev", "heldout"], + "exclude_kinds_composed": [], "scorer_module": "economics_scorer", "scorer_fn": "ok"}, + "routing_cues": ["price elasticity of demand", "inflation from CPI", "real value in another year's dollars", "real interest rate", "spending multiplier", "unemployment rate", "GDP deflator", "rule of 70"], + "budgets": {"latency_p50_ms": 50, "store_mb": 1}, + "core_sample": {"n": 400, "seed": 20260928}, + "notes": "Introductory economics arithmetic, formula named in every answer; Fisher approximation primary with the exact value stated; rule of 70 labelled an approximation. Roles from grammar and years (earlier year = base), never order of mention. Never forecasts, never advises (will-X-rise / should-I / invest turns fall through). Narrowed from the start (narrow_v1)." +} diff --git a/root/specialists/economics/narrow_v1.py b/root/specialists/economics/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/economics/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/economics/organ_economics_v1.py b/root/specialists/economics/organ_economics_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..90709c475b6300480cf43972b24537d1275c8d6f --- /dev/null +++ b/root/specialists/economics/organ_economics_v1.py @@ -0,0 +1,209 @@ +#!/usr/bin/env python3 +"""organ_economics_v1 - introductory macro / micro arithmetic (OpenStax Principles of Economics conventions), formula +named in every answer: +- price elasticity of demand, midpoint (arc) method from two price / quantity points, or from percentage changes; + labelled elastic / inelastic / unit elastic by |E|; +- inflation rate from two CPI values; an amount in one year's dollars expressed in another year's (x CPI_to / CPI_from); +- real interest rate by the Fisher approximation r = i - pi (exact (1+i)/(1+pi) - 1 also stated); +- growth rate between two values; GDP deflator = nominal / real x 100; +- spending multiplier 1 / (1 - MPC) = 1 / MPS; tax multiplier -MPC / MPS; +- unemployment rate = unemployed / labour force; labour-force participation = labour force / working-age population; +- rule of 70 doubling time = 70 / growth rate (an approximation, said so). +ROLES FROM GRAMMAR AND YEARS, never order of mention: "from A to B", "A in 2019 ... B in 2023" (earlier year = base). +Never forecasts, never advises. Narrowed from the start (narrow_v1). Returns {kind, status, response, value}.""" +from __future__ import annotations + +import re + +from narrow_v1 import narrative, short_direct + +N = r"\$?(\d+(?:,\d{3})*(?:\.\d+)?)" +SCALE = r"\s*(trillion|billion|million|thousand)?" +MULT = {"trillion": 1e12, "billion": 1e9, "million": 1e6, "thousand": 1e3, None: 1, "": 1} + + +def num(s): + return float(s.replace(",", "")) + + +def g(x): + return ("%.3f" % x).rstrip("0").rstrip(".") if abs(x) < 1e6 else format(round(x), ",") + + +def money(x): + return "$" + format(round(x, 2), ",.2f") + + +def from_to(low, subject): + """(a, b) from ' ... from A to B' or ' ... A in YEAR ... B in YEAR' (earlier year first)""" + m = re.search(r"(?:" + subject + r")" + r"[^.?;]{0,40}?\bfrom\s+" + N + SCALE + r"(?:\s*\w+)?\s+(?:in\s+\d{4}\s+)?to\s+" + N + SCALE, low) + if m: + return num(m.group(1)) * MULT[m.group(2)], num(m.group(3)) * MULT[m.group(4)] + if not re.search(subject, low): + return None + yrs = re.findall(N + SCALE + r"\s*(?:\w+\s+){0,2}?(?:in|for)\s+((?:19|20)\d{2})\b", low) + if len(yrs) >= 2: + pts = sorted((int(y), num(v) * MULT[s]) for v, s, y in yrs[:2]) + if pts[0][0] != pts[1][0]: + return pts[0][1], pts[1][1] + return None + + +class EconomicsOrgan: + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def _need(self, what): + return self._say("underspecified", "I need %s to work that out; I won't assume it." % what, status="withheld") + + def answer(self, text, session_id="default"): + if narrative(text): + return None + r = self._answer(text) + if r and r.get("status") != "answered" and not short_direct(text): + return None + return r + + def _answer(self, text): + t = " ".join(str(text or "").split()) + low = t.lower() + if re.search(r"\bwill\b.*\b(?:rise|fall|go up|go down|crash|recession)\b|\bpredict\w*\b|\bforecast\w*\b|\bshould i\b|\bbuy\b|\binvest\b", low): + return None + # --- multipliers + mpc = re.search(r"\bmpc\b[^0-9]{0,25}?(\d+(?:\.\d+)?|\.\d+)|\bmarginal propensity to consume\b[^0-9]{0,25}?(\d+(?:\.\d+)?|\.\d+)", low) + mps = re.search(r"\bmps\b[^0-9]{0,25}?(\d+(?:\.\d+)?|\.\d+)|\bmarginal propensity to save\b[^0-9]{0,25}?(\d+(?:\.\d+)?|\.\d+)", low) + if (mpc or mps) and re.search(r"\bmultiplier\b", low): + c = float(mpc.group(1) or mpc.group(2)) if mpc else 1 - float(mps.group(1) or mps.group(2)) + if not 0 < c < 1: + return self._say("impossible", "The MPC must be between 0 and 1 for a finite multiplier.", status="withheld") + if re.search(r"\btax multiplier\b", low): + v = -c / (1 - c) + return self._say("tax_multiplier", "The tax multiplier is %s (-MPC / MPS = -%s / %s)." % (g(v), g(c), g(1 - c)), v) + v = 1 / (1 - c) + return self._say("multiplier", "The spending multiplier is %s (1 / (1 - MPC) = 1 / %s)." % (g(v), g(1 - c)), v) + # --- real interest rate (Fisher) + nom = re.search(r"\bnominal (?:interest )?rate\b[^0-9%]{0,25}?(\d+(?:\.\d+)?)\s*%|(\d+(?:\.\d+)?)\s*%\s*nominal", low) + inf = re.search(r"\binflation(?: rate)?\b[^0-9%]{0,25}?(-?\d+(?:\.\d+)?)\s*%|(-?\d+(?:\.\d+)?)\s*%\s*inflation", low) + if nom and inf and re.search(r"\breal (?:interest )?rate\b|\breal return\b", low): + i, p = float(nom.group(1) or nom.group(2)), float(inf.group(1) or inf.group(2)) + ex = ((1 + i / 100) / (1 + p / 100) - 1) * 100 + return self._say("real_rate", "The real interest rate is %s%% (Fisher approximation i - π = %s%% - %s%%; exact (1+i)/(1+π) - 1 = %s%%)." % (g(i - p), g(i), g(p), g(ex)), i - p) + # --- unemployment / participation + if re.search(r"\bunemployment rate\b", low): + u = re.search(N + SCALE + r"\s*(?:people\s+)?(?:are\s+|were\s+)?unemployed|\bunemployed\s*(?:people)?\s*(?:of|is|are|=|:)?\s*" + N + SCALE, low) + lf = re.search(r"\blabou?r force\s*(?:of|is|=|:)?\s*" + N + SCALE + r"|" + N + SCALE + r"\s*(?:people\s+)?in the labou?r force", low) + e = re.search(N + SCALE + r"\s*(?:people\s+)?(?:are\s+|were\s+)?employed|\bemployed\s*(?:people)?\s*(?:of|is|are|=|:)?\s*" + N + SCALE, low) + if not u: + return self._need("the number unemployed") + U = num(u.group(1) or u.group(3)) * MULT[u.group(2) if u.group(1) else u.group(4)] + if lf: + L = num(lf.group(1) or lf.group(3)) * MULT[lf.group(2) if lf.group(1) else lf.group(4)] + elif e: + L = U + num(e.group(1) or e.group(3)) * MULT[e.group(2) if e.group(1) else e.group(4)] + else: + return self._need("the labour force (or the number employed)") + if L <= 0 or U > L: + return self._say("impossible", "The unemployed cannot outnumber the labour force.", status="withheld") + v = U / L * 100 + return self._say("unemployment", "The unemployment rate is %s%% (unemployed %s ÷ labour force %s)." % (g(v), g(U), g(L)), v) + if re.search(r"\bparticipation rate\b", low): + lf = re.search(r"\blabou?r force\s*(?:of|is|=|:)?\s*" + N + SCALE + r"|" + N + SCALE + r"\s*(?:people\s+)?in the labou?r force", low) + pop = re.search(r"\b(?:working[- ]age|adult|civilian noninstitutional) population\s*(?:of|is|=|:)?\s*" + N + SCALE + r"|" + N + SCALE + r"\s*(?:working[- ]age|adults?)\b", low) + if not lf or not pop: + return self._need("the labour force and the working-age population") + L = num(lf.group(1) or lf.group(3)) * MULT[lf.group(2) if lf.group(1) else lf.group(4)] + P = num(pop.group(1) or pop.group(3)) * MULT[pop.group(2) if pop.group(1) else pop.group(4)] + if P <= 0 or L > P: + return self._say("impossible", "The labour force cannot exceed the working-age population.", status="withheld") + v = L / P * 100 + return self._say("participation", "The labour-force participation rate is %s%% (labour force %s ÷ working-age population %s)." % (g(v), g(L), g(P)), v) + # --- GDP deflator + if re.search(r"\bgdp deflator\b|\bdeflator\b", low): + nm = re.search(r"\bnominal gdp\s*(?:of|is|was|=|:)?\s*" + N + SCALE, low) + rm = re.search(r"\breal gdp\s*(?:of|is|was|=|:)?\s*" + N + SCALE, low) + if not nm or not rm: + return self._need("both nominal and real GDP") + nv, rv = num(nm.group(1)) * MULT[nm.group(2)], num(rm.group(1)) * MULT[rm.group(2)] + if rv <= 0: + return None + v = nv / rv * 100 + return self._say("deflator", "The GDP deflator is %s (nominal ÷ real × 100)." % g(v), v) + # --- rule of 70 + if re.search(r"\brule of 70\b", low) or (re.search(r"\bdouble\b|\bdoubling\b", low) and re.search(r"\bgdp\b|\beconomy\b|\bper capita\b|\bincome\b|\bpopulation\b", low)): + gm = re.search(r"(\d+(?:\.\d+)?)\s*%", low) + if not gm: + return self._need("the annual growth rate") + gr = float(gm.group(1)) + if gr <= 0: + return None + v = 70 / gr + return self._say("rule70", "The doubling time is about %s years (rule of 70: 70 ÷ %s%%; an approximation)." % (g(v), g(gr)), v) + # --- elasticity + if re.search(r"\belasticity\b|\belastic\b", low): + pr = from_to(low, r"\bprices?\b") + qt = from_to(low, r"\bquantit(?:y|ies)\b") + if pr and qt: + (p1, p2), (q1, q2) = pr, qt + if p1 == p2 or (p1 + p2) == 0 or (q1 + q2) == 0: + return None + e = ((q2 - q1) / ((q1 + q2) / 2)) / ((p2 - p1) / ((p1 + p2) / 2)) + return self._say("elasticity", "The price elasticity of demand is %s (midpoint method: %%ΔQ %s%% ÷ %%ΔP %s%%) - %s." % ( + g(e), g((q2 - q1) / ((q1 + q2) / 2) * 100), g((p2 - p1) / ((p1 + p2) / 2) * 100), self._label(e)), e) + pp = re.search(r"\bprices?\b[^.;%]{0,30}?\b(rises?|rose|increases?|increased|goes up|went up|falls?|fell|drops?|dropped|decreases?|decreased)\s+(?:by\s+)?(\d+(?:\.\d+)?)\s*%", low) + qp = re.search(r"\bquantit(?:y|ies)(?: demanded)?\b[^.;%]{0,30}?\b(rises?|rose|increases?|increased|goes up|went up|falls?|fell|drops?|dropped|decreases?|decreased)\s+(?:by\s+)?(\d+(?:\.\d+)?)\s*%", low) + if pp and qp: + sp = -1 if re.match(r"f|d", pp.group(1)) else 1 + sq = -1 if re.match(r"f|d", qp.group(1)) else 1 + dp, dq = sp * float(pp.group(2)), sq * float(qp.group(2)) + if dp == 0: + return None + e = dq / dp + return self._say("elasticity", "The price elasticity of demand is %s (%%ΔQ %s%% ÷ %%ΔP %s%%) - %s." % (g(e), g(dq), g(dp), self._label(e)), e) + return self._need("the price and quantity before and after (or their percentage changes)") + # --- inflation from CPI + if re.search(r"\bcpi\b|\bconsumer price index\b|\bprice index\b", low) and re.search(r"\binflation\b|\bhow much (?:did )?prices\b|\bpercent(?:age)? (?:change|increase)\b", low) \ + and not re.search(r"\bworth\b|\bdollars\b|\badjust\w*\b", low): + ft = from_to(low, r"\bcpi\b|\bconsumer price index\b|\bprice index\b") + if not ft: + return self._need("the CPI in both periods (and which came first)") + a, b = ft + if a <= 0: + return None + v = (b - a) / a * 100 + return self._say("inflation", "The inflation rate is %s%% ((%s - %s) ÷ %s × 100)." % (g(v), g(b), g(a), g(a)), v) + # --- an amount in another year's dollars + if re.search(r"\bcpi\b|\bconsumer price index\b", low) and re.search(r"\bworth\b|\bin (?:\d{4}|today'?s) dollars\b|\badjust\w*\b|\bequivalent\b", low): + am = re.search(r"\$(\d+(?:,\d{3})*(?:\.\d+)?)" + SCALE + r"(?:\s+\w+){0,3}?\s+in\s+((?:19|20)\d{2})", low) + tg = re.search(r"\bin\s+((?:19|20)\d{2})\s+dollars\b", low) + if not am or not tg: + return None + rest = (low[:am.start()] + " " + low[am.end():]).replace(tg.group(0), " ") # the amount and target are not CPIs + cp = {} + for v, y in re.findall(r"(\d+(?:\.\d+)?)\s+(?:in|for)\s+((?:19|20)\d{2})\b", rest): + cp.setdefault(int(y), num(v)) + for y, v in re.findall(r"\b((?:19|20)\d{2})\s+(?:cpi|consumer price index)\s*(?:of|was|is|=|:)?\s*(\d+(?:\.\d+)?)", rest): + cp.setdefault(int(y), num(v)) + for y, v in re.findall(r"\b(?:cpi|consumer price index)\s+(?:in|for)\s+((?:19|20)\d{2})\s*(?:of|was|is|=|:)?\s*(\d+(?:\.\d+)?)", rest): + cp.setdefault(int(y), num(v)) + y0, y1 = int(am.group(3)), int(tg.group(1)) + if y0 not in cp or y1 not in cp or y0 == y1: + return self._need("the CPI for both years") + X = num(am.group(1)) * MULT[am.group(2)] + v = X * cp[y1] / cp[y0] + return self._say("real_value", "That is %s in %d dollars (%s × CPI %s ÷ CPI %s)." % (money(v), y1, money(X), g(cp[y1]), g(cp[y0])), v) + # --- growth rate + if re.search(r"\bgrowth rate\b|\bgrew\b|\bgrowth\b|\bpercent(?:age)? (?:change|increase|growth)\b", low) and re.search(r"\bgdp\b|\boutput\b|\bpopulation\b|\bincome\b|\bper capita\b", low): + ft = from_to(low, r"\bgdp\b|\boutput\b|\bpopulation\b|\bincome\b|\bper capita\b") + if not ft: + return None + a, b = ft + if a <= 0: + return None + v = (b - a) / a * 100 + return self._say("growth", "The growth rate is %s%% ((%s - %s) ÷ %s × 100)." % (g(v), g(b), g(a), g(a)), v) + return None + + @staticmethod + def _label(e): + a = abs(e) + return "elastic (|E| > 1)" if a > 1.0005 else "inelastic (|E| < 1)" if a < 0.9995 else "unit elastic (|E| = 1)" diff --git a/root/specialists/economics/verdict_dev.json b/root/specialists/economics/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..af06d945bcd277fd8364a643c0c60ca8777f478a --- /dev/null +++ b/root/specialists/economics/verdict_dev.json @@ -0,0 +1,113 @@ +{ + "id": "economics", + "name": "Oracle7 Economics", + "tier": "A", + "split": "dev", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T08:22:15Z", + "domain": { + "head": { + "correct": 1, + "false_yes": 2, + "wrong": 0, + "n": 39, + "p50_ms": 62.74, + "fails": [ + [ + "elast", + "The price of a good rises from $20 to $22 and the quantity demanded fa", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "elast", + "The price of a good rises from $1.5 to $2.5 and the quantity demanded ", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "elast", + "The price of a good rises from $4 to $5 and the quantity demanded fall", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "elastp", + "If the price increases by 5% and quantity demanded decreases by 2%, wh", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "elastp", + "If the price increases by 8% and quantity demanded decreases by 12%, w", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "elastp", + "If the price increases by 10% and quantity demanded decreases by 25%, ", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "infl", + "The CPI rose from 250 to 260. What was the inflation rate?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "infl", + "The CPI rose from 218.1 to 258.8. What was the inflation rate?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 39, + "false_yes": 0, + "wrong": 0, + "n": 39, + "p50_ms": 0.12, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/economics/verdict_heldout.json b/root/specialists/economics/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..ee1e7e733519b848cf1b36ffa08398a73a7d49bb --- /dev/null +++ b/root/specialists/economics/verdict_heldout.json @@ -0,0 +1,162 @@ +{ + "id": "economics", + "name": "Oracle7 Economics", + "tier": "A", + "split": "heldout", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T08:26:12Z", + "domain": { + "head": { + "correct": 3, + "false_yes": 0, + "wrong": 3, + "n": 39, + "p50_ms": 61.69, + "fails": [ + [ + "elast", + "Quantity demanded dropped from 60 to 30 units when the price went from", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "elast", + "Quantity demanded dropped from 500 to 450 units when the price went fr", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "elast", + "Quantity demanded dropped from 1000 to 980 units when the price went f", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "elastp", + "A 20% price cut raises quantity demanded by 20%. What is the elasticit", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "elastp", + "A 5% price cut raises quantity demanded by 2%. What is the elasticity?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "elastp", + "A 4% price cut raises quantity demanded by 1%. What is the elasticity?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "infl", + "Find the inflation rate if the consumer price index went from 240 to 2", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "infl", + "Find the inflation rate if the consumer price index went from 250 to 2", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 26, + "false_yes": 0, + "wrong": 0, + "n": 39, + "p50_ms": 0.07, + "fails": [ + [ + "elastp", + "A 20% price cut raises quantity demanded by 20%. What is the elasticit", + "specialist:economics>underspecified", + "I need the price and quantity before and after (or their percentage changes) to work that " + ], + [ + "elastp", + "A 5% price cut raises quantity demanded by 2%. What is the elasticity?", + "specialist:economics>underspecified", + "I need the price and quantity before and after (or their percentage changes) to work that " + ], + [ + "elastp", + "A 4% price cut raises quantity demanded by 1%. What is the elasticity?", + "specialist:economics>underspecified", + "I need the price and quantity before and after (or their percentage changes) to work that " + ], + [ + "infl_rev", + "In 2022 the CPI stood at 260; in 2021 it was 250. Compute inflation be", + "specialist:economics>underspecified", + "I need the CPI in both periods (and which came first) to work that out; I won't assume it." + ], + [ + "infl_rev", + "In 2020 the CPI stood at 245; in 2018 it was 230. Compute inflation be", + "specialist:economics>underspecified", + "I need the CPI in both periods (and which came first) to work that out; I won't assume it." + ], + [ + "infl_rev", + "In 2006 the CPI stood at 190; in 2004 it was 180. Compute inflation be", + "specialist:economics>underspecified", + "I need the CPI in both periods (and which came first) to work that out; I won't assume it." + ], + [ + "realval", + "Express $50,000 from 2010 in 2020 dollars, given CPI 218 in 2010 and C", + "specialist:economics>underspecified", + "I need the CPI for both years to work that out; I won't assume it." + ], + [ + "realval", + "Express $75,000 from 2015 in 2023 dollars, given CPI 237 in 2015 and C", + "specialist:economics>underspecified", + "I need the CPI for both years to work that out; I won't assume it." + ] + ] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/energy-v3/energy_panel_v3.json b/root/specialists/energy-v3/energy_panel_v3.json new file mode 100644 index 0000000000000000000000000000000000000000..50c8e5335dbe6e6b49fcd00d2989bf8da3903d31 --- /dev/null +++ b/root/specialists/energy-v3/energy_panel_v3.json @@ -0,0 +1,1010 @@ +[ + { + "split": "dev", + "kind": "energy", + "valid": true, + "q": "A 60 W fan is on for 8 hours. How much energy does it use in kWh?", + "expect": 0.48 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "At $0.25 per kWh, what does it cost to run a 60 W fan for 8 hours?", + "expect": 0.12 + }, + { + "split": "dev", + "kind": "cost_c", + "valid": true, + "q": "Running a 60 W fan for 8 hours at 30 cents per kWh costs how much?", + "expect": 0.144 + }, + { + "split": "dev", + "kind": "runtime", + "valid": true, + "q": "My 256 Wh battery powers a 60 W fan. How long will it last?", + "expect": 4.266666666666667 + }, + { + "split": "dev", + "kind": "runtime_ah", + "valid": true, + "q": "How long can a 24 V 200 Ah battery run a 60 W fan?", + "expect": 80.0 + }, + { + "split": "dev", + "kind": "solar", + "valid": true, + "q": "My 6.6 kW panels get 6 peak sun hours. How much energy per day do they make?", + "expect": 39.599999999999994 + }, + { + "split": "dev", + "kind": "solar_loss", + "valid": true, + "q": "6.6 kW of solar, 6 peak sun hours, 14% losses: how much energy per day?", + "expect": 34.056 + }, + { + "split": "dev", + "kind": "payback", + "valid": true, + "q": "It saves $1500 a year and costs $8000 up front. What is the payback period?", + "expect": 5.333333333333333 + }, + { + "split": "dev", + "kind": "swap", + "valid": true, + "q": "A 75 W bulb was replaced with a 11 W LED used 8 hours a day. How much energy is saved in a year?", + "expect": 186.88 + }, + { + "split": "dev", + "kind": "energy", + "valid": true, + "q": "A 15 W lamp is on for 2 hours. How much energy does it use in kWh?", + "expect": 0.03 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "At $0.15 per kWh, what does it cost to run a 15 W lamp for 2 hours?", + "expect": 0.0045 + }, + { + "split": "dev", + "kind": "cost_c", + "valid": true, + "q": "Running a 15 W lamp for 2 hours at 17 cents per kWh costs how much?", + "expect": 0.0051 + }, + { + "split": "dev", + "kind": "runtime", + "valid": true, + "q": "My 256 Wh battery powers a 15 W lamp. How long will it last?", + "expect": 17.066666666666666 + }, + { + "split": "dev", + "kind": "runtime_ah", + "valid": true, + "q": "How long can a 48 V 100 Ah battery run a 15 W lamp?", + "expect": 320.0 + }, + { + "split": "dev", + "kind": "solar", + "valid": true, + "q": "My 6.6 kW panels get 4 peak sun hours. How much energy per day do they make?", + "expect": 26.4 + }, + { + "split": "dev", + "kind": "solar_loss", + "valid": true, + "q": "6.6 kW of solar, 4 peak sun hours, 14% losses: how much energy per day?", + "expect": 22.703999999999997 + }, + { + "split": "dev", + "kind": "payback", + "valid": true, + "q": "It saves $900 a year and costs $15000 up front. What is the payback period?", + "expect": 16.666666666666668 + }, + { + "split": "dev", + "kind": "swap", + "valid": true, + "q": "A 40 W bulb was replaced with a 6 W LED used 5 hours a day. How much energy is saved in a year?", + "expect": 62.05 + }, + { + "split": "dev", + "kind": "energy", + "valid": true, + "q": "A 1200 W fridge is on for 24 hours. How much energy does it use in kWh?", + "expect": 28.8 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "At $0.15 per kWh, what does it cost to run a 1200 W fridge for 24 hours?", + "expect": 4.32 + }, + { + "split": "dev", + "kind": "cost_c", + "valid": true, + "q": "Running a 1200 W fridge for 24 hours at 22 cents per kWh costs how much?", + "expect": 6.336 + }, + { + "split": "dev", + "kind": "runtime", + "valid": true, + "q": "My 500 Wh battery powers a 1200 W fridge. How long will it last?", + "expect": 0.4166666666666667 + }, + { + "split": "dev", + "kind": "runtime_ah", + "valid": true, + "q": "How long can a 12 V 100 Ah battery run a 1200 W fridge?", + "expect": 1.0 + }, + { + "split": "dev", + "kind": "solar", + "valid": true, + "q": "My 3 kW panels get 6 peak sun hours. How much energy per day do they make?", + "expect": 18 + }, + { + "split": "dev", + "kind": "solar_loss", + "valid": true, + "q": "3 kW of solar, 6 peak sun hours, 20% losses: how much energy per day?", + "expect": 14.4 + }, + { + "split": "dev", + "kind": "payback", + "valid": true, + "q": "It saves $600 a year and costs $18500 up front. What is the payback period?", + "expect": 30.833333333333332 + }, + { + "split": "dev", + "kind": "swap", + "valid": true, + "q": "A 75 W bulb was replaced with a 11 W LED used 3 hours a day. How much energy is saved in a year?", + "expect": 70.08 + }, + { + "split": "dev", + "kind": "energy", + "valid": true, + "q": "A 60 W heater is on for 5 hours. How much energy does it use in kWh?", + "expect": 0.3 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "At $0.25 per kWh, what does it cost to run a 60 W heater for 5 hours?", + "expect": 0.075 + }, + { + "split": "dev", + "kind": "cost_c", + "valid": true, + "q": "Running a 60 W heater for 5 hours at 22 cents per kWh costs how much?", + "expect": 0.066 + }, + { + "split": "dev", + "kind": "runtime", + "valid": true, + "q": "My 256 Wh battery powers a 60 W heater. How long will it last?", + "expect": 4.266666666666667 + }, + { + "split": "dev", + "kind": "runtime_ah", + "valid": true, + "q": "How long can a 24 V 200 Ah battery run a 60 W heater?", + "expect": 80.0 + }, + { + "split": "dev", + "kind": "solar", + "valid": true, + "q": "My 4.5 kW panels get 4.5 peak sun hours. How much energy per day do they make?", + "expect": 20.25 + }, + { + "split": "dev", + "kind": "solar_loss", + "valid": true, + "q": "4.5 kW of solar, 4.5 peak sun hours, 14% losses: how much energy per day?", + "expect": 17.415 + }, + { + "split": "dev", + "kind": "swap", + "valid": true, + "q": "A 100 W bulb was replaced with a 14 W LED used 5 hours a day. How much energy is saved in a year?", + "expect": 156.95 + }, + { + "split": "dev", + "kind": "energy", + "valid": true, + "q": "A 40 W fridge is on for 5 hours. How much energy does it use in kWh?", + "expect": 0.2 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "At $0.18 per kWh, what does it cost to run a 40 W fridge for 5 hours?", + "expect": 0.036 + }, + { + "split": "dev", + "kind": "cost_c", + "valid": true, + "q": "Running a 40 W fridge for 5 hours at 22 cents per kWh costs how much?", + "expect": 0.044000000000000004 + }, + { + "split": "dev", + "kind": "runtime", + "valid": true, + "q": "My 1000 Wh battery powers a 40 W fridge. How long will it last?", + "expect": 25.0 + }, + { + "split": "dev", + "kind": "runtime_ah", + "valid": true, + "q": "How long can a 12 V 100 Ah battery run a 40 W fridge?", + "expect": 30.0 + }, + { + "split": "dev", + "kind": "solar", + "valid": true, + "q": "My 8 kW panels get 5 peak sun hours. How much energy per day do they make?", + "expect": 40 + }, + { + "split": "dev", + "kind": "solar_loss", + "valid": true, + "q": "8 kW of solar, 5 peak sun hours, 10% losses: how much energy per day?", + "expect": 36.0 + }, + { + "split": "dev", + "kind": "payback", + "valid": true, + "q": "It saves $600 a year and costs $15000 up front. What is the payback period?", + "expect": 25.0 + }, + { + "split": "dev", + "kind": "swap", + "valid": true, + "q": "A 75 W bulb was replaced with a 11 W LED used 6 hours a day. How much energy is saved in a year?", + "expect": 140.16 + }, + { + "split": "dev", + "kind": "energy", + "valid": true, + "q": "A 40 W lamp is on for 10 hours. How much energy does it use in kWh?", + "expect": 0.4 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "At $0.18 per kWh, what does it cost to run a 40 W lamp for 10 hours?", + "expect": 0.072 + }, + { + "split": "dev", + "kind": "cost_c", + "valid": true, + "q": "Running a 40 W lamp for 10 hours at 30 cents per kWh costs how much?", + "expect": 0.12 + }, + { + "split": "dev", + "kind": "runtime", + "valid": true, + "q": "My 256 Wh battery powers a 40 W lamp. How long will it last?", + "expect": 6.4 + }, + { + "split": "dev", + "kind": "runtime_ah", + "valid": true, + "q": "How long can a 48 V 100 Ah battery run a 40 W lamp?", + "expect": 120.0 + }, + { + "split": "dev", + "kind": "solar", + "valid": true, + "q": "My 3 kW panels get 4.5 peak sun hours. How much energy per day do they make?", + "expect": 13.5 + }, + { + "split": "dev", + "kind": "solar_loss", + "valid": true, + "q": "3 kW of solar, 4.5 peak sun hours, 20% losses: how much energy per day?", + "expect": 10.8 + }, + { + "split": "dev", + "kind": "payback", + "valid": true, + "q": "It saves $600 a year and costs $8000 up front. What is the payback period?", + "expect": 13.333333333333334 + }, + { + "split": "dev", + "kind": "swap", + "valid": true, + "q": "A 40 W bulb was replaced with a 6 W LED used 6 hours a day. How much energy is saved in a year?", + "expect": 74.46 + }, + { + "split": "dev", + "kind": "energy", + "valid": true, + "q": "A 9 W fan is on for 2 hours. How much energy does it use in kWh?", + "expect": 0.018 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "At $0.18 per kWh, what does it cost to run a 9 W fan for 2 hours?", + "expect": 0.00324 + }, + { + "split": "dev", + "kind": "cost_c", + "valid": true, + "q": "Running a 9 W fan for 2 hours at 22 cents per kWh costs how much?", + "expect": 0.00396 + }, + { + "split": "dev", + "kind": "runtime", + "valid": true, + "q": "My 50 Wh battery powers a 9 W fan. How long will it last?", + "expect": 5.555555555555555 + }, + { + "split": "dev", + "kind": "runtime_ah", + "valid": true, + "q": "How long can a 48 V 100 Ah battery run a 9 W fan?", + "expect": 533.3333333333334 + }, + { + "split": "dev", + "kind": "solar", + "valid": true, + "q": "My 4.5 kW panels get 5 peak sun hours. How much energy per day do they make?", + "expect": 22.5 + }, + { + "split": "dev", + "kind": "solar_loss", + "valid": true, + "q": "4.5 kW of solar, 5 peak sun hours, 14% losses: how much energy per day?", + "expect": 19.35 + }, + { + "split": "dev", + "kind": "payback", + "valid": true, + "q": "It saves $1200 a year and costs $12000 up front. What is the payback period?", + "expect": 10.0 + }, + { + "split": "dev", + "kind": "swap", + "valid": true, + "q": "A 60 W bulb was replaced with a 9 W LED used 8 hours a day. How much energy is saved in a year?", + "expect": 148.92 + }, + { + "split": "dev", + "kind": "energy", + "valid": true, + "q": "A 15 W heater is on for 24 hours. How much energy does it use in kWh?", + "expect": 0.36 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "At $0.12 per kWh, what does it cost to run a 15 W heater for 24 hours?", + "expect": 0.043199999999999995 + }, + { + "split": "dev", + "kind": "cost_c", + "valid": true, + "q": "Running a 15 W heater for 24 hours at 30 cents per kWh costs how much?", + "expect": 0.10799999999999998 + }, + { + "split": "dev", + "kind": "runtime", + "valid": true, + "q": "My 1000 Wh battery powers a 15 W heater. How long will it last?", + "expect": 66.66666666666667 + }, + { + "split": "dev", + "kind": "runtime_ah", + "valid": true, + "q": "How long can a 48 V 100 Ah battery run a 15 W heater?", + "expect": 320.0 + }, + { + "split": "dev", + "kind": "solar", + "valid": true, + "q": "My 4.5 kW panels get 6 peak sun hours. How much energy per day do they make?", + "expect": 27.0 + }, + { + "split": "dev", + "kind": "solar_loss", + "valid": true, + "q": "4.5 kW of solar, 6 peak sun hours, 20% losses: how much energy per day?", + "expect": 21.6 + }, + { + "split": "dev", + "kind": "payback", + "valid": true, + "q": "It saves $2100 a year and costs $12000 up front. What is the payback period?", + "expect": 5.714285714285714 + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "Insulation saves $400 a year. What is the payback period?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What does it cost to run a 1200 W heater for 4 hours?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "How long will my battery run a 50 W fan?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "How much energy per day do 5 kW of panels make?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "energy", + "valid": true, + "q": "What is the energy use (kWh) of a 500 W TV left on 4 hours?", + "expect": 2.0 + }, + { + "split": "heldout", + "kind": "cost", + "valid": true, + "q": "With power at $0.25 per kWh, how much to run a 500 W TV for 4 hours (cost)?", + "expect": 0.5 + }, + { + "split": "heldout", + "kind": "cost_c", + "valid": true, + "q": "At 22 cents per kWh, what does 4 hours of a 500 W TV cost?", + "expect": 0.44 + }, + { + "split": "heldout", + "kind": "runtime", + "valid": true, + "q": "How long will a 500 W TV last on a 50 Wh battery?", + "expect": 0.1 + }, + { + "split": "heldout", + "kind": "runtime_ah", + "valid": true, + "q": "A 500 W TV on a 24 V 200 Ah battery: how long will it last?", + "expect": 9.6 + }, + { + "split": "heldout", + "kind": "solar", + "valid": true, + "q": "Estimate daily energy from a 5 kW solar array with 4.5 peak sun hours.", + "expect": 22.5 + }, + { + "split": "heldout", + "kind": "solar_loss", + "valid": true, + "q": "Estimate kWh per day from 5 kW of solar at 4.5 peak sun hours with 14% losses.", + "expect": 19.35 + }, + { + "split": "heldout", + "kind": "payback", + "valid": true, + "q": "Upgrade cost: $15000. It saves $1200 a year. What's the payback?", + "expect": 12.5 + }, + { + "split": "heldout", + "kind": "swap", + "valid": true, + "q": "If a 40 W lamp gets swapped for a 6 W LED running 8 hours a day, what is the yearly energy saving?", + "expect": 99.28 + }, + { + "split": "heldout", + "kind": "energy", + "valid": true, + "q": "What is the energy use (kWh) of a 9 W router left on 5 hours?", + "expect": 0.045 + }, + { + "split": "heldout", + "kind": "cost", + "valid": true, + "q": "With power at $0.12 per kWh, how much to run a 9 W router for 5 hours (cost)?", + "expect": 0.005399999999999999 + }, + { + "split": "heldout", + "kind": "cost_c", + "valid": true, + "q": "At 14 cents per kWh, what does 5 hours of a 9 W router cost?", + "expect": 0.0063 + }, + { + "split": "heldout", + "kind": "runtime", + "valid": true, + "q": "How long will a 9 W router last on a 100 Wh battery?", + "expect": 11.11111111111111 + }, + { + "split": "heldout", + "kind": "runtime_ah", + "valid": true, + "q": "A 9 W router on a 12 V 100 Ah battery: how long will it last?", + "expect": 133.33333333333334 + }, + { + "split": "heldout", + "kind": "solar", + "valid": true, + "q": "Estimate daily energy from a 5 kW solar array with 5 peak sun hours.", + "expect": 25 + }, + { + "split": "heldout", + "kind": "solar_loss", + "valid": true, + "q": "Estimate kWh per day from 5 kW of solar at 5 peak sun hours with 10% losses.", + "expect": 22.5 + }, + { + "split": "heldout", + "kind": "swap", + "valid": true, + "q": "If a 75 W lamp gets swapped for a 11 W LED running 8 hours a day, what is the yearly energy saving?", + "expect": 186.88 + }, + { + "split": "heldout", + "kind": "energy", + "valid": true, + "q": "What is the energy use (kWh) of a 500 W laptop left on 24 hours?", + "expect": 12.0 + }, + { + "split": "heldout", + "kind": "cost", + "valid": true, + "q": "With power at $0.25 per kWh, how much to run a 500 W laptop for 24 hours (cost)?", + "expect": 3.0 + }, + { + "split": "heldout", + "kind": "cost_c", + "valid": true, + "q": "At 22 cents per kWh, what does 24 hours of a 500 W laptop cost?", + "expect": 2.64 + }, + { + "split": "heldout", + "kind": "runtime", + "valid": true, + "q": "How long will a 500 W laptop last on a 256 Wh battery?", + "expect": 0.512 + }, + { + "split": "heldout", + "kind": "runtime_ah", + "valid": true, + "q": "A 500 W laptop on a 12 V 50 Ah battery: how long will it last?", + "expect": 1.2 + }, + { + "split": "heldout", + "kind": "solar", + "valid": true, + "q": "Estimate daily energy from a 8 kW solar array with 3.5 peak sun hours.", + "expect": 28.0 + }, + { + "split": "heldout", + "kind": "solar_loss", + "valid": true, + "q": "Estimate kWh per day from 8 kW of solar at 3.5 peak sun hours with 10% losses.", + "expect": 25.2 + }, + { + "split": "heldout", + "kind": "swap", + "valid": true, + "q": "If a 75 W lamp gets swapped for a 11 W LED running 4 hours a day, what is the yearly energy saving?", + "expect": 93.44 + }, + { + "split": "heldout", + "kind": "energy", + "valid": true, + "q": "What is the energy use (kWh) of a 60 W pump left on 2 hours?", + "expect": 0.12 + }, + { + "split": "heldout", + "kind": "cost", + "valid": true, + "q": "With power at $0.12 per kWh, how much to run a 60 W pump for 2 hours (cost)?", + "expect": 0.0144 + }, + { + "split": "heldout", + "kind": "cost_c", + "valid": true, + "q": "At 17 cents per kWh, what does 2 hours of a 60 W pump cost?", + "expect": 0.0204 + }, + { + "split": "heldout", + "kind": "runtime", + "valid": true, + "q": "How long will a 60 W pump last on a 500 Wh battery?", + "expect": 8.333333333333334 + }, + { + "split": "heldout", + "kind": "runtime_ah", + "valid": true, + "q": "A 60 W pump on a 48 V 100 Ah battery: how long will it last?", + "expect": 80.0 + }, + { + "split": "heldout", + "kind": "solar", + "valid": true, + "q": "Estimate daily energy from a 10 kW solar array with 6 peak sun hours.", + "expect": 60 + }, + { + "split": "heldout", + "kind": "solar_loss", + "valid": true, + "q": "Estimate kWh per day from 10 kW of solar at 6 peak sun hours with 20% losses.", + "expect": 48.0 + }, + { + "split": "heldout", + "kind": "payback", + "valid": true, + "q": "Upgrade cost: $8000. It saves $1500 a year. What's the payback?", + "expect": 5.333333333333333 + }, + { + "split": "heldout", + "kind": "swap", + "valid": true, + "q": "If a 60 W lamp gets swapped for a 9 W LED running 5 hours a day, what is the yearly energy saving?", + "expect": 93.075 + }, + { + "split": "heldout", + "kind": "energy", + "valid": true, + "q": "What is the energy use (kWh) of a 1500 W fan left on 3 hours?", + "expect": 4.5 + }, + { + "split": "heldout", + "kind": "cost", + "valid": true, + "q": "With power at $0.15 per kWh, how much to run a 1500 W fan for 3 hours (cost)?", + "expect": 0.6749999999999999 + }, + { + "split": "heldout", + "kind": "cost_c", + "valid": true, + "q": "At 11 cents per kWh, what does 3 hours of a 1500 W fan cost?", + "expect": 0.495 + }, + { + "split": "heldout", + "kind": "runtime", + "valid": true, + "q": "How long will a 1500 W fan last on a 256 Wh battery?", + "expect": 0.17066666666666666 + }, + { + "split": "heldout", + "kind": "runtime_ah", + "valid": true, + "q": "A 1500 W fan on a 12 V 50 Ah battery: how long will it last?", + "expect": 0.4 + }, + { + "split": "heldout", + "kind": "swap", + "valid": true, + "q": "If a 75 W lamp gets swapped for a 11 W LED running 3 hours a day, what is the yearly energy saving?", + "expect": 70.08 + }, + { + "split": "heldout", + "kind": "energy", + "valid": true, + "q": "What is the energy use (kWh) of a 500 W fan left on 2 hours?", + "expect": 1.0 + }, + { + "split": "heldout", + "kind": "cost", + "valid": true, + "q": "With power at $0.25 per kWh, how much to run a 500 W fan for 2 hours (cost)?", + "expect": 0.25 + }, + { + "split": "heldout", + "kind": "cost_c", + "valid": true, + "q": "At 14 cents per kWh, what does 2 hours of a 500 W fan cost?", + "expect": 0.14 + }, + { + "split": "heldout", + "kind": "runtime", + "valid": true, + "q": "How long will a 500 W fan last on a 50 Wh battery?", + "expect": 0.1 + }, + { + "split": "heldout", + "kind": "runtime_ah", + "valid": true, + "q": "A 500 W fan on a 24 V 200 Ah battery: how long will it last?", + "expect": 9.6 + }, + { + "split": "heldout", + "kind": "solar", + "valid": true, + "q": "Estimate daily energy from a 8 kW solar array with 5 peak sun hours.", + "expect": 40 + }, + { + "split": "heldout", + "kind": "solar_loss", + "valid": true, + "q": "Estimate kWh per day from 8 kW of solar at 5 peak sun hours with 14% losses.", + "expect": 34.4 + }, + { + "split": "heldout", + "kind": "payback", + "valid": true, + "q": "Upgrade cost: $18500. It saves $900 a year. What's the payback?", + "expect": 20.555555555555557 + }, + { + "split": "heldout", + "kind": "swap", + "valid": true, + "q": "If a 75 W lamp gets swapped for a 11 W LED running 6 hours a day, what is the yearly energy saving?", + "expect": 140.16 + }, + { + "split": "heldout", + "kind": "energy", + "valid": true, + "q": "What is the energy use (kWh) of a 1500 W fridge left on 24 hours?", + "expect": 36.0 + }, + { + "split": "heldout", + "kind": "cost", + "valid": true, + "q": "With power at $0.18 per kWh, how much to run a 1500 W fridge for 24 hours (cost)?", + "expect": 6.4799999999999995 + }, + { + "split": "heldout", + "kind": "cost_c", + "valid": true, + "q": "At 17 cents per kWh, what does 24 hours of a 1500 W fridge cost?", + "expect": 6.12 + }, + { + "split": "heldout", + "kind": "runtime", + "valid": true, + "q": "How long will a 1500 W fridge last on a 50 Wh battery?", + "expect": 0.03333333333333333 + }, + { + "split": "heldout", + "kind": "runtime_ah", + "valid": true, + "q": "A 1500 W fridge on a 12 V 100 Ah battery: how long will it last?", + "expect": 0.8 + }, + { + "split": "heldout", + "kind": "solar", + "valid": true, + "q": "Estimate daily energy from a 10 kW solar array with 5 peak sun hours.", + "expect": 50 + }, + { + "split": "heldout", + "kind": "solar_loss", + "valid": true, + "q": "Estimate kWh per day from 10 kW of solar at 5 peak sun hours with 20% losses.", + "expect": 40.0 + }, + { + "split": "heldout", + "kind": "payback", + "valid": true, + "q": "Upgrade cost: $8000. It saves $1200 a year. What's the payback?", + "expect": 6.666666666666667 + }, + { + "split": "heldout", + "kind": "swap", + "valid": true, + "q": "If a 60 W lamp gets swapped for a 9 W LED running 6 hours a day, what is the yearly energy saving?", + "expect": 111.69 + }, + { + "split": "heldout", + "kind": "energy", + "valid": true, + "q": "What is the energy use (kWh) of a 100 W fan left on 10 hours?", + "expect": 1.0 + }, + { + "split": "heldout", + "kind": "cost", + "valid": true, + "q": "With power at $0.18 per kWh, how much to run a 100 W fan for 10 hours (cost)?", + "expect": 0.18 + }, + { + "split": "heldout", + "kind": "cost_c", + "valid": true, + "q": "At 17 cents per kWh, what does 10 hours of a 100 W fan cost?", + "expect": 0.17 + }, + { + "split": "heldout", + "kind": "runtime", + "valid": true, + "q": "How long will a 100 W fan last on a 100 Wh battery?", + "expect": 1.0 + }, + { + "split": "heldout", + "kind": "runtime_ah", + "valid": true, + "q": "A 100 W fan on a 12 V 50 Ah battery: how long will it last?", + "expect": 6.0 + }, + { + "split": "heldout", + "kind": "solar", + "valid": true, + "q": "Estimate daily energy from a 4.5 kW solar array with 4 peak sun hours.", + "expect": 18.0 + }, + { + "split": "heldout", + "kind": "solar_loss", + "valid": true, + "q": "Estimate kWh per day from 4.5 kW of solar at 4 peak sun hours with 10% losses.", + "expect": 16.2 + }, + { + "split": "heldout", + "kind": "payback", + "valid": true, + "q": "Upgrade cost: $15000. It saves $600 a year. What's the payback?", + "expect": 25.0 + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "A new furnace saves $650 a year. What's the payback?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "At 3 hours a day, what does a 900 W microwave cost to run?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "How long will a 100 W TV last on my battery?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "Estimate daily energy from a 7 kW solar array.", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/energy-v3/energy_scorer.py b/root/specialists/energy-v3/energy_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..e4e01f631e0a7e04516e2a897de080fb1f62e7ca --- /dev/null +++ b/root/specialists/energy-v3/energy_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""energy_scorer - the stated result in the REPLY TEXT must match the panel's own arithmetic: kWh after "uses" / +"makes about" / "saves", dollars after "costs about $", hours after "is about", years after "is". Tolerance 0.5%, or one +cent (one dollar once amounts are shown whole). A must-decline item answered is a false yes. (ok, asserted).""" +import re + +PAT = {"energy": r"\buses ([\d,]+(?:\.\d+)?) kWh", "cost": r"\bcosts about \$([\d,]+(?:\.\d+)?)", "cost_c": r"\bcosts about \$([\d,]+(?:\.\d+)?)", + "runtime": r"\bis about ([\d,]+(?:\.\d+)?) hours", "runtime_ah": r"\bis about ([\d,]+(?:\.\d+)?) hours", + "solar": r"\bmakes about ([\d,]+(?:\.\d+)?) kWh", "solar_loss": r"\bmakes about ([\d,]+(?:\.\d+)?) kWh", + "payback": r"\bis ([\d,]+(?:\.\d+)?) years", "swap": r"\bsaves ([\d,]+(?:\.\d+)?) kWh"} + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + m = re.search(PAT[p["kind"]], text) + if not m: + return False, True + got, want = float(m.group(1).replace(",", "")), float(p["expect"]) + tol = max(0.005 * abs(want), 0.01 if want < 1000 else 1.0) + return abs(got - want) <= tol, True diff --git a/root/specialists/energy-v3/manifest.json b/root/specialists/energy-v3/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..ba5cf7639d42b968ce06010e980afa55288179f2 --- /dev/null +++ b/root/specialists/energy-v3/manifest.json @@ -0,0 +1,68 @@ +{ + "id": "energy-v3", + "name": "Oracle7 Home Energy & Solar v3", + "number": 5, + "tier": "B", + "sources": [ + { + "name": "Energy arithmetic (kWh = W x h / 1000; Wh = V x Ah; PV yield = kW x peak sun hours x derate) as in DOE Energy Saver and NREL PVWatts documentation", + "licence": "public domain (US government)", + "url": "https://www.energy.gov/energysaver/estimating-appliance-and-home-electronic-energy-use" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/energy-v3/organ_energy_v3.py" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/energy-v3", + "module": "organ_energy_v3", + "class": "EnergyOrganV3", + "init": {} + }, + "accept": { + "kinds": [ + "payback", + "never", + "runtime", + "solar_yield", + "swap_saving", + "cost", + "energy" + ], + "declines_in_domain": [ + "underspecified", + "need_tariff", + "impossible" + ], + "context_regex": "\\b(?:kwh|watts?|kw|battery|solar|payback|energy|electricity|power bank|tariff|bill)\\b" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/energy-v3/energy_panel_v3.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "energy_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [ + "how much energy", + "cost to run", + "per kWh", + "battery run", + "peak sun hours", + "payback", + "replace a bulb" + ], + "budgets": { + "latency_p50_ms": 50, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20260928 + }, + "notes": "v3 = v2 + passive swap ('X W bulb is replaced by a Y W LED') + asked-quantity rule (a SAVING question is never answered with what is used). Judged under spec_gate_v3 (wrong-answer cap) on a FRESH panel v3. Same author - disclosed. v2 = v1 + payback roles from grammar (saving = the amount attached to save; cost = a DIFFERENT amount; no cost -> decline) - v1's held-out answered 'A heat pump saves $900 a year. How long is the payback?' with 1 year ($900/$900) and was NEGATIVE; + 'costs' read as 'cost'. Judged under spec_gate_v2 on a FRESH panel v2 (saving stated before cost in half the payback items). Same author - disclosed. Never assumes a tariff, price or sun-hours it was not given (a cost with no tariff gives the kWh and asks for the price). Losses stated: solar 'before losses' unless given; battery runtime before inverter and depth-of-discharge losses. Full-core pre-check: 0 of 3107 items taken. Dev fixes before hel", + "supersedes": "energy-v2 (ADMIT gate v2, 66/74, but 8 misses CONFIDENT WRONG: passive swap answered with energy used)" +} \ No newline at end of file diff --git a/root/specialists/energy-v3/organ_energy_v1.py b/root/specialists/energy-v3/organ_energy_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..ed0cca53da9b7c2db0185e8ed987ec1b3666da38 --- /dev/null +++ b/root/specialists/energy-v3/organ_energy_v1.py @@ -0,0 +1,159 @@ +#!/usr/bin/env python3 +"""organ_energy_v1 - household energy arithmetic, every step shown: energy used by a device (W x h -> kWh), what it costs +at a stated tariff, how long a battery runs a load (Wh, or V x Ah), a solar array's daily yield (kW x peak-sun-hours, +x a stated derate, otherwise said to be before losses), a payback period, and the yearly saving from swapping one +device for another. It never assumes a tariff, a price or sun-hours it was not given. Returns {kind, status, response, value}.""" +from __future__ import annotations + +import re + +N = r"(\d+(?:,\d{3})*(?:\.\d+)?)" + + +def num(s): + return float(s.replace(",", "")) + + +def g(x): + return ("%.4g" % x) if abs(x) < 1e6 else ("%.0f" % x) + + +def watts(low): + m = re.search(N + r"\s*(kw|kilowatts?|w|watts?)\b(?!\s*h\b)", low) + if not m: + return None + return num(m.group(1)) * (1000 if m.group(2).startswith("k") else 1) + + +def hours(low): + """total hours: 'for 5 hours', '3 hours a day for 30 days', '8 hours per day ... a year'""" + m = re.search(N + r"\s*(?:hours?|hrs?|h)\s*(?:a|per|each)\s*day\b", low) + if m: + h = num(m.group(1)) + d = re.search(N + r"\s*days?\b", low) + if d: + return h * num(d.group(1)), "%s h/day × %s days" % (g(h), g(num(d.group(1)))) + if re.search(r"\b(?:a|per|each|in a|for a|over a)\s+year\b|\bannual|\byearly\b", low): + return h * 365, "%s h/day × 365 days" % g(h) + if re.search(r"\b(?:a|per|each|in a|for a|over a)\s+month\b|\bmonthly\b", low): + return h * 30, "%s h/day × 30 days" % g(h) + return h, "%s h (one day)" % g(h) + m = re.search(r"\bfor\s+" + N + r"\s*(?:hours?|hrs?|h)\b", low) or re.search(N + r"\s*(?:hours?|hrs?)\b", low) + if m: + return num(m.group(1)), "%s h" % g(num(m.group(1))) + m = re.search(N + r"\s*minutes?\b", low) + if m: + return num(m.group(1)) / 60, "%s min" % g(num(m.group(1))) + return None + + +def tariff(low): + """$ per kWh from '$0.15 per kWh', '15 cents per kWh', '0.15 $/kWh'""" + m = re.search(r"\$\s*" + N + r"\s*(?:per|/|a|an)\s*kwh\b", low) or re.search(N + r"\s*(?:\$|dollars?)\s*(?:per|/|a)\s*kwh\b", low) + if m: + return num(m.group(1)) + m = re.search(N + r"\s*(?:cents?|c|¢)\s*(?:per|/|a|an)\s*kwh\b", low) + return num(m.group(1)) / 100 if m else None + + +def money(x): + return "$%.2f" % x if x < 1000 else "$%s" % format(round(x), ",") + + +class EnergyOrgan: + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def _need(self, what): + return self._say("underspecified", "I need %s to work that out; I won't assume it." % what, status="withheld") + + def answer(self, text, session_id="default"): + t = " ".join(str(text or "").split()) + low = t.lower() + # payback + if re.search(r"\bpayback|\bpay (?:for )?itself|\bbreak even\b|\bpay back\b", low): + cost = re.search(r"\$\s*" + N + r"(?:\s*(k))?", low) + save = re.search(r"\bsav\w*\s+(?:about\s+)?\$\s*" + N + r"\s*(?:a|per|each)\s*(year|month)", low) or re.search(r"\$\s*" + N + r"\s*(?:a|per|each)\s*(year|month)\s*(?:in\s+)?sav", low) + if not cost or not save: + return self._need("the up-front cost and the saving per year (or month)") + c = num(cost.group(1)) * (1000 if cost.group(2) else 1) + s = num(save.group(1)) * (12 if save.group(2) == "month" else 1) + if s <= 0: + return self._say("never", "With no saving, it never pays back.", None) + y = c / s + return self._say("payback", "The payback period is %s years (%s ÷ %s saved per year), ignoring price changes and financing." % (g(y), money(c), money(s)), y) + # battery runtime + if re.search(r"\bbattery|\bpower bank\b|\bups\b", low) and re.search(r"\bhow long\b|\bruntime\b|\brun time\b|\blast\b", low): + wh = re.search(N + r"\s*(kwh|wh)\b", low) + ah = re.search(N + r"\s*ah\b", low) + v = re.search(N + r"\s*v(?:olts?)?\b", low) + load = re.search(r"\b(?:a|an|the)?\s*" + N + r"\s*(w|watts?)\b(?!\s*h\b)\s*(?:device|load|appliance|fridge|light|laptop|lamp|fan|tv|router|pump|heater)?", low) + if wh: + cap = num(wh.group(1)) * (1000 if wh.group(2) == "kwh" else 1) + capnote = "%s Wh" % g(cap) + elif ah and v: + cap = num(ah.group(1)) * num(v.group(1)) + capnote = "%s V × %s Ah = %s Wh" % (g(num(v.group(1))), g(num(ah.group(1))), g(cap)) + else: + return self._need("the battery's capacity (Wh, or volts and amp-hours)") + if not load: + return self._need("the load in watts") + w = num(load.group(1)) + if w <= 0: + return self._say("impossible", "A load must draw more than 0 W.", status="withheld") + hrs = cap / w + return self._say("runtime", "The runtime is about %s hours (%s ÷ %s W), before inverter and depth-of-discharge losses." % (g(hrs), capnote, g(w)), hrs) + # solar daily yield + if re.search(r"\bsolar\b|\bpv\b|\bpanels?\b", low) and re.search(r"\bsun ?hours?\b|\bpeak sun\b|\bsunlight hours?\b", low): + k = re.search(N + r"\s*(kw|kilowatts?|w|watts?)\b(?!\s*h\b)", low) + sh = re.search(N + r"\s*(?:peak\s+)?(?:sun|sunlight)[ -]?hours?\b", low) or re.search(r"\b(?:peak\s+)?sun[ -]?hours?\s*(?:of|is|=)?\s*" + N, low) + if not k or not sh: + return self._need("the array size (kW) and the peak sun hours") + kw = num(k.group(1)) / (1 if k.group(2).startswith("k") else 1000) + n_panels = re.search(N + r"\s*(?:x\s*)?panels?\b", low) + if n_panels and not k.group(2).startswith("k"): + kw *= num(n_panels.group(1)) + h = num(sh.group(1)) + der = re.search(N + r"\s*%\s*(?:system\s+)?(?:losses|loss)\b", low) + eff = re.search(r"\b(?:derate|efficiency|performance ratio)\s*(?:of|is|=)?\s*" + N + r"\s*(%?)", low) + kwh = kw * h + note = "before losses" + if der: + kwh *= 1 - num(der.group(1)) / 100 + note = "after %s%% losses" % g(num(der.group(1))) + elif eff: + f = num(eff.group(1)) / (100 if eff.group(2) or num(eff.group(1)) > 1 else 1) + kwh *= f + note = "at a %s derate" % g(f) + per = " a day" + if re.search(r"\b(?:a|per|each|in a)\s+year\b|\bannual|\byearly\b", low): + kwh *= 365; per = " a year (365 days)" + elif re.search(r"\b(?:a|per|each|in a)\s+month\b|\bmonthly\b", low): + kwh *= 30; per = " a month (30 days)" + return self._say("solar_yield", "The array makes about %s kWh%s (%s kW × %s peak sun hours, %s)." % (g(kwh), per, g(kw), g(h), note), kwh) + # swap saving: "replace a 60 W bulb with a 9 W LED, 5 hours a day" + m = re.search(r"\b(?:replac\w*|swap\w*|switch\w*)\b.*?" + N + r"\s*(?:w|watts?)\b.*?\b(?:with|for|to)\b.*?" + N + r"\s*(?:w|watts?)\b", low) + if m: + a, b = num(m.group(1)), num(m.group(2)) + h = hours(low[m.end():] + " " + low[:m.start()]) + if not h: + return self._need("how many hours it runs") + kwh = (a - b) * h[0] / 1000 + rate = tariff(low) + if rate is None: + return self._say("swap_saving", "That saves %s kWh (%s W less × %s)." % (g(kwh), g(a - b), h[1]), kwh) + return self._say("swap_saving", "That saves %s kWh, about %s at %s/kWh (%s W less × %s)." % (g(kwh), money(kwh * rate), "$%g" % rate, g(a - b), h[1]), kwh * rate) + # device energy / cost + if re.search(r"\bhow much (?:energy|electricity|power)\b|\bkwh\b|\bhow much (?:does|will|would) it cost\b|\bcost to run\b|\bhow much .* cost\b|\benergy (?:use|usage|consumption)\b", low): + w = watts(low) + h = hours(low) + if w is None or h is None: + return None if not re.search(r"\bkwh\b|\bwatts?\b|\bkw\b", low) else self._need("the device's wattage and how long it runs") + kwh = w * h[0] / 1000 + rate = tariff(low) + if re.search(r"\bcost\b|\bprice\b|\bbill\b|\bspend\b|\bhow much money\b", low): + if rate is None: + return self._say("need_tariff", "It uses %s kWh (%s W × %s); give me your price per kWh and I'll price it." % (g(kwh), g(w), h[1]), status="withheld") + return self._say("cost", "It costs about %s (%s kWh = %s W × %s, at %s/kWh)." % (money(kwh * rate), g(kwh), g(w), h[1], "$%g" % rate), kwh * rate) + return self._say("energy", "It uses %s kWh (%s W × %s = %s Wh)." % (g(kwh), g(w), h[1], g(w * h[0])), kwh) + return None diff --git a/root/specialists/energy-v3/organ_energy_v2.py b/root/specialists/energy-v3/organ_energy_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c46bee6b9961dfbbef8815f31c2755dc473ee504 --- /dev/null +++ b/root/specialists/energy-v3/organ_energy_v2.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +"""organ_energy_v2 - organ_energy_v1 (NEGATIVE under gate v2 on 2026-09-29: domain false yes 1 > 0) with payback roles +from grammar: "A heat pump saves $900 a year. How long is the payback?" was answered "1 years ($900 / $900)" - v1 took +the FIRST dollar amount as the cost, and the only amount was the saving (CONFIDENT WRONG on a must-decline item). v2: the +saving is the amount attached to save/saving; the cost is a DIFFERENT dollar amount; with no cost stated, it declines. +Everything else v1.""" +from __future__ import annotations + +import re + +from organ_energy_v1 import N, EnergyOrgan, g, money, num + + +class EnergyOrganV2(EnergyOrgan): + def answer(self, text, session_id="default"): + t = " ".join(str(text or "").split()) + low = t.lower() + if re.search(r"\bpayback|\bpay (?:for )?itself|\bbreak even\b|\bpay back\b", low): + save = (re.search(r"\bsav\w*\s+(?:about\s+|me\s+|us\s+)?\$\s*" + N + r"\s*(?:a|per|each)\s*(year|month)", low) + or re.search(r"\$\s*" + N + r"\s*(?:a|per|each)\s*(year|month)\s*(?:in\s+)?sav", low)) + costs = [m for m in re.finditer(r"\$\s*" + N + r"(?:\s*(k))?", low) if not save or not (save.start() <= m.start() < save.end())] + if not save or not costs: + return self._need("the up-front cost and the saving per year (or month)") + c = num(costs[0].group(1)) * (1000 if costs[0].group(2) else 1) + s = num(save.group(1)) * (12 if save.group(2) == "month" else 1) + if s <= 0: + return self._say("never", "With no saving, it never pays back.", None) + y = c / s + return self._say("payback", "The payback period is %s years (%s ÷ %s saved per year), ignoring price changes and financing." % (g(y), money(c), money(s)), y) + # "... costs how much?" - v1's cost cue was the bare word "cost" (fresh dev panel) + return super().answer(re.sub(r"\bcosts\b", "cost", t, flags=re.I), session_id) diff --git a/root/specialists/energy-v3/organ_energy_v3.py b/root/specialists/energy-v3/organ_energy_v3.py new file mode 100644 index 0000000000000000000000000000000000000000..b111bd027f9b81a9a51033bfaef97ad1d7dcb778 --- /dev/null +++ b/root/specialists/energy-v3/organ_energy_v3.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +"""organ_energy_v3 - organ_energy_v2 (ADMIT under gate v2, held-out 66/74) with the two defects its held-out exposed, both +CONFIDENT WRONG: "A 75 W bulb is replaced by a 11 W LED, lit 6 hours a day. How much energy is saved in a year?" was +answered "It uses 164.2 kWh" - (1) the PASSIVE swap ("is replaced by") was not read as a swap, and (2) the organ then +answered a different quantity than the one asked. v3 reads the passive swap, and never answers what is USED (energy, +cost) when the question asks what is SAVED - it says nothing instead. Everything else v2.""" +from __future__ import annotations + +import re + +from organ_energy_v2 import EnergyOrganV2 + +PASSIVE = re.compile(r"\b(?:an?\s+|the\s+)?(\d+(?:\.\d+)?)\s*(w|watts?)\s+([a-z]+(?:\s[a-z]+)?)\s+(?:is|was|gets|being|are)?\s*(?:replaced|swapped)\s+(?:by|with|for)\s+(?:an?\s+|the\s+)?(\d+(?:\.\d+)?)\s*(w|watts?)\b", re.I) + + +class EnergyOrganV3(EnergyOrganV2): + def answer(self, text, session_id="default"): + t = " ".join(str(text or "").split()) + t = PASSIVE.sub(lambda m: "replace a %s W %s with a %s W" % (m.group(1), m.group(3), m.group(4)), t) + r = super().answer(t, session_id) + # the asked quantity decides the answer: a SAVING question is never answered with what is used + if r and r.get("kind") in ("energy", "cost") and re.search(r"\bsav(?:e|ed|es|ing|ings)\b", t, re.I): + return None + return r diff --git a/root/specialists/energy-v3/verdict_dev.json b/root/specialists/energy-v3/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..44e42c915ec6d829742c12fe31790d0b69dab23a --- /dev/null +++ b/root/specialists/energy-v3/verdict_dev.json @@ -0,0 +1,120 @@ +{ + "id": "energy-v3", + "name": "Oracle7 Home Energy & Solar v3", + "tier": "B", + "split": "dev", + "head": "oracle_release_runtime_w502", + "time": "2026-09-29T05:36:01Z", + "domain": { + "head": { + "correct": 3, + "false_yes": 1, + "wrong": 0, + "n": 74, + "p50_ms": 32.32, + "fails": [ + [ + "energy", + "A 60 W fan is on for 8 hours. How much energy does it use in kWh?", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ], + [ + "cost", + "At $0.25 per kWh, what does it cost to run a 60 W fan for 8 hours?", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ], + [ + "cost_c", + "Running a 60 W fan for 8 hours at 30 cents per kWh costs how much?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "runtime", + "My 256 Wh battery powers a 60 W fan. How long will it last?", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ], + [ + "runtime_ah", + "How long can a 24 V 200 Ah battery run a 60 W fan?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "solar", + "My 6.6 kW panels get 6 peak sun hours. How much energy per day do they", + "act:clarify_specific", + "What does \"they\" refer to? Nothing earlier in this conversation names it. Tell me the name" + ], + [ + "solar_loss", + "6.6 kW of solar, 6 peak sun hours, 14% losses: how much energy per day", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "payback", + "It saves $1500 a year and costs $8000 up front. What is the payback pe", + "act:clarify_specific", + "What does \"It\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ] + ] + }, + "spec": { + "correct": 73, + "false_yes": 1, + "wrong": 0, + "n": 74, + "p50_ms": 0.03, + "fails": [ + [ + "decline", + "What does it cost to run a 1200 W heater for 4 hours?", + "arb:definitional->document_runtime", + "[ev:unknown] Four is defined as the cardinal number that is the sum of three and one [W1]." + ] + ] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/energy-v3/verdict_heldout.json b/root/specialists/energy-v3/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..f49567b59af9abadeaf6918eafcf21153ec0da93 --- /dev/null +++ b/root/specialists/energy-v3/verdict_heldout.json @@ -0,0 +1,120 @@ +{ + "id": "energy-v3", + "name": "Oracle7 Home Energy & Solar v3", + "tier": "B", + "split": "heldout", + "head": "oracle_release_runtime_w502", + "time": "2026-09-29T05:39:59Z", + "domain": { + "head": { + "correct": 3, + "false_yes": 1, + "wrong": 15, + "n": 70, + "p50_ms": 43.86, + "fails": [ + [ + "energy", + "What is the energy use (kWh) of a 500 W TV left on 4 hours?", + "organ:math>evaluate", + "[ev:derived] W*h*k. In steps: read W*h*k; then simplify. Checked: equivalent to the input " + ], + [ + "cost", + "With power at $0.25 per kWh, how much to run a 500 W TV for 4 hours (c", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "cost_c", + "At 22 cents per kWh, what does 4 hours of a 500 W TV cost?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "runtime", + "How long will a 500 W TV last on a 50 Wh battery?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "runtime_ah", + "A 500 W TV on a 24 V 200 Ah battery: how long will it last?", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ], + [ + "solar", + "Estimate daily energy from a 5 kW solar array with 4.5 peak sun hours.", + "organ:converse>statement", + "Got it. Since you mention array: ARRAY is an independent distribution company launched by " + ], + [ + "solar_loss", + "Estimate kWh per day from 5 kW of solar at 4.5 peak sun hours with 14%", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "payback", + "Upgrade cost: $15000. It saves $1200 a year. What's the payback?", + "act:clarify_specific", + "What does \"It\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ] + ] + }, + "spec": { + "correct": 69, + "false_yes": 1, + "wrong": 0, + "n": 70, + "p50_ms": 0.03, + "fails": [ + [ + "decline", + "Estimate daily energy from a 7 kW solar array.", + "organ:converse>statement", + "Got it. Since you mention array: ARRAY is an independent distribution company launched by " + ] + ] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/finance-v2-r2/finance_panel_v1.json b/root/specialists/finance-v2-r2/finance_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..cdd4fc38d01965ce8f818d01f86025a71b88ff61 --- /dev/null +++ b/root/specialists/finance-v2-r2/finance_panel_v1.json @@ -0,0 +1,905 @@ +[ + { + "split": "dev", + "kind": "compound", + "valid": true, + "q": "If I invest $10,000 at 4% compounded quarterly for 10 years, how much will I have?", + "expect": 14888.637335882213 + }, + { + "split": "dev", + "kind": "cont", + "valid": true, + "q": "What does $10,000 grow to at 4% compounded continuously for 10 years?", + "expect": 14918.246976412704 + }, + { + "split": "dev", + "kind": "loan", + "valid": true, + "q": "What is the monthly payment on a $10,000 loan at 4% for 10 years?", + "expect": 101.24513816487958 + }, + { + "split": "dev", + "kind": "interest", + "valid": true, + "q": "How much interest do I pay in total on a $10,000 loan at 4% for 10 years?", + "expect": 2149.4165797855494 + }, + { + "split": "dev", + "kind": "apy", + "valid": true, + "q": "What is the APY of a 4% APR compounded quarterly?", + "expect": 4.060401000000002 + }, + { + "split": "dev", + "kind": "goal", + "valid": true, + "q": "How much should I save each month to reach $50,000 in 10 years at 4%?", + "expect": 339.55902415773124 + }, + { + "split": "dev", + "kind": "simple", + "valid": true, + "q": "What is the simple interest on $10,000 at 4% for 10 years?", + "expect": 4000.0 + }, + { + "split": "dev", + "kind": "double", + "valid": true, + "q": "How long does it take money to double at 4%?", + "expect": 17.672987685129698 + }, + { + "split": "dev", + "kind": "compound", + "valid": true, + "q": "If I invest $10,000 at 6.5% compounded monthly for 15 years, how much will I have?", + "expect": 26442.008195043076 + }, + { + "split": "dev", + "kind": "cont", + "valid": true, + "q": "What does $10,000 grow to at 6.5% compounded continuously for 15 years?", + "expect": 26511.67210982607 + }, + { + "split": "dev", + "kind": "loan", + "valid": true, + "q": "What is the monthly payment on a $10,000 loan at 6.5% for 15 years?", + "expect": 87.11073652973656 + }, + { + "split": "dev", + "kind": "interest", + "valid": true, + "q": "How much interest do I pay in total on a $10,000 loan at 6.5% for 15 years?", + "expect": 5679.932575352581 + }, + { + "split": "dev", + "kind": "apy", + "valid": true, + "q": "What is the APY of a 6.5% APR compounded monthly?", + "expect": 6.69718520025433 + }, + { + "split": "dev", + "kind": "goal", + "valid": true, + "q": "How much should I save each month to reach $50,000 in 15 years at 6.5%?", + "expect": 164.7203493153494 + }, + { + "split": "dev", + "kind": "simple", + "valid": true, + "q": "What is the simple interest on $10,000 at 6.5% for 15 years?", + "expect": 9750.0 + }, + { + "split": "dev", + "kind": "double", + "valid": true, + "q": "How long does it take money to double at 6.5%?", + "expect": 11.006739041494765 + }, + { + "split": "dev", + "kind": "compound", + "valid": true, + "q": "If I invest $2,500 at 2% compounded daily for 20 years, how much will I have?", + "expect": 3729.520873912555 + }, + { + "split": "dev", + "kind": "cont", + "valid": true, + "q": "What does $2,500 grow to at 2% compounded continuously for 20 years?", + "expect": 3729.561744103176 + }, + { + "split": "dev", + "kind": "loan", + "valid": true, + "q": "What is the monthly payment on a $2,500 loan at 2% for 20 years?", + "expect": 12.647083376127693 + }, + { + "split": "dev", + "kind": "interest", + "valid": true, + "q": "How much interest do I pay in total on a $2,500 loan at 2% for 20 years?", + "expect": 535.3000102706465 + }, + { + "split": "dev", + "kind": "apy", + "valid": true, + "q": "What is the APY of a 2% APR compounded daily?", + "expect": 2.0200781032923 + }, + { + "split": "dev", + "kind": "goal", + "valid": true, + "q": "How much should I save each month to reach $25,000 in 20 years at 2%?", + "expect": 84.80416709461025 + }, + { + "split": "dev", + "kind": "simple", + "valid": true, + "q": "What is the simple interest on $2,500 at 2% for 20 years?", + "expect": 1000.0 + }, + { + "split": "dev", + "kind": "double", + "valid": true, + "q": "How long does it take money to double at 2%?", + "expect": 35.0027887811465 + }, + { + "split": "dev", + "kind": "compound", + "valid": true, + "q": "If I invest $2,500 at 7% compounded annually for 15 years, how much will I have?", + "expect": 6897.578851788341 + }, + { + "split": "dev", + "kind": "cont", + "valid": true, + "q": "What does $2,500 grow to at 7% compounded continuously for 15 years?", + "expect": 7144.1277951579095 + }, + { + "split": "dev", + "kind": "loan", + "valid": true, + "q": "What is the monthly payment on a $2,500 loan at 7% for 15 years?", + "expect": 22.47070677131062 + }, + { + "split": "dev", + "kind": "interest", + "valid": true, + "q": "How much interest do I pay in total on a $2,500 loan at 7% for 15 years?", + "expect": 1544.7272188359116 + }, + { + "split": "dev", + "kind": "apy", + "valid": true, + "q": "What is the APY of a 7% APR compounded annually?", + "expect": 7.000000000000006 + }, + { + "split": "dev", + "kind": "goal", + "valid": true, + "q": "How much should I save each month to reach $25,000 in 15 years at 7%?", + "expect": 78.87373437977288 + }, + { + "split": "dev", + "kind": "simple", + "valid": true, + "q": "What is the simple interest on $2,500 at 7% for 15 years?", + "expect": 2625.0 + }, + { + "split": "dev", + "kind": "double", + "valid": true, + "q": "How long does it take money to double at 7%?", + "expect": 10.244768351058712 + }, + { + "split": "dev", + "kind": "compound", + "valid": true, + "q": "If I invest $1,000 at 3.5% compounded quarterly for 20 years, how much will I have?", + "expect": 2007.6306550073627 + }, + { + "split": "dev", + "kind": "cont", + "valid": true, + "q": "What does $1,000 grow to at 3.5% compounded continuously for 20 years?", + "expect": 2013.7527074704767 + }, + { + "split": "dev", + "kind": "loan", + "valid": true, + "q": "What is the monthly payment on a $1,000 loan at 3.5% for 20 years?", + "expect": 5.7995971798309185 + }, + { + "split": "dev", + "kind": "interest", + "valid": true, + "q": "How much interest do I pay in total on a $1,000 loan at 3.5% for 20 years?", + "expect": 391.9033231594203 + }, + { + "split": "dev", + "kind": "apy", + "valid": true, + "q": "What is the APY of a 3.5% APR compounded quarterly?", + "expect": 3.5462060549316554 + }, + { + "split": "dev", + "kind": "goal", + "valid": true, + "q": "How much should I save each month to reach $5,000 in 20 years at 3.5%?", + "expect": 14.414652565821253 + }, + { + "split": "dev", + "kind": "simple", + "valid": true, + "q": "What is the simple interest on $1,000 at 3.5% for 20 years?", + "expect": 700.0 + }, + { + "split": "dev", + "kind": "double", + "valid": true, + "q": "How long does it take money to double at 3.5%?", + "expect": 20.148791684000713 + }, + { + "split": "dev", + "kind": "compound", + "valid": true, + "q": "If I invest $2,500 at 7% compounded monthly for 10 years, how much will I have?", + "expect": 5024.153441739082 + }, + { + "split": "dev", + "kind": "cont", + "valid": true, + "q": "What does $2,500 grow to at 7% compounded continuously for 10 years?", + "expect": 5034.381768676191 + }, + { + "split": "dev", + "kind": "loan", + "valid": true, + "q": "What is the monthly payment on a $2,500 loan at 7% for 10 years?", + "expect": 29.02711980465594 + }, + { + "split": "dev", + "kind": "interest", + "valid": true, + "q": "How much interest do I pay in total on a $2,500 loan at 7% for 10 years?", + "expect": 983.2543765587125 + }, + { + "split": "dev", + "kind": "apy", + "valid": true, + "q": "What is the APY of a 7% APR compounded monthly?", + "expect": 7.229008085623589 + }, + { + "split": "dev", + "kind": "goal", + "valid": true, + "q": "How much should I save each month to reach $25,000 in 10 years at 7%?", + "expect": 144.43786471322602 + }, + { + "split": "dev", + "kind": "simple", + "valid": true, + "q": "What is the simple interest on $2,500 at 7% for 10 years?", + "expect": 1750.0 + }, + { + "split": "dev", + "kind": "compound", + "valid": true, + "q": "If I invest $20,000 at 3.5% compounded quarterly for 30 years, how much will I have?", + "expect": 56892.59236762816 + }, + { + "split": "dev", + "kind": "cont", + "valid": true, + "q": "What does $20,000 grow to at 3.5% compounded continuously for 30 years?", + "expect": 57153.022361263276 + }, + { + "split": "dev", + "kind": "loan", + "valid": true, + "q": "What is the monthly payment on a $20,000 loan at 3.5% for 30 years?", + "expect": 89.8089375617647 + }, + { + "split": "dev", + "kind": "interest", + "valid": true, + "q": "How much interest do I pay in total on a $20,000 loan at 3.5% for 30 years?", + "expect": 12331.217522235289 + }, + { + "split": "dev", + "kind": "goal", + "valid": true, + "q": "How much should I save each month to reach $50,000 in 30 years at 3.5%?", + "expect": 78.68901057107841 + }, + { + "split": "dev", + "kind": "simple", + "valid": true, + "q": "What is the simple interest on $20,000 at 3.5% for 30 years?", + "expect": 21000.0 + }, + { + "split": "dev", + "kind": "compound", + "valid": true, + "q": "If I invest $10,000 at 5% compounded quarterly for 3 years, how much will I have?", + "expect": 11607.54517722998 + }, + { + "split": "dev", + "kind": "cont", + "valid": true, + "q": "What does $10,000 grow to at 5% compounded continuously for 3 years?", + "expect": 11618.34242728283 + }, + { + "split": "dev", + "kind": "loan", + "valid": true, + "q": "What is the monthly payment on a $10,000 loan at 5% for 3 years?", + "expect": 299.7089710466557 + }, + { + "split": "dev", + "kind": "interest", + "valid": true, + "q": "How much interest do I pay in total on a $10,000 loan at 5% for 3 years?", + "expect": 789.5229576796046 + }, + { + "split": "dev", + "kind": "apy", + "valid": true, + "q": "What is the APY of a 5% APR compounded quarterly?", + "expect": 5.094533691406222 + }, + { + "split": "dev", + "kind": "goal", + "valid": true, + "q": "How much should I save each month to reach $5,000 in 3 years at 5%?", + "expect": 129.02115218999444 + }, + { + "split": "dev", + "kind": "simple", + "valid": true, + "q": "What is the simple interest on $10,000 at 5% for 3 years?", + "expect": 1500.0 + }, + { + "split": "dev", + "kind": "double", + "valid": true, + "q": "How long does it take money to double at 5%?", + "expect": 14.206699082890461 + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "Should I invest $10,000 in index funds at 7%?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "Which stock will double my savings fastest?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What is the monthly payment on a $20,000 loan?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "How much interest will I earn on my savings?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "compound", + "valid": true, + "q": "$250,000 is invested at 3.5% interest, compounded annually. What will it be worth after 15 years?", + "expect": 418837.2076880398 + }, + { + "split": "heldout", + "kind": "cont", + "valid": true, + "q": "With continuous compounding at 3.5%, what will $250,000 become in 15 years?", + "expect": 422614.71209477284 + }, + { + "split": "heldout", + "kind": "loan", + "valid": true, + "q": "I borrow $250,000 over 15 years at 3.5% APR. What is my monthly payment on the loan?", + "expect": 1787.2063533579328 + }, + { + "split": "heldout", + "kind": "interest", + "valid": true, + "q": "Over the life of a 15-year, $250,000 mortgage at 3.5%, how much interest is paid in total?", + "expect": 71697.14360442793 + }, + { + "split": "heldout", + "kind": "apy", + "valid": true, + "q": "Convert an APR of 3.5%, compounded annually, to the APY.", + "expect": 3.499999999999992 + }, + { + "split": "heldout", + "kind": "goal", + "valid": true, + "q": "To save up $10,000 over 15 years earning 3.5% a year, how much must I deposit per month?", + "expect": 42.32158746765062 + }, + { + "split": "heldout", + "kind": "simple", + "valid": true, + "q": "Find the simple interest on a principal of $250,000 at 3.5% per year over 15 years.", + "expect": 131250.0 + }, + { + "split": "heldout", + "kind": "double", + "valid": true, + "q": "At an annual return of 3.5%, how many years until an investment doubles?", + "expect": 20.148791684000713 + }, + { + "split": "heldout", + "kind": "compound", + "valid": true, + "q": "$250,000 is invested at 4% interest, compounded daily. What will it be worth after 3 years?", + "expect": 281872.3596168295 + }, + { + "split": "heldout", + "kind": "cont", + "valid": true, + "q": "With continuous compounding at 4%, what will $250,000 become in 3 years?", + "expect": 281874.21289484395 + }, + { + "split": "heldout", + "kind": "loan", + "valid": true, + "q": "I borrow $250,000 over 3 years at 4% APR. What is my monthly payment on the loan?", + "expect": 7380.996251710762 + }, + { + "split": "heldout", + "kind": "interest", + "valid": true, + "q": "Over the life of a 3-year, $250,000 mortgage at 4%, how much interest is paid in total?", + "expect": 15715.865061587421 + }, + { + "split": "heldout", + "kind": "apy", + "valid": true, + "q": "Convert an APR of 4%, compounded daily, to the APY.", + "expect": 4.080849313241641 + }, + { + "split": "heldout", + "kind": "goal", + "valid": true, + "q": "To save up $5,000 over 3 years earning 4% a year, how much must I deposit per month?", + "expect": 130.95325836754856 + }, + { + "split": "heldout", + "kind": "simple", + "valid": true, + "q": "Find the simple interest on a principal of $250,000 at 4% per year over 3 years.", + "expect": 30000.0 + }, + { + "split": "heldout", + "kind": "double", + "valid": true, + "q": "At an annual return of 4%, how many years until an investment doubles?", + "expect": 17.672987685129698 + }, + { + "split": "heldout", + "kind": "compound", + "valid": true, + "q": "$20,000 is invested at 2% interest, compounded quarterly. What will it be worth after 30 years?", + "expect": 36387.9346806458 + }, + { + "split": "heldout", + "kind": "cont", + "valid": true, + "q": "With continuous compounding at 2%, what will $20,000 become in 30 years?", + "expect": 36442.37600781018 + }, + { + "split": "heldout", + "kind": "loan", + "valid": true, + "q": "I borrow $20,000 over 30 years at 2% APR. What is my monthly payment on the loan?", + "expect": 73.92389453776288 + }, + { + "split": "heldout", + "kind": "interest", + "valid": true, + "q": "Over the life of a 30-year, $20,000 mortgage at 2%, how much interest is paid in total?", + "expect": 6612.602033594634 + }, + { + "split": "heldout", + "kind": "apy", + "valid": true, + "q": "Convert an APR of 2%, compounded quarterly, to the APY.", + "expect": 2.0150500624999568 + }, + { + "split": "heldout", + "kind": "goal", + "valid": true, + "q": "To save up $10,000 over 30 years earning 2% a year, how much must I deposit per month?", + "expect": 20.29528060221477 + }, + { + "split": "heldout", + "kind": "simple", + "valid": true, + "q": "Find the simple interest on a principal of $20,000 at 2% per year over 30 years.", + "expect": 12000.0 + }, + { + "split": "heldout", + "kind": "double", + "valid": true, + "q": "At an annual return of 2%, how many years until an investment doubles?", + "expect": 35.0027887811465 + }, + { + "split": "heldout", + "kind": "compound", + "valid": true, + "q": "$250,000 is invested at 8% interest, compounded daily. What will it be worth after 3 years?", + "expect": 317803.9300129359 + }, + { + "split": "heldout", + "kind": "cont", + "valid": true, + "q": "With continuous compounding at 8%, what will $250,000 become in 3 years?", + "expect": 317812.28758035117 + }, + { + "split": "heldout", + "kind": "loan", + "valid": true, + "q": "I borrow $250,000 over 3 years at 8% APR. What is my monthly payment on the loan?", + "expect": 7834.091365357783 + }, + { + "split": "heldout", + "kind": "interest", + "valid": true, + "q": "Over the life of a 3-year, $250,000 mortgage at 8%, how much interest is paid in total?", + "expect": 32027.2891528802 + }, + { + "split": "heldout", + "kind": "apy", + "valid": true, + "q": "Convert an APR of 8%, compounded daily, to the APY.", + "expect": 8.327757179283468 + }, + { + "split": "heldout", + "kind": "goal", + "valid": true, + "q": "To save up $10,000 over 3 years earning 8% a year, how much must I deposit per month?", + "expect": 246.69698794764457 + }, + { + "split": "heldout", + "kind": "simple", + "valid": true, + "q": "Find the simple interest on a principal of $250,000 at 8% per year over 3 years.", + "expect": 60000.0 + }, + { + "split": "heldout", + "kind": "double", + "valid": true, + "q": "At an annual return of 8%, how many years until an investment doubles?", + "expect": 9.006468342000588 + }, + { + "split": "heldout", + "kind": "compound", + "valid": true, + "q": "$2,500 is invested at 3.5% interest, compounded monthly. What will it be worth after 3 years?", + "expect": 2776.352189371381 + }, + { + "split": "heldout", + "kind": "cont", + "valid": true, + "q": "With continuous compounding at 3.5%, what will $2,500 become in 3 years?", + "expect": 2776.7765258892628 + }, + { + "split": "heldout", + "kind": "loan", + "valid": true, + "q": "I borrow $2,500 over 3 years at 3.5% APR. What is my monthly payment on the loan?", + "expect": 73.25519931727673 + }, + { + "split": "heldout", + "kind": "interest", + "valid": true, + "q": "Over the life of a 3-year, $2,500 mortgage at 3.5%, how much interest is paid in total?", + "expect": 137.18717542196237 + }, + { + "split": "heldout", + "kind": "apy", + "valid": true, + "q": "Convert an APR of 3.5%, compounded monthly, to the APY.", + "expect": 3.5566952945970565 + }, + { + "split": "heldout", + "kind": "goal", + "valid": true, + "q": "To save up $5,000 over 3 years earning 3.5% a year, how much must I deposit per month?", + "expect": 131.9270653012201 + }, + { + "split": "heldout", + "kind": "simple", + "valid": true, + "q": "Find the simple interest on a principal of $2,500 at 3.5% per year over 3 years.", + "expect": 262.5 + }, + { + "split": "heldout", + "kind": "compound", + "valid": true, + "q": "$2,500 is invested at 4% interest, compounded daily. What will it be worth after 15 years?", + "expect": 4555.147251187483 + }, + { + "split": "heldout", + "kind": "cont", + "valid": true, + "q": "With continuous compounding at 4%, what will $2,500 become in 15 years?", + "expect": 4555.297000976272 + }, + { + "split": "heldout", + "kind": "loan", + "valid": true, + "q": "I borrow $2,500 over 15 years at 4% APR. What is my monthly payment on the loan?", + "expect": 18.492198140231444 + }, + { + "split": "heldout", + "kind": "interest", + "valid": true, + "q": "Over the life of a 15-year, $2,500 mortgage at 4%, how much interest is paid in total?", + "expect": 828.5956652416598 + }, + { + "split": "heldout", + "kind": "goal", + "valid": true, + "q": "To save up $10,000 over 15 years earning 4% a year, how much must I deposit per month?", + "expect": 40.63545922759245 + }, + { + "split": "heldout", + "kind": "simple", + "valid": true, + "q": "Find the simple interest on a principal of $2,500 at 4% per year over 15 years.", + "expect": 1500.0 + }, + { + "split": "heldout", + "kind": "compound", + "valid": true, + "q": "$1,000 is invested at 5% interest, compounded daily. What will it be worth after 15 years?", + "expect": 2116.8912793345294 + }, + { + "split": "heldout", + "kind": "cont", + "valid": true, + "q": "With continuous compounding at 5%, what will $1,000 become in 15 years?", + "expect": 2117.0000166126747 + }, + { + "split": "heldout", + "kind": "loan", + "valid": true, + "q": "I borrow $1,000 over 15 years at 5% APR. What is my monthly payment on the loan?", + "expect": 7.907936267415464 + }, + { + "split": "heldout", + "kind": "interest", + "valid": true, + "q": "Over the life of a 15-year, $1,000 mortgage at 5%, how much interest is paid in total?", + "expect": 423.4285281347836 + }, + { + "split": "heldout", + "kind": "apy", + "valid": true, + "q": "Convert an APR of 5%, compounded daily, to the APY.", + "expect": 5.126749646744733 + }, + { + "split": "heldout", + "kind": "goal", + "valid": true, + "q": "To save up $25,000 over 15 years earning 5% a year, how much must I deposit per month?", + "expect": 93.53174001871994 + }, + { + "split": "heldout", + "kind": "simple", + "valid": true, + "q": "Find the simple interest on a principal of $1,000 at 5% per year over 15 years.", + "expect": 750.0 + }, + { + "split": "heldout", + "kind": "double", + "valid": true, + "q": "At an annual return of 5%, how many years until an investment doubles?", + "expect": 14.206699082890461 + }, + { + "split": "heldout", + "kind": "compound", + "valid": true, + "q": "$250,000 is invested at 2% interest, compounded annually. What will it be worth after 3 years?", + "expect": 265302.00000000006 + }, + { + "split": "heldout", + "kind": "cont", + "valid": true, + "q": "With continuous compounding at 2%, what will $250,000 become in 3 years?", + "expect": 265459.1366363399 + }, + { + "split": "heldout", + "kind": "loan", + "valid": true, + "q": "I borrow $250,000 over 3 years at 2% APR. What is my monthly payment on the loan?", + "expect": 7160.64468311394 + }, + { + "split": "heldout", + "kind": "interest", + "valid": true, + "q": "Over the life of a 3-year, $250,000 mortgage at 2%, how much interest is paid in total?", + "expect": 7783.208592101844 + }, + { + "split": "heldout", + "kind": "apy", + "valid": true, + "q": "Convert an APR of 2%, compounded annually, to the APY.", + "expect": 2.0000000000000018 + }, + { + "split": "heldout", + "kind": "goal", + "valid": true, + "q": "To save up $5,000 over 3 years earning 2% a year, how much must I deposit per month?", + "expect": 134.8795603289455 + }, + { + "split": "heldout", + "kind": "simple", + "valid": true, + "q": "Find the simple interest on a principal of $250,000 at 2% per year over 3 years.", + "expect": 15000.0 + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "Is it a good idea to take a loan at 9% to buy crypto?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "What's the best investment for my savings right now?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "I borrow $15,000 at 6% APR. What is my monthly payment on the loan?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "What will my investment be worth after 10 years?", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/finance-v2-r2/finance_panel_v1.py b/root/specialists/finance-v2-r2/finance_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..272db9e28f4753800c1008c1ec1a3d0d8aae44a5 --- /dev/null +++ b/root/specialists/finance-v2-r2/finance_panel_v1.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python3 +"""finance_panel_v1 - the sealed panel for specialist #65 (personal finance basics, arithmetic only). Expected values +from the standard formulas written here (FV = P(1 + r/n)^(nt); continuous Pe^(rt); amortized payment P i / (1-(1+i)^-n); +APY = (1 + r/n)^n - 1; sinking-fund deposit FV i / ((1+i)^n - 1); doubling ln2/ln(1+r); I = Prt). Must-decline: advice +("should I...", "which stock...") and missing inputs. Dev / held-out differ in seed and phrasing. +usage: finance_panel_v1.py """ +import collections +import json +import math +import random +import sys + +FN = {"annually": 1, "quarterly": 4, "monthly": 12, "daily": 365} +T = {"dev": {"compound": "If I invest ${p} at {r}% compounded {f} for {y} years, how much will I have?", + "cont": "What does ${p} grow to at {r}% compounded continuously for {y} years?", + "loan": "What is the monthly payment on a ${p} loan at {r}% for {y} years?", + "interest": "How much interest do I pay in total on a ${p} loan at {r}% for {y} years?", + "apy": "What is the APY of a {r}% APR compounded {f}?", + "goal": "How much should I save each month to reach ${g} in {y} years at {r}%?", + "simple": "What is the simple interest on ${p} at {r}% for {y} years?", + "double": "How long does it take money to double at {r}%?"}, + "heldout": {"compound": "${p} is invested at {r}% interest, compounded {f}. What will it be worth after {y} years?", + "cont": "With continuous compounding at {r}%, what will ${p} become in {y} years?", + "loan": "I borrow ${p} over {y} years at {r}% APR. What is my monthly payment on the loan?", + "interest": "Over the life of a {y}-year, ${p} mortgage at {r}%, how much interest is paid in total?", + "apy": "Convert an APR of {r}%, compounded {f}, to the APY.", + "goal": "To save up ${g} over {y} years earning {r}% a year, how much must I deposit per month?", + "simple": "Find the simple interest on a principal of ${p} at {r}% per year over {y} years.", + "double": "At an annual return of {r}%, how many years until an investment doubles?"}} +DECLINE = {"dev": ["Should I invest $10,000 in index funds at 7%?", "Which stock will double my savings fastest?", + "What is the monthly payment on a $20,000 loan?", "How much interest will I earn on my savings?"], + "heldout": ["Is it a good idea to take a loan at 9% to buy crypto?", "What's the best investment for my savings right now?", + "I borrow $15,000 at 6% APR. What is my monthly payment on the loan?", "What will my investment be worth after 10 years?"]} + + +def main(): + items = [] + for split, seed in (("dev", 65), ("heldout", 6565)): + rng = random.Random(seed) + t = T[split] + for _ in range(8): + p = rng.choice([1000, 2500, 5000, 10000, 20000, 250000]); r = rng.choice([2, 3.5, 4, 5, 6.5, 7, 8]) + y = rng.choice([3, 5, 10, 15, 20, 30]); f = rng.choice(list(FN)); g = rng.choice([5000, 10000, 25000, 50000]) + n, i = y * 12, r / 1200 + pay = p * i / (1 - (1 + i) ** -n) + add = [("compound", {"p": format(p, ","), "r": r, "f": f, "y": y}, p * (1 + r / 100 / FN[f]) ** (FN[f] * y)), + ("cont", {"p": format(p, ","), "r": r, "y": y}, p * math.exp(r / 100 * y)), + ("loan", {"p": format(p, ","), "r": r, "y": y}, pay), + ("interest", {"p": format(p, ","), "r": r, "y": y}, pay * n - p), + ("apy", {"r": r, "f": f}, 100 * ((1 + r / 100 / FN[f]) ** FN[f] - 1)), + ("goal", {"g": format(g, ","), "y": y, "r": r}, g * i / ((1 + i) ** n - 1)), + ("simple", {"p": format(p, ","), "r": r, "y": y}, p * r / 100 * y), + ("double", {"r": r}, math.log(2) / math.log(1 + r / 100))] + for kind, kw, exp in add: + items.append({"split": split, "kind": kind, "valid": True, "q": t[kind].format(**kw), "expect": exp}) + for q in DECLINE[split]: + items.append({"split": split, "kind": "decline", "valid": False, "q": q, "expect": "decline"}) + seen, out = set(), [] + for it in items: + if (it["split"], it["q"]) not in seen: + seen.add((it["split"], it["q"])) + out.append(it) + json.dump(out, open(sys.argv[1], "w"), indent=1) + print("panel:", dict(collections.Counter(i["split"] for i in out))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/finance-v2-r2/finance_panel_v2.json b/root/specialists/finance-v2-r2/finance_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..1679c9e2b5c6d9e7b869c5ad965e1bdd560536bb --- /dev/null +++ b/root/specialists/finance-v2-r2/finance_panel_v2.json @@ -0,0 +1,898 @@ +[ + { + "split": "dev", + "kind": "compound", + "valid": true, + "q": "What will $5,000 grow to at 8% compounded annually over 10 years?", + "expect": 10794.62498636394 + }, + { + "split": "dev", + "kind": "cont", + "valid": true, + "q": "Continuous compounding: $5,000 at 8% for 10 years grows to what?", + "expect": 11127.704642462339 + }, + { + "split": "dev", + "kind": "loan", + "valid": true, + "q": "Monthly payment on a 10-year, $5,000 loan at 8%?", + "expect": 60.66379717767888 + }, + { + "split": "dev", + "kind": "interest", + "valid": true, + "q": "Total interest on a 10-year, $5,000 mortgage at 8%?", + "expect": 2279.6556613214652 + }, + { + "split": "dev", + "kind": "apy", + "valid": true, + "q": "APY for a 8% APR compounded annually?", + "expect": 8.000000000000007 + }, + { + "split": "dev", + "kind": "goal", + "valid": true, + "q": "How much must I save each month to have $25,000 in 10 years at 8%?", + "expect": 136.6523192217277 + }, + { + "split": "dev", + "kind": "simple", + "valid": true, + "q": "Simple interest on $5,000 at 8% over 10 years?", + "expect": 4000.0 + }, + { + "split": "dev", + "kind": "double", + "valid": true, + "q": "At 8%, how long until money doubles?", + "expect": 9.006468342000588 + }, + { + "split": "dev", + "kind": "compound", + "valid": true, + "q": "What will $1,000 grow to at 4% compounded quarterly over 5 years?", + "expect": 1220.190039947967 + }, + { + "split": "dev", + "kind": "cont", + "valid": true, + "q": "Continuous compounding: $1,000 at 4% for 5 years grows to what?", + "expect": 1221.40275816017 + }, + { + "split": "dev", + "kind": "loan", + "valid": true, + "q": "Monthly payment on a 5-year, $1,000 loan at 4%?", + "expect": 18.41652205526597 + }, + { + "split": "dev", + "kind": "interest", + "valid": true, + "q": "Total interest on a 5-year, $1,000 mortgage at 4%?", + "expect": 104.9913233159582 + }, + { + "split": "dev", + "kind": "apy", + "valid": true, + "q": "APY for a 4% APR compounded quarterly?", + "expect": 4.060401000000002 + }, + { + "split": "dev", + "kind": "goal", + "valid": true, + "q": "How much must I save each month to have $5,000 in 5 years at 4%?", + "expect": 75.4159436096632 + }, + { + "split": "dev", + "kind": "simple", + "valid": true, + "q": "Simple interest on $1,000 at 4% over 5 years?", + "expect": 200.0 + }, + { + "split": "dev", + "kind": "double", + "valid": true, + "q": "At 4%, how long until money doubles?", + "expect": 17.672987685129698 + }, + { + "split": "dev", + "kind": "compound", + "valid": true, + "q": "What will $250,000 grow to at 5% compounded quarterly over 5 years?", + "expect": 320509.3079271461 + }, + { + "split": "dev", + "kind": "cont", + "valid": true, + "q": "Continuous compounding: $250,000 at 5% for 5 years grows to what?", + "expect": 321006.35417193535 + }, + { + "split": "dev", + "kind": "loan", + "valid": true, + "q": "Monthly payment on a 5-year, $250,000 loan at 5%?", + "expect": 4717.8084110027485 + }, + { + "split": "dev", + "kind": "interest", + "valid": true, + "q": "Total interest on a 5-year, $250,000 mortgage at 5%?", + "expect": 33068.50466016494 + }, + { + "split": "dev", + "kind": "apy", + "valid": true, + "q": "APY for a 5% APR compounded quarterly?", + "expect": 5.094533691406222 + }, + { + "split": "dev", + "kind": "goal", + "valid": true, + "q": "How much must I save each month to have $10,000 in 5 years at 5%?", + "expect": 147.04566977344322 + }, + { + "split": "dev", + "kind": "simple", + "valid": true, + "q": "Simple interest on $250,000 at 5% over 5 years?", + "expect": 62500.0 + }, + { + "split": "dev", + "kind": "double", + "valid": true, + "q": "At 5%, how long until money doubles?", + "expect": 14.206699082890461 + }, + { + "split": "dev", + "kind": "compound", + "valid": true, + "q": "What will $20,000 grow to at 4% compounded quarterly over 20 years?", + "expect": 44334.30434388517 + }, + { + "split": "dev", + "kind": "cont", + "valid": true, + "q": "Continuous compounding: $20,000 at 4% for 20 years grows to what?", + "expect": 44510.818569849354 + }, + { + "split": "dev", + "kind": "loan", + "valid": true, + "q": "Monthly payment on a 20-year, $20,000 loan at 4%?", + "expect": 121.1960658598819 + }, + { + "split": "dev", + "kind": "interest", + "valid": true, + "q": "Total interest on a 20-year, $20,000 mortgage at 4%?", + "expect": 9087.055806371656 + }, + { + "split": "dev", + "kind": "goal", + "valid": true, + "q": "How much must I save each month to have $5,000 in 20 years at 4%?", + "expect": 13.632349798303808 + }, + { + "split": "dev", + "kind": "simple", + "valid": true, + "q": "Simple interest on $20,000 at 4% over 20 years?", + "expect": 16000.0 + }, + { + "split": "dev", + "kind": "compound", + "valid": true, + "q": "What will $2,500 grow to at 2% compounded annually over 5 years?", + "expect": 2760.202008 + }, + { + "split": "dev", + "kind": "cont", + "valid": true, + "q": "Continuous compounding: $2,500 at 2% for 5 years grows to what?", + "expect": 2762.9272951891194 + }, + { + "split": "dev", + "kind": "loan", + "valid": true, + "q": "Monthly payment on a 5-year, $2,500 loan at 2%?", + "expect": 43.819400133109994 + }, + { + "split": "dev", + "kind": "interest", + "valid": true, + "q": "Total interest on a 5-year, $2,500 mortgage at 2%?", + "expect": 129.1640079865997 + }, + { + "split": "dev", + "kind": "apy", + "valid": true, + "q": "APY for a 2% APR compounded annually?", + "expect": 2.0000000000000018 + }, + { + "split": "dev", + "kind": "goal", + "valid": true, + "q": "How much must I save each month to have $50,000 in 5 years at 2%?", + "expect": 793.0546693288663 + }, + { + "split": "dev", + "kind": "simple", + "valid": true, + "q": "Simple interest on $2,500 at 2% over 5 years?", + "expect": 250.0 + }, + { + "split": "dev", + "kind": "double", + "valid": true, + "q": "At 2%, how long until money doubles?", + "expect": 35.0027887811465 + }, + { + "split": "dev", + "kind": "compound", + "valid": true, + "q": "What will $10,000 grow to at 6.5% compounded monthly over 5 years?", + "expect": 13828.17324206292 + }, + { + "split": "dev", + "kind": "cont", + "valid": true, + "q": "Continuous compounding: $10,000 at 6.5% for 5 years grows to what?", + "expect": 13840.306459807514 + }, + { + "split": "dev", + "kind": "loan", + "valid": true, + "q": "Monthly payment on a 5-year, $10,000 loan at 6.5%?", + "expect": 195.66148218728677 + }, + { + "split": "dev", + "kind": "interest", + "valid": true, + "q": "Total interest on a 5-year, $10,000 mortgage at 6.5%?", + "expect": 1739.688931237206 + }, + { + "split": "dev", + "kind": "apy", + "valid": true, + "q": "APY for a 6.5% APR compounded monthly?", + "expect": 6.69718520025433 + }, + { + "split": "dev", + "kind": "goal", + "valid": true, + "q": "How much must I save each month to have $10,000 in 5 years at 6.5%?", + "expect": 141.49481552062002 + }, + { + "split": "dev", + "kind": "simple", + "valid": true, + "q": "Simple interest on $10,000 at 6.5% over 5 years?", + "expect": 3250.0 + }, + { + "split": "dev", + "kind": "double", + "valid": true, + "q": "At 6.5%, how long until money doubles?", + "expect": 11.006739041494765 + }, + { + "split": "dev", + "kind": "compound", + "valid": true, + "q": "What will $5,000 grow to at 5% compounded daily over 20 years?", + "expect": 13590.47834073778 + }, + { + "split": "dev", + "kind": "cont", + "valid": true, + "q": "Continuous compounding: $5,000 at 5% for 20 years grows to what?", + "expect": 13591.409142295226 + }, + { + "split": "dev", + "kind": "loan", + "valid": true, + "q": "Monthly payment on a 20-year, $5,000 loan at 5%?", + "expect": 32.99778696083293 + }, + { + "split": "dev", + "kind": "interest", + "valid": true, + "q": "Total interest on a 20-year, $5,000 mortgage at 5%?", + "expect": 2919.468870599904 + }, + { + "split": "dev", + "kind": "apy", + "valid": true, + "q": "APY for a 5% APR compounded daily?", + "expect": 5.126749646744733 + }, + { + "split": "dev", + "kind": "goal", + "valid": true, + "q": "How much must I save each month to have $50,000 in 20 years at 5%?", + "expect": 121.64453627499604 + }, + { + "split": "dev", + "kind": "simple", + "valid": true, + "q": "Simple interest on $5,000 at 5% over 20 years?", + "expect": 5000.0 + }, + { + "split": "dev", + "kind": "compound", + "valid": true, + "q": "What will $1,000 grow to at 2% compounded monthly over 20 years?", + "expect": 1491.3280572661247 + }, + { + "split": "dev", + "kind": "cont", + "valid": true, + "q": "Continuous compounding: $1,000 at 2% for 20 years grows to what?", + "expect": 1491.8246976412704 + }, + { + "split": "dev", + "kind": "loan", + "valid": true, + "q": "Monthly payment on a 20-year, $1,000 loan at 2%?", + "expect": 5.058833350451077 + }, + { + "split": "dev", + "kind": "interest", + "valid": true, + "q": "Total interest on a 20-year, $1,000 mortgage at 2%?", + "expect": 214.1200041082584 + }, + { + "split": "dev", + "kind": "apy", + "valid": true, + "q": "APY for a 2% APR compounded monthly?", + "expect": 2.0184355681501787 + }, + { + "split": "dev", + "kind": "goal", + "valid": true, + "q": "How much must I save each month to have $25,000 in 20 years at 2%?", + "expect": 84.80416709461025 + }, + { + "split": "dev", + "kind": "simple", + "valid": true, + "q": "Simple interest on $1,000 at 2% over 20 years?", + "expect": 400.0 + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "Should I invest $10,000 in index funds at 7%?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "Which stock will double my savings fastest?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What is the monthly payment on a $20,000 loan?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "How much interest will I earn on my savings?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "compound", + "valid": true, + "q": "Work out the value after 3 years of $10,000 earning 6.5% compounded quarterly.", + "expect": 12134.075789595536 + }, + { + "split": "heldout", + "kind": "cont", + "valid": true, + "q": "Work out what $10,000 becomes after 3 years at 6.5% with continuous compounding.", + "expect": 12153.109864897307 + }, + { + "split": "heldout", + "kind": "loan", + "valid": true, + "q": "Work out the monthly payment on a $10,000 loan over 3 years at 6.5% APR.", + "expect": 306.49002876509996 + }, + { + "split": "heldout", + "kind": "interest", + "valid": true, + "q": "Work out the total interest paid over the life of a 3-year, $10,000 mortgage at 6.5%.", + "expect": 1033.6410355435983 + }, + { + "split": "heldout", + "kind": "apy", + "valid": true, + "q": "Work out the APY from a 6.5% APR compounded quarterly.", + "expect": 6.660160879150423 + }, + { + "split": "heldout", + "kind": "goal", + "valid": true, + "q": "Work out the monthly deposit needed to reach $50,000 in 3 years at 6.5%.", + "expect": 1261.6168104921667 + }, + { + "split": "heldout", + "kind": "simple", + "valid": true, + "q": "Work out the simple interest on $10,000 at 6.5% for 3 years.", + "expect": 1950.0 + }, + { + "split": "heldout", + "kind": "double", + "valid": true, + "q": "Work out how many years it takes an investment to double at 6.5% a year.", + "expect": 11.006739041494765 + }, + { + "split": "heldout", + "kind": "compound", + "valid": true, + "q": "Work out the value after 15 years of $250,000 earning 6.5% compounded daily.", + "expect": 662734.2717569286 + }, + { + "split": "heldout", + "kind": "cont", + "valid": true, + "q": "Work out what $250,000 becomes after 15 years at 6.5% with continuous compounding.", + "expect": 662791.8027456518 + }, + { + "split": "heldout", + "kind": "loan", + "valid": true, + "q": "Work out the monthly payment on a $250,000 loan over 15 years at 6.5% APR.", + "expect": 2177.7684132434138 + }, + { + "split": "heldout", + "kind": "interest", + "valid": true, + "q": "Work out the total interest paid over the life of a 15-year, $250,000 mortgage at 6.5%.", + "expect": 141998.31438381446 + }, + { + "split": "heldout", + "kind": "apy", + "valid": true, + "q": "Work out the APY from a 6.5% APR compounded daily.", + "expect": 6.7152848769607365 + }, + { + "split": "heldout", + "kind": "goal", + "valid": true, + "q": "Work out the monthly deposit needed to reach $10,000 in 15 years at 6.5%.", + "expect": 32.944069863069885 + }, + { + "split": "heldout", + "kind": "simple", + "valid": true, + "q": "Work out the simple interest on $250,000 at 6.5% for 15 years.", + "expect": 243750.0 + }, + { + "split": "heldout", + "kind": "compound", + "valid": true, + "q": "Work out the value after 20 years of $5,000 earning 3.5% compounded monthly.", + "expect": 10058.510174540052 + }, + { + "split": "heldout", + "kind": "cont", + "valid": true, + "q": "Work out what $5,000 becomes after 20 years at 3.5% with continuous compounding.", + "expect": 10068.763537352383 + }, + { + "split": "heldout", + "kind": "loan", + "valid": true, + "q": "Work out the monthly payment on a $5,000 loan over 20 years at 3.5% APR.", + "expect": 28.99798589915459 + }, + { + "split": "heldout", + "kind": "interest", + "valid": true, + "q": "Work out the total interest paid over the life of a 20-year, $5,000 mortgage at 3.5%.", + "expect": 1959.5166157971016 + }, + { + "split": "heldout", + "kind": "apy", + "valid": true, + "q": "Work out the APY from a 3.5% APR compounded monthly.", + "expect": 3.5566952945970565 + }, + { + "split": "heldout", + "kind": "goal", + "valid": true, + "q": "Work out the monthly deposit needed to reach $5,000 in 20 years at 3.5%.", + "expect": 14.414652565821253 + }, + { + "split": "heldout", + "kind": "simple", + "valid": true, + "q": "Work out the simple interest on $5,000 at 3.5% for 20 years.", + "expect": 3500.0 + }, + { + "split": "heldout", + "kind": "double", + "valid": true, + "q": "Work out how many years it takes an investment to double at 3.5% a year.", + "expect": 20.148791684000713 + }, + { + "split": "heldout", + "kind": "compound", + "valid": true, + "q": "Work out the value after 15 years of $1,000 earning 5% compounded daily.", + "expect": 2116.8912793345294 + }, + { + "split": "heldout", + "kind": "cont", + "valid": true, + "q": "Work out what $1,000 becomes after 15 years at 5% with continuous compounding.", + "expect": 2117.0000166126747 + }, + { + "split": "heldout", + "kind": "loan", + "valid": true, + "q": "Work out the monthly payment on a $1,000 loan over 15 years at 5% APR.", + "expect": 7.907936267415464 + }, + { + "split": "heldout", + "kind": "interest", + "valid": true, + "q": "Work out the total interest paid over the life of a 15-year, $1,000 mortgage at 5%.", + "expect": 423.4285281347836 + }, + { + "split": "heldout", + "kind": "apy", + "valid": true, + "q": "Work out the APY from a 5% APR compounded daily.", + "expect": 5.126749646744733 + }, + { + "split": "heldout", + "kind": "goal", + "valid": true, + "q": "Work out the monthly deposit needed to reach $10,000 in 15 years at 5%.", + "expect": 37.41269600748797 + }, + { + "split": "heldout", + "kind": "simple", + "valid": true, + "q": "Work out the simple interest on $1,000 at 5% for 15 years.", + "expect": 750.0 + }, + { + "split": "heldout", + "kind": "double", + "valid": true, + "q": "Work out how many years it takes an investment to double at 5% a year.", + "expect": 14.206699082890461 + }, + { + "split": "heldout", + "kind": "compound", + "valid": true, + "q": "Work out the value after 20 years of $5,000 earning 8% compounded daily.", + "expect": 24760.820752365144 + }, + { + "split": "heldout", + "kind": "cont", + "valid": true, + "q": "Work out what $5,000 becomes after 20 years at 8% with continuous compounding.", + "expect": 24765.162121975576 + }, + { + "split": "heldout", + "kind": "loan", + "valid": true, + "q": "Work out the monthly payment on a $5,000 loan over 20 years at 8% APR.", + "expect": 41.82200344967332 + }, + { + "split": "heldout", + "kind": "interest", + "valid": true, + "q": "Work out the total interest paid over the life of a 20-year, $5,000 mortgage at 8%.", + "expect": 5037.280827921597 + }, + { + "split": "heldout", + "kind": "apy", + "valid": true, + "q": "Work out the APY from a 8% APR compounded daily.", + "expect": 8.327757179283468 + }, + { + "split": "heldout", + "kind": "goal", + "valid": true, + "q": "Work out the monthly deposit needed to reach $50,000 in 20 years at 8%.", + "expect": 84.88670116339983 + }, + { + "split": "heldout", + "kind": "simple", + "valid": true, + "q": "Work out the simple interest on $5,000 at 8% for 20 years.", + "expect": 8000.0 + }, + { + "split": "heldout", + "kind": "double", + "valid": true, + "q": "Work out how many years it takes an investment to double at 8% a year.", + "expect": 9.006468342000588 + }, + { + "split": "heldout", + "kind": "compound", + "valid": true, + "q": "Work out the value after 5 years of $250,000 earning 3.5% compounded daily.", + "expect": 297809.0555619791 + }, + { + "split": "heldout", + "kind": "cont", + "valid": true, + "q": "Work out what $250,000 becomes after 5 years at 3.5% with continuous compounding.", + "expect": 297811.5541530895 + }, + { + "split": "heldout", + "kind": "loan", + "valid": true, + "q": "Work out the monthly payment on a $250,000 loan over 5 years at 3.5% APR.", + "expect": 4547.936242564083 + }, + { + "split": "heldout", + "kind": "interest", + "valid": true, + "q": "Work out the total interest paid over the life of a 5-year, $250,000 mortgage at 3.5%.", + "expect": 22876.17455384496 + }, + { + "split": "heldout", + "kind": "apy", + "valid": true, + "q": "Work out the APY from a 3.5% APR compounded daily.", + "expect": 3.561797105718445 + }, + { + "split": "heldout", + "kind": "goal", + "valid": true, + "q": "Work out the monthly deposit needed to reach $50,000 in 5 years at 3.5%.", + "expect": 763.7539151794833 + }, + { + "split": "heldout", + "kind": "simple", + "valid": true, + "q": "Work out the simple interest on $250,000 at 3.5% for 5 years.", + "expect": 43750.0 + }, + { + "split": "heldout", + "kind": "compound", + "valid": true, + "q": "Work out the value after 10 years of $20,000 earning 8% compounded quarterly.", + "expect": 44160.79327229707 + }, + { + "split": "heldout", + "kind": "cont", + "valid": true, + "q": "Work out what $20,000 becomes after 10 years at 8% with continuous compounding.", + "expect": 44510.818569849354 + }, + { + "split": "heldout", + "kind": "loan", + "valid": true, + "q": "Work out the monthly payment on a $20,000 loan over 10 years at 8% APR.", + "expect": 242.65518871071552 + }, + { + "split": "heldout", + "kind": "interest", + "valid": true, + "q": "Work out the total interest paid over the life of a 10-year, $20,000 mortgage at 8%.", + "expect": 9118.622645285861 + }, + { + "split": "heldout", + "kind": "apy", + "valid": true, + "q": "Work out the APY from a 8% APR compounded quarterly.", + "expect": 8.243215999999997 + }, + { + "split": "heldout", + "kind": "goal", + "valid": true, + "q": "Work out the monthly deposit needed to reach $10,000 in 10 years at 8%.", + "expect": 54.66092768869108 + }, + { + "split": "heldout", + "kind": "simple", + "valid": true, + "q": "Work out the simple interest on $20,000 at 8% for 10 years.", + "expect": 16000.0 + }, + { + "split": "heldout", + "kind": "compound", + "valid": true, + "q": "Work out the value after 30 years of $250,000 earning 6.5% compounded annually.", + "expect": 1653591.5407602082 + }, + { + "split": "heldout", + "kind": "cont", + "valid": true, + "q": "Work out what $250,000 becomes after 30 years at 6.5% with continuous compounding.", + "expect": 1757171.8951473236 + }, + { + "split": "heldout", + "kind": "loan", + "valid": true, + "q": "Work out the monthly payment on a $250,000 loan over 30 years at 6.5% APR.", + "expect": 1580.1700587324133 + }, + { + "split": "heldout", + "kind": "interest", + "valid": true, + "q": "Work out the total interest paid over the life of a 30-year, $250,000 mortgage at 6.5%.", + "expect": 318861.22114366875 + }, + { + "split": "heldout", + "kind": "apy", + "valid": true, + "q": "Work out the APY from a 6.5% APR compounded annually.", + "expect": 6.499999999999995 + }, + { + "split": "heldout", + "kind": "goal", + "valid": true, + "q": "Work out the monthly deposit needed to reach $10,000 in 30 years at 6.5%.", + "expect": 9.040135682629863 + }, + { + "split": "heldout", + "kind": "simple", + "valid": true, + "q": "Work out the simple interest on $250,000 at 6.5% for 30 years.", + "expect": 487500.0 + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "Is it a good idea to take a loan at 9% to buy crypto?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "What's the best investment for my savings right now?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "I borrow $15,000 at 6% APR. What is my monthly payment on the loan?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "What will my investment be worth after 10 years?", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/finance-v2-r2/finance_panel_v2.py b/root/specialists/finance-v2-r2/finance_panel_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..d5686c7b492bb4c912ae606854c004307ae89959 --- /dev/null +++ b/root/specialists/finance-v2-r2/finance_panel_v2.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 +"""finance_panel_v2 - FRESH panel for finance v2 (v1 held-out sealed): seeds 656565/65656565, adjective terms (15-year) and doubles. Same author - disclosed. +Derived from finance_panel_v1 - the sealed panel for specialist #65 (personal finance basics, arithmetic only). Expected values +from the standard formulas written here (FV = P(1 + r/n)^(nt); continuous Pe^(rt); amortized payment P i / (1-(1+i)^-n); +APY = (1 + r/n)^n - 1; sinking-fund deposit FV i / ((1+i)^n - 1); doubling ln2/ln(1+r); I = Prt). Must-decline: advice +("should I...", "which stock...") and missing inputs. Dev / held-out differ in seed and phrasing. +usage: finance_panel_v1.py """ +import collections +import json +import math +import random +import sys + +FN = {"annually": 1, "quarterly": 4, "monthly": 12, "daily": 365} +T = {"dev": {"compound": "What will ${p} grow to at {r}% compounded {f} over {y} years?", "cont": "Continuous compounding: ${p} at {r}% for {y} years grows to what?", + "loan": "Monthly payment on a {y}-year, ${p} loan at {r}%?", "interest": "Total interest on a {y}-year, ${p} mortgage at {r}%?", + "apy": "APY for a {r}% APR compounded {f}?", "goal": "How much must I save each month to have ${g} in {y} years at {r}%?", + "simple": "Simple interest on ${p} at {r}% over {y} years?", "double": "At {r}%, how long until money doubles?"}, + "heldout": {"compound": "Work out the value after {y} years of ${p} earning {r}% compounded {f}.", "cont": "Work out what ${p} becomes after {y} years at {r}% with continuous compounding.", + "loan": "Work out the monthly payment on a ${p} loan over {y} years at {r}% APR.", "interest": "Work out the total interest paid over the life of a {y}-year, ${p} mortgage at {r}%.", + "apy": "Work out the APY from a {r}% APR compounded {f}.", "goal": "Work out the monthly deposit needed to reach ${g} in {y} years at {r}%.", + "simple": "Work out the simple interest on ${p} at {r}% for {y} years.", "double": "Work out how many years it takes an investment to double at {r}% a year."}} + +DECLINE = {"dev": ["Should I invest $10,000 in index funds at 7%?", "Which stock will double my savings fastest?", + "What is the monthly payment on a $20,000 loan?", "How much interest will I earn on my savings?"], + "heldout": ["Is it a good idea to take a loan at 9% to buy crypto?", "What's the best investment for my savings right now?", + "I borrow $15,000 at 6% APR. What is my monthly payment on the loan?", "What will my investment be worth after 10 years?"]} + + +def main(): + items = [] + for split, seed in (("dev", 656565), ("heldout", 65656565)): + rng = random.Random(seed) + t = T[split] + for _ in range(8): + p = rng.choice([1000, 2500, 5000, 10000, 20000, 250000]); r = rng.choice([2, 3.5, 4, 5, 6.5, 7, 8]) + y = rng.choice([3, 5, 10, 15, 20, 30]); f = rng.choice(list(FN)); g = rng.choice([5000, 10000, 25000, 50000]) + n, i = y * 12, r / 1200 + pay = p * i / (1 - (1 + i) ** -n) + add = [("compound", {"p": format(p, ","), "r": r, "f": f, "y": y}, p * (1 + r / 100 / FN[f]) ** (FN[f] * y)), + ("cont", {"p": format(p, ","), "r": r, "y": y}, p * math.exp(r / 100 * y)), + ("loan", {"p": format(p, ","), "r": r, "y": y}, pay), + ("interest", {"p": format(p, ","), "r": r, "y": y}, pay * n - p), + ("apy", {"r": r, "f": f}, 100 * ((1 + r / 100 / FN[f]) ** FN[f] - 1)), + ("goal", {"g": format(g, ","), "y": y, "r": r}, g * i / ((1 + i) ** n - 1)), + ("simple", {"p": format(p, ","), "r": r, "y": y}, p * r / 100 * y), + ("double", {"r": r}, math.log(2) / math.log(1 + r / 100))] + for kind, kw, exp in add: + items.append({"split": split, "kind": kind, "valid": True, "q": t[kind].format(**kw), "expect": exp}) + for q in DECLINE[split]: + items.append({"split": split, "kind": "decline", "valid": False, "q": q, "expect": "decline"}) + seen, out = set(), [] + for it in items: + if (it["split"], it["q"]) not in seen: + seen.add((it["split"], it["q"])) + out.append(it) + json.dump(out, open(sys.argv[1], "w"), indent=1) + print("panel:", dict(collections.Counter(i["split"] for i in out))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/finance-v2-r2/finance_scorer.py b/root/specialists/finance-v2-r2/finance_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..b7e16e1b76f28ea40897cb91ff645db52d073529 --- /dev/null +++ b/root/specialists/finance-v2-r2/finance_scorer.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +"""finance_scorer - the stated result in the REPLY TEXT (the first amount / number after "is", "grows to", "is about") +must be within one cent (or 0.01% for large amounts; 0.01 for percentages and years) of the panel's own formula. +A must-decline item answered is a false yes. (ok, asserted).""" +import re + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + m = re.search(r"\b(?:is|grows to)\s+\$?([\d,]+(?:\.\d+)?)", text) + if not m: + return False, True + got, want = float(m.group(1).replace(",", "")), float(p["expect"]) + return abs(got - want) <= max(0.0001 * abs(want), 0.01), True diff --git a/root/specialists/finance-v2-r2/manifest.json b/root/specialists/finance-v2-r2/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..11445a1e99dbf56f81655c6d41ebc9e19ba6d196 --- /dev/null +++ b/root/specialists/finance-v2-r2/manifest.json @@ -0,0 +1,68 @@ +{ + "id": "finance-v2-r2", + "name": "Oracle7 Personal Finance Arithmetic v2", + "number": 65, + "tier": "B", + "sources": [ + { + "name": "Standard time-value-of-money formulas (compound interest, amortization, APY, sinking fund) as published by the CFPB and Investor.gov calculators", + "licence": "public domain (US government)", + "url": "https://www.investor.gov/financial-tools-calculators/calculators/compound-interest-calculator" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/finance-v2/organ_finance_v2.py" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/finance-v2-r2", + "module": "organ_finance_v2r2", + "class": "FinanceOrganV2R2", + "init": {} + }, + "accept": { + "kinds": [ + "apy", + "doubling", + "loan_interest", + "loan_payment", + "savings_goal", + "simple_interest", + "compound" + ], + "declines_in_domain": [ + "advice", + "multi_phase", + "underspecified" + ], + "context_regex": "\\b(?:interest|loan|mortgage|apr|apy|savings?|save|invest\\w*|compound\\w*|doubl\\w*|deposit|stock|fund|crypto)\\b" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/finance-v2/finance_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "finance_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [ + "compound interest", + "monthly payment", + "loan", + "APY", + "simple interest", + "double my money", + "save each month" + ], + "budgets": { + "latency_p50_ms": 50, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20260928 + }, + "notes": "v2 = v1 + a term written as an adjective ('a 15-year, $250,000 mortgage') and doubles/doubled/doubling as doubling - v1's held-out misses (safe declines) - and the family numbers rule. Arithmetic only; advice, prices and predictions still declined. Judged under spec_gate_v3.1 on a FRESH panel v2 (seeds 656565/65656565). Same author - disclosed. r2 (2026-09-30): two-phase / two-rate accounts declined in-domain (was a confident first-phase-only answer).", + "supersedes": "finance (ADMIT gate v2, held-out 51/64; 13 misses safe declines)" +} \ No newline at end of file diff --git a/root/specialists/finance-v2-r2/narrow_v1.py b/root/specialists/finance-v2-r2/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/finance-v2-r2/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/finance-v2-r2/numbers_rule_v1.py b/root/specialists/finance-v2-r2/numbers_rule_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..d6f49bcbf989ad299cd11deacb643137c812bc79 --- /dev/null +++ b/root/specialists/finance-v2-r2/numbers_rule_v1.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +"""numbers_rule_v1 - the family-wide rule from the 2026-09-29 gate-v2 batch: an organ never says "I need X" when the turn +carries numbers it could not attach (optics "object 60 cm away", mechanisms "a 0.25 m lever", finance "a 15-year ... +mortgage" were all declined as underspecified although the numbers were there). Such a decline becomes SILENCE - the +head answers - unless the turn is a short direct question with no numbers at all.""" +from narrow_v1 import numbers + + +def apply(reply, text): + if reply and reply.get("kind") == "underspecified" and numbers(text) >= 1: + return None + return reply diff --git a/root/specialists/finance-v2-r2/organ_finance_v1.py b/root/specialists/finance-v2-r2/organ_finance_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..ee02f7e921b4fa1854805a9c4d884645461adf96 --- /dev/null +++ b/root/specialists/finance-v2-r2/organ_finance_v1.py @@ -0,0 +1,152 @@ +#!/usr/bin/env python3 +"""organ_finance_v1 - personal-finance ARITHMETIC only, formula shown, never advice: compound growth (any compounding +frequency, or continuous), simple interest, a fixed-rate loan's monthly payment with total paid and total interest, +APR -> APY, the monthly deposit that reaches a savings goal, and the exact doubling time (with the rule-of-72 estimate +beside it). Declines anything that asks what to DO ("should I", "is it a good idea", "which stock/fund", "best +investment") - that is advice, and this organ is a calculator. Returns {kind, status, response, value}.""" +from __future__ import annotations + +import math +import re + +from narrow_v1 import narrative, numbers, short_direct + +N = r"(\d+(?:,\d{3})*(?:\.\d+)?)" +FREQ = {"annually": 1, "yearly": 1, "annual": 1, "semiannually": 2, "semi-annually": 2, "quarterly": 4, "monthly": 12, + "weekly": 52, "daily": 365} +ADVICE = re.compile(r"\bshould i\b|\bis it (?:a )?(?:good|bad|smart|wise)\b|\bworth it\b|\bwhich (?:stock|fund|etf|crypto|coin|bank|card)\b|" + r"\bbest (?:investment|stock|fund|way to invest)\b|\bwhat (?:should|to) (?:i )?(?:buy|invest)\b|\brecommend\b|\bwill .* go up\b", re.I) + + +def num(s): + return float(s.replace(",", "")) + + +def money(x): + return "$" + format(round(x, 2), ",.2f") + + +def rate(low): + m = re.search(N + r"\s*%", low) + return num(m.group(1)) / 100 if m else None + + +def years(low): + m = re.search(N + r"\s*years?\b", low) + if m: + return num(m.group(1)) + m = re.search(N + r"\s*months?\b", low) + return num(m.group(1)) / 12 if m else None + + +def principal(low): + m = re.search(r"\$\s*" + N + r"\s*(k|thousand|million)?\b", low) + if not m: + return None + return num(m.group(1)) * {"k": 1e3, "thousand": 1e3, "million": 1e6}.get(m.group(2) or "", 1) + + +def freq(low): + if re.search(r"\bcontinuous(?:ly)?\b", low): + return "continuous" + m = re.search(r"\bcompounded\s+(\w+(?:-\w+)?)|\b(annually|semiannually|semi-annually|quarterly|monthly|weekly|daily)\b", low) + w = (m.group(1) or m.group(2)) if m else None + return FREQ.get(w, None) if w else None + + +class FinanceOrgan: + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def _need(self, what): + return self._say("underspecified", "I need %s to calculate that; I won't assume it." % what, status="withheld") + + def answer(self, text, session_id="default"): + r = self._answer(text, session_id) + if r is None or r.get("kind") == "advice": + return r + # narrow_v1: word problems belong to the head (the full-core sweep found 15 annuity / loan stories taken); + # "I need X" only for a short direct question that already carries numbers ("What is compound interest?" is a + # concept question, not a calculation with a missing input) + if narrative(text): + return None + if r.get("status") != "answered" and (not short_direct(text) or numbers(text) == 0): + return None + return r + + def _answer(self, text, session_id="default"): + t = " ".join(str(text or "").split()) + low = t.lower() + money_words = re.search(r"\binterest\b|\bloan\b|\bmortgage\b|\bapr\b|\bapy\b|\bsav(?:e|ings)\b|\binvest\w*\b|\bcompound\w*\b|\bdoubl\w*\b|\bdeposit\b", low) + if not money_words: + return None + # "How much should I save each month to reach $50,000 in 10 years at 4%?" is arithmetic (amount and time given); + # "Should I invest $10,000 in index funds?" is a decision - advice + calc = re.search(r"\bhow (?:much|long|many)\b", low) and principal(low) is not None and years(low) is not None + if ADVICE.search(t) and not calc: + return self._say("advice", "That's a decision about what to do with money, and I only do the arithmetic - I won't advise. " + "I can compute growth, loan payments, interest or a savings target for any numbers you give me.", status="withheld") + r = rate(low) + # APR -> APY + if re.search(r"\bapy\b|\beffective annual\b", low) and re.search(r"\bapr\b|\bnominal\b|\bcompounded\b", low): + f = freq(low) + if r is None or f is None: + return self._need("the APR and how often it compounds") + apy = math.exp(r) - 1 if f == "continuous" else (1 + r / f) ** f - 1 + return self._say("apy", "The APY is %.4f%% (an APR of %g%% compounded %s: (1 + r/n)^n − 1)." % (100 * apy, 100 * r, "continuously" if f == "continuous" else "%d times a year" % f), 100 * apy) + # doubling time + if re.search(r"\bdouble\b|\bdoubling\b", low): + if r is None or r <= 0: + return self._need("a positive annual rate") + exact = math.log(2) / math.log(1 + r) + return self._say("doubling", "The doubling time is %.2f years at %g%% compounded annually (ln 2 / ln(1 + r)); the rule of 72 estimates %.1f." % (exact, 100 * r, 72 / (100 * r)), exact) + # loan / mortgage payment + if re.search(r"\bloan\b|\bmortgage\b|\bborrow", low) and re.search(r"\bpayment\b|\bpay (?:each|per|a) month\b|\bmonthly\b|\btotal interest\b|\bhow much interest\b", low): + P, y = principal(low), years(low) + if P is None or r is None or y is None: + return self._need("the amount borrowed, the annual rate and the term") + n = round(y * 12) + i = r / 12 + pay = P / n if i == 0 else P * i / (1 - (1 + i) ** -n) + total = pay * n + if re.search(r"\btotal interest\b|\bhow much interest\b", low): + return self._say("loan_interest", "The total interest is %s (%d payments of %s = %s, minus the %s borrowed)." % (money(total - P), n, money(pay), money(total), money(P)), total - P) + return self._say("loan_payment", "The monthly payment is %s (%s at %g%% APR over %d months: P·i / (1 − (1 + i)^−n), i = r/12); total paid %s." % ( + money(pay), money(P), 100 * r, n, money(total)), pay) + # savings goal: monthly deposit to reach a target + if re.search(r"\bhow much (?:should|do|would|must) i (?:save|deposit|put)\b|\bmonthly (?:deposit|saving|contribution)\b.*\b(?:reach|goal|have)\b|\bto (?:reach|have|save up)\b", low) and re.search(r"\bmonth", low): + goal, y = principal(low), years(low) + if goal is None or y is None: + return self._need("the target amount and the time") + n = round(y * 12) + i = (r or 0) / 12 + dep = goal / n if i == 0 else goal * i / ((1 + i) ** n - 1) + return self._say("savings_goal", "The monthly deposit is %s (to reach %s in %d months at %g%% compounded monthly: FV·i / ((1 + i)^n − 1))." % ( + money(dep), money(goal), n, 100 * (r or 0)), dep) + # simple interest + if re.search(r"\bsimple interest\b", low): + P, y = principal(low), years(low) + if P is None or r is None or y is None: + return self._need("the principal, the annual rate and the time") + si = P * r * y + return self._say("simple_interest", "The simple interest is %s (I = P·r·t = %s × %g%% × %g years); total %s." % (money(si), money(P), 100 * r, y, money(P + si)), si) + # compound growth of a LUMP SUM. Recurring deposits are a different calculation (an annuity): "deposits $80 of his + # monthly earnings into an annuity" was answered as $80 growing once - confident wrong (full-core sweep) + if re.search(r"\bannuit|\b(?:per|each|every|a) (?:month|week|year)\b(?![^.?]*\bcompound)|\bmonthly (?:deposits?|payments?|contributions?|earnings|savings)\b", low): + return None + # any RECURRING deposit is an annuity too: "$5,000 is saved annually for 20 years" (a core benchmark guard item, + # answered as a lump sum by the first dev gate - confident wrong) + # ... but "compounded annually" is the COMPOUNDING cadence, not a deposit cadence - strip it before looking + low_nc = re.sub(r"\bcompounded\s+(?:annually|yearly|monthly|quarterly|weekly|daily|semi-?annually|continuously)\b", " ", low) + if re.search(r"\b(?:saved?|saving|deposit(?:ed|s|ing)?|invest(?:ed|s|ing)?|contribut(?:ed|es|ing)|put (?:away|aside|in)|paid in|adds?)\b[^.?]*?" + r"\b(?:annually|yearly|monthly|quarterly|weekly|each (?:year|month|quarter|week)|every (?:year|month|quarter|week)|per (?:year|month|quarter|week))\b", low_nc): + return None + if re.search(r"\bcompound\w*\b|\bgrow\b|\bbe worth\b|\bwill (?:i|it) have\b|\bfuture value\b|\bafter \d+ years?\b.*\b(?:balance|worth|have)\b|\binvest\w*\b.*\bat\b", low): + P, y = principal(low), years(low) + if P is None or r is None or y is None: + return self._need("the starting amount, the annual rate and the time") + f = freq(low) or 1 + fv = P * math.exp(r * y) if f == "continuous" else P * (1 + r / f) ** (f * y) + how = "continuously" if f == "continuous" else {1: "annually", 2: "semiannually", 4: "quarterly", 12: "monthly", 52: "weekly", 365: "daily"}.get(f, "%d times a year" % f) + return self._say("compound", "It grows to %s (%s at %g%% compounded %s for %g years; interest earned %s)." % (money(fv), money(P), 100 * r, how, y, money(fv - P)), fv) + return None diff --git a/root/specialists/finance-v2-r2/organ_finance_v2.py b/root/specialists/finance-v2-r2/organ_finance_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..b30a85a310ad350bd800273bd3d759b6f3890de1 --- /dev/null +++ b/root/specialists/finance-v2-r2/organ_finance_v2.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +"""organ_finance_v2 - organ_finance_v1 (ADMIT gate v2, held-out 51/64; all misses safe declines) plus: a term written +as an adjective ("a 15-year, $250,000 mortgage") and "doubles" / "doubled" as doubling - v1's held-out misses. The +family numbers rule too. Arithmetic only, advice still declined. Everything else v1.""" +from __future__ import annotations + +import re + +from numbers_rule_v1 import apply +from organ_finance_v1 import FinanceOrgan + + +class FinanceOrganV2(FinanceOrgan): + def answer(self, text, session_id="default"): + t = str(text or "") + t = re.sub(r"\b(\d+(?:\.\d+)?)[- ](year|month)s?\b(?!\s+(?:old|ago))", r"\1 \2s", t, flags=re.I) # "15-year" -> "15 years" + t = re.sub(r"\bdoubl(?:es|ed|ing)\b", "double", t, flags=re.I) + return apply(super().answer(t, session_id), text) diff --git a/root/specialists/finance-v2-r2/organ_finance_v2r2.py b/root/specialists/finance-v2-r2/organ_finance_v2r2.py new file mode 100644 index 0000000000000000000000000000000000000000..cdb962490e0a3273cefc1a557badc9509255430a --- /dev/null +++ b/root/specialists/finance-v2-r2/organ_finance_v2r2.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 +"""organ_finance_v2r2 - NARROWING-ONLY patch of finance-v2 (inherits its held-out only if byte-identical on every +held-out input; invariance_v1.py). + +Defect (found 2026-09-30 by the combo harness, confirmed on finance-v2 alone): a TWO-PHASE account - "earned 4% +compounded quarterly for 3 years, and then 5% compounded semiannually for the next two years" - was answered with the +first phase only ("It grows to $2,253.65 ... 4% for 3 years"), a confident wrong answer. finance-v2 computes one rate +over one term; a turn that states two or more rates, or a second phase ("and then", "for the next", "after that"), +is now declined in-domain instead of half-computed. Nothing else changes. +""" +import re + +from organ_finance_v2 import FinanceOrganV2 + +PCT = re.compile(r"\d+(?:\.\d+)?\s*(?:%|percent\b)", re.I) +PHASE = re.compile(r"\b(?:and\s+then|then\s+\d|for\s+the\s+(?:next|following|remaining)|after\s+that|thereafter|afterwards)\b", re.I) + + +class FinanceOrganV2R2(FinanceOrganV2): + def answer(self, text, session_id="default"): + a = super().answer(text, session_id) + if a and a.get("kind") not in ("multi_phase",) and a.get("status", "answered") == "answered": + t = str(text) + if len(set(m.group(0).replace(" ", "").lower() for m in PCT.finditer(t))) >= 2 or (PHASE.search(t) and PCT.search(t)): + return {"kind": "multi_phase", "status": "clarification", + "response": "That account changes rate or term partway through; I compute one rate over one " + "term at a time, so I won't give a single figure for the whole thing. Ask about each " + "phase separately (the first phase's ending balance is the second phase's start)."} + return a diff --git a/root/specialists/fleet/fleet_panel_v1.json b/root/specialists/fleet/fleet_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..e32efd0b301bc30012088837e548a47275ed561c --- /dev/null +++ b/root/specialists/fleet/fleet_panel_v1.json @@ -0,0 +1,758 @@ +[ + { + "split": "dev", + "kind": "to_lpk", + "valid": true, + "q": "Convert 30 mpg to L/100 km.", + "expect": 7.840486666666666 + }, + { + "split": "dev", + "kind": "to_mpg", + "valid": true, + "q": "Convert 10 L/100 km to mpg.", + "expect": 23.521459999999998 + }, + { + "split": "dev", + "kind": "gal", + "valid": true, + "q": "How many gallons of fuel does a 300 mile trip need at 30 mpg?", + "expect": 10.0 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "What is the fuel cost of a 300 mile trip at 30 mpg with gas at $3.89 per gallon?", + "expect": 38.9 + }, + { + "split": "dev", + "kind": "co2", + "valid": true, + "q": "How much CO2 does a 300 mile trip at 30 mpg emit in a gasoline car?", + "expect": 88.87 + }, + { + "split": "dev", + "kind": "co2d", + "valid": true, + "q": "How much CO2 does a 300 mile trip at 30 mpg emit in a diesel truck?", + "expect": 101.8 + }, + { + "split": "dev", + "kind": "stop", + "valid": true, + "q": "What is the stopping distance at 60 km/h with a reaction time of 1 s and a friction coefficient of 0.4?", + "expect": 52.07347961728918 + }, + { + "split": "dev", + "kind": "brake", + "valid": true, + "q": "What is the braking distance at 60 km/h with a friction coefficient of 0.4?", + "expect": 35.406812950622516 + }, + { + "split": "dev", + "kind": "to_lpk", + "valid": true, + "q": "Convert 25 mpg to L/100 km.", + "expect": 9.408584 + }, + { + "split": "dev", + "kind": "gal", + "valid": true, + "q": "How many gallons of fuel does a 480 mile trip need at 25 mpg?", + "expect": 19.2 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "What is the fuel cost of a 480 mile trip at 25 mpg with gas at $4.79 per gallon?", + "expect": 91.968 + }, + { + "split": "dev", + "kind": "co2", + "valid": true, + "q": "How much CO2 does a 480 mile trip at 25 mpg emit in a gasoline car?", + "expect": 170.6304 + }, + { + "split": "dev", + "kind": "co2d", + "valid": true, + "q": "How much CO2 does a 480 mile trip at 25 mpg emit in a diesel truck?", + "expect": 195.456 + }, + { + "split": "dev", + "kind": "stop", + "valid": true, + "q": "What is the stopping distance at 50 km/h with a reaction time of 1.5 s and a friction coefficient of 0.8?", + "expect": 33.12736560785504 + }, + { + "split": "dev", + "kind": "brake", + "valid": true, + "q": "What is the braking distance at 50 km/h with a friction coefficient of 0.8?", + "expect": 12.294032274521705 + }, + { + "split": "dev", + "kind": "to_lpk", + "valid": true, + "q": "Convert 35 mpg to L/100 km.", + "expect": 6.720417142857142 + }, + { + "split": "dev", + "kind": "to_mpg", + "valid": true, + "q": "Convert 12.5 L/100 km to mpg.", + "expect": 18.817168 + }, + { + "split": "dev", + "kind": "gal", + "valid": true, + "q": "How many gallons of fuel does a 120 mile trip need at 35 mpg?", + "expect": 3.4285714285714284 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "What is the fuel cost of a 120 mile trip at 35 mpg with gas at $4.25 per gallon?", + "expect": 14.571428571428571 + }, + { + "split": "dev", + "kind": "co2", + "valid": true, + "q": "How much CO2 does a 120 mile trip at 35 mpg emit in a gasoline car?", + "expect": 30.469714285714286 + }, + { + "split": "dev", + "kind": "co2d", + "valid": true, + "q": "How much CO2 does a 120 mile trip at 35 mpg emit in a diesel truck?", + "expect": 34.90285714285714 + }, + { + "split": "dev", + "kind": "stop", + "valid": true, + "q": "What is the stopping distance at 60 km/h with a reaction time of 2 s and a friction coefficient of 0.7?", + "expect": 53.5657978765462 + }, + { + "split": "dev", + "kind": "brake", + "valid": true, + "q": "What is the braking distance at 60 km/h with a friction coefficient of 0.7?", + "expect": 20.232464543212867 + }, + { + "split": "dev", + "kind": "to_lpk", + "valid": true, + "q": "Convert 22 mpg to L/100 km.", + "expect": 10.691572727272726 + }, + { + "split": "dev", + "kind": "to_mpg", + "valid": true, + "q": "Convert 5.9 L/100 km to mpg.", + "expect": 39.8668813559322 + }, + { + "split": "dev", + "kind": "gal", + "valid": true, + "q": "How many gallons of fuel does a 250 mile trip need at 22 mpg?", + "expect": 11.363636363636363 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "What is the fuel cost of a 250 mile trip at 22 mpg with gas at $3.19 per gallon?", + "expect": 36.25 + }, + { + "split": "dev", + "kind": "co2", + "valid": true, + "q": "How much CO2 does a 250 mile trip at 22 mpg emit in a gasoline car?", + "expect": 100.98863636363636 + }, + { + "split": "dev", + "kind": "co2d", + "valid": true, + "q": "How much CO2 does a 250 mile trip at 22 mpg emit in a diesel truck?", + "expect": 115.68181818181817 + }, + { + "split": "dev", + "kind": "stop", + "valid": true, + "q": "What is the stopping distance at 50 km/h with a reaction time of 1 s and a friction coefficient of 0.8?", + "expect": 26.182921163410594 + }, + { + "split": "dev", + "kind": "to_lpk", + "valid": true, + "q": "Convert 50 mpg to L/100 km.", + "expect": 4.704292 + }, + { + "split": "dev", + "kind": "gal", + "valid": true, + "q": "How many gallons of fuel does a 120 mile trip need at 50 mpg?", + "expect": 2.4 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "What is the fuel cost of a 120 mile trip at 50 mpg with gas at $4.25 per gallon?", + "expect": 10.2 + }, + { + "split": "dev", + "kind": "co2", + "valid": true, + "q": "How much CO2 does a 120 mile trip at 50 mpg emit in a gasoline car?", + "expect": 21.3288 + }, + { + "split": "dev", + "kind": "co2d", + "valid": true, + "q": "How much CO2 does a 120 mile trip at 50 mpg emit in a diesel truck?", + "expect": 24.432 + }, + { + "split": "dev", + "kind": "stop", + "valid": true, + "q": "What is the stopping distance at 130 km/h with a reaction time of 0.75 s and a friction coefficient of 0.6?", + "expect": 137.8935442343556 + }, + { + "split": "dev", + "kind": "brake", + "valid": true, + "q": "What is the braking distance at 130 km/h with a friction coefficient of 0.6?", + "expect": 110.81021090102227 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "What is the fuel cost of a 250 mile trip at 22 mpg with gas at $4.25 per gallon?", + "expect": 48.29545454545455 + }, + { + "split": "dev", + "kind": "stop", + "valid": true, + "q": "What is the stopping distance at 50 km/h with a reaction time of 1.5 s and a friction coefficient of 0.5?", + "expect": 40.50378497256806 + }, + { + "split": "dev", + "kind": "brake", + "valid": true, + "q": "What is the braking distance at 50 km/h with a friction coefficient of 0.5?", + "expect": 19.670451639234727 + }, + { + "split": "dev", + "kind": "to_mpg", + "valid": true, + "q": "Convert 7.2 L/100 km to mpg.", + "expect": 32.66869444444444 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "What is the fuel cost of a 300 mile trip at 30 mpg with gas at $3.19 per gallon?", + "expect": 31.9 + }, + { + "split": "dev", + "kind": "stop", + "valid": true, + "q": "What is the stopping distance at 60 km/h with a reaction time of 0.75 s and a friction coefficient of 0.7?", + "expect": 32.73246454321287 + }, + { + "split": "dev", + "kind": "to_lpk", + "valid": true, + "q": "Convert 18 mpg to L/100 km.", + "expect": 13.067477777777777 + }, + { + "split": "dev", + "kind": "to_mpg", + "valid": true, + "q": "Convert 8.4 L/100 km to mpg.", + "expect": 28.001738095238093 + }, + { + "split": "dev", + "kind": "gal", + "valid": true, + "q": "How many gallons of fuel does a 480 mile trip need at 18 mpg?", + "expect": 26.666666666666668 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "What is the fuel cost of a 480 mile trip at 18 mpg with gas at $3.59 per gallon?", + "expect": 95.73333333333333 + }, + { + "split": "dev", + "kind": "co2", + "valid": true, + "q": "How much CO2 does a 480 mile trip at 18 mpg emit in a gasoline car?", + "expect": 236.98666666666668 + }, + { + "split": "dev", + "kind": "co2d", + "valid": true, + "q": "How much CO2 does a 480 mile trip at 18 mpg emit in a diesel truck?", + "expect": 271.4666666666667 + }, + { + "split": "dev", + "kind": "stop", + "valid": true, + "q": "What is the stopping distance at 50 km/h with a reaction time of 1 s and a friction coefficient of 0.7?", + "expect": 27.939211488342266 + }, + { + "split": "dev", + "kind": "brake", + "valid": true, + "q": "What is the braking distance at 50 km/h with a friction coefficient of 0.7?", + "expect": 14.050322599453379 + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What is the stopping distance at 100 km/h?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What is the fuel cost of a 300 mile trip at 30 mpg?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What is the stopping distance at 80 km/h with a friction coefficient of 0.7?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "to_lpk", + "valid": true, + "q": "A car gets 50 miles per gallon. What is that in L/100 km?", + "expect": 4.704292 + }, + { + "split": "heldout", + "kind": "to_mpg", + "valid": true, + "q": "My car uses 4.5 L/100 km. What is that in mpg?", + "expect": 52.26991111111111 + }, + { + "split": "heldout", + "kind": "gal", + "valid": true, + "q": "At 50 mpg, how many gallons of gas will I burn driving 250 miles?", + "expect": 5.0 + }, + { + "split": "heldout", + "kind": "cost", + "valid": true, + "q": "Driving 250 miles in a car that gets 50 mpg, with fuel at $3.19 per gallon, what will the fuel cost be?", + "expect": 15.95 + }, + { + "split": "heldout", + "kind": "co2", + "valid": true, + "q": "Estimate the CO2 emissions of driving 250 miles at 50 mpg on gasoline.", + "expect": 44.435 + }, + { + "split": "heldout", + "kind": "co2d", + "valid": true, + "q": "Estimate the CO2 emissions for a diesel vehicle doing 50 mpg over 250 miles.", + "expect": 50.9 + }, + { + "split": "heldout", + "kind": "stop", + "valid": true, + "q": "Find the total stopping distance from 60 km/h if reaction time is 1 s and the coefficient of friction is 0.6.", + "expect": 40.271208633748344 + }, + { + "split": "heldout", + "kind": "brake", + "valid": true, + "q": "Find the braking distance from 60 km/h on a road with coefficient of friction 0.6.", + "expect": 23.604541967081676 + }, + { + "split": "heldout", + "kind": "to_lpk", + "valid": true, + "q": "A car gets 22 miles per gallon. What is that in L/100 km?", + "expect": 10.691572727272726 + }, + { + "split": "heldout", + "kind": "to_mpg", + "valid": true, + "q": "My car uses 12.5 L/100 km. What is that in mpg?", + "expect": 18.817168 + }, + { + "split": "heldout", + "kind": "gal", + "valid": true, + "q": "At 22 mpg, how many gallons of gas will I burn driving 750 miles?", + "expect": 34.09090909090909 + }, + { + "split": "heldout", + "kind": "cost", + "valid": true, + "q": "Driving 750 miles in a car that gets 22 mpg, with fuel at $4.79 per gallon, what will the fuel cost be?", + "expect": 163.29545454545456 + }, + { + "split": "heldout", + "kind": "co2", + "valid": true, + "q": "Estimate the CO2 emissions of driving 750 miles at 22 mpg on gasoline.", + "expect": 302.9659090909091 + }, + { + "split": "heldout", + "kind": "co2d", + "valid": true, + "q": "Estimate the CO2 emissions for a diesel vehicle doing 22 mpg over 750 miles.", + "expect": 347.04545454545456 + }, + { + "split": "heldout", + "kind": "stop", + "valid": true, + "q": "Find the total stopping distance from 80 km/h if reaction time is 1 s and the coefficient of friction is 0.4.", + "expect": 85.16766746777334 + }, + { + "split": "heldout", + "kind": "brake", + "valid": true, + "q": "Find the braking distance from 80 km/h on a road with coefficient of friction 0.4.", + "expect": 62.94544524555112 + }, + { + "split": "heldout", + "kind": "to_lpk", + "valid": true, + "q": "A car gets 35 miles per gallon. What is that in L/100 km?", + "expect": 6.720417142857142 + }, + { + "split": "heldout", + "kind": "to_mpg", + "valid": true, + "q": "My car uses 10 L/100 km. What is that in mpg?", + "expect": 23.521459999999998 + }, + { + "split": "heldout", + "kind": "gal", + "valid": true, + "q": "At 35 mpg, how many gallons of gas will I burn driving 120 miles?", + "expect": 3.4285714285714284 + }, + { + "split": "heldout", + "kind": "cost", + "valid": true, + "q": "Driving 120 miles in a car that gets 35 mpg, with fuel at $4.79 per gallon, what will the fuel cost be?", + "expect": 16.422857142857143 + }, + { + "split": "heldout", + "kind": "co2", + "valid": true, + "q": "Estimate the CO2 emissions of driving 120 miles at 35 mpg on gasoline.", + "expect": 30.469714285714286 + }, + { + "split": "heldout", + "kind": "co2d", + "valid": true, + "q": "Estimate the CO2 emissions for a diesel vehicle doing 35 mpg over 120 miles.", + "expect": 34.90285714285714 + }, + { + "split": "heldout", + "kind": "stop", + "valid": true, + "q": "Find the total stopping distance from 100 km/h if reaction time is 2 s and the coefficient of friction is 0.4.", + "expect": 153.90781375172918 + }, + { + "split": "heldout", + "kind": "brake", + "valid": true, + "q": "Find the braking distance from 100 km/h on a road with coefficient of friction 0.4.", + "expect": 98.35225819617364 + }, + { + "split": "heldout", + "kind": "to_mpg", + "valid": true, + "q": "My car uses 7.2 L/100 km. What is that in mpg?", + "expect": 32.66869444444444 + }, + { + "split": "heldout", + "kind": "gal", + "valid": true, + "q": "At 35 mpg, how many gallons of gas will I burn driving 250 miles?", + "expect": 7.142857142857143 + }, + { + "split": "heldout", + "kind": "cost", + "valid": true, + "q": "Driving 250 miles in a car that gets 35 mpg, with fuel at $3.59 per gallon, what will the fuel cost be?", + "expect": 25.642857142857142 + }, + { + "split": "heldout", + "kind": "co2", + "valid": true, + "q": "Estimate the CO2 emissions of driving 250 miles at 35 mpg on gasoline.", + "expect": 63.478571428571435 + }, + { + "split": "heldout", + "kind": "co2d", + "valid": true, + "q": "Estimate the CO2 emissions for a diesel vehicle doing 35 mpg over 250 miles.", + "expect": 72.71428571428572 + }, + { + "split": "heldout", + "kind": "stop", + "valid": true, + "q": "Find the total stopping distance from 110 km/h if reaction time is 1.5 s and the coefficient of friction is 0.8.", + "expect": 105.33644954201836 + }, + { + "split": "heldout", + "kind": "brake", + "valid": true, + "q": "Find the braking distance from 110 km/h on a road with coefficient of friction 0.8.", + "expect": 59.503116208685036 + }, + { + "split": "heldout", + "kind": "to_mpg", + "valid": true, + "q": "My car uses 8.4 L/100 km. What is that in mpg?", + "expect": 28.001738095238093 + }, + { + "split": "heldout", + "kind": "gal", + "valid": true, + "q": "At 22 mpg, how many gallons of gas will I burn driving 120 miles?", + "expect": 5.454545454545454 + }, + { + "split": "heldout", + "kind": "cost", + "valid": true, + "q": "Driving 120 miles in a car that gets 22 mpg, with fuel at $4.25 per gallon, what will the fuel cost be?", + "expect": 23.18181818181818 + }, + { + "split": "heldout", + "kind": "co2", + "valid": true, + "q": "Estimate the CO2 emissions of driving 120 miles at 22 mpg on gasoline.", + "expect": 48.474545454545456 + }, + { + "split": "heldout", + "kind": "co2d", + "valid": true, + "q": "Estimate the CO2 emissions for a diesel vehicle doing 22 mpg over 120 miles.", + "expect": 55.527272727272724 + }, + { + "split": "heldout", + "kind": "stop", + "valid": true, + "q": "Find the total stopping distance from 110 km/h if reaction time is 2 s and the coefficient of friction is 0.5.", + "expect": 156.31609704500718 + }, + { + "split": "heldout", + "kind": "brake", + "valid": true, + "q": "Find the braking distance from 110 km/h on a road with coefficient of friction 0.5.", + "expect": 95.20498593389607 + }, + { + "split": "heldout", + "kind": "gal", + "valid": true, + "q": "At 50 mpg, how many gallons of gas will I burn driving 750 miles?", + "expect": 15.0 + }, + { + "split": "heldout", + "kind": "cost", + "valid": true, + "q": "Driving 750 miles in a car that gets 50 mpg, with fuel at $3.59 per gallon, what will the fuel cost be?", + "expect": 53.849999999999994 + }, + { + "split": "heldout", + "kind": "co2", + "valid": true, + "q": "Estimate the CO2 emissions of driving 750 miles at 50 mpg on gasoline.", + "expect": 133.305 + }, + { + "split": "heldout", + "kind": "co2d", + "valid": true, + "q": "Estimate the CO2 emissions for a diesel vehicle doing 50 mpg over 750 miles.", + "expect": 152.7 + }, + { + "split": "heldout", + "kind": "stop", + "valid": true, + "q": "Find the total stopping distance from 130 km/h if reaction time is 1.5 s and the coefficient of friction is 0.4.", + "expect": 220.38198301820006 + }, + { + "split": "heldout", + "kind": "brake", + "valid": true, + "q": "Find the braking distance from 130 km/h on a road with coefficient of friction 0.4.", + "expect": 166.2153163515334 + }, + { + "split": "heldout", + "kind": "stop", + "valid": true, + "q": "Find the total stopping distance from 50 km/h if reaction time is 2 s and the coefficient of friction is 0.6.", + "expect": 44.16982081047338 + }, + { + "split": "heldout", + "kind": "brake", + "valid": true, + "q": "Find the braking distance from 50 km/h on a road with coefficient of friction 0.6.", + "expect": 16.392043032695607 + }, + { + "split": "heldout", + "kind": "gal", + "valid": true, + "q": "At 50 mpg, how many gallons of gas will I burn driving 300 miles?", + "expect": 6.0 + }, + { + "split": "heldout", + "kind": "cost", + "valid": true, + "q": "Driving 300 miles in a car that gets 50 mpg, with fuel at $3.59 per gallon, what will the fuel cost be?", + "expect": 21.54 + }, + { + "split": "heldout", + "kind": "co2", + "valid": true, + "q": "Estimate the CO2 emissions of driving 300 miles at 50 mpg on gasoline.", + "expect": 53.322 + }, + { + "split": "heldout", + "kind": "co2d", + "valid": true, + "q": "Estimate the CO2 emissions for a diesel vehicle doing 50 mpg over 300 miles.", + "expect": 61.08 + }, + { + "split": "heldout", + "kind": "stop", + "valid": true, + "q": "Find the total stopping distance from 100 km/h if reaction time is 1 s and the coefficient of friction is 0.4.", + "expect": 126.13003597395141 + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "Find the braking distance from 90 km/h.", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "Driving 500 miles in a car that gets 25 mpg, what will the fuel cost be?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "Find the total stopping distance from 60 km/h with coefficient of friction 0.6.", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/fleet/fleet_scorer.py b/root/specialists/fleet/fleet_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..da7e9483a4cc49727e580b08af7459e229e10006 --- /dev/null +++ b/root/specialists/fleet/fleet_scorer.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +"""fleet_scorer - the first result number in the REPLY TEXT (after "is", "needs", "costs about $", "emits about") must be +within 0.3% (or one cent) of the panel's formula. A must-decline item answered is a false yes. (ok, asserted).""" +import re + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + m = re.search(r"\b(?:is|needs|costs about|emits about)\s+\$?([\d,]+(?:\.\d+)?)", text) + if not m: + return False, True + got, want = float(m.group(1).replace(",", "")), float(p["expect"]) + return abs(got - want) <= max(0.003 * abs(want), 0.01), True diff --git a/root/specialists/fleet/manifest.json b/root/specialists/fleet/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..323d9855ea741e052275588d2cdd39922a038cc3 --- /dev/null +++ b/root/specialists/fleet/manifest.json @@ -0,0 +1,23 @@ +{ + "id": "fleet", + "name": "Oracle7 Fleet & Vehicle Arithmetic", + "number": 9, + "tier": "B", + "sources": [ + {"name": "EPA 'Greenhouse Gas Emissions from a Typical Passenger Vehicle' (8,887 g CO2/gal gasoline; 10,180 g/gal diesel)", "licence": "public domain (US government)", "url": "https://www.epa.gov/greenvehicles/greenhouse-gas-emissions-typical-passenger-vehicle"}, + {"name": "Exact unit definitions (US gallon 3.785411784 L, mile 1.609344 km, imperial gallon 4.54609 L) and stopping-distance kinematics (OpenStax University Physics)", "licence": "NIST (PD) / CC-BY 4.0", "url": "https://www.nist.gov/pml/owm/si-units"} + ], + "store": {"path": "__ORACLE7_ROOT__/specialists/fleet/organ_fleet_v1.py"}, + "organ": {"dir": "__ORACLE7_ROOT__/specialists/fleet", "module": "organ_fleet_v1", "class": "FleetOrgan", "init": {}}, + "accept": { + "kinds": ["braking", "stopping", "to_lpk", "to_mpg", "co2", "trip_cost", "trip_litres", "trip_gallons"], + "declines_in_domain": ["underspecified", "need_price", "impossible"], + "context_regex": "\\b(?:mpg|l/100\\s*km|fuel|gas|gallons?|stopping distance|braking distance|co2|emissions?|trip)\\b" + }, + "panel": {"path": "__ORACLE7_ROOT__/specialists/fleet/fleet_panel_v1.json", "splits": ["dev", "heldout"], + "exclude_kinds_composed": [], "scorer_module": "fleet_scorer", "scorer_fn": "ok"}, + "routing_cues": ["mpg", "L/100 km", "fuel cost", "gallons for a trip", "CO2 emissions", "stopping distance", "braking distance"], + "budgets": {"latency_p50_ms": 50, "store_mb": 1}, + "core_sample": {"n": 400, "seed": 20260928}, + "notes": "Constants stated in every answer. Never assumes a fuel price, a reaction time or a friction coefficient (stopping distance declines without them; braking distance needs only friction). Conversion mpg <-> L/100 km only when no trip distance is given." +} diff --git a/root/specialists/fleet/narrow_v1.py b/root/specialists/fleet/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/fleet/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/fleet/organ_fleet_v1.py b/root/specialists/fleet/organ_fleet_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..ca5bf2e603ff97b87783776b63e64827e90d0e9f --- /dev/null +++ b/root/specialists/fleet/organ_fleet_v1.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python3 +"""organ_fleet_v1 - vehicle and fleet arithmetic, every constant stated: fuel economy conversion (US mpg <-> L/100 km: +L/100km = 235.2146 / mpg; UK mpg uses the imperial gallon, 282.4809 / mpg), fuel needed for a trip, its cost at a stated +price, cost per mile / km, tailpipe CO2 from fuel burned (EPA: 8,887 g per gallon of gasoline, 10,180 g per gallon of +diesel), and stopping distance = reaction distance + braking distance (v t + v^2 / (2 mu g), g = 9.80665) with the +reaction time and friction coefficient STATED (never assumed). Returns {kind, status, response, value}.""" +from __future__ import annotations + +import re + +from narrow_v1 import narrative, short_direct + +N = r"(\d+(?:,\d{3})*(?:\.\d+)?)" +G0 = 9.80665 +L_PER_GAL, KM_PER_MI = 3.785411784, 1.609344 +CO2 = {"gasoline": 8887.0, "petrol": 8887.0, "gas": 8887.0, "diesel": 10180.0} + + +def num(s): + return float(s.replace(",", "")) + + +def g(x): + return "%.4g" % x + + +def money(x): + return "$" + format(round(x, 2), ",.2f") + + +class FleetOrgan: + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def _need(self, what): + return self._say("underspecified", "I need %s to work that out; I won't assume it." % what, status="withheld") + + def answer(self, text, session_id="default"): + # narrow_v1: multi-part / story word problems belong to the head (core sweep: a road-trip problem was + # answered with the wrong part); declines only on short direct questions + if narrative(text): + return None + r = self._answer(text, session_id) + if r and r.get("status") != "answered" and not short_direct(text): + return None + return r + + def _answer(self, text, session_id="default"): + t = " ".join(str(text or "").split()) + low = t.lower() + mpg = re.search(N + r"\s*(?:us\s+)?(uk\s+|imperial\s+)?mpg\b|" + N + r"\s*miles per (?:us\s+)?(imperial\s+)?gallon\b", low) + lpk = re.search(N + r"\s*(?:l|liters?|litres?)\s*(?:/|per)\s*100\s*km\b", low) + # stopping distance + if re.search(r"\bstopping distance\b|\bdistance to stop\b|\bhow far .* to stop\b|\bbraking distance\b", low): + v = re.search(N + r"\s*(km/h|kph|mph|m/s)\b", low) + mu = re.search(r"\b(?:friction(?: coefficient)?|coefficient of friction|mu|μ)\s*(?:of|is|=)?\s*(0?\.\d+|\d(?:\.\d+)?)", low) + rt = re.search(r"\breaction time\s*(?:of|is|=)?\s*" + N + r"\s*(?:s|sec|seconds?)\b|" + N + r"\s*(?:s|sec|seconds?)\s*reaction\b", low) + if not v or not mu: + return self._need("the speed and the tyre-road friction coefficient") + ms = num(v.group(1)) * {"km/h": 1 / 3.6, "kph": 1 / 3.6, "mph": 0.44704, "m/s": 1}[v.group(2)] + m_ = float(mu.group(1)) + if m_ <= 0: + return self._say("impossible", "A friction coefficient must be above zero.", status="withheld") + brake = ms * ms / (2 * m_ * G0) + if re.search(r"\bbraking distance\b", low) and not re.search(r"\bstopping distance\b", low): + return self._say("braking", "The braking distance is %s m (v²/(2μg) with v = %s m/s, μ = %s)." % (g(brake), g(ms), g(m_)), brake) + if not rt: + return self._need("the driver's reaction time (stopping distance includes it)") + react = ms * num(rt.group(1) or rt.group(2)) + return self._say("stopping", "The stopping distance is %s m (%s m reacting + %s m braking; v = %s m/s, μ = %s, g = 9.80665)." % ( + g(react + brake), g(react), g(brake), g(ms), g(m_)), react + brake) + dist = re.search(N + r"\s*(miles?|mi|km|kilometers?|kilometres?)\b(?!\s*(?:per|/)\s*(?:hour|h|gallon|liter|litre))", + re.sub(r"100\s*km|miles per (?:us\s+|imperial\s+)?gallon", "", low)) + # conversion mpg <-> L/100 km: only when no trip distance is stated + if not dist and (mpg or lpk) and re.search(r"\bconvert\b|\bl/100\s*km\b|\bliters? per 100|\blitres? per 100|\bmpg\b|\bmiles per gallon\b", low): + if mpg and re.search(r"l/100|liters? per 100|litres? per 100", low): + x = num(mpg.group(1) or mpg.group(3)); uk = bool(mpg.group(2) or mpg.group(4)) + v = (282.4809 if uk else 235.2146) / x + return self._say("to_lpk", "That is %s L/100 km (%s / %s %s mpg)." % (g(v), "282.4809" if uk else "235.2146", g(x), "UK" if uk else "US"), v) + if lpk and re.search(r"\bmpg\b|miles per gallon", low): + x = num(lpk.group(1)) + uk = bool(re.search(r"\buk\b|\bimperial\b", low)) + v = (282.4809 if uk else 235.2146) / x + return self._say("to_mpg", "That is %s %s mpg (%s / %s L/100 km)." % (g(v), "UK" if uk else "US", "282.4809" if uk else "235.2146", g(x)), v) + # trip fuel / cost / CO2 + if dist and (mpg or lpk) and re.search(r"\bfuel\b|\bgas\b|\bgallons?\b|\bliters?\b|\blitres?\b|\bcost\b|\bco2\b|\bcarbon\b|\bemissions?\b|\bspend\b", low): + d = num(dist.group(1)) + miles = d if dist.group(2).startswith("mi") else d / KM_PER_MI + if mpg: + e = num(mpg.group(1) or mpg.group(3)) + gal = miles / e if not (mpg.group(2) or mpg.group(4)) else miles / e * 4.54609 / L_PER_GAL + else: + gal = (miles * KM_PER_MI) * num(lpk.group(1)) / 100 / L_PER_GAL + litres = gal * L_PER_GAL + if re.search(r"\bco2\b|\bcarbon\b|\bemissions?\b", low): + fuel = "diesel" if "diesel" in low else "gasoline" + kg = gal * CO2[fuel] / 1000 + return self._say("co2", "The trip emits about %s kg of CO2 (%s US gallons of %s × %s g/gal, EPA)." % (g(kg), g(gal), fuel, format(int(CO2[fuel]), ",")), kg) + price = re.search(r"\$\s*" + N + r"\s*(?:per|/|a)\s*(gallon|gal|liter|litre|l)\b", low) + if re.search(r"\bcost\b|\bspend\b|\bhow much money\b|\bprice\b", low): + if not price: + return self._say("need_price", "It needs %s US gallons (%s L); give me the fuel price and I'll cost it." % (g(gal), g(litres)), status="withheld") + p = num(price.group(1)) + cost = gal * p if price.group(2).startswith("gal") else litres * p + per = cost / (miles if dist.group(2).startswith("mi") else d) + return self._say("trip_cost", "The fuel costs about %s (%s US gallons at %s per %s; %s per %s)." % ( + money(cost), g(gal), money(p), "gallon" if price.group(2).startswith("gal") else "litre", "$%.3f" % per, "mile" if dist.group(2).startswith("mi") else "km"), cost) + if re.search(r"\bliters?\b|\blitres?\b", low) and not re.search(r"\bgallons?\b", low): + return self._say("trip_litres", "The trip needs %s L of fuel (%s US gallons)." % (g(litres), g(gal)), litres) + return self._say("trip_gallons", "The trip needs %s US gallons of fuel (%s L)." % (g(gal), g(litres)), gal) + return None diff --git a/root/specialists/fleet/verdict_dev.json b/root/specialists/fleet/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..c22e5331c0a2f4727d1ef9fb874ce62947e00328 --- /dev/null +++ b/root/specialists/fleet/verdict_dev.json @@ -0,0 +1,111 @@ +{ + "id": "fleet", + "name": "Oracle7 Fleet & Vehicle Arithmetic", + "tier": "B", + "split": "dev", + "head": "oracle_release_runtime_w363", + "time": "2026-09-29T03:19:32Z", + "domain": { + "head": { + "correct": 2, + "false_yes": 1, + "n": 54, + "p50_ms": 41.82, + "fails": [ + [ + "to_lpk", + "Convert 30 mpg to L/100 km.", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "to_mpg", + "Convert 10 L/100 km to mpg.", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "gal", + "How many gallons of fuel does a 300 mile trip need at 30 mpg?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "cost", + "What is the fuel cost of a 300 mile trip at 30 mpg with gas at $3.89 p", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "co2", + "How much CO2 does a 300 mile trip at 30 mpg emit in a gasoline car?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "co2d", + "How much CO2 does a 300 mile trip at 30 mpg emit in a diesel truck?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "stop", + "What is the stopping distance at 60 km/h with a reaction time of 1 s a", + "arb:definitional->document_runtime|subst", + "[ev:unknown] I have no admitted entry for \u201cstopping distance at 60 km/h with a reaction ti" + ], + [ + "brake", + "What is the braking distance at 60 km/h with a friction coefficient of", + "arb:definitional->document_runtime|subst", + "[ev:unknown] I have no admitted entry for \u201cbraking distance at 60 km/h with a friction coe" + ] + ] + }, + "spec": { + "correct": 54, + "false_yes": 0, + "n": 54, + "p50_ms": 0.03, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/fleet/verdict_heldout.json b/root/specialists/fleet/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..25fe7a1bf3d643d09013678a671c6b03538a3949 --- /dev/null +++ b/root/specialists/fleet/verdict_heldout.json @@ -0,0 +1,111 @@ +{ + "id": "fleet", + "name": "Oracle7 Fleet & Vehicle Arithmetic", + "tier": "B", + "split": "heldout", + "head": "oracle_release_runtime_w363", + "time": "2026-09-29T03:23:32Z", + "domain": { + "head": { + "correct": 2, + "false_yes": 1, + "n": 54, + "p50_ms": 56.39, + "fails": [ + [ + "to_lpk", + "A car gets 50 miles per gallon. What is that in L/100 km?", + "act:clarify_specific", + "What does \"that\" refer to? Nothing earlier in this conversation names it. Tell me the name" + ], + [ + "to_mpg", + "My car uses 4.5 L/100 km. What is that in mpg?", + "act:clarify_specific", + "What does \"that\" refer to? Nothing earlier in this conversation names it. Tell me the name" + ], + [ + "gal", + "At 50 mpg, how many gallons of gas will I burn driving 250 miles?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "cost", + "Driving 250 miles in a car that gets 50 mpg, with fuel at $3.19 per ga", + "act:clarify_specific", + "What does \"that\" refer to? Nothing earlier in this conversation names it. Tell me the name" + ], + [ + "co2", + "Estimate the CO2 emissions of driving 250 miles at 50 mpg on gasoline.", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "co2d", + "Estimate the CO2 emissions for a diesel vehicle doing 50 mpg over 250 ", + "organ:converse>statement", + "Got it. Since you mention vehicle: A vehicle ( ) is a machine designed for self-propulsion" + ], + [ + "stop", + "Find the total stopping distance from 60 km/h if reaction time is 1 s ", + "operator:unparsed|vessel:receipt", + "That is a word problem. My exact operators read short forms (a sum, a mean, a choose, a li" + ], + [ + "brake", + "Find the braking distance from 60 km/h on a road with coefficient of f", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 54, + "false_yes": 0, + "n": 54, + "p50_ms": 0.06, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/fluids/fluids_panel_v1.json b/root/specialists/fluids/fluids_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..d5bb25947b8d2a8529ccffec1928ed2593efc149 --- /dev/null +++ b/root/specialists/fluids/fluids_panel_v1.json @@ -0,0 +1,478 @@ +[ + { + "split": "dev", + "kind": "pressure_gauge", + "valid": true, + "q": "What is the pressure 5 m deep in olive oil?", + "expect": 44669.29075 + }, + { + "split": "dev", + "kind": "pressure_abs", + "valid": true, + "q": "What is the absolute pressure at a depth of 3 m in fresh water?", + "expect": 130744.95 + }, + { + "split": "dev", + "kind": "buoyant_force", + "valid": true, + "q": "What is the buoyant force on 2 m3 fully submerged in olive oil?", + "expect": 17867.7163 + }, + { + "split": "dev", + "kind": "submerged_fraction", + "valid": true, + "q": "A block of aluminium floats in mercury. What fraction of it is below the surface?", + "expect": 0.1995034580599397 + }, + { + "split": "dev", + "kind": "pressure_gauge", + "valid": true, + "q": "What is the pressure 30 m deep in fresh water?", + "expect": 294199.5 + }, + { + "split": "dev", + "kind": "pressure_abs", + "valid": true, + "q": "What is the absolute pressure at a depth of 12 m in fresh water?", + "expect": 219004.8 + }, + { + "split": "dev", + "kind": "buoyant_force", + "valid": true, + "q": "What is the buoyant force on 8 m3 fully submerged in fresh water?", + "expect": 78453.2 + }, + { + "split": "dev", + "kind": "submerged_fraction", + "valid": true, + "q": "A block of ice floats in fresh water. What fraction of it is below the surface?", + "expect": 0.917 + }, + { + "split": "dev", + "kind": "pressure_gauge", + "valid": true, + "q": "What is the pressure 5 m deep in fresh water?", + "expect": 49033.25 + }, + { + "split": "dev", + "kind": "pressure_abs", + "valid": true, + "q": "What is the absolute pressure at a depth of 12 m in fresh water?", + "expect": 219004.8 + }, + { + "split": "dev", + "kind": "buoyant_force", + "valid": true, + "q": "What is the buoyant force on 8 m3 fully submerged in sea water?", + "expect": 80414.53 + }, + { + "split": "dev", + "kind": "submerged_fraction", + "valid": true, + "q": "A block of aluminium floats in mercury. What fraction of it is below the surface?", + "expect": 0.1995034580599397 + }, + { + "split": "dev", + "kind": "pressure_gauge", + "valid": true, + "q": "What is the pressure 30 m deep in sea water?", + "expect": 301554.4875 + }, + { + "split": "dev", + "kind": "pressure_abs", + "valid": true, + "q": "What is the absolute pressure at a depth of 12 m in sea water?", + "expect": 221946.79499999998 + }, + { + "split": "dev", + "kind": "buoyant_force", + "valid": true, + "q": "What is the buoyant force on 8 m3 fully submerged in sea water?", + "expect": 80414.53 + }, + { + "split": "dev", + "kind": "submerged_fraction", + "valid": true, + "q": "A block of ice floats in sea water. What fraction of it is below the surface?", + "expect": 0.8946341463414634 + }, + { + "split": "dev", + "kind": "pressure_gauge", + "valid": true, + "q": "What is the pressure 10 m deep in fresh water?", + "expect": 98066.5 + }, + { + "split": "dev", + "kind": "pressure_abs", + "valid": true, + "q": "What is the absolute pressure at a depth of 12 m in fresh water?", + "expect": 219004.8 + }, + { + "split": "dev", + "kind": "buoyant_force", + "valid": true, + "q": "What is the buoyant force on 8 m3 fully submerged in sea water?", + "expect": 80414.53 + }, + { + "split": "dev", + "kind": "submerged_fraction", + "valid": true, + "q": "A block of steel floats in mercury. What fraction of it is below the surface?", + "expect": 0.5800378317668617 + }, + { + "split": "dev", + "kind": "pressure_gauge", + "valid": true, + "q": "What is the pressure 10 m deep in mercury?", + "expect": 1327192.7844 + }, + { + "split": "dev", + "kind": "pressure_abs", + "valid": true, + "q": "What is the absolute pressure at a depth of 250 m in fresh water?", + "expect": 2552987.5 + }, + { + "split": "dev", + "kind": "buoyant_force", + "valid": true, + "q": "What is the buoyant force on 0.2 m3 fully submerged in sea water?", + "expect": 2010.36325 + }, + { + "split": "dev", + "kind": "submerged_fraction", + "valid": true, + "q": "A block of copper floats in mercury. What fraction of it is below the surface?", + "expect": 0.6600608854997931 + }, + { + "split": "dev", + "kind": "pressure_gauge", + "valid": true, + "q": "What is the pressure 2 m deep in mercury?", + "expect": 265438.55688 + }, + { + "split": "dev", + "kind": "pressure_abs", + "valid": true, + "q": "What is the absolute pressure at a depth of 12 m in sea water?", + "expect": 221946.79499999998 + }, + { + "split": "dev", + "kind": "buoyant_force", + "valid": true, + "q": "What is the buoyant force on 2 m3 fully submerged in fresh water?", + "expect": 19613.3 + }, + { + "split": "dev", + "kind": "submerged_fraction", + "valid": true, + "q": "A block of glass floats in mercury. What fraction of it is below the surface?", + "expect": 0.1847254241295738 + }, + { + "split": "dev", + "kind": "pressure_gauge", + "valid": true, + "q": "What is the pressure 2 m deep in mercury?", + "expect": 265438.55688 + }, + { + "split": "dev", + "kind": "pressure_abs", + "valid": true, + "q": "What is the absolute pressure at a depth of 40 m in sea water?", + "expect": 503397.65 + }, + { + "split": "dev", + "kind": "buoyant_force", + "valid": true, + "q": "What is the buoyant force on 0.01 m3 fully submerged in ethanol?", + "expect": 77.37446849999999 + }, + { + "split": "dev", + "kind": "submerged_fraction", + "valid": true, + "q": "A block of aluminium floats in mercury. What fraction of it is below the surface?", + "expect": 0.1995034580599397 + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What is the pressure deep in sea water?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What is the buoyant force on a rock in fresh water?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "pressure_gauge", + "valid": true, + "q": "A diver is 5 m below the surface of mercury. What pressure does the mercury exert there?", + "expect": 663596.3922 + }, + { + "split": "heldout", + "kind": "pressure_abs", + "valid": true, + "q": "Find the total (absolute) pressure 40 m down in sea water.", + "expect": 503397.65 + }, + { + "split": "heldout", + "kind": "buoyant_force", + "valid": true, + "q": "An object displaces 0.2 m3 of fresh water. How much buoyant force acts on it?", + "expect": 1961.33 + }, + { + "split": "heldout", + "kind": "submerged_fraction", + "valid": true, + "q": "If a piece of ice is floating in fresh water, what fraction sits below the surface?", + "expect": 0.917 + }, + { + "split": "heldout", + "kind": "pressure_gauge", + "valid": true, + "q": "A diver is 30 m below the surface of mercury. What pressure does the mercury exert there?", + "expect": 3981578.3532 + }, + { + "split": "heldout", + "kind": "pressure_abs", + "valid": true, + "q": "Find the total (absolute) pressure 40 m down in sea water.", + "expect": 503397.65 + }, + { + "split": "heldout", + "kind": "buoyant_force", + "valid": true, + "q": "An object displaces 0.01 m3 of sea water. How much buoyant force acts on it?", + "expect": 100.5181625 + }, + { + "split": "heldout", + "kind": "submerged_fraction", + "valid": true, + "q": "If a piece of ice is floating in sea water, what fraction sits below the surface?", + "expect": 0.8946341463414634 + }, + { + "split": "heldout", + "kind": "pressure_gauge", + "valid": true, + "q": "A diver is 2 m below the surface of mercury. What pressure does the mercury exert there?", + "expect": 265438.55688 + }, + { + "split": "heldout", + "kind": "pressure_abs", + "valid": true, + "q": "Find the total (absolute) pressure 3 m down in fresh water.", + "expect": 130744.95 + }, + { + "split": "heldout", + "kind": "buoyant_force", + "valid": true, + "q": "An object displaces 0.5 m3 of olive oil. How much buoyant force acts on it?", + "expect": 4466.929075 + }, + { + "split": "heldout", + "kind": "submerged_fraction", + "valid": true, + "q": "If a piece of steel is floating in mercury, what fraction sits below the surface?", + "expect": 0.5800378317668617 + }, + { + "split": "heldout", + "kind": "pressure_gauge", + "valid": true, + "q": "A diver is 2 m below the surface of fresh water. What pressure does the fresh water exert there?", + "expect": 19613.3 + }, + { + "split": "heldout", + "kind": "pressure_abs", + "valid": true, + "q": "Find the total (absolute) pressure 3 m down in fresh water.", + "expect": 130744.95 + }, + { + "split": "heldout", + "kind": "buoyant_force", + "valid": true, + "q": "An object displaces 8 m3 of ethanol. How much buoyant force acts on it?", + "expect": 61899.574799999995 + }, + { + "split": "heldout", + "kind": "submerged_fraction", + "valid": true, + "q": "If a piece of copper is floating in mercury, what fraction sits below the surface?", + "expect": 0.6600608854997931 + }, + { + "split": "heldout", + "kind": "pressure_gauge", + "valid": true, + "q": "A diver is 100 m below the surface of sea water. What pressure does the sea water exert there?", + "expect": 1005181.625 + }, + { + "split": "heldout", + "kind": "pressure_abs", + "valid": true, + "q": "Find the total (absolute) pressure 12 m down in sea water.", + "expect": 221946.79499999998 + }, + { + "split": "heldout", + "kind": "buoyant_force", + "valid": true, + "q": "An object displaces 8 m3 of sea water. How much buoyant force acts on it?", + "expect": 80414.53 + }, + { + "split": "heldout", + "kind": "submerged_fraction", + "valid": true, + "q": "If a piece of ice is floating in sea water, what fraction sits below the surface?", + "expect": 0.8946341463414634 + }, + { + "split": "heldout", + "kind": "pressure_gauge", + "valid": true, + "q": "A diver is 30 m below the surface of mercury. What pressure does the mercury exert there?", + "expect": 3981578.3532 + }, + { + "split": "heldout", + "kind": "pressure_abs", + "valid": true, + "q": "Find the total (absolute) pressure 3 m down in sea water.", + "expect": 131480.44875 + }, + { + "split": "heldout", + "kind": "buoyant_force", + "valid": true, + "q": "An object displaces 0.01 m3 of mercury. How much buoyant force acts on it?", + "expect": 1327.1927844 + }, + { + "split": "heldout", + "kind": "submerged_fraction", + "valid": true, + "q": "If a piece of ice is floating in sea water, what fraction sits below the surface?", + "expect": 0.8946341463414634 + }, + { + "split": "heldout", + "kind": "pressure_gauge", + "valid": true, + "q": "A diver is 10 m below the surface of fresh water. What pressure does the fresh water exert there?", + "expect": 98066.5 + }, + { + "split": "heldout", + "kind": "pressure_abs", + "valid": true, + "q": "Find the total (absolute) pressure 12 m down in fresh water.", + "expect": 219004.8 + }, + { + "split": "heldout", + "kind": "buoyant_force", + "valid": true, + "q": "An object displaces 2 m3 of fresh water. How much buoyant force acts on it?", + "expect": 19613.3 + }, + { + "split": "heldout", + "kind": "submerged_fraction", + "valid": true, + "q": "If a piece of copper is floating in mercury, what fraction sits below the surface?", + "expect": 0.6600608854997931 + }, + { + "split": "heldout", + "kind": "pressure_gauge", + "valid": true, + "q": "A diver is 10 m below the surface of olive oil. What pressure does the olive oil exert there?", + "expect": 89338.5815 + }, + { + "split": "heldout", + "kind": "pressure_abs", + "valid": true, + "q": "Find the total (absolute) pressure 12 m down in fresh water.", + "expect": 219004.8 + }, + { + "split": "heldout", + "kind": "buoyant_force", + "valid": true, + "q": "An object displaces 2 m3 of olive oil. How much buoyant force acts on it?", + "expect": 17867.7163 + }, + { + "split": "heldout", + "kind": "submerged_fraction", + "valid": true, + "q": "If a piece of aluminium is floating in mercury, what fraction sits below the surface?", + "expect": 0.1995034580599397 + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "How much buoyant force acts on a log floating in sea water?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "What is the absolute pressure deep under fresh water?", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/fluids/fluids_panel_v1.py b/root/specialists/fluids/fluids_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..210a5b22d5cec10dfe93c80e7f3a86fb5819fc83 --- /dev/null +++ b/root/specialists/fluids/fluids_panel_v1.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 +"""fluids_panel_v1 - the sealed panel for specialist #103 (fluid statics). Answers from the panel's OWN densities and +formulas (g = 9.80665, P0 = 101325 Pa), written here separately from the organ. Dev / held-out differ in seed and +phrasing (same author - disclosed). Must-decline: depth or volume missing. +usage: fluids_panel_v1.py """ +import json +import random +import sys + +G, ATM = 9.80665, 101325.0 +FL = {"fresh water": 1000.0, "sea water": 1025.0, "mercury": 13533.6, "olive oil": 911.0, "ethanol": 789.0} +SOL = {"ice": 917.0, "aluminium": 2700.0, "steel": 7850.0, "glass": 2500.0, "copper": 8933.0} +T = {"dev": {"gauge": "What is the pressure {h} m deep in {f}?", + "abs": "What is the absolute pressure at a depth of {h} m in {f}?", + "buoy": "What is the buoyant force on {v} m3 fully submerged in {f}?", + "frac": "A block of {s} floats in {f}. What fraction of it is below the surface?"}, + "heldout": {"gauge": "A diver is {h} m below the surface of {f}. What pressure does the {f} exert there?", + "abs": "Find the total (absolute) pressure {h} m down in {f}.", + "buoy": "An object displaces {v} m3 of {f}. How much buoyant force acts on it?", + "frac": "If a piece of {s} is floating in {f}, what fraction sits below the surface?"}} +DECLINE = {"dev": ["What is the pressure deep in sea water?", "What is the buoyant force on a rock in fresh water?"], + "heldout": ["How much buoyant force acts on a log floating in sea water?", "What is the absolute pressure deep under fresh water?"]} + + +def main(): + items = [] + for split, seed in (("dev", 103), ("heldout", 10303)): + rng = random.Random(seed) + t = T[split] + for _ in range(8): + f = rng.choice(["fresh water", "sea water", "mercury", "olive oil"]) + h = rng.choice([2, 5, 10, 30, 100]) + items.append({"split": split, "kind": "pressure_gauge", "valid": True, "q": t["gauge"].format(h=h, f=f), "expect": FL[f] * G * h}) + f = rng.choice(["fresh water", "sea water"]) + h = rng.choice([3, 12, 40, 250]) + items.append({"split": split, "kind": "pressure_abs", "valid": True, "q": t["abs"].format(h=h, f=f), "expect": ATM + FL[f] * G * h}) + f = rng.choice(sorted(FL)) + v = rng.choice([0.01, 0.2, 0.5, 2, 8]) + items.append({"split": split, "kind": "buoyant_force", "valid": True, "q": t["buoy"].format(v=v, f=f), "expect": FL[f] * G * v}) + s, f = rng.choice([("ice", "fresh water"), ("ice", "sea water"), ("aluminium", "mercury"), ("steel", "mercury"), + ("glass", "mercury"), ("copper", "mercury")]) + items.append({"split": split, "kind": "submerged_fraction", "valid": True, "q": t["frac"].format(s=s, f=f), "expect": SOL[s] / FL[f]}) + for q in DECLINE[split]: + items.append({"split": split, "kind": "decline", "valid": False, "q": q, "expect": "decline"}) + json.dump(items, open(sys.argv[1], "w"), indent=1) + import collections + print("panel:", dict(collections.Counter((i["split"], i["kind"]) for i in items))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/fluids/fluids_scorer.py b/root/specialists/fluids/fluids_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..80a333fddc3ca0679af36f7f59c7d5f6afd95cfc --- /dev/null +++ b/root/specialists/fluids/fluids_scorer.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +"""fluids_scorer - the first number after "is about" / "takes about" / "at about" in the REPLY TEXT within 0.5% of the +panel's own value; a must-decline item answered is a false yes. (ok, asserted)""" +import re + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + m = re.search(r"\b(?:is|takes|at) about\s+(-?\d+(?:\.\d+)?(?:e[+-]?\d+)?)", text) + if not m: + return False, True + got, want = float(m.group(1)), float(p["expect"]) + return abs(got - want) <= 0.005 * abs(want) + 1e-9, True diff --git a/root/specialists/fluids/manifest.json b/root/specialists/fluids/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..6001826ef956b94254a9360fe3fad6c8206749e1 --- /dev/null +++ b/root/specialists/fluids/manifest.json @@ -0,0 +1,66 @@ +{ + "id": "fluids", + "name": "Oracle7 Fluid Statics", + "number": 103, + "tier": "A", + "sources": [ + { + "name": "Hydrostatics and Archimedes' principle (P = rho g h, F = rho g V); standard gravity 9.80665 m/s^2, standard atmosphere 101,325 Pa", + "licence": "public domain (physical law; NIST constants)", + "url": "https://physics.nist.gov/cuu/Constants/" + }, + { + "name": "Fluid densities: the densities specialist's table (PubChem for mercury; typical values near 20 C)", + "licence": "facts", + "url": "https://pubchem.ncbi.nlm.nih.gov/" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/fluids/organ_fluids_v1.py" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/fluids", + "module": "organ_fluids_v1", + "class": "FluidsOrgan", + "init": {} + }, + "accept": { + "kinds": [ + "pressure_gauge", + "pressure_abs", + "buoyant_force", + "submerged_fraction", + "sinks" + ], + "declines_in_domain": [ + "underspecified" + ], + "context_regex": "\b(?:pressure|buoyan\\w*|upthrust|submerged|floats?)\b" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/fluids/fluids_panel_v1.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "fluids_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [ + "deep in", + "below the surface", + "buoyant force", + "absolute pressure", + "fraction below" + ], + "budgets": { + "latency_p50_ms": 50, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "notes": "Gauge pressure unless absolute is asked; buoyancy for the displaced volume; floating fraction = density ratio. Panel answers from the panel's own table, written separately; dev/held-out differ in seed and phrasing (same author)." +} \ No newline at end of file diff --git a/root/specialists/fluids/narrow_v1.py b/root/specialists/fluids/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/fluids/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/fluids/organ_fluids_v1.py b/root/specialists/fluids/organ_fluids_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..a237fe47d324566fe42413efc57682636007fd55 --- /dev/null +++ b/root/specialists/fluids/organ_fluids_v1.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python3 +"""organ_fluids_v1 - specialist #103 (fluid statics): hydrostatic pressure at a depth (gauge, or absolute when asked, with +standard atmosphere 101,325 Pa), the buoyant force on a submerged volume (Archimedes), and the fraction of a floating +solid that sits below the surface. Fluid and solid densities are the densities specialist's table (typical values near +20 C; water 1000 kg/m3); g = 9.80665 m/s^2. Formulas shown. Declines a question missing the depth or volume it needs. +Returns {kind, status, response, value}.""" +from __future__ import annotations + +import re + +from narrow_v1 import last_sentence, narrative, short_direct + +G, ATM = 9.80665, 101325.0 +FLUIDS = {"fresh water": (1000.0, r"(?:fresh |pure )?water"), "sea water": (1025.0, r"sea ?water|salt water|the sea|the ocean|ocean"), + "mercury": (13533.6, r"mercury"), "petrol": (745.0, r"petrol|gasoline"), "diesel": (832.0, r"diesel"), + "ethanol": (789.0, r"ethanol"), "olive oil": (911.0, r"olive oil"), "honey": (1420.0, r"honey"), "milk": (1030.0, r"milk")} +SOLIDS = {"ice": 917.0, "aluminium": 2700.0, "steel": 7850.0, "concrete": 2400.0, "glass": 2500.0, "granite": 2700.0, + "iron": 7874.0, "copper": 8933.0, "gold": 19282.0, "lead": 11342.0, "brass": 8500.0} +NUM = r"(\d+(?:,\d{3})*(?:\.\d+)?)" +DEPTH = re.compile(NUM + r"\s*(?:m|met(?:re|er)s?)\b(?!\s*/|\s*per|\s*\^|\s*3|³)\s*(?:deep|down|below|under|beneath|depth)?", re.I) +VOLUME = [(re.compile(NUM + r"\s*(?:m3|m\^3|m³|cubic met(?:re|er)s?)", re.I), 1.0), + (re.compile(NUM + r"\s*(?:litres?|liters?|l)\b", re.I), 1e-3), + (re.compile(NUM + r"\s*(?:cm3|cm\^3|cm³|cubic centimet(?:re|er)s?)", re.I), 1e-6)] + + +def g4(x): + return "%.4g" % x + + +def _n(s): + return float(s.replace(",", "")) + + +class FluidsOrgan: + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def _fluid(self, t): + found = [k for k, (_, rx) in FLUIDS.items() if re.search(r"\b(?:%s)\b" % rx, t, re.I)] + if "sea water" in found and "fresh water" in found: + found.remove("fresh water") + return found[0] if len(found) == 1 else None + + def answer(self, text, session_id="default"): + t = " ".join(str(text or "").split()) + if not t or narrative(t): + return None + ask = last_sentence(t) + fl = self._fluid(t) + if re.search(r"\bpressure\b", ask, re.I) and re.search(r"\b(?:deep|depth|below|under|beneath|down)\b", t, re.I): + if fl is None: + return None + d = DEPTH.findall(t) + if len(d) != 1: + return self._need("a depth", t) + h, rho = _n(d[0]), FLUIDS[fl][0] + p = rho * G * h + if re.search(r"\b(?:absolute|total)\b", t, re.I): + return self._say("pressure_abs", "The absolute pressure is about %s Pa (%s kPa) at %s m in %s (P = P₀ + ρ·g·h = 101325 + %s·9.80665·%s)." % ( + g4(p + ATM), g4((p + ATM) / 1000), g4(h), fl, g4(rho), g4(h)), p + ATM) + return self._say("pressure_gauge", "The gauge pressure is about %s Pa (%s kPa) at %s m in %s (P = ρ·g·h = %s·9.80665·%s; add 101325 Pa for absolute)." % ( + g4(p), g4(p / 1000), g4(h), fl, g4(rho), g4(h)), p) + if re.search(r"\bbuoyan\w*\b|\bupthrust\b", t, re.I) and re.search(r"\bforce\b|\bupthrust\b|\bhow much\b", ask, re.I): + if fl is None: + return None + vols = [(_n(x.group(1)) * f) for rx, f in VOLUME for x in rx.finditer(t)] + if len(vols) != 1: + return self._need("the submerged volume", t) + v, rho = vols[0], FLUIDS[fl][0] + fb = rho * G * v + return self._say("buoyant_force", "The buoyant force is about %s N (F = ρ·g·V = %s·9.80665·%s m³ of %s displaced)." % ( + g4(fb), g4(rho), g4(v), fl), fb) + if re.search(r"\b(?:fraction|percent(?:age)?|how much)\b.*\b(?:below|under|submerged|beneath)\b", ask, re.I) and re.search(r"\bfloat", t, re.I): + if fl is None: + return None + sol = [k for k in SOLIDS if SOLIDS[k] and re.search(r"\b%s\b" % re.escape(k), t, re.I)] + if len(sol) != 1: + return None + rs, rf = SOLIDS[sol[0]], FLUIDS[fl][0] + if rs >= rf: + return self._say("sinks", "It does not float: %s (about %s kg/m³) is denser than %s (about %s kg/m³), so all of it sinks." % ( + sol[0], g4(rs), fl, g4(rf)), None) + frac = rs / rf + return self._say("submerged_fraction", "The submerged fraction is about %s (%s%%) of a floating piece of %s in %s (fraction = ρ_solid/ρ_fluid = %s/%s)." % ( + g4(frac), g4(100 * frac), sol[0], fl, g4(rs), g4(rf)), frac) + return None + + def _need(self, what, t): + if not short_direct(t): + return None + return self._say("underspecified", "I need %s to compute that; I won't assume it." % what, status="withheld") diff --git a/root/specialists/fluids/verdict_dev.json b/root/specialists/fluids/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..21bdb329eaed17e5a22164bf1adf4380b1941d77 --- /dev/null +++ b/root/specialists/fluids/verdict_dev.json @@ -0,0 +1,113 @@ +{ + "id": "fluids", + "name": "Oracle7 Fluid Statics", + "tier": "A", + "split": "dev", + "head": "oracle_release_runtime_w524", + "time": "2026-10-08T22:15:54Z", + "domain": { + "head": { + "correct": 2, + "false_yes": 0, + "wrong": 0, + "n": 34, + "p50_ms": 67.81, + "fails": [ + [ + "pressure_gauge", + "What is the pressure 5 m deep in olive oil?", + "precision_guard:Q1_english_as_algebra|or", + "I can't verify an answer to that exact question, so I won't guess." + ], + [ + "pressure_abs", + "What is the absolute pressure at a depth of 3 m in fresh water?", + "precision_guard:Q1_english_as_algebra|or", + "I can't verify an answer to that exact question, so I won't guess." + ], + [ + "buoyant_force", + "What is the buoyant force on 2 m3 fully submerged in olive oil?", + "precision_guard:Q1_english_as_algebra|or", + "I can't verify an answer to that exact question, so I won't guess." + ], + [ + "submerged_fraction", + "A block of aluminium floats in mercury. What fraction of it is below t", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ], + [ + "pressure_gauge", + "What is the pressure 30 m deep in fresh water?", + "precision_guard:Q1_english_as_algebra|or", + "I can't verify an answer to that exact question, so I won't guess." + ], + [ + "pressure_abs", + "What is the absolute pressure at a depth of 12 m in fresh water?", + "precision_guard:Q1_english_as_algebra|or", + "I can't verify an answer to that exact question, so I won't guess." + ], + [ + "buoyant_force", + "What is the buoyant force on 8 m3 fully submerged in fresh water?", + "precision_guard:Q1_english_as_algebra|or", + "I can't verify an answer to that exact question, so I won't guess." + ], + [ + "submerged_fraction", + "A block of ice floats in fresh water. What fraction of it is below the", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ] + ] + }, + "spec": { + "correct": 34, + "false_yes": 0, + "wrong": 0, + "n": 34, + "p50_ms": 0.04, + "fails": [] + } + }, + "core": { + "head": { + "correct": 149, + "false_yes": 0 + }, + "spec": { + "correct": 149, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/fluids/verdict_heldout.json b/root/specialists/fluids/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..fb706121be17641f332ca7db3d17e45975cab510 --- /dev/null +++ b/root/specialists/fluids/verdict_heldout.json @@ -0,0 +1,113 @@ +{ + "id": "fluids", + "name": "Oracle7 Fluid Statics", + "tier": "A", + "split": "heldout", + "head": "oracle_release_runtime_w524", + "time": "2026-10-08T22:20:21Z", + "domain": { + "head": { + "correct": 2, + "false_yes": 0, + "wrong": 16, + "n": 34, + "p50_ms": 113.72, + "fails": [ + [ + "pressure_gauge", + "A diver is 5 m below the surface of mercury. What pressure does the me", + "specialist_call>specialist:ocean>pressur", + "The gauge pressure is 50.276 kPa (\u03c1 g h = 1025 kg/m\u00b3 \u00d7 9.81 \u00d7 5 m; add 101.325 kPa for abs" + ], + [ + "pressure_abs", + "Find the total (absolute) pressure 40 m down in sea water.", + "specialist_call>specialist:ocean>pressur", + "The absolute pressure is 503.535 kPa (\u03c1 g h + 101.325 kPa = 1025 \u00d7 9.81 \u00d7 40 m + 1 atm). [" + ], + [ + "buoyant_force", + "An object displaces 0.2 m3 of fresh water. How much buoyant force acts", + "specialist_call>specialist:physics-r2>un", + "I need a mass and an acceleration to compute that; I won't assume the missing value. [phys" + ], + [ + "submerged_fraction", + "If a piece of ice is floating in fresh water, what fraction sits below", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "pressure_gauge", + "A diver is 30 m below the surface of mercury. What pressure does the m", + "specialist_call>specialist:ocean>pressur", + "The gauge pressure is 301.658 kPa (\u03c1 g h = 1025 kg/m\u00b3 \u00d7 9.81 \u00d7 30 m; add 101.325 kPa for a" + ], + [ + "pressure_abs", + "Find the total (absolute) pressure 40 m down in sea water.", + "specialist_call>specialist:ocean>pressur", + "The absolute pressure is 503.535 kPa (\u03c1 g h + 101.325 kPa = 1025 \u00d7 9.81 \u00d7 40 m + 1 atm). [" + ], + [ + "buoyant_force", + "An object displaces 0.01 m3 of sea water. How much buoyant force acts ", + "specialist_call>specialist:physics-r2>un", + "I need a mass and an acceleration to compute that; I won't assume the missing value. [phys" + ], + [ + "submerged_fraction", + "If a piece of ice is floating in sea water, what fraction sits below t", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 34, + "false_yes": 0, + "wrong": 0, + "n": 34, + "p50_ms": 0.05, + "fails": [] + } + }, + "core": { + "head": { + "correct": 149, + "false_yes": 0 + }, + "spec": { + "correct": 149, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/forestry/narrow_v1.py b/root/specialists/forestry/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/forestry/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/geography/geography_panel_v1.json b/root/specialists/geography/geography_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..5638fe0a7ff4ea71900cf2856ba956d16549ca29 --- /dev/null +++ b/root/specialists/geography/geography_panel_v1.json @@ -0,0 +1,128 @@ +[ + { + "split": "dev", + "kind": "cap", + "valid": true, + "q": "What is the capital of Brazil?", + "expect": "Brasilia" + }, + { + "split": "dev", + "kind": "cap", + "valid": true, + "q": "What is the capital of Turkey?", + "expect": "Ankara" + }, + { + "split": "dev", + "kind": "cap", + "valid": true, + "q": "What is the capital of Morocco?", + "expect": "Rabat" + }, + { + "split": "dev", + "kind": "cap", + "valid": true, + "q": "What is the capital of Myanmar?", + "expect": "Naypyidaw" + }, + { + "split": "dev", + "kind": "split", + "valid": true, + "q": "What is the capital of Netherlands?", + "expect": "Amsterdam" + }, + { + "split": "dev", + "kind": "gc", + "valid": true, + "q": "What is the great-circle distance between 35.6762°N, 139.65°E and 33.8688°S, 151.209°E in km?", + "expect": 7825.818616516158 + }, + { + "split": "dev", + "kind": "gc", + "valid": true, + "q": "What is the great-circle distance between 23.5505°S, 46.6333°W and 38.7223°N, 9.1393°W in km?", + "expect": 7949.034721308793 + }, + { + "split": "dev", + "kind": "solar", + "valid": true, + "q": "What is the solar time difference between longitudes 60°E and 90°W?", + "expect": 10.0 + }, + { + "split": "dev", + "kind": "lat", + "valid": true, + "q": "What is the north-south distance between 25°N and 26°N?", + "expect": 111.2 + }, + { + "split": "heldout", + "kind": "cap", + "valid": true, + "q": "Name the capital city of Pakistan.", + "expect": "Islamabad" + }, + { + "split": "heldout", + "kind": "cap", + "valid": true, + "q": "Name the capital city of Japan.", + "expect": "Tokyo" + }, + { + "split": "heldout", + "kind": "cap", + "valid": true, + "q": "Name the capital city of Nigeria.", + "expect": "Abuja" + }, + { + "split": "heldout", + "kind": "cap", + "valid": true, + "q": "Name the capital city of Canada.", + "expect": "Ottawa" + }, + { + "split": "heldout", + "kind": "split", + "valid": true, + "q": "Which city is the capital of Netherlands?", + "expect": "Amsterdam" + }, + { + "split": "heldout", + "kind": "gc", + "valid": true, + "q": "How far apart are 23.5505°S, 46.6333°W and 38.7223°N, 9.1393°W along a great circle, in kilometres (km)?", + "expect": 7949.034721308793 + }, + { + "split": "heldout", + "kind": "gc", + "valid": true, + "q": "How far apart are 51.5074°N, 0.1278°W and 48.8566°N, 2.3522°E along a great circle, in kilometres (km)?", + "expect": 343.55606034104153 + }, + { + "split": "heldout", + "kind": "solar", + "valid": true, + "q": "Local solar time difference in hours between 30°E and 45°W?", + "expect": 5.0 + }, + { + "split": "heldout", + "kind": "lat", + "valid": true, + "q": "How far north-south is it from 10°N to 35°N (distance in km)?", + "expect": 2780.0 + } +] \ No newline at end of file diff --git a/root/specialists/geography/geography_panel_v1.py b/root/specialists/geography/geography_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..acb850249cd734683ca9d79d0b272ae2237798d3 --- /dev/null +++ b/root/specialists/geography/geography_panel_v1.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 +"""geography_panel_v1 - the sealed panel for specialist #67 (world geography). Great-circle distances from this file's +OWN haversine (R 6,371 km; anchor: London-Paris ~343.5 km); solar time = |dlon| / 15; latitude km = |dlat| x 111.2; +capitals TYPED OUT from the CIA World Factbook as a second copy (split capitals must be stated as split). Dev / +held-out differ in seed and phrasing. usage: geography_panel_v1.py """ +import collections +import json +import math +import random +import sys + + +def hav(a, b): + p1, p2 = math.radians(a[0]), math.radians(b[0]) + d = 2 * 6371 * math.asin(math.sqrt(math.sin((p2 - p1) / 2) ** 2 + math.cos(p1) * math.cos(p2) * math.sin(math.radians(b[1] - a[1]) / 2) ** 2)) + return d + + +assert abs(hav((51.5074, -0.1278), (48.8566, 2.3522)) - 343.5) < 1.0 + +CAP = {"France": "Paris", "Japan": "Tokyo", "Canada": "Ottawa", "Australia": "Canberra", "Brazil": "Brasilia", "Turkey": "Ankara", "Nigeria": "Abuja", + "Pakistan": "Islamabad", "New Zealand": "Wellington", "Morocco": "Rabat", "Kazakhstan": "Astana", "Switzerland": "Bern", "Myanmar": "Naypyidaw", "Tanzania": "Dodoma"} +SPLIT = {"South Africa": "Pretoria", "Bolivia": "Sucre", "Netherlands": "Amsterdam"} +PTS = [((51.5074, -0.1278), (48.8566, 2.3522)), ((40.7128, -74.0060), (34.0522, -118.2437)), ((35.6762, 139.6503), (-33.8688, 151.2093)), + ((-23.5505, -46.6333), (38.7223, -9.1393)), ((55.7558, 37.6173), (39.9042, 116.4074))] + + +def fmt(p): + la, lo = p + return "%g°%s, %g°%s" % (abs(la), "N" if la >= 0 else "S", abs(lo), "E" if lo >= 0 else "W") + + +T = {"dev": {"cap": "What is the capital of {c}?", "split": "What is the capital of {c}?", + "gc": "What is the great-circle distance between {a} and {b} in km?", "solar": "What is the solar time difference between longitudes {x}°E and {y}°W?", + "lat": "What is the north-south distance between {a}°N and {b}°N?"}, + "heldout": {"cap": "Name the capital city of {c}.", "split": "Which city is the capital of {c}?", + "gc": "How far apart are {a} and {b} along a great circle, in kilometres (km)?", + "solar": "Local solar time difference in hours between {x}°E and {y}°W?", + "lat": "How far north-south is it from {a}°N to {b}°N (distance in km)?"}} + + +def main(): + items = [] + for split, seed in (("dev", 67), ("heldout", 6767)): + rng = random.Random(seed) + t = T[split] + add = [("cap", {"c": c}, CAP[c]) for c in rng.sample(sorted(CAP), 4)] + add += [("split", {"c": c}, SPLIT[c]) for c in rng.sample(sorted(SPLIT), 1)] + add += [("gc", {"a": fmt(a), "b": fmt(b)}, hav(a, b)) for a, b in rng.sample(PTS, 2)] + add += [("solar", {"x": x, "y": y}, (x + y) / 15) for x, y in rng.sample([(30, 45), (15, 75), (120, 0), (60, 90)], 1)] + add += [("lat", {"a": a, "b": b}, abs(a - b) * 111.2) for a, b in rng.sample([(40, 50), (10, 35), (25, 26)], 1)] + for kind, kw, exp in add: + items.append({"split": split, "kind": kind, "valid": True, "q": t[kind].format(**kw), "expect": exp}) + json.dump(items, open(sys.argv[1], "w"), indent=1, ensure_ascii=False) + print("panel:", dict(collections.Counter(i["split"] for i in items))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/geography/geography_scorer.py b/root/specialists/geography/geography_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..9503b374d3944f4791b2f223ba99e139a1b9e213 --- /dev/null +++ b/root/specialists/geography/geography_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""geography_scorer - reads the REPLY TEXT: capitals - the expected city must be named and, for split-capital +countries, the reply must say it is split (mention "capital" more than once or name more than one city); distances / +hours - the first number after "is" within 0.5%. (ok, asserted).""" +import re + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + k, e = p["kind"], p["expect"] + if k == "cap": + m = re.search(r"\bis\s+([A-Z][A-Za-z .,]+?)\.?$", text) + return bool(m) and m.group(1).strip().rstrip(".") == e, True + if k == "split": + return e in text and (text.lower().count("capital") >= 2 or len(re.findall(r"\b[A-Z][a-z]+(?: [A-Z][a-z]+)?\b", text)) >= 3), True + m = re.search(r"\bis\s+(?:about\s+)?([\d,]*\.?\d+)", text) + if not m: + return False, True + got = float(m.group(1).replace(",", "")) + return abs(got - e) <= 0.005 * abs(e), True diff --git a/root/specialists/geography/manifest.json b/root/specialists/geography/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..fe2cb9aa3d5a102baa3acd6327c1a23f6288601a --- /dev/null +++ b/root/specialists/geography/manifest.json @@ -0,0 +1,23 @@ +{ + "id": "geography", + "name": "Oracle7 World Geography", + "number": 67, + "tier": "A", + "sources": [ + {"name": "CIA World Factbook - capitals (including split capitals)", "licence": "public domain (US government)", "url": "https://www.cia.gov/the-world-factbook/"}, + {"name": "Haversine great-circle distance on the mean Earth sphere (R = 6,371 km); 15 degrees of longitude per hour of solar time", "licence": "facts", "url": "https://www.movable-type.co.uk/scripts/latlong.html"} + ], + "store": {"path": "__ORACLE7_ROOT__/specialists/geography/organ_geography_v1.py"}, + "organ": {"dir": "__ORACLE7_ROOT__/specialists/geography", "module": "organ_geography_v1", "class": "GeographyOrgan", "init": {}}, + "accept": { + "kinds": ["capital", "capital_split", "gc_km", "gc_miles", "antipode", "solar_time", "lat_km"], + "declines_in_domain": [], + "context_regex": "\\b(?:capital|great[- ]circle|longitude|latitude|antipode)\\b" + }, + "panel": {"path": "__ORACLE7_ROOT__/specialists/geography/geography_panel_v1.json", "splits": ["dev", "heldout"], + "exclude_kinds_composed": [], "scorer_module": "geography_scorer", "scorer_fn": "ok"}, + "routing_cues": ["capital of a country", "great-circle distance", "solar time difference", "antipode", "north-south distance"], + "budgets": {"latency_p50_ms": 50, "store_mb": 1}, + "core_sample": {"n": 400, "seed": 20260928}, + "notes": "Split or relocating capitals answered with the split stated, never a single guessed city. Spherical Earth for distances (said so). Civil time zones differ from solar time (said so). Narrowed from the start (narrow_v1)." +} diff --git a/root/specialists/geography/narrow_v1.py b/root/specialists/geography/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/geography/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/geography/organ_geography_v1.py b/root/specialists/geography/organ_geography_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..04a5aff36e9929bca4e9504e887a1fba55088de5 --- /dev/null +++ b/root/specialists/geography/organ_geography_v1.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python3 +"""organ_geography_v1 - world-geography computation plus a small capital store (CIA World Factbook, public domain): +- great-circle distance between two latitude / longitude points by the haversine formula (mean Earth radius 6,371 km), + in km (and miles when asked); +- solar time difference from longitude: 15 degrees per hour (civil time zones differ - said so); +- the antipode of a point (-lat, lon +/- 180); +- north-south distance for a latitude difference: 111.2 km per degree (on the mean sphere); +- capitals of about 60 countries; countries with split or relocating capitals are answered with the split stated + (South Africa, Netherlands, Bolivia, Sri Lanka, Cote d'Ivoire, Indonesia), never a single guessed city. +Narrowed from the start (narrow_v1). Returns {kind, status, response, value}.""" +from __future__ import annotations + +import math +import re + +from narrow_v1 import narrative, short_direct + +R = 6371.0 +CAP = {"afghanistan": "Kabul", "argentina": "Buenos Aires", "australia": "Canberra", "austria": "Vienna", "bangladesh": "Dhaka", "belgium": "Brussels", + "brazil": "Brasilia", "canada": "Ottawa", "chile": "Santiago", "china": "Beijing", "colombia": "Bogota", "cuba": "Havana", "czech republic": "Prague", + "czechia": "Prague", "denmark": "Copenhagen", "egypt": "Cairo", "ethiopia": "Addis Ababa", "finland": "Helsinki", "france": "Paris", + "germany": "Berlin", "ghana": "Accra", "greece": "Athens", "hungary": "Budapest", "iceland": "Reykjavik", "india": "New Delhi", "iran": "Tehran", + "iraq": "Baghdad", "ireland": "Dublin", "italy": "Rome", "japan": "Tokyo", "kenya": "Nairobi", "mexico": "Mexico City", "morocco": "Rabat", + "nepal": "Kathmandu", "new zealand": "Wellington", "nigeria": "Abuja", "north korea": "Pyongyang", "norway": "Oslo", "pakistan": "Islamabad", + "peru": "Lima", "philippines": "Manila", "poland": "Warsaw", "portugal": "Lisbon", "russia": "Moscow", "saudi arabia": "Riyadh", + "south korea": "Seoul", "spain": "Madrid", "sweden": "Stockholm", "switzerland": "Bern", "thailand": "Bangkok", "turkey": "Ankara", + "ukraine": "Kyiv", "united kingdom": "London", "uk": "London", "united states": "Washington, D.C.", "usa": "Washington, D.C.", + "venezuela": "Caracas", "vietnam": "Hanoi", "myanmar": "Naypyidaw", "kazakhstan": "Astana", "tanzania": "Dodoma"} +SPLIT = {"south africa": "three capitals: Pretoria (executive), Cape Town (legislative) and Bloemfontein (judicial)", + "netherlands": "Amsterdam (the constitutional capital); the government sits in The Hague", + "bolivia": "Sucre (the constitutional capital); the seat of government is La Paz", + "sri lanka": "Sri Jayawardenepura Kotte (the legislative capital); Colombo is the executive and commercial capital", + "cote d'ivoire": "Yamoussoukro (the official capital); Abidjan is the economic centre", + "ivory coast": "Yamoussoukro (the official capital); Abidjan is the economic centre", + "indonesia": "Jakarta, with a move to Nusantara in progress (check the current status)"} +COORD = r"(-?\d+(?:\.\d+)?)\s*°?\s*([nsNS])?\s*,?\s*(-?\d+(?:\.\d+)?)\s*°?\s*([ewEW])?" + + +def signed(v, h, neg): + x = float(v) + return -abs(x) if (h and h.lower() in neg) else x + + +def g(x): + return ("%.2f" % x).rstrip("0").rstrip(".") + + +class GeographyOrgan: + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def answer(self, text, session_id="default"): + if narrative(text): + return None + t = " ".join(str(text or "").split()) + low = t.lower() + # --- capitals + cm = re.search(r"\bcapital (?:city )?of\s+(?:the\s+)?([a-z' .]+?)\s*(?:\?|$|\.|,)|\b([a-z' .]+?)'s capital\b", low) + if cm and not re.search(r"\bcapital (?:gains|letter|punishment|expenditure|investment)\b", low): + c = (cm.group(1) or cm.group(2)).strip().replace("ô", "o") + if c in SPLIT: + return self._say("capital_split", "%s has %s." % (c.title(), SPLIT[c]), SPLIT[c]) + if c in CAP: + return self._say("capital", "The capital of %s is %s." % (c.title() if len(c) > 3 else c.upper(), CAP[c]), CAP[c]) + return None + # a point is a coordinate only with hemisphere letters or degree signs (core overlap: plain number pairs in + # driving word problems - "338 miles ... 52 mph" - were read as coordinates) + pts = [(signed(m.group(1), m.group(2), "s"), signed(m.group(3), m.group(4), "w")) for m in re.finditer(r"\(?\s*" + COORD + r"\s*\)?", t) + if (m.group(2) and m.group(4) or m.group(0).count("°") >= 2) and -90 <= float(m.group(1)) <= 90 and -180 <= float(m.group(3)) <= 180] + # --- great-circle distance + if len(pts) >= 2 and re.search(r"\bdistance\b|\bhow far\b|\bkm\b|\bmiles\b|\bgreat[- ]circle\b", low): + (la1, lo1), (la2, lo2) = pts[0], pts[1] + p1, p2 = math.radians(la1), math.radians(la2) + dphi, dl = p2 - p1, math.radians(lo2 - lo1) + a = math.sin(dphi / 2) ** 2 + math.cos(p1) * math.cos(p2) * math.sin(dl / 2) ** 2 + d = 2 * R * math.asin(math.sqrt(a)) + if re.search(r"\bmiles\b", low) and not re.search(r"\bkm\b|\bkilomet", low): + return self._say("gc_miles", "The great-circle distance is %s miles (%s km; haversine, mean Earth radius 6,371 km)." % (g(d / 1.609344), g(d)), d / 1.609344) + return self._say("gc_km", "The great-circle distance is %s km (haversine, mean Earth radius 6,371 km)." % g(d), d) + # --- antipode + if len(pts) >= 1 and re.search(r"\bantipod\w*\b|\bopposite side of the (?:earth|globe|world)\b", low): + la, lo = pts[0] + alo = lo - 180 if lo > 0 else lo + 180 + return self._say("antipode", "The antipode is %s°%s, %s°%s (latitude negated, longitude shifted by 180°)." % ( + g(abs(la)), "N" if -la >= 0 else "S", g(abs(alo)), "E" if alo >= 0 else "W"), [-la, alo]) + # --- solar time from longitude + lons = [signed(v, h, "w") for v, h in re.findall(r"(-?\d+(?:\.\d+)?)\s*°?\s*([ewEW])\b", t)] or \ + [float(v) for v in re.findall(r"\blongitudes?\s+(?:of\s+)?(-?\d+(?:\.\d+)?)", low)] + if len(lons) >= 2 and re.search(r"\btime difference\b|\bhours? (?:ahead|behind|apart|difference)\b|\bsolar time\b|\blocal time\b", low): + dh = abs(lons[0] - lons[1]) / 15 + return self._say("solar_time", "The solar time difference is %s hours (%s° of longitude ÷ 15° per hour; civil time zones differ)." % (g(dh), g(abs(lons[0] - lons[1]))), dh) + # --- latitude distance + lat = re.findall(r"(-?\d+(?:\.\d+)?)\s*°?\s*([nsNS])\b", t) + if len(lat) >= 2 and re.search(r"\bnorth[- ]south\b|\bdistance\b|\bhow far\b", low) and len(pts) < 2: + a, b = signed(*lat[0], "s"), signed(*lat[1], "s") + d = abs(a - b) * 111.2 + return self._say("lat_km", "The north-south distance is %s km (%s° × 111.2 km per degree of latitude)." % (g(d), g(abs(a - b))), d) + return None diff --git a/root/specialists/geography/verdict_dev.json b/root/specialists/geography/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..52791d5df3712a4baeb892a8bbff02e7f59e5330 --- /dev/null +++ b/root/specialists/geography/verdict_dev.json @@ -0,0 +1,121 @@ +{ + "id": "geography", + "name": "Oracle7 World Geography", + "tier": "A", + "split": "dev", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T10:43:29Z", + "domain": { + "head": { + "correct": 1, + "false_yes": 0, + "wrong": 5, + "n": 9, + "p50_ms": 80.75, + "fails": [ + [ + "cap", + "What is the capital of Brazil?", + "organ:relation>form:capital>READ>FRAME>L", + "[ev:direct] Bras\u00edlia. Brazil's capital city is Bras\u00edlia; its most populous city is S\u00e3o Pau" + ], + [ + "cap", + "What is the capital of Turkey?", + "corpus_query:property_of", + "[ev:unknown] The Assyrian capital was named Tushhan (900-600 BCE)." + ], + [ + "cap", + "What is the capital of Morocco?", + "organ:relation>form:capital>READ>FRAME>L", + "[ev:direct] Rabat. The capital of Morocco is Rabat. [simplewiki_edd93a5a1f9413d6fea34771] " + ], + [ + "cap", + "What is the capital of Myanmar?", + "organ:relation>form:capital>READ>FRAME>L", + "[ev:direct] Naypyidaw. Its capital city is Naypyidaw and its largest city is Yangon. [simp" + ], + [ + "gc", + "What is the great-circle distance between 35.6762\u00b0N, 139.65\u00b0E and 33.8", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "gc", + "What is the great-circle distance between 23.5505\u00b0S, 46.6333\u00b0W and 38.", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "solar", + "What is the solar time difference between longitudes 60\u00b0E and 90\u00b0W?", + "organ:math>evaluate", + "[ev:derived] E*pi/3. In steps: read E*pi/3; then evaluate. Checked: recomputed numerically" + ], + [ + "lat", + "What is the north-south distance between 25\u00b0N and 26\u00b0N?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 9, + "false_yes": 0, + "wrong": 0, + "n": 9, + "p50_ms": 0.09, + "fails": [] + } + }, + "core": { + "head": { + "correct": 161, + "false_yes": 3 + }, + "spec": { + "correct": 161, + "false_yes": 3 + }, + "n": 401, + "swept_in": 1, + "taken_by_specialist": [ + { + "family": "open_relation", + "q": "What is the capital city of Saudi Arabia?", + "path": "specialist:geography>capital", + "head_correct": 1, + "spec_correct": 1 + } + ] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/geography/verdict_heldout.json b/root/specialists/geography/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..d1a02cdf727bf3083bda260d50af3e4d4afdc4ec --- /dev/null +++ b/root/specialists/geography/verdict_heldout.json @@ -0,0 +1,121 @@ +{ + "id": "geography", + "name": "Oracle7 World Geography", + "tier": "A", + "split": "heldout", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T10:47:17Z", + "domain": { + "head": { + "correct": 1, + "false_yes": 0, + "wrong": 5, + "n": 9, + "p50_ms": 38.36, + "fails": [ + [ + "cap", + "Name the capital city of Pakistan.", + "factoid:page", + "[ev:direct] The capital of Pakistan is Islamabad, but before 1960, it was Karachi, which i" + ], + [ + "cap", + "Name the capital city of Japan.", + "factoid:page", + "[ev:direct] Tokyo is the capital of Japan and its biggest city. [simplewiki_54a872a9a78dde" + ], + [ + "cap", + "Name the capital city of Nigeria.", + "factoid:page", + "[ev:direct] The capital city is Abuja, while its economic center and most populated city i" + ], + [ + "cap", + "Name the capital city of Canada.", + "factoid:page", + "[ev:direct] The national capital is Ottawa, and the nation's most populous city is Toronto" + ], + [ + "gc", + "How far apart are 23.5505\u00b0S, 46.6333\u00b0W and 38.7223\u00b0N, 9.1393\u00b0W along a", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "gc", + "How far apart are 51.5074\u00b0N, 0.1278\u00b0W and 48.8566\u00b0N, 2.3522\u00b0E along a ", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "solar", + "Local solar time difference in hours between 30\u00b0E and 45\u00b0W?", + "arb:compare->capability:compare", + "[ev:direct] According to Solar time, Solar time is a calculation of the passage of time ba" + ], + [ + "lat", + "How far north-south is it from 10\u00b0N to 35\u00b0N (distance in km)?", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ] + ] + }, + "spec": { + "correct": 9, + "false_yes": 0, + "wrong": 0, + "n": 9, + "p50_ms": 0.07, + "fails": [] + } + }, + "core": { + "head": { + "correct": 161, + "false_yes": 3 + }, + "spec": { + "correct": 161, + "false_yes": 3 + }, + "n": 401, + "swept_in": 1, + "taken_by_specialist": [ + { + "family": "open_relation", + "q": "What is the capital city of Saudi Arabia?", + "path": "specialist:geography>capital", + "head_correct": 1, + "spec_correct": 1 + } + ] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/iot/iot_panel_v1.json b/root/specialists/iot/iot_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..68224e3900d5ce5c107c51d6a79733a24d322947 --- /dev/null +++ b/root/specialists/iot/iot_panel_v1.json @@ -0,0 +1,380 @@ +[ + { + "split": "dev", + "kind": "adcv", + "valid": true, + "q": "A 12-bit ADC with a 5 V reference reads code 4000. What is the voltage?", + "expect": 4.8828125 + }, + { + "split": "dev", + "kind": "adcv", + "valid": true, + "q": "A 12-bit ADC with a 3.3 V reference reads code 2048. What is the voltage?", + "expect": 1.65 + }, + { + "split": "dev", + "kind": "adcv", + "valid": true, + "q": "A 10-bit ADC with a 5 V reference reads code 512. What is the voltage?", + "expect": 2.5 + }, + { + "split": "dev", + "kind": "adcc", + "valid": true, + "q": "What code does a 8-bit ADC with a 5 V reference output for an input of 3.7 V?", + "expect": 189 + }, + { + "split": "dev", + "kind": "adcc", + "valid": true, + "q": "What code does a 12-bit ADC with a 5 V reference output for an input of 4.1 V?", + "expect": 3358 + }, + { + "split": "dev", + "kind": "adcc", + "valid": true, + "q": "What code does a 12-bit ADC with a 3.3 V reference output for an input of 1.2 V?", + "expect": 1489 + }, + { + "split": "dev", + "kind": "lsb", + "valid": true, + "q": "What is the resolution of a 10-bit ADC with a 5 V reference?", + "expect": 4.8828125 + }, + { + "split": "dev", + "kind": "lsb", + "valid": true, + "q": "What is the resolution of a 16-bit ADC with a 2.5 V reference?", + "expect": 0.03814697265625 + }, + { + "split": "dev", + "kind": "lsb", + "valid": true, + "q": "What is the resolution of a 12-bit ADC with a 3.3 V reference?", + "expect": 0.8056640625 + }, + { + "split": "dev", + "kind": "avg", + "valid": true, + "q": "A sensor node draws 40 mA when active and 2 uA when asleep, and is active 0.5% of the time. What is its average current?", + "expect": 0.20199 + }, + { + "split": "dev", + "kind": "avg", + "valid": true, + "q": "A sensor node draws 15 mA when active and 10 uA when asleep, and is active 2% of the time. What is its average current?", + "expect": 0.30979999999999996 + }, + { + "split": "dev", + "kind": "avg", + "valid": true, + "q": "A sensor node draws 8 mA when active and 50 uA when asleep, and is active 10% of the time. What is its average current?", + "expect": 0.8450000000000001 + }, + { + "split": "dev", + "kind": "life", + "valid": true, + "q": "How long will a 2000 mAh battery last powering a device that draws 20 mA?", + "expect": 100.0 + }, + { + "split": "dev", + "kind": "life", + "valid": true, + "q": "How long will a 3000 mAh battery last powering a device that draws 150 mA?", + "expect": 20.0 + }, + { + "split": "dev", + "kind": "life", + "valid": true, + "q": "How long will a 500 mAh battery last powering a device that draws 8 mA?", + "expect": 62.5 + }, + { + "split": "dev", + "kind": "lifed", + "valid": true, + "q": "A 3000 mAh battery powers a node that is active 0.5% of the time at 40 mA and sleeps at 2 uA. How many hours will it last?", + "expect": 14852.220406950839 + }, + { + "split": "dev", + "kind": "lifed", + "valid": true, + "q": "A 1000 mAh battery powers a node that is active 2% of the time at 15 mA and sleeps at 10 uA. How many hours will it last?", + "expect": 3227.888960619755 + }, + { + "split": "dev", + "kind": "nyq", + "valid": true, + "q": "What is the minimum sampling rate for a signal with a maximum frequency of 440 Hz (Nyquist)?", + "expect": 880 + }, + { + "split": "dev", + "kind": "nyq", + "valid": true, + "q": "What is the minimum sampling rate for a signal with a maximum frequency of 1000 Hz (Nyquist)?", + "expect": 2000 + }, + { + "split": "dev", + "kind": "nyq", + "valid": true, + "q": "What is the minimum sampling rate for a signal with a maximum frequency of 100 Hz (Nyquist)?", + "expect": 200 + }, + { + "split": "dev", + "kind": "rate", + "valid": true, + "q": "What is the data rate for 1000 samples per second at 16 bits per sample on 2 channels?", + "expect": 32000 + }, + { + "split": "dev", + "kind": "rate", + "valid": true, + "q": "What is the data rate for 10 samples per second at 10 bits per sample on 8 channels?", + "expect": 800 + }, + { + "split": "dev", + "kind": "store", + "valid": true, + "q": "How much storage per day does a sensor need at 100 samples per second and 16 bits per sample?", + "expect": 17.28 + }, + { + "split": "dev", + "kind": "store", + "valid": true, + "q": "How much storage per day does a sensor need at 10 samples per second and 12 bits per sample?", + "expect": 1.296 + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "A 10-bit ADC with a 5 V reference reads code 1500. What is the voltage?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What code does a 12-bit ADC with a 3.3 V reference output for an input of 4 V?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What is the resolution of a 10-bit ADC?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "adcv", + "valid": true, + "q": "Code 4000 from a 12-bit converter (ADC) with a 5 V full-scale reference: what voltage is that?", + "expect": 4.8828125 + }, + { + "split": "heldout", + "kind": "adcv", + "valid": true, + "q": "Code 200 from a 8-bit converter (ADC) with a 5 V full-scale reference: what voltage is that?", + "expect": 3.90625 + }, + { + "split": "heldout", + "kind": "adcv", + "valid": true, + "q": "Code 1000 from a 10-bit converter (ADC) with a 3.3 V full-scale reference: what voltage is that?", + "expect": 3.22265625 + }, + { + "split": "heldout", + "kind": "adcc", + "valid": true, + "q": "For 2.5 V input, which digital code will a 10-bit ADC (reference 5 V) give?", + "expect": 512 + }, + { + "split": "heldout", + "kind": "adcc", + "valid": true, + "q": "For 4.1 V input, which digital code will a 12-bit ADC (reference 5 V) give?", + "expect": 3358 + }, + { + "split": "heldout", + "kind": "adcc", + "valid": true, + "q": "For 1.2 V input, which digital code will a 12-bit ADC (reference 3.3 V) give?", + "expect": 1489 + }, + { + "split": "heldout", + "kind": "lsb", + "valid": true, + "q": "Find the LSB step size of a 12-bit ADC using a 3.3 V reference.", + "expect": 0.8056640625 + }, + { + "split": "heldout", + "kind": "lsb", + "valid": true, + "q": "Find the LSB step size of a 16-bit ADC using a 2.5 V reference.", + "expect": 0.03814697265625 + }, + { + "split": "heldout", + "kind": "lsb", + "valid": true, + "q": "Find the LSB step size of a 12-bit ADC using a 4.096 V reference.", + "expect": 1.0 + }, + { + "split": "heldout", + "kind": "avg", + "valid": true, + "q": "Transmitting draws 20 mA for 1% duty cycle; sleep draws 5 uA the rest of the time. Find the average current.", + "expect": 0.20495000000000002 + }, + { + "split": "heldout", + "kind": "avg", + "valid": true, + "q": "Transmitting draws 40 mA for 0.5% duty cycle; sleep draws 2 uA the rest of the time. Find the average current.", + "expect": 0.20199 + }, + { + "split": "heldout", + "kind": "avg", + "valid": true, + "q": "Transmitting draws 15 mA for 2% duty cycle; sleep draws 10 uA the rest of the time. Find the average current.", + "expect": 0.30979999999999996 + }, + { + "split": "heldout", + "kind": "life", + "valid": true, + "q": "Battery life in hours for a 1200 mAh cell at a steady 0.5 mA load?", + "expect": 2400.0 + }, + { + "split": "heldout", + "kind": "life", + "valid": true, + "q": "Battery life in hours for a 500 mAh cell at a steady 8 mA load?", + "expect": 62.5 + }, + { + "split": "heldout", + "kind": "life", + "valid": true, + "q": "Battery life in hours for a 2000 mAh cell at a steady 20 mA load?", + "expect": 100.0 + }, + { + "split": "heldout", + "kind": "lifed", + "valid": true, + "q": "Estimate the battery life in hours: 2400 mAh cell, awake 1% at 20 mA, sleeping at 5 uA otherwise.", + "expect": 11710.173212978774 + }, + { + "split": "heldout", + "kind": "lifed", + "valid": true, + "q": "Estimate the battery life in hours: 3000 mAh cell, awake 0.5% at 40 mA, sleeping at 2 uA otherwise.", + "expect": 14852.220406950839 + }, + { + "split": "heldout", + "kind": "nyq", + "valid": true, + "q": "A sensor signal contains frequencies up to 100 Hz. How fast must you sample it at minimum?", + "expect": 200 + }, + { + "split": "heldout", + "kind": "nyq", + "valid": true, + "q": "A sensor signal contains frequencies up to 1000 Hz. How fast must you sample it at minimum?", + "expect": 2000 + }, + { + "split": "heldout", + "kind": "nyq", + "valid": true, + "q": "A sensor signal contains frequencies up to 20 Hz. How fast must you sample it at minimum?", + "expect": 40 + }, + { + "split": "heldout", + "kind": "rate", + "valid": true, + "q": "Bit rate for 3 channels sampled at 500 Hz with 24-bit resolution?", + "expect": 36000 + }, + { + "split": "heldout", + "kind": "rate", + "valid": true, + "q": "Bit rate for 8 channels sampled at 10 Hz with 10-bit resolution?", + "expect": 800 + }, + { + "split": "heldout", + "kind": "store", + "valid": true, + "q": "Daily storage in bytes for one 8-bit sensor at 50 samples/s? Give MB per day.", + "expect": 4.32 + }, + { + "split": "heldout", + "kind": "store", + "valid": true, + "q": "Daily storage in bytes for one 16-bit sensor at 100 samples/s? Give MB per day.", + "expect": 17.28 + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "Code 300 from an 8-bit converter (ADC) with a 5 V full-scale reference: what voltage is that?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "For 6 V input, which digital code will a 10-bit ADC (reference 5 V) give?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "Find the LSB step size of a 16-bit ADC.", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/iot/iot_panel_v1.py b/root/specialists/iot/iot_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..60bbeb02a76a179e6222b8669f7f95288288f5f6 --- /dev/null +++ b/root/specialists/iot/iot_panel_v1.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +"""iot_panel_v1 - the sealed panel for specialist #94 (sensor networks & IoT). Expected values from the relations written +here: V = code x Vref / 2^n; code = floor(V / Vref x 2^n); LSB = Vref / 2^n (mV); I_avg = Ia D + Is (1 - D); +life = mAh / I_avg (hours); fs_min = 2 f_max; rate = sps x bits x channels; MB/day = rate x 86400 / 8 / 1e6. +Must-decline: code >= 2^n, V above Vref, duty above 100%, an ADC with no reference voltage. +Dev / held-out differ in seed and phrasing. usage: iot_panel_v1.py """ +import collections +import json +import math +import random +import sys + +T = {"dev": {"adcv": "A {n}-bit ADC with a {V} V reference reads code {c}. What is the voltage?", + "adcc": "What code does a {n}-bit ADC with a {V} V reference output for an input of {vin} V?", + "lsb": "What is the resolution of a {n}-bit ADC with a {V} V reference?", + "avg": "A sensor node draws {ia} mA when active and {is_} uA when asleep, and is active {d}% of the time. What is its average current?", + "life": "How long will a {cap} mAh battery last powering a device that draws {i} mA?", + "lifed": "A {cap} mAh battery powers a node that is active {d}% of the time at {ia} mA and sleeps at {is_} uA. How many hours will it last?", + "nyq": "What is the minimum sampling rate for a signal with a maximum frequency of {f} Hz (Nyquist)?", + "rate": "What is the data rate for {s} samples per second at {b} bits per sample on {ch} channels?", + "store": "How much storage per day does a sensor need at {s} samples per second and {b} bits per sample?"}, + "heldout": {"adcv": "Code {c} from a {n}-bit converter (ADC) with a {V} V full-scale reference: what voltage is that?", + "adcc": "For {vin} V input, which digital code will a {n}-bit ADC (reference {V} V) give?", + "lsb": "Find the LSB step size of a {n}-bit ADC using a {V} V reference.", + "avg": "Transmitting draws {ia} mA for {d}% duty cycle; sleep draws {is_} uA the rest of the time. Find the average current.", + "life": "Battery life in hours for a {cap} mAh cell at a steady {i} mA load?", + "lifed": "Estimate the battery life in hours: {cap} mAh cell, awake {d}% at {ia} mA, sleeping at {is_} uA otherwise.", + "nyq": "A sensor signal contains frequencies up to {f} Hz. How fast must you sample it at minimum?", + "rate": "Bit rate for {ch} channels sampled at {s} Hz with {b}-bit resolution?", + "store": "Daily storage in bytes for one {b}-bit sensor at {s} samples/s? Give MB per day."}} +DECLINE = {"dev": ["A 10-bit ADC with a 5 V reference reads code 1500. What is the voltage?", + "What code does a 12-bit ADC with a 3.3 V reference output for an input of 4 V?", + "What is the resolution of a 10-bit ADC?"], + "heldout": ["Code 300 from an 8-bit converter (ADC) with a 5 V full-scale reference: what voltage is that?", + "For 6 V input, which digital code will a 10-bit ADC (reference 5 V) give?", + "Find the LSB step size of a 16-bit ADC."]} + + +def main(): + items = [] + for split, seed in (("dev", 94), ("heldout", 9494)): + rng = random.Random(seed) + t = T[split] + add = [] + for n, V, c in rng.sample([(10, 5, 512), (12, 3.3, 2048), (8, 5, 200), (10, 3.3, 1000), (12, 5, 4000), (16, 2.5, 30000)], 3): + add.append(("adcv", {"n": n, "V": V, "c": c}, c * V / 2 ** n)) + for n, V, vin in rng.sample([(10, 5, 2.5), (12, 3.3, 1.2), (8, 5, 3.7), (10, 3.3, 0.9), (12, 5, 4.1)], 3): + add.append(("adcc", {"n": n, "V": V, "vin": vin}, math.floor(vin / V * 2 ** n + 1e-9))) + for n, V in rng.sample([(10, 5), (12, 3.3), (8, 5), (16, 2.5), (12, 4.096)], 3): + add.append(("lsb", {"n": n, "V": V}, V / 2 ** n * 1000)) + for ia, is_, d in rng.sample([(20, 5, 1), (15, 10, 2), (40, 2, 0.5), (8, 50, 10)], 3): + add.append(("avg", {"ia": ia, "is_": is_, "d": d}, ia * d / 100 + is_ / 1000 * (1 - d / 100))) + for cap, i in rng.sample([(2000, 20), (3000, 150), (1200, 0.5), (500, 8)], 3): + add.append(("life", {"cap": cap, "i": i}, cap / i)) + for cap, ia, is_, d in rng.sample([(2400, 20, 5, 1), (1000, 15, 10, 2), (3000, 40, 2, 0.5)], 2): + add.append(("lifed", {"cap": cap, "ia": ia, "is_": is_, "d": d}, cap / (ia * d / 100 + is_ / 1000 * (1 - d / 100)))) + for f in rng.sample([20, 100, 440, 1000, 20000], 3): + add.append(("nyq", {"f": f}, 2 * f)) + for s, b, ch in rng.sample([(100, 12, 4), (1000, 16, 2), (10, 10, 8), (500, 24, 3)], 2): + add.append(("rate", {"s": s, "b": b, "ch": ch}, s * b * ch)) + for s, b in rng.sample([(100, 16), (10, 12), (1000, 24), (50, 8)], 2): + add.append(("store", {"s": s, "b": b}, s * b * 86400 / 8 / 1e6)) + for kind, kw, exp in add: + items.append({"split": split, "kind": kind, "valid": True, "q": t[kind].format(**kw), "expect": exp}) + for q in DECLINE[split]: + items.append({"split": split, "kind": "decline", "valid": False, "q": q, "expect": "decline"}) + json.dump(items, open(sys.argv[1], "w"), indent=1) + print("panel:", dict(collections.Counter(i["split"] for i in items))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/iot/iot_scorer.py b/root/specialists/iot/iot_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..eeb78b8113dc05b859cf62c3112376ea832883d6 --- /dev/null +++ b/root/specialists/iot/iot_scorer.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +"""iot_scorer - the first number after is / lasts in the REPLY TEXT must match the panel's relation: ADC codes exactly; +everything else within 0.5%. Units are fixed by the panel (V, mV per step, mA, hours, Hz, bit/s, MB per day) and a +reply in other units (e.g. battery life in days) is read as its number only - so it counts as wrong. A must-decline +item answered is a false yes. (ok, asserted).""" +import re + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + m = re.search(r"\b(?:is|lasts)\s+(?:about\s+)?(-?[\d,]*\.?\d+)", text) + if not m: + return False, True + got, e = float(m.group(1).replace(",", "")), float(p["expect"]) + if p["kind"] == "adcc": + return got == e, True + return abs(got - e) <= max(0.005 * abs(e), 1e-9), True diff --git a/root/specialists/iot/manifest.json b/root/specialists/iot/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..3aa031a6594a8183da0befe01ae33033bf19921e --- /dev/null +++ b/root/specialists/iot/manifest.json @@ -0,0 +1,22 @@ +{ + "id": "iot", + "name": "Oracle7 Sensor Networks & IoT", + "number": 94, + "tier": "B", + "sources": [ + {"name": "NIST IoT and measurement publications; ideal ADC transfer (LSB = Vref / 2^n), Nyquist-Shannon sampling, duty-cycle average current", "licence": "public domain (US government) / facts", "url": "https://www.nist.gov/programs-projects/nist-cybersecurity-iot-program"} + ], + "store": {"path": "__ORACLE7_ROOT__/specialists/iot/organ_iot_v1.py"}, + "organ": {"dir": "__ORACLE7_ROOT__/specialists/iot", "module": "organ_iot_v1", "class": "IotOrgan", "init": {}}, + "accept": { + "kinds": ["adc_voltage", "adc_code", "adc_lsb", "avg_current", "battery_life", "nyquist", "data_rate", "storage_day"], + "declines_in_domain": ["underspecified", "impossible"], + "context_regex": "\\b(?:adc|analog[- ]to[- ]digital|battery|mah|duty cycle|nyquist|sampl\\w+|sensor|data rate|bit rate)\\b" + }, + "panel": {"path": "__ORACLE7_ROOT__/specialists/iot/iot_panel_v1.json", "splits": ["dev", "heldout"], + "exclude_kinds_composed": [], "scorer_module": "iot_scorer", "scorer_fn": "ok"}, + "routing_cues": ["ADC code to voltage", "ADC resolution", "average current duty cycle", "battery life mAh", "Nyquist rate", "sensor data rate"], + "budgets": {"latency_p50_ms": 50, "store_mb": 1}, + "core_sample": {"n": 400, "seed": 20260928}, + "notes": "Ideal ADC convention LSB = Vref / 2^n (named; some datasheets use 2^n - 1). Battery life is ideal (no self-discharge / derating), said so. Radio link budgets are left to spacecomms (#95). Narrowed from the start (narrow_v1)." +} diff --git a/root/specialists/iot/narrow_v1.py b/root/specialists/iot/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/iot/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/iot/organ_iot_v1.py b/root/specialists/iot/organ_iot_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..ce9546d78afe1a8fc083731005d72c3e8df93e49 --- /dev/null +++ b/root/specialists/iot/organ_iot_v1.py @@ -0,0 +1,135 @@ +#!/usr/bin/env python3 +"""organ_iot_v1 - sensor-node / IoT arithmetic, convention named in every answer: +- ADC (ideal transfer, LSB = Vref / 2^n): voltage of a code = code x Vref / 2^n; the code for a voltage = + floor(V / Vref x 2^n) clamped to 2^n - 1; resolution (LSB size) = Vref / 2^n; +- average current of a duty-cycled node = I_active x D + I_sleep x (1 - D); battery life = capacity / average current + (ideal - no self-discharge or derating, said so); +- Nyquist: the minimum sampling rate is 2 x the highest frequency; +- data rate = samples/s x bits per sample x channels; per-day storage = rate x 86,400 s (8 bits per byte). +Declines: a code at or above 2^n, a voltage above Vref, a duty cycle above 100%. Narrowed from the start (narrow_v1). +Returns {kind, status, response, value}.""" +from __future__ import annotations + +import math +import re + +from narrow_v1 import narrative, short_direct + +N = r"(\d+(?:,\d{3})*(?:\.\d+)?)" + + +def num(s): + return float(s.replace(",", "")) + + +def g(x): + return ("%.4f" % x).rstrip("0").rstrip(".") if abs(x) < 1e5 else format(round(x), ",") + + +CUR_RX = r"(a|ma|ua|µa|μa|microamps?|milliamps?|amps?)\b" + + +def to_ma(v, u): + u = u.lower().rstrip("s") + u = {"amp": "a", "milliamp": "ma", "microamp": "ua", "µa": "ua", "μa": "ua"}.get(u, u) + return v * {"a": 1000.0, "ma": 1.0, "ua": 1e-3}[u] + + +class IotOrgan: + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def _bad(self, why): + return self._say("impossible", why, status="withheld") + + def answer(self, text, session_id="default"): + if narrative(text): + return None + r = self._answer(text) + if r and r.get("status") != "answered" and not short_direct(text): + return None + return r + + def _answer(self, text): + t = " ".join(str(text or "").split()) + low = t.lower() + # --- ADC + bits = re.search(r"\b(\d{1,2})[- ]?bits?\b", low) + vref = re.search(r"\b(?:vref|reference(?: voltage)?|v_?ref|full[- ]scale)\s*(?:of|is|=|:)?\s*" + N + r"\s*v\b|" + N + r"\s*v\s*(?:reference|vref|full[- ]scale)\b", low) + if bits and re.search(r"\badc\b|\banalog[- ]to[- ]digital\b|\bconverter\b", low): + n = int(bits.group(1)) + if not 1 <= n <= 32: + return None + full = 2 ** n + if not vref: + return self._say("underspecified", "I need the reference voltage to work that out; I won't assume it.", status="withheld") + V = num(vref.group(1) or vref.group(2)) + if re.search(r"\bresolution\b|\blsb\b|\bstep size\b|\bsmallest (?:change|step)\b", low) and not re.search(r"\breading\b|\bcode\b|\bcount\b", low): + lsb = V / full + return self._say("adc_lsb", "The resolution is %s mV per step (Vref %s V ÷ 2^%d = %s steps)." % (g(lsb * 1000), g(V), n, format(full, ",")), lsb * 1000) + code = re.search(r"\b(?:reading|code|count|value|output)\s*(?:of|is|=|:)?\s*(\d+)\b(?!\s*(?:v|bit|mv))|\breads\s+(\d+)\b", low) + volt = re.search(r"\binput (?:of\s+)?" + N + r"\s*v\b|" + N + r"\s*v\s*(?:input|signal|in)\b|\b(?:for|at)\s+" + N + r"\s*v\b(?!\s*(?:reference|vref|full))", low) + if code and re.search(r"\bvolt\w*\b|\bwhat voltage\b|\bin volts\b", low) and not volt: + c = int(code.group(1) or code.group(2)) + if c >= full: + return self._bad("A %d-bit ADC only outputs codes 0-%s; %d is out of range." % (n, format(full - 1, ","), c)) + v = c * V / full + return self._say("adc_voltage", "The voltage is %s V (code %d × %s V ÷ 2^%d)." % (g(v), c, g(V), n), v) + if volt and re.search(r"\bcode\b|\breading\b|\bcount\b|\bdigital value\b|\boutput\b", low): + vin = num(volt.group(1) or volt.group(2) or volt.group(3)) + if vin > V: + return self._bad("%s V is above the %s V reference; the ADC saturates at code %s." % (g(vin), g(V), format(full - 1, ","))) + c = min(math.floor(vin / V * full + 1e-9), full - 1) + return self._say("adc_code", "The code is %d (floor(%s V ÷ %s V × 2^%d))." % (c, g(vin), g(V), n), c) + return None + # --- Nyquist + if re.search(r"\bnyquist\b|\bminimum sampl\w+ (?:rate|frequency)\b|\bsample (?:at )?(?:least|minimum)\b|\bhow fast\b.*\bsampl", low): + fm = re.search(N + r"\s*(hz|khz|mhz)\b", low) + if not fm: + return None + f = num(fm.group(1)) * {"hz": 1, "khz": 1e3, "mhz": 1e6}[fm.group(2)] + v = 2 * f + return self._say("nyquist", "The minimum sampling rate is %s Hz (Nyquist: 2 × %s Hz)." % (g(v), g(f)), v) + # --- battery life / average current + cap = re.search(N + r"\s*mah\b", low) + if re.search(r"\bbattery\b|\bbatteries\b|\bcell\b", low) or re.search(r"\baverage current\b", low): + duty = re.search(r"\b(?:awake|active|on|transmitting|duty cycle(?: of)?)\s*(?:for\s+)?(\d+(?:\.\d+)?)\s*%|(\d+(?:\.\d+)?)\s*%\s*(?:of the time\s+)?(?:duty cycle|awake|active|of the time)", low) + curs = [(to_ma(num(v), u), m.start()) for m in re.finditer(N + r"\s*" + CUR_RX, low) for v, u in [(m.group(1), m.group(2))]] + if duty: + D = float(duty.group(1) or duty.group(2)) / 100 + if D > 1: + return self._bad("A duty cycle above 100% is not possible.") + act = re.search(N + r"\s*" + CUR_RX + r"\s*(?:when\s+|while\s+)?(?:awake|active|on|transmitting)|(?:awake|active|transmitting)\w*(?:(?:[^.;]|\.(?=\d)){0,30}?\bat)?\s*(?:current\s*)?(?:of|is|=|at|draws)?\s*" + N + r"\s*" + CUR_RX, low) + slp = re.search(N + r"\s*" + CUR_RX + r"\s*(?:when\s+|while\s+|in\s+)?(?:asleep|sleep\w*|idle)|(?:sleep\w*|asleep|idle)(?:(?:[^.;]|\.(?=\d)){0,30}?\bat)?\s*(?:current\s*)?(?:of|is|=|at|draws)?\s*" + N + r"\s*" + CUR_RX, low) + if not act or not slp: + return None + Ia = to_ma(num(act.group(1) or act.group(3)), act.group(2) or act.group(4)) + Is = to_ma(num(slp.group(1) or slp.group(3)), slp.group(2) or slp.group(4)) + avg = Ia * D + Is * (1 - D) + if cap and re.search(r"\bhow long\b|\blife\b|\blast\b|\bhours\b|\bdays\b", low): + h = num(cap.group(1)) / avg + unit_days = re.search(r"\bdays?\b", low) and not re.search(r"\bhours\b", low) + if unit_days: + return self._say("battery_life", "The battery lasts %s days (%s mAh ÷ %s mA average = %s h; ideal, no self-discharge)." % (g(h / 24), g(num(cap.group(1))), g(avg), g(h)), h) + return self._say("battery_life", "The battery lasts %s hours (%s mAh ÷ %s mA average; ideal, no self-discharge)." % (g(h), g(num(cap.group(1))), g(avg)), h) + return self._say("avg_current", "The average current is %s mA (%s mA × %s + %s mA × %s)." % (g(avg), g(Ia), g(D), g(Is), g(1 - D)), avg) + if cap and len(curs) == 1 and re.search(r"\bhow long\b|\blife\b|\blast\b|\bhours\b|\bdays\b", low): + I = curs[0][0] + if I <= 0: + return None + h = num(cap.group(1)) / I + if re.search(r"\bdays?\b", low) and not re.search(r"\bhours\b", low): + return self._say("battery_life", "The battery lasts %s days (%s mAh ÷ %s mA = %s h; ideal, no self-discharge)." % (g(h / 24), g(num(cap.group(1))), g(I), g(h)), h) + return self._say("battery_life", "The battery lasts %s hours (%s mAh ÷ %s mA; ideal, no self-discharge)." % (g(h), g(num(cap.group(1))), g(I)), h) + # --- data rate / storage + sps = re.search(N + r"\s*(?:samples?(?:/s| per second| a second)|sps|hz)\b", low) + bps_m = re.search(r"\b(\d+)[- ]?bits?\s*(?:per sample|samples?|resolution|each)?\b", low) + if sps and bps_m and re.search(r"\bdata rate\b|\bbit rate\b|\bthroughput\b|\bstorage\b|\bper day\b|\bbytes\b|\bbandwidth\b", low): + ch = re.search(r"\b(\d+)\s+(?:channels?|sensors?)\b", low) + C = int(ch.group(1)) if ch else 1 + rate = num(sps.group(1)) * int(bps_m.group(1)) * C + if re.search(r"\bper day\b|\ba day\b|\bdaily\b|\bstorage\b", low): + b = rate * 86400 / 8 + return self._say("storage_day", "That is %s MB per day (%s bit/s × 86,400 s ÷ 8 ÷ 10^6)." % (g(b / 1e6), g(rate)), b / 1e6) + return self._say("data_rate", "The data rate is %s bit/s (%s samples/s × %d bits%s)." % (g(rate), g(num(sps.group(1))), int(bps_m.group(1)), " × %d channels" % C if C > 1 else ""), rate) + return None diff --git a/root/specialists/iot/verdict_dev.json b/root/specialists/iot/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..4280e5475da331da37016e8cad3c3524e25c0a85 --- /dev/null +++ b/root/specialists/iot/verdict_dev.json @@ -0,0 +1,113 @@ +{ + "id": "iot", + "name": "Oracle7 Sensor Networks & IoT", + "tier": "B", + "split": "dev", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T08:45:30Z", + "domain": { + "head": { + "correct": 1, + "false_yes": 2, + "wrong": 8, + "n": 27, + "p50_ms": 51.96, + "fails": [ + [ + "adcv", + "A 12-bit ADC with a 5 V reference reads code 4000. What is the voltage", + "organ:math>evaluate", + "[ev:derived] -b*i*t + 12. In steps: read -b*i*t + 12; then simplify. Checked: equivalent t" + ], + [ + "adcv", + "A 12-bit ADC with a 3.3 V reference reads code 2048. What is the volta", + "organ:math>evaluate", + "[ev:derived] -b*i*t + 12. In steps: read -b*i*t + 12; then simplify. Checked: equivalent t" + ], + [ + "adcv", + "A 10-bit ADC with a 5 V reference reads code 512. What is the voltage?", + "organ:math>evaluate", + "[ev:derived] -b*i*t + 10. In steps: read -b*i*t + 10; then simplify. Checked: equivalent t" + ], + [ + "adcc", + "What code does a 8-bit ADC with a 5 V reference output for an input of", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "adcc", + "What code does a 12-bit ADC with a 5 V reference output for an input o", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "adcc", + "What code does a 12-bit ADC with a 3.3 V reference output for an input", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "lsb", + "What is the resolution of a 10-bit ADC with a 5 V reference?", + "organ:math>evaluate", + "[ev:derived] -b*i*t + 10. In steps: read -b*i*t + 10; then simplify. Checked: equivalent t" + ], + [ + "lsb", + "What is the resolution of a 16-bit ADC with a 2.5 V reference?", + "organ:math>evaluate", + "[ev:derived] -b*i*t + 16. In steps: read -b*i*t + 16; then simplify. Checked: equivalent t" + ] + ] + }, + "spec": { + "correct": 27, + "false_yes": 0, + "wrong": 0, + "n": 27, + "p50_ms": 0.07, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/iot/verdict_heldout.json b/root/specialists/iot/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..9936eeb3e36d728ae96da5877794aede9195835a --- /dev/null +++ b/root/specialists/iot/verdict_heldout.json @@ -0,0 +1,113 @@ +{ + "id": "iot", + "name": "Oracle7 Sensor Networks & IoT", + "tier": "B", + "split": "heldout", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T08:49:19Z", + "domain": { + "head": { + "correct": 2, + "false_yes": 1, + "wrong": 11, + "n": 27, + "p50_ms": 45.17, + "fails": [ + [ + "adcv", + "Code 4000 from a 12-bit converter (ADC) with a 5 V full-scale referenc", + "arb:definitional->definitional_encyclope", + "[ev:direct] Voltage is what makes electric charges move. [simplewiki_a22f1c479abc99a8cc340" + ], + [ + "adcv", + "Code 200 from a 8-bit converter (ADC) with a 5 V full-scale reference:", + "arb:definitional->definitional_encyclope", + "[ev:direct] Voltage is what makes electric charges move. [simplewiki_a22f1c479abc99a8cc340" + ], + [ + "adcv", + "Code 1000 from a 10-bit converter (ADC) with a 3.3 V full-scale refere", + "arb:definitional->definitional_encyclope", + "[ev:direct] Voltage is what makes electric charges move. [simplewiki_a22f1c479abc99a8cc340" + ], + [ + "adcc", + "For 2.5 V input, which digital code will a 10-bit ADC (reference 5 V) ", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "adcc", + "For 4.1 V input, which digital code will a 12-bit ADC (reference 5 V) ", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "adcc", + "For 1.2 V input, which digital code will a 12-bit ADC (reference 3.3 V", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "lsb", + "Find the LSB step size of a 12-bit ADC using a 3.3 V reference.", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "lsb", + "Find the LSB step size of a 16-bit ADC using a 2.5 V reference.", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 27, + "false_yes": 0, + "wrong": 0, + "n": 27, + "p50_ms": 0.05, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/medicine/facts_medicine_v1.py b/root/specialists/medicine/facts_medicine_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..5cbbca32adf8186d75e2bfb50f8e34d0d611a70b --- /dev/null +++ b/root/specialists/medicine/facts_medicine_v1.py @@ -0,0 +1,24 @@ +"""facts_medicine_v1 - the store for specialist #90 (medicine: reference only): general reference facts from MedlinePlus +and CDC / NIH public pages (public domain) and history of medicine. Tier C: symptoms, diagnosis, a person's own readings, +treatment, medication and dosing are NEVER answered (the head answers).""" +GATE = r"\bmedic\w*\b|\bbody temperature\b|\bheart rate\b|\bpulse\b|\bblood pressure\b|\bantibiotics?\b|\binsulin\b|\bvaccines?\b|\bvaccination\b|\bsmallpox\b|\bblood (?:types?|donors?)\b|\buniversal (?:donor|recipient)\b|\bhypertension\b|\bhypotension\b|\bdiabetes\b" +BLOCK = r"\bmy\b|\bme\b|\bi (?:have|am|feel|got|was|take)\b|\bshould i\b|\bam i\b|\bdo i\b|\bdos(?:e|es|age)\b|\bmg\b|\bpills?\b|\bsymptoms?\b|\bdiagnos\w*\b|\bpregnan\w*\b|\bchild\w*\b|\bbab(?:y|ies)\b|\bcure\b|\b\d{2,}\b|\bautism\b" +KIND = "medicine" +ASK = r"\b(?:who|what|which|when|how|where|why|is|are|does|do|can|could|name)\b" +FACTS = [ + (r"(?=.*\bnormal\b)(?=.*\bbody temperature\b)", "98.6", "Normal adult body temperature averages about 98.6 °F (37 °C), varying by about a degree."), + (r"(?=.*\b(?:normal|typical|healthy)\b)(?=.*\bresting (?:heart rate|pulse)\b)", "60 to 100", "A normal resting heart rate for adults is 60 to 100 beats per minute."), + (r"(?=.*\b(?:normal|healthy)\b)(?=.*\bblood pressure\b)", "less than 120/80", "Normal adult blood pressure is less than 120/80 mm Hg."), + (r"(?=.*\bantibiotics?\b)(?=.*\b(?:virus\w*|viral|cold|colds|flu)\b)", "bacterial", + "Antibiotics treat bacterial infections only; they do not work on viruses such as colds or flu."), + (r"(?=.*\bantibiotics?\b)(?=.*\b(?:what|which)\b.*\b(?:treat|kill|work on|for)\b)", "bacterial", "Antibiotics treat bacterial infections."), + (r"(?=.*\binsulin\b)(?=.*\b(?:discover\w*|who)\b)", "Frederick Banting", "Insulin was discovered in 1921 by Frederick Banting and Charles Best."), + (r"(?=.*\binsulin\b)(?=.*\b(?:organ|produces?|made|makes)\b)", "pancreas", "Insulin is made by the pancreas (its beta cells)."), + (r"(?=.*\b(?:first vaccine|smallpox vaccine)\b)|(?=.*\bvaccin\w*\b)(?=.*\b(?:invent\w*|develop\w*|first|who)\b)(?=.*\bsmallpox\b|.*\bfirst\b)", "Edward Jenner", + "The first vaccine, against smallpox, was developed by Edward Jenner in 1796."), + (r"\buniversal (?:blood |red cell )?donor\b", "O negative", "The universal red-cell donor blood type is O negative."), + (r"\buniversal (?:blood )?recipient\b", "AB positive", "The universal red-cell recipient blood type is AB positive."), + (r"(?=.*\bhypertension\b)(?=.*\b(?:mean|what is)\b)", "high blood pressure", "Hypertension means high blood pressure."), + (r"(?=.*\bhypotension\b)(?=.*\b(?:mean|what is)\b)", "low blood pressure", "Hypotension means low blood pressure."), + (r"(?=.*\btype 1 diabetes\b)(?=.*\b(?:what|cause\w*|is)\b)", "autoimmune", + "Type 1 diabetes is an autoimmune condition in which the pancreas makes little or no insulin.")] diff --git a/root/specialists/medicine/facts_panel_v1.py b/root/specialists/medicine/facts_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..dc5b51fa8440ee06aa10d97d8f0c3a014163763b --- /dev/null +++ b/root/specialists/medicine/facts_panel_v1.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +"""facts_panel_v1 - the shared panel writer for typed-fact specialists. A specialist's panel file defines DEV and HELD +as [(question, expect or [accepted...], [rejected...])] and OFF as {"dev": [...], "heldout": [...]} (turns that must NOT +be taken), then calls build(). Expectations are typed by hand in the panel file, as a copy separate from the store.""" +import collections +import json +import sys + + +def build(DEV, HELD, OFF, out=None): + out = out or sys.argv[1] + items = [] + for split, rows in (("dev", DEV), ("heldout", HELD)): + for q, e, rej in rows: + items.append({"split": split, "kind": "fact", "valid": True, "q": q, "expect": e, "reject": rej}) + for q in OFF[split]: + items.append({"split": split, "kind": "off", "valid": False, "q": q, "expect": "not taken"}) + json.dump(items, open(out, "w"), indent=1, ensure_ascii=False) + print("panel:", dict(collections.Counter(i["split"] for i in items))) diff --git a/root/specialists/medicine/facts_scorer_v1.py b/root/specialists/medicine/facts_scorer_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..3b3242a53358377b6158b9cdc4a0b35e4e1f69ab --- /dev/null +++ b/root/specialists/medicine/facts_scorer_v1.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +"""facts_scorer_v1 - the shared scorer for typed-fact specialists. An item's expect is a string or a list of accepted +strings; the reply is right when ANY accepted string appears in it as a whole word / phrase (case-insensitive, +punctuation-normalised, like the core's answer_any), AND the reply does not also contain an item-listed wrong answer +("reject"), so a reply that hedges between two answers is not credited. Invalid (off-domain / advice) items must not +be answered - answering one is a false yes. A simple plural of an expected answer (arachnid / arachnids) counts. (ok, asserted).""" +import re + + +def norm(s): + return " " + " ".join(re.sub(r"[^a-z0-9 ]+", " ", str(s).lower()).split()) + " " + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + b = norm(text) + want = p["expect"] if isinstance(p["expect"], list) else [p["expect"]] + rej = p.get("reject") or [] + good = any(norm(w).strip() and (norm(w) in b or norm(w + "s") in b or norm(w + "es") in b) for w in want) # plural of the same answer + bad = any(norm(x).strip() and norm(x) in b for x in rej) + return good and not bad, True diff --git a/root/specialists/medicine/manifest.json b/root/specialists/medicine/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..dcb18b32de9923325d5757e784bda36ef2fee67b --- /dev/null +++ b/root/specialists/medicine/manifest.json @@ -0,0 +1,62 @@ +{ + "id": "medicine", + "name": "Oracle7 Medicine (reference only)", + "number": 90, + "tier": "C", + "sources": [ + { + "name": "MedlinePlus (NIH NLM)", + "licence": "public domain (US government)", + "url": "https://medlineplus.gov/" + }, + { + "name": "CDC antibiotic use / vaccine history", + "licence": "public domain (US government)", + "url": "https://www.cdc.gov/" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/medicine/facts_medicine_v1.py" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/medicine", + "module": "organ_facts_v1", + "class": "FactsOrgan", + "init": { + "store": "facts_medicine_v1" + } + }, + "accept": { + "kinds": [ + "medicine" + ], + "declines_in_domain": [], + "context_regex": "\\b(?:body temperature|heart rate|blood pressure|antibiotics?|insulin|vaccines?|universal (?:donor|recipient)|hypertension|hypotension|diabetes)\\b" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/medicine/medicine_panel_v1.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "facts_scorer_v1", + "scorer_fn": "ok" + }, + "routing_cues": [ + "normal reference values", + "antibiotics vs viruses", + "insulin", + "first vaccine", + "blood types" + ], + "budgets": { + "latency_p50_ms": 50, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20260928 + }, + "notes": "Typed-fact organ (tier C): general reference values and history of medicine. Symptoms, diagnosis, a person's readings, treatment, medication and dosing are blocked (the head answers). Narrowed (narrow_v1)." +} \ No newline at end of file diff --git a/root/specialists/medicine/medicine_panel_v1.json b/root/specialists/medicine/medicine_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..8748f9af0518898ebb033ec6cd2f4eb0d19674c9 --- /dev/null +++ b/root/specialists/medicine/medicine_panel_v1.json @@ -0,0 +1,152 @@ +[ + { + "split": "dev", + "kind": "fact", + "valid": true, + "q": "What is normal human body temperature?", + "expect": "98.6", + "reject": [] + }, + { + "split": "dev", + "kind": "fact", + "valid": true, + "q": "What is a normal resting heart rate for adults?", + "expect": "60 to 100", + "reject": [] + }, + { + "split": "dev", + "kind": "fact", + "valid": true, + "q": "Do antibiotics work against viruses?", + "expect": "bacterial", + "reject": [] + }, + { + "split": "dev", + "kind": "fact", + "valid": true, + "q": "Who discovered insulin?", + "expect": "Frederick Banting", + "reject": [] + }, + { + "split": "dev", + "kind": "fact", + "valid": true, + "q": "Which blood type is the universal donor?", + "expect": "O negative", + "reject": [ + "AB positive" + ] + }, + { + "split": "dev", + "kind": "fact", + "valid": true, + "q": "Which blood type is the universal recipient?", + "expect": "AB positive", + "reject": [ + "O negative" + ] + }, + { + "split": "dev", + "kind": "fact", + "valid": true, + "q": "What does hypertension mean?", + "expect": "high blood pressure", + "reject": [] + }, + { + "split": "dev", + "kind": "fact", + "valid": true, + "q": "Who developed the first vaccine?", + "expect": "Edward Jenner", + "reject": [] + }, + { + "split": "dev", + "kind": "off", + "valid": false, + "q": "I have a fever and a headache, what medicine should I take?", + "expect": "not taken" + }, + { + "split": "heldout", + "kind": "fact", + "valid": true, + "q": "What is considered a normal blood pressure?", + "expect": "less than 120/80", + "reject": [] + }, + { + "split": "heldout", + "kind": "fact", + "valid": true, + "q": "Which organ produces insulin?", + "expect": "pancreas", + "reject": [] + }, + { + "split": "heldout", + "kind": "fact", + "valid": true, + "q": "Can antibiotics treat the flu?", + "expect": "bacterial", + "reject": [] + }, + { + "split": "heldout", + "kind": "fact", + "valid": true, + "q": "Who created the smallpox vaccine?", + "expect": "Edward Jenner", + "reject": [] + }, + { + "split": "heldout", + "kind": "fact", + "valid": true, + "q": "What is the universal recipient blood type?", + "expect": "AB positive", + "reject": [ + "O negative" + ] + }, + { + "split": "heldout", + "kind": "fact", + "valid": true, + "q": "What blood type is known as the universal donor?", + "expect": "O negative", + "reject": [ + "AB positive" + ] + }, + { + "split": "heldout", + "kind": "fact", + "valid": true, + "q": "What is hypotension?", + "expect": "low blood pressure", + "reject": [] + }, + { + "split": "heldout", + "kind": "fact", + "valid": true, + "q": "What is type 1 diabetes?", + "expect": "autoimmune", + "reject": [] + }, + { + "split": "heldout", + "kind": "off", + "valid": false, + "q": "Is a blood pressure of 150/95 dangerous for me?", + "expect": "not taken" + } +] \ No newline at end of file diff --git a/root/specialists/medicine/medicine_panel_v1.py b/root/specialists/medicine/medicine_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..195ac2468f63d9ff88e49e77cb9d6ac74d6d6f94 --- /dev/null +++ b/root/specialists/medicine/medicine_panel_v1.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +"""medicine_panel_v1 - the sealed panel for specialist #90 (medicine: reference only). Answers TYPED OUT here as a second +copy of MedlinePlus / CDC reference values. Invalid: a person's symptoms, readings or dosing, which must not be taken. +Both orders: donor / recipient asked each way.""" +from facts_panel_v1 import build + +DEV = [("What is normal human body temperature?", "98.6", []), + ("What is a normal resting heart rate for adults?", "60 to 100", []), + ("Do antibiotics work against viruses?", "bacterial", []), + ("Who discovered insulin?", "Frederick Banting", []), + ("Which blood type is the universal donor?", "O negative", ["AB positive"]), + ("Which blood type is the universal recipient?", "AB positive", ["O negative"]), + ("What does hypertension mean?", "high blood pressure", []), + ("Who developed the first vaccine?", "Edward Jenner", [])] +HELD = [("What is considered a normal blood pressure?", "less than 120/80", []), + ("Which organ produces insulin?", "pancreas", []), + ("Can antibiotics treat the flu?", "bacterial", []), + ("Who created the smallpox vaccine?", "Edward Jenner", []), + ("What is the universal recipient blood type?", "AB positive", ["O negative"]), + ("What blood type is known as the universal donor?", "O negative", ["AB positive"]), + ("What is hypotension?", "low blood pressure", []), + ("What is type 1 diabetes?", "autoimmune", [])] +OFF = {"dev": ["I have a fever and a headache, what medicine should I take?"], "heldout": ["Is a blood pressure of 150/95 dangerous for me?"]} + +if __name__ == "__main__": + build(DEV, HELD, OFF) diff --git a/root/specialists/medicine/narrow_v1.py b/root/specialists/medicine/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/medicine/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/medicine/organ_facts_v1.py b/root/specialists/medicine/organ_facts_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..4c00754a2f59922614398ded18a226484232c343 --- /dev/null +++ b/root/specialists/medicine/organ_facts_v1.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 +"""organ_facts_v1 - the shared TYPED-FACT organ for reference specialists. A specialist supplies a store module with: + GATE - regex a turn must match to be in this domain at all; + BLOCK - regex for turns the specialist must never take (opinion, advice, medical / legal / personal, safety); + ASK - regex marking a question (default: who / what / which / when / how many / name / is ...); + FACTS - [(pattern, value, sentence)] tried IN ORDER (specific patterns first); the sentence is the reply. +The first fact whose pattern matches answers; nothing matching -> silence (the head answers), never a guess. +Narrowed (narrow_v1). Returns {kind, status, response, value}.""" +from __future__ import annotations + +import importlib +import re + +from narrow_v1 import narrative + +DEFAULT_ASK = r"\bwho\b|\bwhat\b|\bwhich\b|\bwhen\b|\bhow many\b|\bhow much\b|\bname\b|\bwhere\b|\bis\b|\bare\b|\bdoes\b|\bdo\b|\bcan\b|\bcould\b" + + +class FactsOrgan: + def __init__(self, store): + self.s = importlib.import_module(store) + self.gate = re.compile(self.s.GATE, re.I) + self.block = re.compile(self.s.BLOCK, re.I) if getattr(self.s, "BLOCK", None) else None + self.ask = re.compile(getattr(self.s, "ASK", DEFAULT_ASK), re.I) + self.facts = [(re.compile(p, re.I), v, sent) for p, v, sent in self.s.FACTS] + self.kind = getattr(self.s, "KIND", "fact") + + def answer(self, text, session_id="default"): + if narrative(text): + return None + t = " ".join(str(text or "").split()) + if not self.gate.search(t) or (self.block and self.block.search(t)) or not self.ask.search(t): + return None + for rx, v, sent in self.facts: + if rx.search(t): + return {"kind": self.kind, "status": "answered", "response": sent, "value": v} + return None diff --git a/root/specialists/medicine/verdict_dev.json b/root/specialists/medicine/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..fe70f7e15a78a8a7f478a54de3acf911c4b5bb9a --- /dev/null +++ b/root/specialists/medicine/verdict_dev.json @@ -0,0 +1,107 @@ +{ + "id": "medicine", + "name": "Oracle7 Medicine (reference only)", + "tier": "C", + "split": "dev", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T12:07:44Z", + "domain": { + "head": { + "correct": 2, + "false_yes": 0, + "wrong": 3, + "n": 9, + "p50_ms": 49.77, + "fails": [ + [ + "fact", + "What is normal human body temperature?", + "factoid:page", + "[ev:direct] Normal! is a 2011 Algerian drama film written and directed by Merzak Allouache" + ], + [ + "fact", + "What is a normal resting heart rate for adults?", + "arb:definitional->document_runtime|subst", + "[ev:unknown] I have no admitted entry for \u201cnormal resting heart rate for adults\u201d. The rela" + ], + [ + "fact", + "Do antibiotics work against viruses?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fact", + "Who discovered insulin?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fact", + "Which blood type is the universal donor?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fact", + "Which blood type is the universal recipient?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fact", + "Who developed the first vaccine?", + "factoid:page", + "[ev:direct] In 1881, to honor Jenner, Louis Pasteur proposed that the terms should be exte" + ] + ] + }, + "spec": { + "correct": 9, + "false_yes": 0, + "wrong": 0, + "n": 9, + "p50_ms": 0.17, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/medicine/verdict_heldout.json b/root/specialists/medicine/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..32dd53cccb288e9057bee47a12fe1d4713548d2e --- /dev/null +++ b/root/specialists/medicine/verdict_heldout.json @@ -0,0 +1,107 @@ +{ + "id": "medicine", + "name": "Oracle7 Medicine (reference only)", + "tier": "C", + "split": "heldout", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T12:11:32Z", + "domain": { + "head": { + "correct": 2, + "false_yes": 0, + "wrong": 3, + "n": 9, + "p50_ms": 26.58, + "fails": [ + [ + "fact", + "What is considered a normal blood pressure?", + "arb:definitional->definitional_encyclope", + "[ev:direct] I have no admitted entry for \u201cconsidered a normal blood pressure\u201d. The related" + ], + [ + "fact", + "Which organ produces insulin?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fact", + "Can antibiotics treat the flu?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fact", + "Who created the smallpox vaccine?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fact", + "What is the universal recipient blood type?", + "arb:definitional->definitional_encyclope", + "[ev:direct] I have no admitted entry for \u201cuniversal recipient blood type\u201d. The related ter" + ], + [ + "fact", + "What blood type is known as the universal donor?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fact", + "What is type 1 diabetes?", + "arb:definitional->document_runtime|subst", + "[ev:unknown] I have no admitted entry for \u201ctype 1 diabet\u201d. The related term \u201cOne\u201d is what " + ] + ] + }, + "spec": { + "correct": 9, + "false_yes": 0, + "wrong": 0, + "n": 9, + "p50_ms": 0.1, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/music-v2-r2/manifest.json b/root/specialists/music-v2-r2/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..de4ed650c3d19cad48a782fdcc3c93ab4c43fedd --- /dev/null +++ b/root/specialists/music-v2-r2/manifest.json @@ -0,0 +1,77 @@ +{ + "id": "music-v2-r2", + "name": "Oracle7 Music Theory v2", + "number": 74, + "tier": "B", + "sources": [ + { + "name": "Music theory (intervals, scales, key signatures, circle of fifths) - Wikibooks Music Theory", + "licence": "CC-BY-SA 4.0 (store ships share-alike)", + "url": "https://en.wikibooks.org/wiki/Music_Theory" + }, + { + "name": "12-tone equal temperament f = 440 x 2^((m-69)/12) (ISO 16:1975 standard pitch A4 = 440 Hz); MIDI 1.0 note numbering (middle C = 60)", + "licence": "facts", + "url": "https://www.iso.org/standard/3601.html" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/music-v2/organ_music_v2.py" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/music-v2-r2", + "module": "organ_music_v2_r2", + "class": "MusicOrganV2Boundary", + "init": {} + }, + "accept": { + "kinds": [ + "frequency", + "midi_number", + "midi_note", + "semitones", + "semitones_between", + "interval", + "key_sig", + "relative", + "scale", + "duration", + "cents" + ], + "declines_in_domain": [ + "underspecified", + "impossible" + ], + "context_regex": "\\b(?:notes?|scale|key signature|sharps?|flats?|major|minor|interval|semitones?|half[- ]steps?|midi|hz|bpm|cents|octave|pitch|frequency)\\b" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/music-v2/music_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "music_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [ + "frequency of a note", + "MIDI note number", + "interval between notes", + "key signature", + "relative minor", + "scale notes", + "note length at bpm", + "cents" + ], + "budgets": { + "latency_p50_ms": 50, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20260928 + }, + "notes": "v2 = v1 + the tuning REFERENCE is never the target (v1 NEGATIVE under gate v3: 'Tuning to A4 = 432 Hz, what frequency is C5?' answered A4 = 432 Hz, 3 confident wrong - roles from grammar, never order of mention) + 'which minor key is relative to X' (5 safe misses) + 'frequency' in the decline context (v1 dev: the correct decline on 'frequency of C' was dropped). Judged under spec_gate_v3.1 on a FRESH panel v2 (seeds 747474/74747474; reference first AND last on both splits). Same author - disclosed. music-v2-r2 (2026-09-30): boundary patch - silent on turns with another domain's markers and none of its own (family census).", + "supersedes": "music (v1 NEGATIVE under gate v3: held-out 56/64 vs 2/64, 3 wrong > cap 1)" +} \ No newline at end of file diff --git a/root/specialists/music-v2-r2/music_panel_v1.json b/root/specialists/music-v2-r2/music_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..0d9bafeb8132159cfcf21540dd34234e484aadfb --- /dev/null +++ b/root/specialists/music-v2-r2/music_panel_v1.json @@ -0,0 +1,920 @@ +[ + { + "split": "dev", + "kind": "freq", + "valid": true, + "q": "What is the frequency of G3?", + "expect": 195.99771799087463 + }, + { + "split": "dev", + "kind": "freq", + "valid": true, + "q": "What is the frequency of F#4?", + "expect": 369.9944227116344 + }, + { + "split": "dev", + "kind": "freq", + "valid": true, + "q": "What is the frequency of B3?", + "expect": 246.94165062806206 + }, + { + "split": "dev", + "kind": "freq", + "valid": true, + "q": "What is the frequency of Bb2?", + "expect": 116.54094037952248 + }, + { + "split": "dev", + "kind": "freq", + "valid": true, + "q": "What is the frequency of A4?", + "expect": 440.0 + }, + { + "split": "dev", + "kind": "freq", + "valid": true, + "q": "What is the frequency of E5?", + "expect": 659.2551138257398 + }, + { + "split": "dev", + "kind": "freq_ref", + "valid": true, + "q": "What is the frequency of Bb2 with A4 = 432 Hz?", + "expect": 114.42201419080389 + }, + { + "split": "dev", + "kind": "freq_ref", + "valid": true, + "q": "What is the frequency of C4 with A4 = 432 Hz?", + "expect": 256.86873684058776 + }, + { + "split": "dev", + "kind": "freq_ref", + "valid": true, + "q": "What is the frequency of D6 with A4 = 432 Hz?", + "expect": 1153.3016340029096 + }, + { + "split": "dev", + "kind": "freq_ref", + "valid": true, + "q": "What is the frequency of A4 with A4 = 432 Hz?", + "expect": 432.0 + }, + { + "split": "dev", + "kind": "midi_num", + "valid": true, + "q": "What is the MIDI note number of Eb4?", + "expect": 63 + }, + { + "split": "dev", + "kind": "midi_num", + "valid": true, + "q": "What is the MIDI note number of G3?", + "expect": 55 + }, + { + "split": "dev", + "kind": "midi_num", + "valid": true, + "q": "What is the MIDI note number of C5?", + "expect": 72 + }, + { + "split": "dev", + "kind": "midi_num", + "valid": true, + "q": "What is the MIDI note number of C4?", + "expect": 60 + }, + { + "split": "dev", + "kind": "midi_num", + "valid": true, + "q": "What is the MIDI note number of B3?", + "expect": 59 + }, + { + "split": "dev", + "kind": "midi_note", + "valid": true, + "q": "What note is MIDI 69?", + "expect": [ + "A4" + ] + }, + { + "split": "dev", + "kind": "midi_note", + "valid": true, + "q": "What note is MIDI 64?", + "expect": [ + "E4" + ] + }, + { + "split": "dev", + "kind": "midi_note", + "valid": true, + "q": "What note is MIDI 21?", + "expect": [ + "A0" + ] + }, + { + "split": "dev", + "kind": "midi_note", + "valid": true, + "q": "What note is MIDI 108?", + "expect": [ + "C8" + ] + }, + { + "split": "dev", + "kind": "midi_note", + "valid": true, + "q": "What note is MIDI 90?", + "expect": [ + "F#6", + "Gb6" + ] + }, + { + "split": "dev", + "kind": "semis", + "valid": true, + "q": "How many semitones are in a major second?", + "expect": 2 + }, + { + "split": "dev", + "kind": "semis", + "valid": true, + "q": "How many semitones are in a major sixth?", + "expect": 9 + }, + { + "split": "dev", + "kind": "semis", + "valid": true, + "q": "How many semitones are in a major third?", + "expect": 4 + }, + { + "split": "dev", + "kind": "semis", + "valid": true, + "q": "How many semitones are in a minor third?", + "expect": 3 + }, + { + "split": "dev", + "kind": "semis", + "valid": true, + "q": "How many semitones are in a major seventh?", + "expect": 11 + }, + { + "split": "dev", + "kind": "semis", + "valid": true, + "q": "How many semitones are in a minor second?", + "expect": 1 + }, + { + "split": "dev", + "kind": "interval", + "valid": true, + "q": "What interval is F up to G?", + "expect": "major second" + }, + { + "split": "dev", + "kind": "interval", + "valid": true, + "q": "What interval is C up to Gb?", + "expect": "diminished fifth" + }, + { + "split": "dev", + "kind": "interval", + "valid": true, + "q": "What interval is G up to F?", + "expect": "minor seventh" + }, + { + "split": "dev", + "kind": "interval", + "valid": true, + "q": "What interval is F up to B?", + "expect": "augmented fourth" + }, + { + "split": "dev", + "kind": "interval", + "valid": true, + "q": "What interval is Eb up to C?", + "expect": "major sixth" + }, + { + "split": "dev", + "kind": "interval", + "valid": true, + "q": "What interval is C up to F#?", + "expect": "augmented fourth" + }, + { + "split": "dev", + "kind": "interval", + "valid": true, + "q": "What interval is C up to E?", + "expect": "major third" + }, + { + "split": "dev", + "kind": "interval", + "valid": true, + "q": "What interval is Bb up to D?", + "expect": "major third" + }, + { + "split": "dev", + "kind": "keysig", + "valid": true, + "q": "How many sharps or flats does Bb minor have?", + "expect": -5 + }, + { + "split": "dev", + "kind": "keysig", + "valid": true, + "q": "How many sharps or flats does F# major have?", + "expect": 6 + }, + { + "split": "dev", + "kind": "keysig", + "valid": true, + "q": "How many sharps or flats does Bb major have?", + "expect": -2 + }, + { + "split": "dev", + "kind": "keysig", + "valid": true, + "q": "How many sharps or flats does Eb minor have?", + "expect": -6 + }, + { + "split": "dev", + "kind": "keysig", + "valid": true, + "q": "How many sharps or flats does A minor have?", + "expect": 0 + }, + { + "split": "dev", + "kind": "keysig", + "valid": true, + "q": "How many sharps or flats does Gb major have?", + "expect": -6 + }, + { + "split": "dev", + "kind": "keysig", + "valid": true, + "q": "How many sharps or flats does C# minor have?", + "expect": 4 + }, + { + "split": "dev", + "kind": "relative", + "valid": true, + "q": "What is the relative major of A minor?", + "expect": "C major" + }, + { + "split": "dev", + "kind": "relative", + "valid": true, + "q": "What is the relative minor of A major?", + "expect": "F# minor" + }, + { + "split": "dev", + "kind": "relative", + "valid": true, + "q": "What is the relative minor of G major?", + "expect": "E minor" + }, + { + "split": "dev", + "kind": "relative", + "valid": true, + "q": "What is the relative minor of B major?", + "expect": "G# minor" + }, + { + "split": "dev", + "kind": "relative", + "valid": true, + "q": "What is the relative minor of C major?", + "expect": "A minor" + }, + { + "split": "dev", + "kind": "scale", + "valid": true, + "q": "What are the notes of the F# major scale?", + "expect": "F# G# A# B C# D# E#" + }, + { + "split": "dev", + "kind": "scale", + "valid": true, + "q": "What are the notes of the E minor scale?", + "expect": "E F# G A B C D" + }, + { + "split": "dev", + "kind": "scale", + "valid": true, + "q": "What are the notes of the D minor scale?", + "expect": "D E F G A Bb C" + }, + { + "split": "dev", + "kind": "scale", + "valid": true, + "q": "What are the notes of the G minor scale?", + "expect": "G A Bb C D Eb F" + }, + { + "split": "dev", + "kind": "scale", + "valid": true, + "q": "What are the notes of the D major scale?", + "expect": "D E F# G A B C#" + }, + { + "split": "dev", + "kind": "scale", + "valid": true, + "q": "What are the notes of the B minor scale?", + "expect": "B C# D E F# G A" + }, + { + "split": "dev", + "kind": "duration", + "valid": true, + "q": "How long is a sixteenth note at 120 bpm in seconds?", + "expect": 0.125 + }, + { + "split": "dev", + "kind": "duration", + "valid": true, + "q": "How long is a half note at 90 bpm in seconds?", + "expect": 1.3333333333333333 + }, + { + "split": "dev", + "kind": "duration", + "valid": true, + "q": "How long is a whole note at 80 bpm in seconds?", + "expect": 3.0 + }, + { + "split": "dev", + "kind": "duration", + "valid": true, + "q": "How long is a dotted half note at 72 bpm in seconds?", + "expect": 2.5 + }, + { + "split": "dev", + "kind": "duration", + "valid": true, + "q": "How long is a eighth note at 100 bpm in seconds?", + "expect": 0.3 + }, + { + "split": "dev", + "kind": "cents", + "valid": true, + "q": "How many cents is it from 261.63 Hz to 329.63 Hz?", + "expect": 399.98348613429863 + }, + { + "split": "dev", + "kind": "cents", + "valid": true, + "q": "How many cents is it from 220 Hz to 330 Hz?", + "expect": 701.9550008653874 + }, + { + "split": "dev", + "kind": "cents", + "valid": true, + "q": "How many cents is it from 300 Hz to 400 Hz?", + "expect": 498.0449991346125 + }, + { + "split": "dev", + "kind": "cents", + "valid": true, + "q": "How many cents is it from 440 Hz to 660 Hz?", + "expect": 701.9550008653874 + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "How many sharps does G# major have?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What is the frequency of C?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What note is MIDI 140?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "freq", + "valid": true, + "q": "Give the pitch in Hz of G3 in equal temperament.", + "expect": 195.99771799087463 + }, + { + "split": "heldout", + "kind": "freq", + "valid": true, + "q": "Give the pitch in Hz of Eb4 in equal temperament.", + "expect": 311.1269837220809 + }, + { + "split": "heldout", + "kind": "freq", + "valid": true, + "q": "Give the pitch in Hz of F#4 in equal temperament.", + "expect": 369.9944227116344 + }, + { + "split": "heldout", + "kind": "freq", + "valid": true, + "q": "Give the pitch in Hz of Bb2 in equal temperament.", + "expect": 116.54094037952248 + }, + { + "split": "heldout", + "kind": "freq", + "valid": true, + "q": "Give the pitch in Hz of D6 in equal temperament.", + "expect": 1174.6590716696303 + }, + { + "split": "heldout", + "kind": "freq", + "valid": true, + "q": "Give the pitch in Hz of B3 in equal temperament.", + "expect": 246.94165062806206 + }, + { + "split": "heldout", + "kind": "freq_ref", + "valid": true, + "q": "Tuning to A4 = 432 Hz, what frequency is C5?", + "expect": 513.7374736811755 + }, + { + "split": "heldout", + "kind": "freq_ref", + "valid": true, + "q": "Tuning to A4 = 432 Hz, what frequency is G3?", + "expect": 192.4341231183133 + }, + { + "split": "heldout", + "kind": "freq_ref", + "valid": true, + "q": "Tuning to A4 = 432 Hz, what frequency is Eb4?", + "expect": 305.47012947258855 + }, + { + "split": "heldout", + "kind": "freq_ref", + "valid": true, + "q": "Tuning to A4 = 432 Hz, what frequency is A4?", + "expect": 432.0 + }, + { + "split": "heldout", + "kind": "midi_num", + "valid": true, + "q": "Which MIDI number corresponds to B3?", + "expect": 59 + }, + { + "split": "heldout", + "kind": "midi_num", + "valid": true, + "q": "Which MIDI number corresponds to E5?", + "expect": 76 + }, + { + "split": "heldout", + "kind": "midi_num", + "valid": true, + "q": "Which MIDI number corresponds to G3?", + "expect": 55 + }, + { + "split": "heldout", + "kind": "midi_num", + "valid": true, + "q": "Which MIDI number corresponds to F#4?", + "expect": 66 + }, + { + "split": "heldout", + "kind": "midi_num", + "valid": true, + "q": "Which MIDI number corresponds to C5?", + "expect": 72 + }, + { + "split": "heldout", + "kind": "midi_note", + "valid": true, + "q": "MIDI note 21 is what note?", + "expect": [ + "A0" + ] + }, + { + "split": "heldout", + "kind": "midi_note", + "valid": true, + "q": "MIDI note 108 is what note?", + "expect": [ + "C8" + ] + }, + { + "split": "heldout", + "kind": "midi_note", + "valid": true, + "q": "MIDI note 60 is what note?", + "expect": [ + "C4" + ] + }, + { + "split": "heldout", + "kind": "midi_note", + "valid": true, + "q": "MIDI note 61 is what note?", + "expect": [ + "C#4", + "Db4" + ] + }, + { + "split": "heldout", + "kind": "midi_note", + "valid": true, + "q": "MIDI note 69 is what note?", + "expect": [ + "A4" + ] + }, + { + "split": "heldout", + "kind": "semis", + "valid": true, + "q": "A minor seventh spans how many half steps?", + "expect": 10 + }, + { + "split": "heldout", + "kind": "semis", + "valid": true, + "q": "A major third spans how many half steps?", + "expect": 4 + }, + { + "split": "heldout", + "kind": "semis", + "valid": true, + "q": "A perfect fourth spans how many half steps?", + "expect": 5 + }, + { + "split": "heldout", + "kind": "semis", + "valid": true, + "q": "A octave spans how many half steps?", + "expect": 12 + }, + { + "split": "heldout", + "kind": "semis", + "valid": true, + "q": "A minor sixth spans how many half steps?", + "expect": 8 + }, + { + "split": "heldout", + "kind": "semis", + "valid": true, + "q": "A major second spans how many half steps?", + "expect": 2 + }, + { + "split": "heldout", + "kind": "interval", + "valid": true, + "q": "Name the interval from G up to F.", + "expect": "minor seventh" + }, + { + "split": "heldout", + "kind": "interval", + "valid": true, + "q": "Name the interval from F# up to A.", + "expect": "minor third" + }, + { + "split": "heldout", + "kind": "interval", + "valid": true, + "q": "Name the interval from C4 up to C5.", + "expect": "perfect octave" + }, + { + "split": "heldout", + "kind": "interval", + "valid": true, + "q": "Name the interval from G up to D.", + "expect": "perfect fifth" + }, + { + "split": "heldout", + "kind": "interval", + "valid": true, + "q": "Name the interval from C up to E.", + "expect": "major third" + }, + { + "split": "heldout", + "kind": "interval", + "valid": true, + "q": "Name the interval from C up to Eb.", + "expect": "minor third" + }, + { + "split": "heldout", + "kind": "interval", + "valid": true, + "q": "Name the interval from B up to F.", + "expect": "diminished fifth" + }, + { + "split": "heldout", + "kind": "interval", + "valid": true, + "q": "Name the interval from D up to A.", + "expect": "perfect fifth" + }, + { + "split": "heldout", + "kind": "keysig", + "valid": true, + "q": "What is the key signature of C minor?", + "expect": -3 + }, + { + "split": "heldout", + "kind": "keysig", + "valid": true, + "q": "What is the key signature of Bb major?", + "expect": -2 + }, + { + "split": "heldout", + "kind": "keysig", + "valid": true, + "q": "What is the key signature of D major?", + "expect": 2 + }, + { + "split": "heldout", + "kind": "keysig", + "valid": true, + "q": "What is the key signature of C# major?", + "expect": 7 + }, + { + "split": "heldout", + "kind": "keysig", + "valid": true, + "q": "What is the key signature of E minor?", + "expect": 1 + }, + { + "split": "heldout", + "kind": "keysig", + "valid": true, + "q": "What is the key signature of Bb minor?", + "expect": -5 + }, + { + "split": "heldout", + "kind": "keysig", + "valid": true, + "q": "What is the key signature of Gb major?", + "expect": -6 + }, + { + "split": "heldout", + "kind": "relative", + "valid": true, + "q": "Which minor key is relative to G major?", + "expect": "E minor" + }, + { + "split": "heldout", + "kind": "relative", + "valid": true, + "q": "Which minor key is relative to B major?", + "expect": "G# minor" + }, + { + "split": "heldout", + "kind": "relative", + "valid": true, + "q": "Which major key is relative to A minor?", + "expect": "C major" + }, + { + "split": "heldout", + "kind": "relative", + "valid": true, + "q": "Which minor key is relative to D major?", + "expect": "B minor" + }, + { + "split": "heldout", + "kind": "relative", + "valid": true, + "q": "Which minor key is relative to F major?", + "expect": "D minor" + }, + { + "split": "heldout", + "kind": "scale", + "valid": true, + "q": "Spell the C minor scale.", + "expect": "C D Eb F G Ab Bb" + }, + { + "split": "heldout", + "kind": "scale", + "valid": true, + "q": "Spell the D minor scale.", + "expect": "D E F G A Bb C" + }, + { + "split": "heldout", + "kind": "scale", + "valid": true, + "q": "Spell the A minor scale.", + "expect": "A B C D E F G" + }, + { + "split": "heldout", + "kind": "scale", + "valid": true, + "q": "Spell the Bb major scale.", + "expect": "Bb C D Eb F G A" + }, + { + "split": "heldout", + "kind": "scale", + "valid": true, + "q": "Spell the D major scale.", + "expect": "D E F# G A B C#" + }, + { + "split": "heldout", + "kind": "scale", + "valid": true, + "q": "Spell the Ab major scale.", + "expect": "Ab Bb C Db Eb F G" + }, + { + "split": "heldout", + "kind": "duration", + "valid": true, + "q": "At 120 bpm, what is the duration of a quarter note in seconds?", + "expect": 0.5 + }, + { + "split": "heldout", + "kind": "duration", + "valid": true, + "q": "At 80 bpm, what is the duration of a whole note in seconds?", + "expect": 3.0 + }, + { + "split": "heldout", + "kind": "duration", + "valid": true, + "q": "At 60 bpm, what is the duration of a dotted quarter note in seconds?", + "expect": 1.5 + }, + { + "split": "heldout", + "kind": "duration", + "valid": true, + "q": "At 90 bpm, what is the duration of a half note in seconds?", + "expect": 1.3333333333333333 + }, + { + "split": "heldout", + "kind": "duration", + "valid": true, + "q": "At 100 bpm, what is the duration of a eighth note in seconds?", + "expect": 0.3 + }, + { + "split": "heldout", + "kind": "cents", + "valid": true, + "q": "Express the interval between 220 Hz and 330 Hz in cents.", + "expect": 701.9550008653874 + }, + { + "split": "heldout", + "kind": "cents", + "valid": true, + "q": "Express the interval between 440 Hz and 466.16 Hz in cents.", + "expect": 99.98603045752498 + }, + { + "split": "heldout", + "kind": "cents", + "valid": true, + "q": "Express the interval between 440 Hz and 880 Hz in cents.", + "expect": 1200.0 + }, + { + "split": "heldout", + "kind": "cents", + "valid": true, + "q": "Express the interval between 440 Hz and 660 Hz in cents.", + "expect": 701.9550008653874 + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "What is the key signature of D# major?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "Give the pitch in Hz of F# in equal temperament.", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "MIDI note 200 is what note?", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/music-v2-r2/music_panel_v1.py b/root/specialists/music-v2-r2/music_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..b2dbf662fe6ebf73b19af2da14b3d0617ec3202c --- /dev/null +++ b/root/specialists/music-v2-r2/music_panel_v1.py @@ -0,0 +1,93 @@ +#!/usr/bin/env python3 +"""music_panel_v1 - the sealed panel for specialist #74 (music theory). Expected answers are WRITTEN OUT here from the +standard tables (circle-of-fifths key signatures, relative keys, spelled major / natural-minor scales, spelled interval +names, semitone counts, MIDI numbers with middle C = C4 = 60), not computed by the organ's code; frequencies are +A x 2^((m - 69)/12) on the listed MIDI numbers; durations 60/bpm x beats; cents 1200 log2(f2/f1). +Must-decline: theoretical keys (G# major, D# major), a pitch with no octave, a MIDI number over 127. +Dev / held-out differ in seed and phrasing. usage: music_panel_v1.py """ +import collections +import json +import math +import random +import sys + +T = {"dev": {"freq": "What is the frequency of {note}?", "freq_ref": "What is the frequency of {note} with A4 = 432 Hz?", + "midi_num": "What is the MIDI note number of {note}?", "midi_note": "What note is MIDI {n}?", + "semis": "How many semitones are in a {ivl}?", "interval": "What interval is {n1} up to {n2}?", + "keysig": "How many sharps or flats does {key} have?", "relative": "What is the relative {other} of {key}?", + "scale": "What are the notes of the {key} scale?", "duration": "How long is a {dur} note at {bpm} bpm in seconds?", + "cents": "How many cents is it from {f1} Hz to {f2} Hz?"}, + "heldout": {"freq": "Give the pitch in Hz of {note} in equal temperament.", "freq_ref": "Tuning to A4 = 432 Hz, what frequency is {note}?", + "midi_num": "Which MIDI number corresponds to {note}?", "midi_note": "MIDI note {n} is what note?", + "semis": "A {ivl} spans how many half steps?", "interval": "Name the interval from {n1} up to {n2}.", + "keysig": "What is the key signature of {key}?", "relative": "Which {other} key is relative to {key}?", + "scale": "Spell the {key} scale.", "duration": "At {bpm} bpm, what is the duration of a {dur} note in seconds?", + "cents": "Express the interval between {f1} Hz and {f2} Hz in cents."}} +DECLINE = {"dev": ["How many sharps does G# major have?", "What is the frequency of C?", "What note is MIDI 140?"], + "heldout": ["What is the key signature of D# major?", "Give the pitch in Hz of F# in equal temperament.", "MIDI note 200 is what note?"]} + +MIDI = {"A4": 69, "C4": 60, "E5": 76, "G3": 55, "F#4": 66, "Bb2": 46, "D6": 86, "C5": 72, "Eb4": 63, "B3": 59} +MIDI_NAMES = {60: ["C4"], 61: ["C#4", "Db4"], 64: ["E4"], 69: ["A4"], 70: ["A#4", "Bb4"], 72: ["C5"], 47: ["B2"], 90: ["F#6", "Gb6"], + 21: ["A0"], 108: ["C8"]} +SEMIS = {"minor second": 1, "major second": 2, "minor third": 3, "major third": 4, "perfect fourth": 5, "perfect fifth": 7, + "minor sixth": 8, "major sixth": 9, "minor seventh": 10, "major seventh": 11, "octave": 12} +IVLS = [("C", "E", "major third"), ("C", "Eb", "minor third"), ("D", "A", "perfect fifth"), ("E", "A", "perfect fourth"), + ("F", "B", "augmented fourth"), ("B", "F", "diminished fifth"), ("C", "F#", "augmented fourth"), ("C", "Gb", "diminished fifth"), + ("G", "F", "minor seventh"), ("A", "G#", "major seventh"), ("Eb", "C", "major sixth"), ("D", "Bb", "minor sixth"), + ("E", "F", "minor second"), ("F", "G", "major second"), ("C4", "C5", "perfect octave"), ("Bb", "D", "major third"), + ("F#", "A", "minor third"), ("G", "D", "perfect fifth")] +KEYSIG = {"G major": 1, "D major": 2, "A major": 3, "E major": 4, "B major": 5, "F# major": 6, "C# major": 7, "F major": -1, + "Bb major": -2, "Eb major": -3, "Ab major": -4, "Db major": -5, "Gb major": -6, "C major": 0, + "E minor": 1, "B minor": 2, "F# minor": 3, "C# minor": 4, "G# minor": 5, "D# minor": 6, "D minor": -1, "G minor": -2, + "C minor": -3, "F minor": -4, "Bb minor": -5, "Eb minor": -6, "A minor": 0} +REL = {"C major": "A minor", "G major": "E minor", "D major": "B minor", "A major": "F# minor", "E major": "C# minor", + "B major": "G# minor", "F major": "D minor", "Bb major": "G minor", "Eb major": "C minor", "Ab major": "F minor", + "Db major": "Bb minor", "A minor": "C major", "E minor": "G major", "D minor": "F major", "C minor": "Eb major", + "B minor": "D major", "G minor": "Bb major", "F# minor": "A major", "F minor": "Ab major"} +SCALES = {"G major": "G A B C D E F#", "D major": "D E F# G A B C#", "Bb major": "Bb C D Eb F G A", "E major": "E F# G# A B C# D#", + "Ab major": "Ab Bb C Db Eb F G", "F# major": "F# G# A# B C# D# E#", "Eb major": "Eb F G Ab Bb C D", + "A minor": "A B C D E F G", "E minor": "E F# G A B C D", "D minor": "D E F G A Bb C", "C minor": "C D Eb F G Ab Bb", + "B minor": "B C# D E F# G A", "F# minor": "F# G# A B C# D E", "G minor": "G A Bb C D Eb F", "C# minor": "C# D# E F# G# A B"} +DURS = [("quarter", 120, 0.5), ("half", 90, 2 * 60 / 90), ("dotted quarter", 60, 1.5), ("eighth", 100, 0.3), ("whole", 80, 3.0), + ("sixteenth", 120, 0.125), ("dotted half", 72, 2.5)] +CENTS = [(440, 880), (440, 466.16), (440, 660), (261.63, 329.63), (300, 400), (220, 330)] + + +def main(): + items = [] + for split, seed in (("dev", 74), ("heldout", 7474)): + rng = random.Random(seed) + t = T[split] + add = [] + for note in rng.sample(sorted(MIDI), 6): + add.append(("freq", {"note": note}, 440 * 2 ** ((MIDI[note] - 69) / 12))) + for note in rng.sample(sorted(MIDI), 4): + add.append(("freq_ref", {"note": note}, 432 * 2 ** ((MIDI[note] - 69) / 12))) + for note in rng.sample(sorted(MIDI), 5): + add.append(("midi_num", {"note": note}, MIDI[note])) + for n in rng.sample(sorted(MIDI_NAMES), 5): + add.append(("midi_note", {"n": n}, MIDI_NAMES[n])) + for ivl in rng.sample(sorted(SEMIS), 6): + add.append(("semis", {"ivl": ivl}, SEMIS[ivl])) + for n1, n2, name in rng.sample(IVLS, 8): + add.append(("interval", {"n1": n1, "n2": n2}, name)) + for key in rng.sample(sorted(KEYSIG), 7): + add.append(("keysig", {"key": key}, KEYSIG[key])) + for key in rng.sample(sorted(REL), 5): + add.append(("relative", {"key": key, "other": "major" if "minor" in key else "minor"}, REL[key])) + for key in rng.sample(sorted(SCALES), 6): + add.append(("scale", {"key": key}, SCALES[key])) + for dur, bpm, s in rng.sample(DURS, 5): + add.append(("duration", {"dur": dur, "bpm": bpm}, s)) + for f1, f2 in rng.sample(CENTS, 4): + add.append(("cents", {"f1": f1, "f2": f2}, 1200 * math.log2(f2 / f1))) + for kind, kw, exp in add: + items.append({"split": split, "kind": kind, "valid": True, "q": t[kind].format(**kw), "expect": exp}) + for q in DECLINE[split]: + items.append({"split": split, "kind": "decline", "valid": False, "q": q, "expect": "decline"}) + json.dump(items, open(sys.argv[1], "w"), indent=1) + print("panel:", dict(collections.Counter(i["split"] for i in items))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/music-v2-r2/music_panel_v2.json b/root/specialists/music-v2-r2/music_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..d36ba10a463dc45cedf54d3338e550eeb02d9fc4 --- /dev/null +++ b/root/specialists/music-v2-r2/music_panel_v2.json @@ -0,0 +1,922 @@ +[ + { + "split": "dev", + "kind": "freq", + "valid": true, + "q": "What is the frequency of B3 in Hz?", + "expect": 246.94165062806206 + }, + { + "split": "dev", + "kind": "freq", + "valid": true, + "q": "What is the frequency of C4 in Hz?", + "expect": 261.6255653005986 + }, + { + "split": "dev", + "kind": "freq", + "valid": true, + "q": "What is the frequency of G3 in Hz?", + "expect": 195.99771799087463 + }, + { + "split": "dev", + "kind": "freq", + "valid": true, + "q": "What is the frequency of F#4 in Hz?", + "expect": 369.9944227116344 + }, + { + "split": "dev", + "kind": "freq", + "valid": true, + "q": "What is the frequency of Eb4 in Hz?", + "expect": 311.1269837220809 + }, + { + "split": "dev", + "kind": "freq", + "valid": true, + "q": "What is the frequency of D6 in Hz?", + "expect": 1174.6590716696303 + }, + { + "split": "dev", + "kind": "freq_ref", + "valid": true, + "q": "With A4 tuned to 432 Hz, what is the frequency of F#4?", + "expect": 363.26725138960467 + }, + { + "split": "dev", + "kind": "freq_ref", + "valid": true, + "q": "What is the frequency of C4 when A4 = 432 Hz?", + "expect": 256.86873684058776 + }, + { + "split": "dev", + "kind": "freq_ref", + "valid": true, + "q": "With A4 tuned to 432 Hz, what is the frequency of Eb4?", + "expect": 305.47012947258855 + }, + { + "split": "dev", + "kind": "freq_ref", + "valid": true, + "q": "What is the frequency of A4 when A4 = 432 Hz?", + "expect": 432.0 + }, + { + "split": "dev", + "kind": "midi_num", + "valid": true, + "q": "What MIDI note number is D6?", + "expect": 86 + }, + { + "split": "dev", + "kind": "midi_num", + "valid": true, + "q": "What MIDI note number is F#4?", + "expect": 66 + }, + { + "split": "dev", + "kind": "midi_num", + "valid": true, + "q": "What MIDI note number is A4?", + "expect": 69 + }, + { + "split": "dev", + "kind": "midi_num", + "valid": true, + "q": "What MIDI note number is Eb4?", + "expect": 63 + }, + { + "split": "dev", + "kind": "midi_num", + "valid": true, + "q": "What MIDI note number is C4?", + "expect": 60 + }, + { + "split": "dev", + "kind": "midi_note", + "valid": true, + "q": "Which note is MIDI note 21?", + "expect": [ + "A0" + ] + }, + { + "split": "dev", + "kind": "midi_note", + "valid": true, + "q": "Which note is MIDI note 47?", + "expect": [ + "B2" + ] + }, + { + "split": "dev", + "kind": "midi_note", + "valid": true, + "q": "Which note is MIDI note 108?", + "expect": [ + "C8" + ] + }, + { + "split": "dev", + "kind": "midi_note", + "valid": true, + "q": "Which note is MIDI note 60?", + "expect": [ + "C4" + ] + }, + { + "split": "dev", + "kind": "midi_note", + "valid": true, + "q": "Which note is MIDI note 90?", + "expect": [ + "F#6", + "Gb6" + ] + }, + { + "split": "dev", + "kind": "semis", + "valid": true, + "q": "How many half steps are in a minor third?", + "expect": 3 + }, + { + "split": "dev", + "kind": "semis", + "valid": true, + "q": "How many half steps are in a minor sixth?", + "expect": 8 + }, + { + "split": "dev", + "kind": "semis", + "valid": true, + "q": "How many half steps are in a major third?", + "expect": 4 + }, + { + "split": "dev", + "kind": "semis", + "valid": true, + "q": "How many half steps are in a perfect fourth?", + "expect": 5 + }, + { + "split": "dev", + "kind": "semis", + "valid": true, + "q": "How many half steps are in a major sixth?", + "expect": 9 + }, + { + "split": "dev", + "kind": "semis", + "valid": true, + "q": "How many half steps are in a perfect fifth?", + "expect": 7 + }, + { + "split": "dev", + "kind": "interval", + "valid": true, + "q": "What is the interval between F and B going up?", + "expect": "augmented fourth" + }, + { + "split": "dev", + "kind": "interval", + "valid": true, + "q": "What is the interval between C4 and C5 going up?", + "expect": "perfect octave" + }, + { + "split": "dev", + "kind": "interval", + "valid": true, + "q": "What is the interval between C and F# going up?", + "expect": "augmented fourth" + }, + { + "split": "dev", + "kind": "interval", + "valid": true, + "q": "What is the interval between E and A going up?", + "expect": "perfect fourth" + }, + { + "split": "dev", + "kind": "interval", + "valid": true, + "q": "What is the interval between C and Eb going up?", + "expect": "minor third" + }, + { + "split": "dev", + "kind": "interval", + "valid": true, + "q": "What is the interval between G and F going up?", + "expect": "minor seventh" + }, + { + "split": "dev", + "kind": "interval", + "valid": true, + "q": "What is the interval between D and Bb going up?", + "expect": "minor sixth" + }, + { + "split": "dev", + "kind": "interval", + "valid": true, + "q": "What is the interval between Eb and C going up?", + "expect": "major sixth" + }, + { + "split": "dev", + "kind": "keysig", + "valid": true, + "q": "How many sharps or flats are in the key signature of E minor?", + "expect": 1 + }, + { + "split": "dev", + "kind": "keysig", + "valid": true, + "q": "How many sharps or flats are in the key signature of Ab major?", + "expect": -4 + }, + { + "split": "dev", + "kind": "keysig", + "valid": true, + "q": "How many sharps or flats are in the key signature of F# minor?", + "expect": 3 + }, + { + "split": "dev", + "kind": "keysig", + "valid": true, + "q": "How many sharps or flats are in the key signature of Bb minor?", + "expect": -5 + }, + { + "split": "dev", + "kind": "keysig", + "valid": true, + "q": "How many sharps or flats are in the key signature of Db major?", + "expect": -5 + }, + { + "split": "dev", + "kind": "keysig", + "valid": true, + "q": "How many sharps or flats are in the key signature of F# major?", + "expect": 6 + }, + { + "split": "dev", + "kind": "keysig", + "valid": true, + "q": "How many sharps or flats are in the key signature of C# minor?", + "expect": 4 + }, + { + "split": "dev", + "kind": "relative", + "valid": true, + "q": "Which minor key is relative to Eb major?", + "expect": "C minor" + }, + { + "split": "dev", + "kind": "relative", + "valid": true, + "q": "Which minor key is relative to D major?", + "expect": "B minor" + }, + { + "split": "dev", + "kind": "relative", + "valid": true, + "q": "Which minor key is relative to Ab major?", + "expect": "F minor" + }, + { + "split": "dev", + "kind": "relative", + "valid": true, + "q": "Which minor key is relative to Bb major?", + "expect": "G minor" + }, + { + "split": "dev", + "kind": "relative", + "valid": true, + "q": "Which minor key is relative to F major?", + "expect": "D minor" + }, + { + "split": "dev", + "kind": "scale", + "valid": true, + "q": "List the notes of the G minor scale.", + "expect": "G A Bb C D Eb F" + }, + { + "split": "dev", + "kind": "scale", + "valid": true, + "q": "List the notes of the Eb major scale.", + "expect": "Eb F G Ab Bb C D" + }, + { + "split": "dev", + "kind": "scale", + "valid": true, + "q": "List the notes of the Ab major scale.", + "expect": "Ab Bb C Db Eb F G" + }, + { + "split": "dev", + "kind": "scale", + "valid": true, + "q": "List the notes of the D minor scale.", + "expect": "D E F G A Bb C" + }, + { + "split": "dev", + "kind": "scale", + "valid": true, + "q": "List the notes of the C# minor scale.", + "expect": "C# D# E F# G# A B" + }, + { + "split": "dev", + "kind": "scale", + "valid": true, + "q": "List the notes of the E major scale.", + "expect": "E F# G# A B C# D#" + }, + { + "split": "dev", + "kind": "duration", + "valid": true, + "q": "At 90 bpm, how long does a half note last in seconds?", + "expect": 1.3333333333333333 + }, + { + "split": "dev", + "kind": "duration", + "valid": true, + "q": "At 60 bpm, how long does a dotted quarter note last in seconds?", + "expect": 1.5 + }, + { + "split": "dev", + "kind": "duration", + "valid": true, + "q": "At 72 bpm, how long does a dotted half note last in seconds?", + "expect": 2.5 + }, + { + "split": "dev", + "kind": "duration", + "valid": true, + "q": "At 80 bpm, how long does a whole note last in seconds?", + "expect": 3.0 + }, + { + "split": "dev", + "kind": "duration", + "valid": true, + "q": "At 120 bpm, how long does a quarter note last in seconds?", + "expect": 0.5 + }, + { + "split": "dev", + "kind": "cents", + "valid": true, + "q": "What is the interval in cents from 440 Hz up to 880 Hz?", + "expect": 1200.0 + }, + { + "split": "dev", + "kind": "cents", + "valid": true, + "q": "What is the interval in cents from 300 Hz up to 400 Hz?", + "expect": 498.0449991346125 + }, + { + "split": "dev", + "kind": "cents", + "valid": true, + "q": "What is the interval in cents from 220 Hz up to 330 Hz?", + "expect": 701.9550008653874 + }, + { + "split": "dev", + "kind": "cents", + "valid": true, + "q": "What is the interval in cents from 440 Hz up to 466.16 Hz?", + "expect": 99.98603045752498 + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "How many sharps are in the key signature of A# major?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What is the frequency of D in Hz?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "Which note is MIDI note 150?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "freq", + "valid": true, + "q": "Equal-temperament frequency of G3?", + "expect": 195.99771799087463 + }, + { + "split": "heldout", + "kind": "freq", + "valid": true, + "q": "Equal-temperament frequency of D6?", + "expect": 1174.6590716696303 + }, + { + "split": "heldout", + "kind": "freq", + "valid": true, + "q": "Equal-temperament frequency of C5?", + "expect": 523.2511306011972 + }, + { + "split": "heldout", + "kind": "freq", + "valid": true, + "q": "Equal-temperament frequency of Eb4?", + "expect": 311.1269837220809 + }, + { + "split": "heldout", + "kind": "freq", + "valid": true, + "q": "Equal-temperament frequency of F#4?", + "expect": 369.9944227116344 + }, + { + "split": "heldout", + "kind": "freq", + "valid": true, + "q": "Equal-temperament frequency of E5?", + "expect": 659.2551138257398 + }, + { + "split": "heldout", + "kind": "freq_ref", + "valid": true, + "q": "If A4 = 432 Hz, what frequency is Bb2 in hertz?", + "expect": 114.42201419080389 + }, + { + "split": "heldout", + "kind": "freq_ref", + "valid": true, + "q": "What frequency, in hertz, is C5 with A4 at 432 Hz?", + "expect": 513.7374736811755 + }, + { + "split": "heldout", + "kind": "freq_ref", + "valid": true, + "q": "If A4 = 432 Hz, what frequency is Eb4 in hertz?", + "expect": 305.47012947258855 + }, + { + "split": "heldout", + "kind": "freq_ref", + "valid": true, + "q": "What frequency, in hertz, is B3 with A4 at 432 Hz?", + "expect": 242.45180243482457 + }, + { + "split": "heldout", + "kind": "midi_num", + "valid": true, + "q": "G3 corresponds to which MIDI number?", + "expect": 55 + }, + { + "split": "heldout", + "kind": "midi_num", + "valid": true, + "q": "C5 corresponds to which MIDI number?", + "expect": 72 + }, + { + "split": "heldout", + "kind": "midi_num", + "valid": true, + "q": "F#4 corresponds to which MIDI number?", + "expect": 66 + }, + { + "split": "heldout", + "kind": "midi_num", + "valid": true, + "q": "Bb2 corresponds to which MIDI number?", + "expect": 46 + }, + { + "split": "heldout", + "kind": "midi_num", + "valid": true, + "q": "A4 corresponds to which MIDI number?", + "expect": 69 + }, + { + "split": "heldout", + "kind": "midi_note", + "valid": true, + "q": "What note name is MIDI 21?", + "expect": [ + "A0" + ] + }, + { + "split": "heldout", + "kind": "midi_note", + "valid": true, + "q": "What note name is MIDI 61?", + "expect": [ + "C#4", + "Db4" + ] + }, + { + "split": "heldout", + "kind": "midi_note", + "valid": true, + "q": "What note name is MIDI 108?", + "expect": [ + "C8" + ] + }, + { + "split": "heldout", + "kind": "midi_note", + "valid": true, + "q": "What note name is MIDI 70?", + "expect": [ + "A#4", + "Bb4" + ] + }, + { + "split": "heldout", + "kind": "midi_note", + "valid": true, + "q": "What note name is MIDI 90?", + "expect": [ + "F#6", + "Gb6" + ] + }, + { + "split": "heldout", + "kind": "semis", + "valid": true, + "q": "A major sixth is how many semitones?", + "expect": 9 + }, + { + "split": "heldout", + "kind": "semis", + "valid": true, + "q": "A minor seventh is how many semitones?", + "expect": 10 + }, + { + "split": "heldout", + "kind": "semis", + "valid": true, + "q": "A perfect fourth is how many semitones?", + "expect": 5 + }, + { + "split": "heldout", + "kind": "semis", + "valid": true, + "q": "A major third is how many semitones?", + "expect": 4 + }, + { + "split": "heldout", + "kind": "semis", + "valid": true, + "q": "A major seventh is how many semitones?", + "expect": 11 + }, + { + "split": "heldout", + "kind": "semis", + "valid": true, + "q": "A octave is how many semitones?", + "expect": 12 + }, + { + "split": "heldout", + "kind": "interval", + "valid": true, + "q": "Name the interval going up from C to F#.", + "expect": "augmented fourth" + }, + { + "split": "heldout", + "kind": "interval", + "valid": true, + "q": "Name the interval going up from Eb to C.", + "expect": "major sixth" + }, + { + "split": "heldout", + "kind": "interval", + "valid": true, + "q": "Name the interval going up from D to Bb.", + "expect": "minor sixth" + }, + { + "split": "heldout", + "kind": "interval", + "valid": true, + "q": "Name the interval going up from F to G.", + "expect": "major second" + }, + { + "split": "heldout", + "kind": "interval", + "valid": true, + "q": "Name the interval going up from C4 to C5.", + "expect": "perfect octave" + }, + { + "split": "heldout", + "kind": "interval", + "valid": true, + "q": "Name the interval going up from E to A.", + "expect": "perfect fourth" + }, + { + "split": "heldout", + "kind": "interval", + "valid": true, + "q": "Name the interval going up from C to Eb.", + "expect": "minor third" + }, + { + "split": "heldout", + "kind": "interval", + "valid": true, + "q": "Name the interval going up from F to B.", + "expect": "augmented fourth" + }, + { + "split": "heldout", + "kind": "keysig", + "valid": true, + "q": "Key signature of Eb major: how many sharps or flats?", + "expect": -3 + }, + { + "split": "heldout", + "kind": "keysig", + "valid": true, + "q": "Key signature of F major: how many sharps or flats?", + "expect": -1 + }, + { + "split": "heldout", + "kind": "keysig", + "valid": true, + "q": "Key signature of E major: how many sharps or flats?", + "expect": 4 + }, + { + "split": "heldout", + "kind": "keysig", + "valid": true, + "q": "Key signature of Bb major: how many sharps or flats?", + "expect": -2 + }, + { + "split": "heldout", + "kind": "keysig", + "valid": true, + "q": "Key signature of Db major: how many sharps or flats?", + "expect": -5 + }, + { + "split": "heldout", + "kind": "keysig", + "valid": true, + "q": "Key signature of Eb minor: how many sharps or flats?", + "expect": -6 + }, + { + "split": "heldout", + "kind": "keysig", + "valid": true, + "q": "Key signature of B minor: how many sharps or flats?", + "expect": 2 + }, + { + "split": "heldout", + "kind": "relative", + "valid": true, + "q": "What is the relative minor of D major?", + "expect": "B minor" + }, + { + "split": "heldout", + "kind": "relative", + "valid": true, + "q": "What is the relative minor of Bb major?", + "expect": "G minor" + }, + { + "split": "heldout", + "kind": "relative", + "valid": true, + "q": "What is the relative major of B minor?", + "expect": "D major" + }, + { + "split": "heldout", + "kind": "relative", + "valid": true, + "q": "What is the relative major of E minor?", + "expect": "G major" + }, + { + "split": "heldout", + "kind": "relative", + "valid": true, + "q": "What is the relative minor of B major?", + "expect": "G# minor" + }, + { + "split": "heldout", + "kind": "scale", + "valid": true, + "q": "What notes make up the E major scale?", + "expect": "E F# G# A B C# D#" + }, + { + "split": "heldout", + "kind": "scale", + "valid": true, + "q": "What notes make up the Bb major scale?", + "expect": "Bb C D Eb F G A" + }, + { + "split": "heldout", + "kind": "scale", + "valid": true, + "q": "What notes make up the F# major scale?", + "expect": "F# G# A# B C# D# E#" + }, + { + "split": "heldout", + "kind": "scale", + "valid": true, + "q": "What notes make up the C# minor scale?", + "expect": "C# D# E F# G# A B" + }, + { + "split": "heldout", + "kind": "scale", + "valid": true, + "q": "What notes make up the Eb major scale?", + "expect": "Eb F G Ab Bb C D" + }, + { + "split": "heldout", + "kind": "scale", + "valid": true, + "q": "What notes make up the A minor scale?", + "expect": "A B C D E F G" + }, + { + "split": "heldout", + "kind": "duration", + "valid": true, + "q": "How many seconds is a half note at 90 bpm?", + "expect": 1.3333333333333333 + }, + { + "split": "heldout", + "kind": "duration", + "valid": true, + "q": "How many seconds is a quarter note at 120 bpm?", + "expect": 0.5 + }, + { + "split": "heldout", + "kind": "duration", + "valid": true, + "q": "How many seconds is a dotted quarter note at 60 bpm?", + "expect": 1.5 + }, + { + "split": "heldout", + "kind": "duration", + "valid": true, + "q": "How many seconds is a sixteenth note at 120 bpm?", + "expect": 0.125 + }, + { + "split": "heldout", + "kind": "duration", + "valid": true, + "q": "How many seconds is a eighth note at 100 bpm?", + "expect": 0.3 + }, + { + "split": "heldout", + "kind": "cents", + "valid": true, + "q": "Cents between 220 Hz and 330 Hz?", + "expect": 701.9550008653874 + }, + { + "split": "heldout", + "kind": "cents", + "valid": true, + "q": "Cents between 440 Hz and 466.16 Hz?", + "expect": 99.98603045752498 + }, + { + "split": "heldout", + "kind": "cents", + "valid": true, + "q": "Cents between 261.63 Hz and 329.63 Hz?", + "expect": 399.98348613429863 + }, + { + "split": "heldout", + "kind": "cents", + "valid": true, + "q": "Cents between 440 Hz and 660 Hz?", + "expect": 701.9550008653874 + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "Key signature of E# major: how many sharps or flats?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "Equal-temperament frequency of G?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "What note name is MIDI 300?", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/music-v2-r2/music_panel_v2.py b/root/specialists/music-v2-r2/music_panel_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..31ea970ce2b01e7bdf0ef5683ef28c4e4956d939 --- /dev/null +++ b/root/specialists/music-v2-r2/music_panel_v2.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python3 +"""music_panel_v2 - FRESH panel for music v2 (v1 held-out sealed; v1 NEGATIVE): seeds 747474/74747474; the tuning reference comes FIRST in half the freq_ref items on BOTH splits; 'which X key is relative to' phrasings. Same author - disclosed. +Derived from music_panel_v1 - the sealed panel for specialist #74 (music theory). Expected answers are WRITTEN OUT here from the +standard tables (circle-of-fifths key signatures, relative keys, spelled major / natural-minor scales, spelled interval +names, semitone counts, MIDI numbers with middle C = C4 = 60), not computed by the organ's code; frequencies are +A x 2^((m - 69)/12) on the listed MIDI numbers; durations 60/bpm x beats; cents 1200 log2(f2/f1). +Must-decline: theoretical keys (G# major, D# major), a pitch with no octave, a MIDI number over 127. +Dev / held-out differ in seed and phrasing. usage: music_panel_v1.py """ +import collections +import json +import math +import random +import sys + +T = {"dev": {"freq": "What is the frequency of {note} in Hz?", "freq_ref": "With A4 tuned to 432 Hz, what is the frequency of {note}?", + "midi_num": "What MIDI note number is {note}?", "midi_note": "Which note is MIDI note {n}?", + "semis": "How many half steps are in a {ivl}?", "interval": "What is the interval between {n1} and {n2} going up?", + "keysig": "How many sharps or flats are in the key signature of {key}?", "relative": "Which {other} key is relative to {key}?", + "scale": "List the notes of the {key} scale.", "duration": "At {bpm} bpm, how long does a {dur} note last in seconds?", + "cents": "What is the interval in cents from {f1} Hz up to {f2} Hz?"}, + "heldout": {"freq": "Equal-temperament frequency of {note}?", "freq_ref": "If A4 = 432 Hz, what frequency is {note} in hertz?", + "midi_num": "{note} corresponds to which MIDI number?", "midi_note": "What note name is MIDI {n}?", + "semis": "A {ivl} is how many semitones?", "interval": "Name the interval going up from {n1} to {n2}.", + "keysig": "Key signature of {key}: how many sharps or flats?", "relative": "What is the relative {other} of {key}?", + "scale": "What notes make up the {key} scale?", "duration": "How many seconds is a {dur} note at {bpm} bpm?", + "cents": "Cents between {f1} Hz and {f2} Hz?"}} +DECLINE = {"dev": ["How many sharps are in the key signature of A# major?", "What is the frequency of D in Hz?", "Which note is MIDI note 150?"], + "heldout": ["Key signature of E# major: how many sharps or flats?", "Equal-temperament frequency of G?", "What note name is MIDI 300?"]} + +MIDI = {"A4": 69, "C4": 60, "E5": 76, "G3": 55, "F#4": 66, "Bb2": 46, "D6": 86, "C5": 72, "Eb4": 63, "B3": 59} +MIDI_NAMES = {60: ["C4"], 61: ["C#4", "Db4"], 64: ["E4"], 69: ["A4"], 70: ["A#4", "Bb4"], 72: ["C5"], 47: ["B2"], 90: ["F#6", "Gb6"], + 21: ["A0"], 108: ["C8"]} +SEMIS = {"minor second": 1, "major second": 2, "minor third": 3, "major third": 4, "perfect fourth": 5, "perfect fifth": 7, + "minor sixth": 8, "major sixth": 9, "minor seventh": 10, "major seventh": 11, "octave": 12} +IVLS = [("C", "E", "major third"), ("C", "Eb", "minor third"), ("D", "A", "perfect fifth"), ("E", "A", "perfect fourth"), + ("F", "B", "augmented fourth"), ("B", "F", "diminished fifth"), ("C", "F#", "augmented fourth"), ("C", "Gb", "diminished fifth"), + ("G", "F", "minor seventh"), ("A", "G#", "major seventh"), ("Eb", "C", "major sixth"), ("D", "Bb", "minor sixth"), + ("E", "F", "minor second"), ("F", "G", "major second"), ("C4", "C5", "perfect octave"), ("Bb", "D", "major third"), + ("F#", "A", "minor third"), ("G", "D", "perfect fifth")] +KEYSIG = {"G major": 1, "D major": 2, "A major": 3, "E major": 4, "B major": 5, "F# major": 6, "C# major": 7, "F major": -1, + "Bb major": -2, "Eb major": -3, "Ab major": -4, "Db major": -5, "Gb major": -6, "C major": 0, + "E minor": 1, "B minor": 2, "F# minor": 3, "C# minor": 4, "G# minor": 5, "D# minor": 6, "D minor": -1, "G minor": -2, + "C minor": -3, "F minor": -4, "Bb minor": -5, "Eb minor": -6, "A minor": 0} +REL = {"C major": "A minor", "G major": "E minor", "D major": "B minor", "A major": "F# minor", "E major": "C# minor", + "B major": "G# minor", "F major": "D minor", "Bb major": "G minor", "Eb major": "C minor", "Ab major": "F minor", + "Db major": "Bb minor", "A minor": "C major", "E minor": "G major", "D minor": "F major", "C minor": "Eb major", + "B minor": "D major", "G minor": "Bb major", "F# minor": "A major", "F minor": "Ab major"} +SCALES = {"G major": "G A B C D E F#", "D major": "D E F# G A B C#", "Bb major": "Bb C D Eb F G A", "E major": "E F# G# A B C# D#", + "Ab major": "Ab Bb C Db Eb F G", "F# major": "F# G# A# B C# D# E#", "Eb major": "Eb F G Ab Bb C D", + "A minor": "A B C D E F G", "E minor": "E F# G A B C D", "D minor": "D E F G A Bb C", "C minor": "C D Eb F G Ab Bb", + "B minor": "B C# D E F# G A", "F# minor": "F# G# A B C# D E", "G minor": "G A Bb C D Eb F", "C# minor": "C# D# E F# G# A B"} +DURS = [("quarter", 120, 0.5), ("half", 90, 2 * 60 / 90), ("dotted quarter", 60, 1.5), ("eighth", 100, 0.3), ("whole", 80, 3.0), + ("sixteenth", 120, 0.125), ("dotted half", 72, 2.5)] +CENTS = [(440, 880), (440, 466.16), (440, 660), (261.63, 329.63), (300, 400), (220, 330)] + + +def main(): + items = [] + for split, seed in (("dev", 747474), ("heldout", 74747474)): + rng = random.Random(seed) + t = T[split] + add = [] + for note in rng.sample(sorted(MIDI), 6): + add.append(("freq", {"note": note}, 440 * 2 ** ((MIDI[note] - 69) / 12))) + for k, note in enumerate(rng.sample(sorted(MIDI), 4)): + add.append(("freq_ref" if k % 2 == 0 else "freq_ref_last", {"note": note}, 432 * 2 ** ((MIDI[note] - 69) / 12))) + for note in rng.sample(sorted(MIDI), 5): + add.append(("midi_num", {"note": note}, MIDI[note])) + for n in rng.sample(sorted(MIDI_NAMES), 5): + add.append(("midi_note", {"n": n}, MIDI_NAMES[n])) + for ivl in rng.sample(sorted(SEMIS), 6): + add.append(("semis", {"ivl": ivl}, SEMIS[ivl])) + for n1, n2, name in rng.sample(IVLS, 8): + add.append(("interval", {"n1": n1, "n2": n2}, name)) + for key in rng.sample(sorted(KEYSIG), 7): + add.append(("keysig", {"key": key}, KEYSIG[key])) + for key in rng.sample(sorted(REL), 5): + add.append(("relative", {"key": key, "other": "major" if "minor" in key else "minor"}, REL[key])) + for key in rng.sample(sorted(SCALES), 6): + add.append(("scale", {"key": key}, SCALES[key])) + for dur, bpm, s in rng.sample(DURS, 5): + add.append(("duration", {"dur": dur, "bpm": bpm}, s)) + for f1, f2 in rng.sample(CENTS, 4): + add.append(("cents", {"f1": f1, "f2": f2}, 1200 * math.log2(f2 / f1))) + LAST = {"dev": "What is the frequency of {note} when A4 = 432 Hz?", "heldout": "What frequency, in hertz, is {note} with A4 at 432 Hz?"} + for kind, kw, exp in add: + q = LAST[split].format(**kw) if kind == "freq_ref_last" else t[kind].format(**kw) + items.append({"split": split, "kind": "freq_ref" if kind == "freq_ref_last" else kind, "valid": True, "q": q, "expect": exp}) + for q in DECLINE[split]: + items.append({"split": split, "kind": "decline", "valid": False, "q": q, "expect": "decline"}) + json.dump(items, open(sys.argv[1], "w"), indent=1) + print("panel:", dict(collections.Counter(i["split"] for i in items))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/music-v2-r2/music_scorer.py b/root/specialists/music-v2-r2/music_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..818c6df1572918e4ed9f3e5213a64890598b7816 --- /dev/null +++ b/root/specialists/music-v2-r2/music_scorer.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""music_scorer - reads the REPLY TEXT, per kind: +- freq / freq_ref: first number after "is" within 0.05% (Hz); duration: after "lasts" / "is" within 0.5%; cents: within 0.5; +- midi_num / semis: first integer after "is" exact; +- midi_note: the first note token after "is" is one of the expected (enharmonic) names; +- interval: "is a/an " equals the expected spelled name; +- keysig: "N sharp(s)" / "N flat(s)" / "0 (or no) sharps or flats" equals the expected signed count; +- relative: the first " major|minor" after "is" equals the expected key; +- scale: the note tokens after "is" (commas allowed) equal the expected seven, in order. +♯/♭ read as #/b. A must-decline item answered is a false yes. (ok, asserted).""" +import re + +NOTE = r"[A-G](?:##|bb|#|b)?" + + +def norm(s): + return str(s).replace("♯", "#").replace("♭", "b") + + +def ok(p, r): + text = norm((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + k, e = p["kind"], p["expect"] + if k in ("freq", "freq_ref", "duration", "cents"): + m = re.search(r"\b(?:is|lasts|of)\s+(-?[\d,]+(?:\.\d+)?)", text) + if not m: + return False, True + got = float(m.group(1).replace(",", "")) + tol = 0.5 if k == "cents" else (0.005 * abs(e) if k == "duration" else 0.0005 * abs(e)) + return abs(got - e) <= tol, True + if k in ("midi_num", "semis"): + m = re.search(r"\b(?:is|are|has|spans)\s+(\d+)\b", text) + return bool(m) and int(m.group(1)) == e, True + if k == "midi_note": + m = re.search(r"\bis\s+(" + NOTE + r"-?\d)\b", text) + return bool(m) and m.group(1) in e, True + if k == "interval": + m = re.search(r"\bis an?\s+((?:perfect|major|minor|augmented|diminished)\s+(?:unison|second|third|fourth|fifth|sixth|seventh|octave))\b", text, re.I) + return bool(m) and m.group(1).lower() == e, True + if k == "keysig": + if re.search(r"\b(?:0|no|zero)\s+sharps or flats\b", text, re.I): + return e == 0, True + m = re.search(r"\b(\d)\s+(sharp|flat)s?\b", text) + return bool(m) and (int(m.group(1)) * (1 if m.group(2) == "sharp" else -1)) == e, True + if k == "relative": + m = re.search(r"\bis\s+(" + NOTE + r")\s+(major|minor)\b", text) + return bool(m) and "%s %s" % (m.group(1), m.group(2)) == e, True + if k == "scale": + m = re.search(r"\bis:?\s+((?:" + NOTE + r"[,\s]+){6}" + NOTE + r")(?![#\w])", text) + return bool(m) and re.findall(NOTE, m.group(1)) == e.split(), True + return False, True diff --git a/root/specialists/music-v2-r2/narrow_v1.py b/root/specialists/music-v2-r2/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/music-v2-r2/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/music-v2-r2/organ_music_v1.py b/root/specialists/music-v2-r2/organ_music_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..de49a869001634b587f2bfcacc1eb0b64b03207c --- /dev/null +++ b/root/specialists/music-v2-r2/organ_music_v1.py @@ -0,0 +1,228 @@ +#!/usr/bin/env python3 +"""organ_music_v1 - Western music-theory arithmetic, exact, rule named in every answer: +- pitch frequency in 12-tone equal temperament, A4 = 440 Hz unless another reference is given: f = A x 2^((m - 69)/12); +- MIDI note number <-> note name (middle C = C4 = 60, scientific pitch notation); +- semitones in a named interval; the SPELLED interval between two notes (letter distance + semitones, so C-F# is an + augmented fourth and C-Gb a diminished fifth); +- key signatures (sharps / flats of a major or minor key), relative major / minor; +- the notes of a major or natural minor scale, spelled (one letter per degree); +- note length in seconds at a tempo (quarter = 60 / bpm; whole, half, eighth, sixteenth, dotted); +- cents between two frequencies: 1200 log2(f2 / f1). +Declines: a key that needs double sharps/flats in its signature (e.g. G# major), an interval with no letters named, +a note outside MIDI 0-127. Narrowed from the start (narrow_v1). Returns {kind, status, response, value}.""" +from __future__ import annotations + +import math +import re + +from narrow_v1 import narrative, short_direct + +LETTERS = "CDEFGAB" +NAT = {"C": 0, "D": 2, "E": 4, "F": 5, "G": 7, "A": 9, "B": 11} +ACC = {"#": 1, "♯": 1, "sharp": 1, "b": -1, "♭": -1, "flat": -1, "": 0, "##": 2, "x": 2, "bb": -2} +NOTE = r"\b([A-G])(##|bb|#|b|♯|♭|x)?(?:\s*(sharp|flat))?(-?\d)?(?![\w#♯♭])" +# interval name -> (letter steps, semitones) +IVL = {"unison": (0, 0), "minor second": (1, 1), "major second": (1, 2), "minor third": (2, 3), "major third": (2, 4), + "perfect fourth": (3, 5), "augmented fourth": (3, 6), "tritone": (None, 6), "diminished fifth": (4, 6), "perfect fifth": (4, 7), + "augmented fifth": (4, 8), "minor sixth": (5, 8), "major sixth": (5, 9), "diminished seventh": (6, 9), "minor seventh": (6, 10), + "major seventh": (6, 11), "octave": (7, 12), "perfect octave": (7, 12), "minor ninth": (8, 13), "major ninth": (8, 14)} +QUAL = {0: {0: "perfect unison", 1: "augmented unison"}, 1: {0: "diminished second", 1: "minor second", 2: "major second", 3: "augmented second"}, + 2: {2: "diminished third", 3: "minor third", 4: "major third", 5: "augmented third"}, + 3: {4: "diminished fourth", 5: "perfect fourth", 6: "augmented fourth"}, 4: {6: "diminished fifth", 7: "perfect fifth", 8: "augmented fifth"}, + 5: {7: "diminished sixth", 8: "minor sixth", 9: "major sixth", 10: "augmented sixth"}, + 6: {9: "diminished seventh", 10: "minor seventh", 11: "major seventh"}, 7: {11: "diminished octave", 12: "perfect octave"}} +SHARP_MAJ = ["C", "G", "D", "A", "E", "B", "F#", "C#"] +FLAT_MAJ = ["C", "F", "Bb", "Eb", "Ab", "Db", "Gb", "Cb"] +SHARP_MIN = ["A", "E", "B", "F#", "C#", "G#", "D#", "A#"] +FLAT_MIN = ["A", "D", "G", "C", "F", "Bb", "Eb", "Ab"] +DUR = {"whole": 4, "half": 2, "quarter": 1, "eighth": 0.5, "sixteenth": 0.25, "thirty-second": 0.125} + + +def g(x): + return ("%.3f" % x).rstrip("0").rstrip(".") if abs(x) < 1e5 else "%.4g" % x + + +def spell(letter, acc): + return letter + {0: "", 1: "#", -1: "b", 2: "##", -2: "bb"}[acc] + + +def parse_note(m): + letter, a1, a2, octv = m.group(1), m.group(2) or "", m.group(3) or "", m.group(4) + a = ACC[{"♯": "#", "♭": "b"}.get(a1, a1)] + ACC[a2] + return letter, a, (int(octv) if octv is not None else None) + + +NOTE_WORDS = {"to", "and", "up", "down", "above", "below", "in", "at", "is", "or", "with", "has", "flat", "sharp", "major", "minor", "than"} + + +def notes_in(t): + """note tokens, skipping the article "A" ("A perfect fifth is ...") and key names ("C major")""" + out = [] + for m in re.finditer(NOTE, t): + rest = t[m.end():].lstrip() + nxt = re.match(r"[A-Za-z]+", rest) + if m.group(0) == "A" and nxt and nxt.group(0)[0].islower() and nxt.group(0).lower() not in NOTE_WORDS: + continue + if nxt and nxt.group(0).lower() in ("major", "minor", "maj", "min"): + continue + out.append(m) + return out + + +def midi(letter, acc, octv): + return 12 * (octv + 1) + NAT[letter] + acc + + +def scale(tonic_l, tonic_a, minor): + steps = [2, 1, 2, 2, 1, 2, 2] if minor else [2, 2, 1, 2, 2, 2, 1] + out, pc, li = [], NAT[tonic_l] + tonic_a, LETTERS.index(tonic_l) + for i in range(7): + L = LETTERS[(li + i) % 7] + a = (pc - NAT[L] + 6) % 12 - 6 + out.append((L, a)) + pc = (pc + steps[i]) % 12 + return out + + +class MusicOrgan: + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def _need(self, what): + return self._say("underspecified", "I need %s to work that out; I won't assume it." % what, status="withheld") + + def answer(self, text, session_id="default"): + if narrative(text): + return None + r = self._answer(text) + if r and r.get("status") != "answered" and not short_direct(text): + return None + return r + + def _key(self, t): + m = re.search(r"\b([A-G])(#|b|♯|♭)?(?:\s*(sharp|flat))?\s*(major|minor|maj|min)\b", t) + if not m: + return None + letter, a1, a2, mode = m.groups() + a = ACC[{"♯": "#", "♭": "b"}.get(a1 or "", a1 or "")] + ACC[a2 or ""] + return letter, a, mode.startswith("min") + + def _answer(self, text): + t = " ".join(str(text or "").split()) + low = t.lower() + # --- cents between two frequencies + if re.search(r"\bcents?\b", low): + fs = [float(x) for x in re.findall(r"(\d+(?:\.\d+)?)\s*hz\b", low)] + if len(fs) >= 2 and fs[0] > 0 and fs[1] > 0: + c = 1200 * math.log2(fs[1] / fs[0]) + return self._say("cents", "The interval is %s cents (1200 × log2(%s / %s))." % (g(c), g(fs[1]), g(fs[0])), c) + return None + # --- note duration at a tempo + bpm = re.search(r"(\d+(?:\.\d+)?)\s*(?:bpm|beats per minute)\b", low) + dm = re.search(r"\b(dotted\s+)?(whole|half|quarter|eighth|sixteenth|thirty-second)[- ]notes?\b", low) + if bpm and dm and re.search(r"\bhow long\b|\bduration\b|\bseconds\b|\bhow many (?:seconds|ms|milliseconds)\b|\blast\b", low): + b = float(bpm.group(1)) + if b <= 0: + return None + beats = DUR[dm.group(2)] * (1.5 if dm.group(1) else 1) + s = 60 / b * beats + return self._say("duration", "A %s%s note at %s bpm lasts %s seconds (60 ÷ %s × %s beats, quarter-note beat)." % ( + "dotted " if dm.group(1) else "", dm.group(2), g(b), g(s), g(b), g(beats)), s) + # --- key signature / relative key / scale + k = self._key(t) + if k and re.search(r"\bhow many (?:sharps|flats)\b|\bkey signature\b|\bsharps or flats\b|\bnumber of (?:sharps|flats)\b", low): + L, a, minor = k + name = spell(L, a) + lists = (SHARP_MIN, FLAT_MIN) if minor else (SHARP_MAJ, FLAT_MAJ) + mode = "minor" if minor else "major" + if name in lists[0] and name != lists[0][0]: + n = lists[0].index(name) + return self._say("key_sig", "%s %s has %d sharp%s in its key signature." % (name, mode, n, "" if n == 1 else "s"), n) + if name in lists[1] and name != lists[1][0]: + n = lists[1].index(name) + return self._say("key_sig", "%s %s has %d flat%s in its key signature." % (name, mode, n, "" if n == 1 else "s"), -n) + if name == lists[0][0]: + return self._say("key_sig", "%s %s has 0 sharps or flats in its key signature." % (name, mode), 0) + return self._say("impossible", "%s %s is a theoretical key - its signature would need double sharps or flats; it is written as its enharmonic." % (name, mode), + status="withheld") + if k and re.search(r"\brelative (?:major|minor)\b", low): + L, a, minor = k + li, pc = LETTERS.index(L), NAT[L] + a + if minor: + L2, pc2 = LETTERS[(li + 2) % 7], (pc + 3) % 12 + else: + L2, pc2 = LETTERS[(li + 5) % 7], (pc + 9) % 12 + a2 = (pc2 - NAT[L2] + 6) % 12 - 6 + ans = "%s %s" % (spell(L2, a2), "major" if minor else "minor") + return self._say("relative", "The relative %s of %s %s is %s." % ("major" if minor else "minor", spell(L, a), "minor" if minor else "major", ans), ans) + if k and re.search(r"\bscale\b", low) and re.search(r"\bnotes?\b|\bspell\b|\bwhat (?:is|are)\b|\blist\b", low): + L, a, minor = k + if minor and re.search(r"\bharmonic\b|\bmelodic\b", low): + return None + notes = scale(L, a, minor) + if any(abs(x[1]) > 1 for x in notes): + return self._say("impossible", "%s %s needs double sharps or flats; it is usually written as its enharmonic." % (spell(L, a), "minor" if minor else "major"), + status="withheld") + s = " ".join(spell(*x) for x in notes) + return self._say("scale", "The %s %s scale is %s." % (spell(L, a), "natural minor" if minor else "major", s), s) + # --- semitones in a named interval + if re.search(r"\bhow many (?:semitones|half[- ]steps)\b", low): + for name in sorted(IVL, key=len, reverse=True): + if re.search(r"\b" + name + r"\b", low): + return self._say("semitones", "A %s is %d semitone%s." % (name, IVL[name][1], "" if IVL[name][1] == 1 else "s"), IVL[name][1]) + # --- interval between two notes (simple intervals, ascending; compound intervals fall through in v1) + notes = notes_in(t) + if re.search(r"\binterval\b|\bhow many (?:semitones|half[- ]steps)\b", low) and len(notes) >= 2: + (L1, a1, o1), (L2, a2, o2) = parse_note(notes[0]), parse_note(notes[1]) + if (o1 is None) != (o2 is None): + return None + steps = (LETTERS.index(L2) - LETTERS.index(L1)) % 7 + semi = (NAT[L2] + a2 - NAT[L1] - a1) % 12 + if o1 is not None: + span = midi(L2, a2, o2) - midi(L1, a1, o1) + if span < 0 or span > 12: + return None + if span == 12 and steps == 0: + steps, semi = 7, 12 + elif span != semi: + return None + if re.search(r"\bhow many (?:semitones|half[- ]steps)\b", low): + return self._say("semitones_between", "From %s up to %s is %d semitones." % (spell(L1, a1), spell(L2, a2), semi), semi) + q = QUAL.get(steps, {}).get(semi) + if q is None: + return None + return self._say("interval", "The interval from %s up to %s is a %s (%d letter steps, %d semitones)." % (spell(L1, a1), spell(L2, a2), q, steps, semi), q) + # --- MIDI number <-> note + mm = re.search(r"\bmidi (?:note )?(?:number )?(\d{1,3})\b", low) + if mm and re.search(r"\bwhat note\b|\bwhich note\b|\bnote name\b|\bis what\b", low): + n = int(mm.group(1)) + if n > 127: + return self._say("impossible", "MIDI note numbers run 0-127; %d is not one." % n, status="withheld") + names = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"] + nm = "%s%d" % (names[n % 12], n // 12 - 1) + return self._say("midi_note", "MIDI note %d is %s (middle C = C4 = 60)." % (n, nm), nm) + if re.search(r"\bmidi (?:note )?number\b|\bwhat midi\b|\bmidi note (?:is|for|of)\b", low) and notes: + L, a, o = parse_note(notes[-1]) if len(notes) == 1 else parse_note(notes[0]) + if re.search(r"\bmiddle c\b", low): + L, a, o = "C", 0, 4 + if o is None: + return self._need("the octave number (e.g. C4)") + n = midi(L, a, o) + if not 0 <= n <= 127: + return self._say("impossible", "%s%d is outside the MIDI range 0-127." % (spell(L, a), o), status="withheld") + return self._say("midi_number", "The MIDI note number of %s%d is %d (middle C = C4 = 60)." % (spell(L, a), o, n), n) + # --- frequency of a note + if re.search(r"\bfrequency\b|\bhz\b|\bhertz\b|\bpitch of\b", low) and (notes or re.search(r"\bmiddle c\b", low)): + if re.search(r"\bmiddle c\b", low): + L, a, o = "C", 0, 4 + else: + L, a, o = parse_note(notes[0]) + if o is None: + return self._need("the octave (e.g. A4)") + ref = re.search(r"\ba4?\s*(?:=|is|at)\s*(\d{3}(?:\.\d+)?)\s*(?:hz)?\b|\b(\d{3}(?:\.\d+)?)\s*hz\s*(?:tuning|reference|concert pitch)\b", low) + A = float(ref.group(1) or ref.group(2)) if ref else 440.0 + n = midi(L, a, o) + f = A * 2 ** ((n - 69) / 12) + return self._say("frequency", "The frequency of %s%d is %s Hz (12-tone equal temperament, A4 = %s Hz: %s × 2^((%d - 69)/12))." % ( + spell(L, a), o, g(f), g(A), g(A), n), f) + return None diff --git a/root/specialists/music-v2-r2/organ_music_v2.py b/root/specialists/music-v2-r2/organ_music_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..4b47e9403b6efa2a116ba722aa28b528b80f3120 --- /dev/null +++ b/root/specialists/music-v2-r2/organ_music_v2.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 +"""organ_music_v2 - organ_music_v1 (NEGATIVE under gate v3, 2026-09-29: held-out 56/64 vs head 2/64 but 3 WRONG) with +the two held-out classes fixed: +- CONFIDENT WRONG x3: "Tuning to A4 = 432 Hz, what frequency is C5?" answered "The frequency of A4 is 432 Hz" - the + tuning REFERENCE (a note bound to "= N Hz" / "tuned to N Hz" / "at N Hz") was taken as the target because it came + first. Roles from grammar, never order of mention (the 2026-09-29 law): the reference note is removed before the + target is read; the target is the note after "frequency (is|of)" / "pitch of", else the one non-reference note. +- safe misses x5: "Which minor key is relative to G major?" is read as the relative-key question. +Everything else v1. Judged on a FRESH panel v2 whose dev split puts the reference FIRST as well as last.""" +from __future__ import annotations + +import re + +import organ_music_v1 +from organ_music_v1 import MusicOrgan + +# dev (panel v2): "the interval between E and A going up" - v1's article guard read "A going" as the article "A". +# Additive only: these words after "A" mean the NOTE A (the v1 file is unchanged; its set is extended in this runtime). +organ_music_v1.NOTE_WORDS |= {"going", "ascending", "descending", "then", "above", "below"} + +REF = re.compile(r"\b(A4|A)\s*(?:=|is tuned to|tuned to|at|is)\s*(\d{3}(?:\.\d+)?)\s*(?:hz)?\b", re.I) +REL = re.compile(r"\bwhich\s+(major|minor)\s+key\s+is\s+(?:the\s+)?relative\s+(?:of|to)\s+([A-G](?:#|b)?\s*(?:major|minor))\b", re.I) + + +class MusicOrganV2(MusicOrgan): + def answer(self, text, session_id="default"): + t = " ".join(str(text or "").split()) + rel = REL.search(t) + if rel: + t = "What is the relative %s of %s?" % (rel.group(1).lower(), rel.group(2)) + ref = REF.search(t) + if ref and re.search(r"\bfrequency\b|\bhz\b|\bhertz\b|\bpitch\b", t, re.I): + # keep the reference value, drop the reference NOTE: rewrite to " (with A4 = N Hz)" + rest = (t[:ref.start()] + t[ref.end():]).strip(" ,;:") + rest = re.sub(r"^(?:tuning|tuned|with|using|if)\b\s*(?:to\b)?\s*[,;:]?\s*", "", rest, flags=re.I) + t = "%s with A4 = %s Hz" % (rest.rstrip("?. "), ref.group(2)) + "?" + return super().answer(t, session_id) diff --git a/root/specialists/music-v2-r2/organ_music_v2_r2.py b/root/specialists/music-v2-r2/organ_music_v2_r2.py new file mode 100644 index 0000000000000000000000000000000000000000..849a8e1bd2c7c03a8ba0e546065b9a855b8be7db --- /dev/null +++ b/root/specialists/music-v2-r2/organ_music_v2_r2.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +"""music-v2-r2 - NARROWING-ONLY boundary patch of music-v2 (phase 0.5 of the specialist network, 2026-09-30). +Silent (returns None) on a turn carrying another domain's markers and none of this domain's: the family census found +music-v2 claiming those turns (a neighbour's question, answered or declined in this domain's terms). Nothing else changes.""" +import re + +from organ_music_v2 import MusicOrganV2 as _Parent + +NOT_MINE = re.compile(r"""\b(?:wavelength|speed of sound|in air|degrees C|metres?|meters?|m/s)\b""", re.I) +MINE = re.compile(r"""\b(?:note|notes|octave|A4|C4|semitones?|intervals?|chords?|scales?|key of|tempo|BPM)\b""", re.I) + + +class MusicOrganV2Boundary(_Parent): + def answer(self, text, *a, **k): + t = str(text) + if NOT_MINE.search(t) and not MINE.search(t): + return None + return super().answer(text, *a, **k) diff --git a/root/specialists/networking/manifest.json b/root/specialists/networking/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..eba661fa677dceeb12571e3f0bf4c47160a140a9 --- /dev/null +++ b/root/specialists/networking/manifest.json @@ -0,0 +1,23 @@ +{ + "id": "networking", + "name": "Oracle7 Networking & Protocols (IPv4 addressing)", + "number": 55, + "tier": "A", + "sources": [ + {"name": "RFC 4632 (CIDR), RFC 1918 (private address space), RFC 3021 (/31 point-to-point), RFC 6598 (shared address space) - IETF", "licence": "IETF Trust (BCP 78: RFC text may be freely used and implemented)", "url": "https://www.rfc-editor.org/rfc/rfc4632"}, + {"name": "Python standard library ipaddress module (the arithmetic)", "licence": "PSF License", "url": "https://docs.python.org/3/library/ipaddress.html"} + ], + "store": {"path": "__ORACLE7_ROOT__/specialists/networking/organ_networking_v1.py"}, + "organ": {"dir": "__ORACLE7_ROOT__/specialists/networking", "module": "organ_networking_v1", "class": "NetworkingOrgan", "init": {}}, + "accept": { + "kinds": ["mask", "prefix", "wildcard", "hosts", "total", "network", "broadcast", "first", "last", "range", "same_subnet", "private", "subnet_count", "prefix_for_hosts"], + "declines_in_domain": ["underspecified", "impossible", "p2p"], + "context_regex": "\\b(?:subnet\\w*|cidr|netmask|mask|ip(?:v4)?|broadcast|prefix|network (?:address|id)|rfc ?1918|hosts?)\\b" + }, + "panel": {"path": "__ORACLE7_ROOT__/specialists/networking/networking_panel_v1.json", "splits": ["dev", "heldout"], + "exclude_kinds_composed": [], "scorer_module": "networking_scorer", "scorer_fn": "ok"}, + "routing_cues": ["subnet mask", "CIDR prefix", "usable hosts", "network address", "broadcast address", "wildcard mask", "RFC 1918"], + "budgets": {"latency_p50_ms": 50, "store_mb": 1}, + "core_sample": {"n": 400, "seed": 20260928}, + "notes": "IPv4 only (IPv6 falls through to the head). Exact arithmetic via the ipaddress module; the rule is named in every answer. Declines are structural and recognised (missing prefix/mask, octet > 255, non-contiguous mask, prefix > 32, a larger block inside a smaller one), never guessed. Narrowed from the start (narrow_v1)." +} diff --git a/root/specialists/networking/narrow_v1.py b/root/specialists/networking/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/networking/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/networking/networking_panel_v1.json b/root/specialists/networking/networking_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..a5cba66e48a532573f4ee6a5434d91d5dc928a00 --- /dev/null +++ b/root/specialists/networking/networking_panel_v1.json @@ -0,0 +1,1017 @@ +[ + { + "split": "dev", + "kind": "mask", + "valid": true, + "q": "What is the subnet mask for a /12?", + "expect": "255.240.0.0" + }, + { + "split": "dev", + "kind": "prefix", + "valid": true, + "q": "What prefix length is the subnet mask 255.240.0.0?", + "expect": 12 + }, + { + "split": "dev", + "kind": "wildcard", + "valid": true, + "q": "What is the wildcard mask for /12?", + "expect": "0.15.255.255" + }, + { + "split": "dev", + "kind": "hosts", + "valid": true, + "q": "How many usable hosts are in a /12 subnet?", + "expect": 1048574 + }, + { + "split": "dev", + "kind": "total", + "valid": true, + "q": "How many addresses are in a /12 block in total?", + "expect": 1048576 + }, + { + "split": "dev", + "kind": "network", + "valid": true, + "q": "What is the network address of 100.100.94.78/12?", + "expect": "100.96.0.0" + }, + { + "split": "dev", + "kind": "broadcast", + "valid": true, + "q": "What is the broadcast address for 100.100.94.78/12?", + "expect": "100.111.255.255" + }, + { + "split": "dev", + "kind": "first", + "valid": true, + "q": "What is the first usable host address in 100.100.94.78/12?", + "expect": "100.96.0.1" + }, + { + "split": "dev", + "kind": "last", + "valid": true, + "q": "What is the last usable host in 100.100.94.78 with mask 255.240.0.0?", + "expect": "100.111.255.254" + }, + { + "split": "dev", + "kind": "range", + "valid": true, + "q": "What is the usable range of 100.100.94.78/12?", + "expect": "100.96.0.1 - 100.111.255.254" + }, + { + "split": "dev", + "kind": "same", + "valid": true, + "q": "Are 100.100.94.78 and 100.110.167.221 on the same subnet with a /12?", + "expect": true + }, + { + "split": "dev", + "kind": "private", + "valid": true, + "q": "Is 100.100.94.78 a private address?", + "expect": false + }, + { + "split": "dev", + "kind": "count", + "valid": true, + "q": "How many /30 subnets fit in a /24?", + "expect": 64 + }, + { + "split": "dev", + "kind": "forhosts", + "valid": true, + "q": "What is the smallest subnet for 100 hosts?", + "expect": 25 + }, + { + "split": "dev", + "kind": "mask", + "valid": true, + "q": "What is the subnet mask for a /24?", + "expect": "255.255.255.0" + }, + { + "split": "dev", + "kind": "prefix", + "valid": true, + "q": "What prefix length is the subnet mask 255.255.255.0?", + "expect": 24 + }, + { + "split": "dev", + "kind": "wildcard", + "valid": true, + "q": "What is the wildcard mask for /24?", + "expect": "0.0.0.255" + }, + { + "split": "dev", + "kind": "hosts", + "valid": true, + "q": "How many usable hosts are in a /24 subnet?", + "expect": 254 + }, + { + "split": "dev", + "kind": "total", + "valid": true, + "q": "How many addresses are in a /24 block in total?", + "expect": 256 + }, + { + "split": "dev", + "kind": "network", + "valid": true, + "q": "What is the network address of 64.20.131.11/24?", + "expect": "64.20.131.0" + }, + { + "split": "dev", + "kind": "broadcast", + "valid": true, + "q": "What is the broadcast address for 64.20.131.11/24?", + "expect": "64.20.131.255" + }, + { + "split": "dev", + "kind": "first", + "valid": true, + "q": "What is the first usable host address in 64.20.131.11/24?", + "expect": "64.20.131.1" + }, + { + "split": "dev", + "kind": "last", + "valid": true, + "q": "What is the last usable host in 64.20.131.11 with mask 255.255.255.0?", + "expect": "64.20.131.254" + }, + { + "split": "dev", + "kind": "range", + "valid": true, + "q": "What is the usable range of 64.20.131.11/24?", + "expect": "64.20.131.1 - 64.20.131.254" + }, + { + "split": "dev", + "kind": "same", + "valid": true, + "q": "Are 64.20.131.11 and 10.26.193.60 on the same subnet with a /24?", + "expect": false + }, + { + "split": "dev", + "kind": "private", + "valid": true, + "q": "Is 64.20.131.11 a private address?", + "expect": false + }, + { + "split": "dev", + "kind": "count", + "valid": true, + "q": "How many /22 subnets fit in a /16?", + "expect": 64 + }, + { + "split": "dev", + "kind": "forhosts", + "valid": true, + "q": "What is the smallest subnet for 4000 hosts?", + "expect": 20 + }, + { + "split": "dev", + "kind": "mask", + "valid": true, + "q": "What is the subnet mask for a /29?", + "expect": "255.255.255.248" + }, + { + "split": "dev", + "kind": "prefix", + "valid": true, + "q": "What prefix length is the subnet mask 255.255.255.248?", + "expect": 29 + }, + { + "split": "dev", + "kind": "wildcard", + "valid": true, + "q": "What is the wildcard mask for /29?", + "expect": "0.0.0.7" + }, + { + "split": "dev", + "kind": "hosts", + "valid": true, + "q": "How many usable hosts are in a /29 subnet?", + "expect": 6 + }, + { + "split": "dev", + "kind": "total", + "valid": true, + "q": "How many addresses are in a /29 block in total?", + "expect": 8 + }, + { + "split": "dev", + "kind": "network", + "valid": true, + "q": "What is the network address of 64.210.87.79/29?", + "expect": "64.210.87.72" + }, + { + "split": "dev", + "kind": "broadcast", + "valid": true, + "q": "What is the broadcast address for 64.210.87.79/29?", + "expect": "64.210.87.79" + }, + { + "split": "dev", + "kind": "first", + "valid": true, + "q": "What is the first usable host address in 64.210.87.79/29?", + "expect": "64.210.87.73" + }, + { + "split": "dev", + "kind": "last", + "valid": true, + "q": "What is the last usable host in 64.210.87.79 with mask 255.255.255.248?", + "expect": "64.210.87.78" + }, + { + "split": "dev", + "kind": "range", + "valid": true, + "q": "What is the usable range of 64.210.87.79/29?", + "expect": "64.210.87.73 - 64.210.87.78" + }, + { + "split": "dev", + "kind": "same", + "valid": true, + "q": "Are 64.210.87.79 and 64.210.87.73 on the same subnet with a /29?", + "expect": true + }, + { + "split": "dev", + "kind": "private", + "valid": true, + "q": "Is 64.210.87.79 a private address?", + "expect": false + }, + { + "split": "dev", + "kind": "count", + "valid": true, + "q": "How many /20 subnets fit in a /16?", + "expect": 16 + }, + { + "split": "dev", + "kind": "forhosts", + "valid": true, + "q": "What is the smallest subnet for 50 hosts?", + "expect": 26 + }, + { + "split": "dev", + "kind": "mask", + "valid": true, + "q": "What is the subnet mask for a /23?", + "expect": "255.255.254.0" + }, + { + "split": "dev", + "kind": "prefix", + "valid": true, + "q": "What prefix length is the subnet mask 255.255.254.0?", + "expect": 23 + }, + { + "split": "dev", + "kind": "wildcard", + "valid": true, + "q": "What is the wildcard mask for /23?", + "expect": "0.0.1.255" + }, + { + "split": "dev", + "kind": "hosts", + "valid": true, + "q": "How many usable hosts are in a /23 subnet?", + "expect": 510 + }, + { + "split": "dev", + "kind": "total", + "valid": true, + "q": "How many addresses are in a /23 block in total?", + "expect": 512 + }, + { + "split": "dev", + "kind": "network", + "valid": true, + "q": "What is the network address of 203.239.89.216/23?", + "expect": "203.239.88.0" + }, + { + "split": "dev", + "kind": "broadcast", + "valid": true, + "q": "What is the broadcast address for 203.239.89.216/23?", + "expect": "203.239.89.255" + }, + { + "split": "dev", + "kind": "first", + "valid": true, + "q": "What is the first usable host address in 203.239.89.216/23?", + "expect": "203.239.88.1" + }, + { + "split": "dev", + "kind": "last", + "valid": true, + "q": "What is the last usable host in 203.239.89.216 with mask 255.255.254.0?", + "expect": "203.239.89.254" + }, + { + "split": "dev", + "kind": "range", + "valid": true, + "q": "What is the usable range of 203.239.89.216/23?", + "expect": "203.239.88.1 - 203.239.89.254" + }, + { + "split": "dev", + "kind": "same", + "valid": true, + "q": "Are 203.239.89.216 and 203.239.88.159 on the same subnet with a /23?", + "expect": true + }, + { + "split": "dev", + "kind": "private", + "valid": true, + "q": "Is 203.239.89.216 a private address?", + "expect": false + }, + { + "split": "dev", + "kind": "count", + "valid": true, + "q": "How many /24 subnets fit in a /20?", + "expect": 16 + }, + { + "split": "dev", + "kind": "forhosts", + "valid": true, + "q": "What is the smallest subnet for 30 hosts?", + "expect": 27 + }, + { + "split": "dev", + "kind": "mask", + "valid": true, + "q": "What is the subnet mask for a /22?", + "expect": "255.255.252.0" + }, + { + "split": "dev", + "kind": "prefix", + "valid": true, + "q": "What prefix length is the subnet mask 255.255.252.0?", + "expect": 22 + }, + { + "split": "dev", + "kind": "wildcard", + "valid": true, + "q": "What is the wildcard mask for /22?", + "expect": "0.0.3.255" + }, + { + "split": "dev", + "kind": "hosts", + "valid": true, + "q": "How many usable hosts are in a /22 subnet?", + "expect": 1022 + }, + { + "split": "dev", + "kind": "total", + "valid": true, + "q": "How many addresses are in a /22 block in total?", + "expect": 1024 + }, + { + "split": "dev", + "kind": "network", + "valid": true, + "q": "What is the network address of 192.0.204.210/22?", + "expect": "192.0.204.0" + }, + { + "split": "dev", + "kind": "broadcast", + "valid": true, + "q": "What is the broadcast address for 192.0.204.210/22?", + "expect": "192.0.207.255" + }, + { + "split": "dev", + "kind": "first", + "valid": true, + "q": "What is the first usable host address in 192.0.204.210/22?", + "expect": "192.0.204.1" + }, + { + "split": "dev", + "kind": "last", + "valid": true, + "q": "What is the last usable host in 192.0.204.210 with mask 255.255.252.0?", + "expect": "192.0.207.254" + }, + { + "split": "dev", + "kind": "range", + "valid": true, + "q": "What is the usable range of 192.0.204.210/22?", + "expect": "192.0.204.1 - 192.0.207.254" + }, + { + "split": "dev", + "kind": "same", + "valid": true, + "q": "Are 192.0.204.210 and 172.31.152.81 on the same subnet with a /22?", + "expect": false + }, + { + "split": "dev", + "kind": "private", + "valid": true, + "q": "Is 192.0.204.210 a private address?", + "expect": false + }, + { + "split": "dev", + "kind": "count", + "valid": true, + "q": "How many /24 subnets fit in a /22?", + "expect": 4 + }, + { + "split": "dev", + "kind": "forhosts", + "valid": true, + "q": "What is the smallest subnet for 5 hosts?", + "expect": 29 + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What is the broadcast address of 192.168.10.77?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What is the network address of 10.1.300.4/24?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What prefix length is the subnet mask 255.255.0.255?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "How many usable hosts are in a /35 subnet?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "mask", + "valid": true, + "q": "Convert /24 to a dotted-decimal subnet mask.", + "expect": "255.255.255.0" + }, + { + "split": "heldout", + "kind": "prefix", + "valid": true, + "q": "Express the netmask 255.255.255.0 in CIDR notation (prefix length).", + "expect": 24 + }, + { + "split": "heldout", + "kind": "wildcard", + "valid": true, + "q": "Give the ACL wildcard mask for a /24 network.", + "expect": "0.0.0.255" + }, + { + "split": "heldout", + "kind": "hosts", + "valid": true, + "q": "How many hosts can be assigned in a /24 network?", + "expect": 254 + }, + { + "split": "heldout", + "kind": "total", + "valid": true, + "q": "What is the total number of IP addresses in a /24?", + "expect": 256 + }, + { + "split": "heldout", + "kind": "network", + "valid": true, + "q": "Find the network ID for host 172.16.124.28 with subnet mask 255.255.255.0.", + "expect": "172.16.124.0" + }, + { + "split": "heldout", + "kind": "broadcast", + "valid": true, + "q": "Host 172.16.124.28/24: which broadcast address does it use?", + "expect": "172.16.124.255" + }, + { + "split": "heldout", + "kind": "first", + "valid": true, + "q": "Give the first usable address of the subnet containing 172.16.124.28/24.", + "expect": "172.16.124.1" + }, + { + "split": "heldout", + "kind": "last", + "valid": true, + "q": "Give the last usable address of the subnet containing 172.16.124.28/24.", + "expect": "172.16.124.254" + }, + { + "split": "heldout", + "kind": "range", + "valid": true, + "q": "What is the usable host range for 172.16.124.28/24?", + "expect": "172.16.124.1 - 172.16.124.254" + }, + { + "split": "heldout", + "kind": "same", + "valid": true, + "q": "With mask 255.255.255.0, is 172.16.124.28 in the same network as 172.16.124.90?", + "expect": true + }, + { + "split": "heldout", + "kind": "private", + "valid": true, + "q": "Is 172.16.124.28 an RFC 1918 private IP?", + "expect": true + }, + { + "split": "heldout", + "kind": "count", + "valid": true, + "q": "How many /18 networks can you carve out of a /16?", + "expect": 4 + }, + { + "split": "heldout", + "kind": "forhosts", + "valid": true, + "q": "Which prefix would you use to fit 4000 devices?", + "expect": 20 + }, + { + "split": "heldout", + "kind": "mask", + "valid": true, + "q": "Convert /20 to a dotted-decimal subnet mask.", + "expect": "255.255.240.0" + }, + { + "split": "heldout", + "kind": "prefix", + "valid": true, + "q": "Express the netmask 255.255.240.0 in CIDR notation (prefix length).", + "expect": 20 + }, + { + "split": "heldout", + "kind": "wildcard", + "valid": true, + "q": "Give the ACL wildcard mask for a /20 network.", + "expect": "0.0.15.255" + }, + { + "split": "heldout", + "kind": "hosts", + "valid": true, + "q": "How many hosts can be assigned in a /20 network?", + "expect": 4094 + }, + { + "split": "heldout", + "kind": "total", + "valid": true, + "q": "What is the total number of IP addresses in a /20?", + "expect": 4096 + }, + { + "split": "heldout", + "kind": "network", + "valid": true, + "q": "Find the network ID for host 151.73.98.102 with subnet mask 255.255.240.0.", + "expect": "151.73.96.0" + }, + { + "split": "heldout", + "kind": "broadcast", + "valid": true, + "q": "Host 151.73.98.102/20: which broadcast address does it use?", + "expect": "151.73.111.255" + }, + { + "split": "heldout", + "kind": "first", + "valid": true, + "q": "Give the first usable address of the subnet containing 151.73.98.102/20.", + "expect": "151.73.96.1" + }, + { + "split": "heldout", + "kind": "last", + "valid": true, + "q": "Give the last usable address of the subnet containing 151.73.98.102/20.", + "expect": "151.73.111.254" + }, + { + "split": "heldout", + "kind": "range", + "valid": true, + "q": "What is the usable host range for 151.73.98.102/20?", + "expect": "151.73.96.1 - 151.73.111.254" + }, + { + "split": "heldout", + "kind": "same", + "valid": true, + "q": "With mask 255.255.240.0, is 151.73.98.102 in the same network as 151.73.108.175?", + "expect": true + }, + { + "split": "heldout", + "kind": "private", + "valid": true, + "q": "Is 151.73.98.102 an RFC 1918 private IP?", + "expect": false + }, + { + "split": "heldout", + "kind": "count", + "valid": true, + "q": "How many /22 networks can you carve out of a /16?", + "expect": 64 + }, + { + "split": "heldout", + "kind": "forhosts", + "valid": true, + "q": "Which prefix would you use to fit 200 devices?", + "expect": 24 + }, + { + "split": "heldout", + "kind": "mask", + "valid": true, + "q": "Convert /23 to a dotted-decimal subnet mask.", + "expect": "255.255.254.0" + }, + { + "split": "heldout", + "kind": "prefix", + "valid": true, + "q": "Express the netmask 255.255.254.0 in CIDR notation (prefix length).", + "expect": 23 + }, + { + "split": "heldout", + "kind": "wildcard", + "valid": true, + "q": "Give the ACL wildcard mask for a /23 network.", + "expect": "0.0.1.255" + }, + { + "split": "heldout", + "kind": "hosts", + "valid": true, + "q": "How many hosts can be assigned in a /23 network?", + "expect": 510 + }, + { + "split": "heldout", + "kind": "total", + "valid": true, + "q": "What is the total number of IP addresses in a /23?", + "expect": 512 + }, + { + "split": "heldout", + "kind": "network", + "valid": true, + "q": "Find the network ID for host 10.183.19.251 with subnet mask 255.255.254.0.", + "expect": "10.183.18.0" + }, + { + "split": "heldout", + "kind": "broadcast", + "valid": true, + "q": "Host 10.183.19.251/23: which broadcast address does it use?", + "expect": "10.183.19.255" + }, + { + "split": "heldout", + "kind": "first", + "valid": true, + "q": "Give the first usable address of the subnet containing 10.183.19.251/23.", + "expect": "10.183.18.1" + }, + { + "split": "heldout", + "kind": "last", + "valid": true, + "q": "Give the last usable address of the subnet containing 10.183.19.251/23.", + "expect": "10.183.19.254" + }, + { + "split": "heldout", + "kind": "range", + "valid": true, + "q": "What is the usable host range for 10.183.19.251/23?", + "expect": "10.183.18.1 - 10.183.19.254" + }, + { + "split": "heldout", + "kind": "same", + "valid": true, + "q": "With mask 255.255.254.0, is 10.183.19.251 in the same network as 10.183.18.236?", + "expect": true + }, + { + "split": "heldout", + "kind": "private", + "valid": true, + "q": "Is 10.183.19.251 an RFC 1918 private IP?", + "expect": true + }, + { + "split": "heldout", + "kind": "count", + "valid": true, + "q": "How many /23 networks can you carve out of a /20?", + "expect": 8 + }, + { + "split": "heldout", + "kind": "forhosts", + "valid": true, + "q": "Which prefix would you use to fit 2 devices?", + "expect": 30 + }, + { + "split": "heldout", + "kind": "mask", + "valid": true, + "q": "Convert /8 to a dotted-decimal subnet mask.", + "expect": "255.0.0.0" + }, + { + "split": "heldout", + "kind": "prefix", + "valid": true, + "q": "Express the netmask 255.0.0.0 in CIDR notation (prefix length).", + "expect": 8 + }, + { + "split": "heldout", + "kind": "wildcard", + "valid": true, + "q": "Give the ACL wildcard mask for a /8 network.", + "expect": "0.255.255.255" + }, + { + "split": "heldout", + "kind": "hosts", + "valid": true, + "q": "How many hosts can be assigned in a /8 network?", + "expect": 16777214 + }, + { + "split": "heldout", + "kind": "total", + "valid": true, + "q": "What is the total number of IP addresses in a /8?", + "expect": 16777216 + }, + { + "split": "heldout", + "kind": "network", + "valid": true, + "q": "Find the network ID for host 203.242.143.201 with subnet mask 255.0.0.0.", + "expect": "203.0.0.0" + }, + { + "split": "heldout", + "kind": "broadcast", + "valid": true, + "q": "Host 203.242.143.201/8: which broadcast address does it use?", + "expect": "203.255.255.255" + }, + { + "split": "heldout", + "kind": "first", + "valid": true, + "q": "Give the first usable address of the subnet containing 203.242.143.201/8.", + "expect": "203.0.0.1" + }, + { + "split": "heldout", + "kind": "last", + "valid": true, + "q": "Give the last usable address of the subnet containing 203.242.143.201/8.", + "expect": "203.255.255.254" + }, + { + "split": "heldout", + "kind": "range", + "valid": true, + "q": "What is the usable host range for 203.242.143.201/8?", + "expect": "203.0.0.1 - 203.255.255.254" + }, + { + "split": "heldout", + "kind": "same", + "valid": true, + "q": "With mask 255.0.0.0, is 203.242.143.201 in the same network as 64.58.109.84?", + "expect": false + }, + { + "split": "heldout", + "kind": "private", + "valid": true, + "q": "Is 203.242.143.201 an RFC 1918 private IP?", + "expect": false + }, + { + "split": "heldout", + "kind": "mask", + "valid": true, + "q": "Convert /27 to a dotted-decimal subnet mask.", + "expect": "255.255.255.224" + }, + { + "split": "heldout", + "kind": "prefix", + "valid": true, + "q": "Express the netmask 255.255.255.224 in CIDR notation (prefix length).", + "expect": 27 + }, + { + "split": "heldout", + "kind": "wildcard", + "valid": true, + "q": "Give the ACL wildcard mask for a /27 network.", + "expect": "0.0.0.31" + }, + { + "split": "heldout", + "kind": "hosts", + "valid": true, + "q": "How many hosts can be assigned in a /27 network?", + "expect": 30 + }, + { + "split": "heldout", + "kind": "total", + "valid": true, + "q": "What is the total number of IP addresses in a /27?", + "expect": 32 + }, + { + "split": "heldout", + "kind": "network", + "valid": true, + "q": "Find the network ID for host 100.100.124.119 with subnet mask 255.255.255.224.", + "expect": "100.100.124.96" + }, + { + "split": "heldout", + "kind": "broadcast", + "valid": true, + "q": "Host 100.100.124.119/27: which broadcast address does it use?", + "expect": "100.100.124.127" + }, + { + "split": "heldout", + "kind": "first", + "valid": true, + "q": "Give the first usable address of the subnet containing 100.100.124.119/27.", + "expect": "100.100.124.97" + }, + { + "split": "heldout", + "kind": "last", + "valid": true, + "q": "Give the last usable address of the subnet containing 100.100.124.119/27.", + "expect": "100.100.124.126" + }, + { + "split": "heldout", + "kind": "range", + "valid": true, + "q": "What is the usable host range for 100.100.124.119/27?", + "expect": "100.100.124.97 - 100.100.124.126" + }, + { + "split": "heldout", + "kind": "same", + "valid": true, + "q": "With mask 255.255.255.224, is 100.100.124.119 in the same network as 100.100.124.112?", + "expect": true + }, + { + "split": "heldout", + "kind": "private", + "valid": true, + "q": "Is 100.100.124.119 an RFC 1918 private IP?", + "expect": false + }, + { + "split": "heldout", + "kind": "count", + "valid": true, + "q": "How many /24 networks can you carve out of a /22?", + "expect": 4 + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "Give the first usable address of the subnet containing 172.16.5.9.", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "Host 192.168.256.1/24: which broadcast address does it use?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "Express the netmask 255.0.255.0 in CIDR notation (prefix length).", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "How many /20 networks can you carve out of a /24?", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/networking/networking_panel_v1.py b/root/specialists/networking/networking_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..33c92531fd2e518d927e1200968f116f021b8d2c --- /dev/null +++ b/root/specialists/networking/networking_panel_v1.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python3 +"""networking_panel_v1 - the sealed panel for specialist #55 (networking & protocols: IPv4 addressing). Expected values +from Python's ipaddress module and the RFC rules written here (usable = 2^(32-p) - 2 for p <= 30; RFC 1918 blocks; +subnets = 2^(m-n); smallest prefix p with 2^(32-p) - 2 >= N). Must-decline: an address with no prefix or mask, an octet +over 255, a non-contiguous mask, a prefix over 32, a larger block "inside" a smaller one. +Dev / held-out differ in seed and phrasing. usage: networking_panel_v1.py """ +import collections +import ipaddress +import json +import random +import sys + +T = {"dev": {"mask": "What is the subnet mask for a /{p}?", "prefix": "What prefix length is the subnet mask {mask}?", + "wildcard": "What is the wildcard mask for /{p}?", "hosts": "How many usable hosts are in a /{p} subnet?", + "total": "How many addresses are in a /{p} block in total?", "network": "What is the network address of {ip}/{p}?", + "broadcast": "What is the broadcast address for {ip}/{p}?", "first": "What is the first usable host address in {ip}/{p}?", + "last": "What is the last usable host in {ip} with mask {mask}?", "range": "What is the usable range of {ip}/{p}?", + "same": "Are {ip} and {ip2} on the same subnet with a /{p}?", "private": "Is {ip} a private address?", + "count": "How many /{m} subnets fit in a /{n}?", "forhosts": "What is the smallest subnet for {h} hosts?"}, + "heldout": {"mask": "Convert /{p} to a dotted-decimal subnet mask.", "prefix": "Express the netmask {mask} in CIDR notation (prefix length).", + "wildcard": "Give the ACL wildcard mask for a /{p} network.", "hosts": "How many hosts can be assigned in a /{p} network?", + "total": "What is the total number of IP addresses in a /{p}?", "network": "Find the network ID for host {ip} with subnet mask {mask}.", + "broadcast": "Host {ip}/{p}: which broadcast address does it use?", "first": "Give the first usable address of the subnet containing {ip}/{p}.", + "last": "Give the last usable address of the subnet containing {ip}/{p}.", "range": "What is the usable host range for {ip}/{p}?", + "same": "With mask {mask}, is {ip} in the same network as {ip2}?", "private": "Is {ip} an RFC 1918 private IP?", + "count": "How many /{m} networks can you carve out of a /{n}?", "forhosts": "Which prefix would you use to fit {h} devices?"}} +DECLINE = {"dev": ["What is the broadcast address of 192.168.10.77?", "What is the network address of 10.1.300.4/24?", + "What prefix length is the subnet mask 255.255.0.255?", "How many usable hosts are in a /35 subnet?"], + "heldout": ["Give the first usable address of the subnet containing 172.16.5.9.", "Host 192.168.256.1/24: which broadcast address does it use?", + "Express the netmask 255.0.255.0 in CIDR notation (prefix length).", "How many /20 networks can you carve out of a /24?"]} +RFC1918 = [ipaddress.IPv4Network(x) for x in ("10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16")] + + +def rand_ip(rng): + first = rng.choice([10, 172, 192, 100, 8, 203, 64, 151]) + second = {172: rng.choice([16, 20, 31, 32, 15]), 192: rng.choice([168, 0, 169]), 100: rng.choice([64, 100, 127])}.get(first, rng.randrange(256)) + return "%d.%d.%d.%d" % (first, second, rng.randrange(256), rng.randrange(1, 255)) + + +def main(): + items = [] + for split, seed in (("dev", 55), ("heldout", 5555)): + rng = random.Random(seed) + t = T[split] + for _ in range(5): + p = rng.choice([8, 12, 16, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30]) + ip, ip2 = rand_ip(rng), None + net = ipaddress.IPv4Network("%s/%d" % (ip, p), strict=False) + ip2 = str(net.network_address + rng.randrange(1, net.num_addresses - 1)) if rng.random() < 0.5 else rand_ip(rng) + mask = str(net.netmask) + n = rng.choice([16, 20, 22, 24]); m = n + rng.choice([1, 2, 3, 4, 6]) + h = rng.choice([2, 5, 12, 30, 50, 62, 100, 200, 500, 1000, 4000]) + fh = next(q for q in range(30, 0, -1) if 2 ** (32 - q) - 2 >= h) + same = ipaddress.IPv4Network("%s/%d" % (ip2, p), strict=False) == net + add = [("mask", {"p": p}, mask), ("prefix", {"mask": mask}, p), ("wildcard", {"p": p}, str(net.hostmask)), + ("hosts", {"p": p}, 2 ** (32 - p) - 2), ("total", {"p": p}, 2 ** (32 - p)), + ("network", {"ip": ip, "p": p, "mask": mask}, str(net.network_address)), + ("broadcast", {"ip": ip, "p": p}, str(net.broadcast_address)), + ("first", {"ip": ip, "p": p}, str(net.network_address + 1)), + ("last", {"ip": ip, "p": p, "mask": mask}, str(net.broadcast_address - 1)), + ("range", {"ip": ip, "p": p}, "%s - %s" % (net.network_address + 1, net.broadcast_address - 1)), + ("same", {"ip": ip, "ip2": ip2, "p": p, "mask": mask}, same), + ("private", {"ip": ip}, any(ipaddress.IPv4Address(ip) in b for b in RFC1918)), + ("count", {"m": m, "n": n}, 2 ** (m - n)), ("forhosts", {"h": h}, fh)] + for kind, kw, exp in add: + items.append({"split": split, "kind": kind, "valid": True, "q": t[kind].format(**kw), "expect": exp}) + for q in DECLINE[split]: + items.append({"split": split, "kind": "decline", "valid": False, "q": q, "expect": "decline"}) + seen, out = set(), [] + for it in items: + if (it["split"], it["q"]) not in seen: + seen.add((it["split"], it["q"])) + out.append(it) + json.dump(out, open(sys.argv[1], "w"), indent=1) + print("panel:", dict(collections.Counter(i["split"] for i in out))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/networking/networking_scorer.py b/root/specialists/networking/networking_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..066712372ea911a6f111feb2d4d3107ad09e1940 --- /dev/null +++ b/root/specialists/networking/networking_scorer.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +"""networking_scorer - reads the REPLY TEXT. Dotted answers (mask, wildcard, network, broadcast, first / last host): +the first dotted-quad after "is" must equal the expected address; a range: "is A - B" (or "A to B") with both ends +equal. Yes/no items: the reply must open with the right Yes / No. Numbers: the first number after is / are / has / +contains (an optional "/" allowed, so "/26" reads 26, commas allowed) must equal the expected integer. A must-decline +item answered is a false yes. (ok, asserted).""" +import re + +Q = r"(\d{1,3}(?:\.\d{1,3}){3})" + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + e = p["expect"] + if isinstance(e, bool): + m = re.match(r"\s*(yes|no)\b", text, re.I) + return bool(m) and (m.group(1).lower() == "yes") == e, True + if isinstance(e, str) and " - " in e: + a, b = e.split(" - ") + m = re.search(r"\b(?:is|are)\s+" + Q + r"\s*(?:-|–|to|through)\s*" + Q, text) + return bool(m) and (m.group(1), m.group(2)) == (a, b), True + if isinstance(e, str): + m = re.search(r"\bis\s+" + Q, text) + return bool(m) and m.group(1) == e, True + m = re.search(r"\b(?:is|are|has|have|contains?)\s+/?\s*([\d,]+)(?![\d.]*\.\d)", text) + return bool(m) and int(m.group(1).replace(",", "")) == int(e), True diff --git a/root/specialists/networking/organ_networking_v1.py b/root/specialists/networking/organ_networking_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..e6067bc969f108f392dc57961582149b5df1f3bb --- /dev/null +++ b/root/specialists/networking/organ_networking_v1.py @@ -0,0 +1,179 @@ +#!/usr/bin/env python3 +"""organ_networking_v1 - IPv4 addressing arithmetic, exact (Python's ipaddress module), rule named in every answer: +- subnet mask <-> prefix length (RFC 4632 CIDR); wildcard mask (the inverted mask, as ACLs use it); +- total and usable host addresses in a /n (usable = 2^(32-n) - 2; a /31 has 2 (RFC 3021 point-to-point), a /32 has 1); +- network address, broadcast address, first / last usable host, usable range of an address with a prefix or a mask; +- whether two addresses share a subnet; how many /m subnets fit in a /n; the smallest prefix that holds N hosts; +- whether an address is private under RFC 1918 (10/8, 172.16/12, 192.168/16) - loopback / link-local named as such. +Declines (structural, recognised - not guessed): an octet over 255, a mask that is not contiguous ones, a prefix over 32, +a host / network / broadcast question about an address given with no prefix or mask, more subnets than the block holds. +IPv6 is not handled (falls through). Narrowed from the start (narrow_v1). Returns {kind, status, response, value}.""" +from __future__ import annotations + +import ipaddress +import re + +from narrow_v1 import narrative, short_direct + +IP = r"(? 32: + return self._bad("/%d is not a valid IPv4 prefix length (0-32)." % p) + if mask_ips and not pref: + pref = [MASKS[mask_ips[0][0]]] + + # --- smallest prefix for N hosts + hn = re.search(r"\b(?:for|holds?|fit|support|accommodate|needs?|with)\s+(?:at least\s+)?([\d,]+)\s+(?:usable\s+)?(?:hosts?|devices|addresses|computers|machines)\b", low) + if hn and re.search(r"\b(?:smallest|what|which)\s+(?:subnet|prefix|cidr|mask|size|block)|\bsubnet (?:size|mask) (?:do|would|should)|\bhow (?:big|large) (?:a )?subnet", low) and not hosts_ips: + n = int(hn.group(1).replace(",", "")) + if n < 1 or n > 2 ** 32 - 2: + return self._bad("No IPv4 subnet holds %s usable hosts (a /1 holds at most 2,147,483,646)." % fmt(n)) + p = next(q for q in range(30, 0, -1) if 2 ** (32 - q) - 2 >= n) + mk = str(ipaddress.IPv4Network("0.0.0.0/%d" % p).netmask) + return self._say("prefix_for_hosts", "The smallest subnet is /%d (mask %s, %s usable hosts = 2^%d - 2)." % (p, mk, fmt(2 ** (32 - p) - 2), 32 - p), p) + + # --- how many /m subnets in a /n + if re.search(r"\bhow many\b.*\bsubnets?\b|\bhow many\s*/\d", low) and len(pref) >= 2 and not hosts_ips: + m_, n_ = pref[0], pref[1] + fm = re.search(r"/\s*(\d{1,2})\b[^/]{0,40}?\b(?:in|into|inside|within|from|of)\s+(?:an?\s+|one\s+|a single\s+)?/\s*(\d{1,2})\b", low) + if fm: + m_, n_ = int(fm.group(1)), int(fm.group(2)) + else: + dm = re.search(r"\b(?:divide|split|carve|break|subnet)\w*\s+(?:an?\s+)?/\s*(\d{1,2})\s*(?:network |block )?into\s*/\s*(\d{1,2})", low) + if dm: + n_, m_ = int(dm.group(1)), int(dm.group(2)) + else: + return None + if m_ < n_: + return self._bad("A /%d is larger than a /%d, so no /%d subnets fit inside it." % (m_, n_, m_)) + v = 2 ** (m_ - n_) + return self._say("subnet_count", "The count is %s /%d subnets in a /%d (2^(%d - %d))." % (fmt(v), m_, n_, m_, n_), v) + + # --- private (RFC 1918) + if re.search(r"\bprivate\b|\brfc ?1918\b|\bpublic\b|\broutable\b", low) and len(hosts_ips) == 1 and not re.search(r"\bsubnet\b|\bbroadcast\b", low): + a = ipaddress.IPv4Address(hosts_ips[0][0]) + nets = [ipaddress.IPv4Network(x) for x in ("10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16")] + hit = next((n for n in nets if a in n), None) + if hit: + return self._say("private", "Yes - %s is a private address (RFC 1918 block %s)." % (a, hit), True) + extra = " It is loopback (127.0.0.0/8)." if a.is_loopback else " It is link-local (169.254.0.0/16)." if a.is_link_local else \ + " It is shared address space for carrier-grade NAT (100.64.0.0/10, RFC 6598), not RFC 1918." if a in ipaddress.IPv4Network("100.64.0.0/10") else "" + return self._say("private", "No - %s is not in the RFC 1918 private blocks (10/8, 172.16/12, 192.168/16).%s" % (a, extra), False) + + # --- same subnet + if re.search(r"\bsame (?:subnet|network|lan|segment)\b", low) and len(hosts_ips) >= 2: + if not pref: + return self._need("the prefix length or subnet mask") + n1 = ipaddress.IPv4Network("%s/%d" % (hosts_ips[0][0], pref[0]), strict=False) + n2 = ipaddress.IPv4Network("%s/%d" % (hosts_ips[1][0], pref[0]), strict=False) + if n1 == n2: + return self._say("same_subnet", "Yes - both are in %s." % n1, True) + return self._say("same_subnet", "No - %s is in %s but %s is in %s." % (hosts_ips[0][0], n1, hosts_ips[1][0], n2), False) + + # --- mask <-> prefix, wildcard (no host address involved) + if not hosts_ips: + if re.search(r"\bwildcard\b", low) and pref: + p = pref[0] + w = str(ipaddress.IPv4Network("0.0.0.0/%d" % p).hostmask) + return self._say("wildcard", "The wildcard mask for /%d is %s (255.255.255.255 minus the mask)." % (p, w), w) + if mask_ips and re.search(r"\bprefix\b|\bcidr\b|\bslash\b|\bhow many (?:network )?bits\b|\bnotation\b", low): + p = MASKS[mask_ips[0][0]] + return self._say("prefix", "The prefix length is /%d (%s has %d one bits)." % (p, mask_ips[0][0], p), p) + if pref and not mask_ips and re.search(r"\bmask\b|\bnetmask\b|\bdotted\b", low): + p = pref[0] + mk = str(ipaddress.IPv4Network("0.0.0.0/%d" % p).netmask) + return self._say("mask", "The subnet mask for /%d is %s." % (p, mk), mk) + if pref and re.search(r"\bhow many\b|\bnumber of\b|\bcount\b", low) and re.search(r"\bhosts?\b|\baddress(?:es)?\b|\bips?\b|\bdevices\b", low): + p = pref[0] + total = 2 ** (32 - p) + usable = total - 2 if p <= 30 else (2 if p == 31 else 1) + note = "RFC 3021 point-to-point, no network/broadcast" if p == 31 else "a single-host route" if p == 32 else \ + "network and broadcast reserved" + if re.search(r"\busable\b|\bhosts?\b|\bdevices\b|\bassign", low): + return self._say("hosts", "A /%d has %s usable host addresses (%s in total; %s)." % (p, fmt(usable), fmt(total), note), usable) + return self._say("total", "A /%d contains %s addresses in total (2^%d; %s usable for hosts, %s)." % (p, fmt(total), 32 - p, fmt(usable), note), total) + return None + + # --- questions about one address + prefix/mask + want = ("broadcast" if re.search(r"\bbroadcast\b", low) else + "range" if re.search(r"\brange\b|\bfirst and last\b|\bfirst (?:usable|valid|host)\b.*\blast\b", low) else + "first" if re.search(r"\bfirst (?:usable|valid|host|assignable)\b", low) else + "last" if re.search(r"\blast (?:usable|valid|host|assignable)\b", low) else + "network" if re.search(r"\bnetwork (?:address|id|number)\b|\bsubnet (?:address|id)\b|\bwhich (?:subnet|network)\b|\bwhat (?:subnet|network) (?:is|does)\b", low) else + "hosts" if re.search(r"\bhow many\b", low) and re.search(r"\bhosts?\b|\busable\b", low) else None) + if want is None: + return None + if not pref: + return self._need("the prefix length or subnet mask") + s = hosts_ips[0][0] + net = ipaddress.IPv4Network("%s/%d" % (s, pref[0]), strict=False) + p = net.prefixlen + if want == "hosts": + usable = net.num_addresses - 2 if p <= 30 else (2 if p == 31 else 1) + return self._say("hosts", "%s has %s usable host addresses (%s in total)." % (net, fmt(usable), fmt(net.num_addresses)), usable) + if want == "network": + return self._say("network", "The network address is %s (%s AND mask %s)." % (net.network_address, s, net.netmask), str(net.network_address)) + if p >= 31 and want in ("broadcast", "range", "first", "last"): + return self._say("p2p", "A /%d has no broadcast address or reserved network address (%s)." % (p, "RFC 3021 point-to-point" if p == 31 else "single host"), + status="withheld") + first, last = net.network_address + 1, net.broadcast_address - 1 + if want == "broadcast": + return self._say("broadcast", "The broadcast address is %s (the last address of %s)." % (net.broadcast_address, net), str(net.broadcast_address)) + if want == "first": + return self._say("first", "The first usable host is %s (in %s)." % (first, net), str(first)) + if want == "last": + return self._say("last", "The last usable host is %s (in %s)." % (last, net), str(last)) + return self._say("range", "The usable range is %s - %s (%s; network %s, broadcast %s)." % (first, last, net, net.network_address, net.broadcast_address), + "%s - %s" % (first, last)) diff --git a/root/specialists/networking/verdict_dev.json b/root/specialists/networking/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..3821b03a16df98be2a55ed5bd8dc5b8b4d29ab89 --- /dev/null +++ b/root/specialists/networking/verdict_dev.json @@ -0,0 +1,113 @@ +{ + "id": "networking", + "name": "Oracle7 Networking & Protocols (IPv4 addressing)", + "tier": "A", + "split": "dev", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T07:34:18Z", + "domain": { + "head": { + "correct": 3, + "false_yes": 1, + "wrong": 36, + "n": 74, + "p50_ms": 25.9, + "fails": [ + [ + "mask", + "What is the subnet mask for a /12?", + "arb:definitional->definitional_encyclope", + "[ev:direct] I have no admitted entry for \u201csubnet mask for a /12\u201d. The related term \u201c12\u201d is" + ], + [ + "prefix", + "What prefix length is the subnet mask 255.240.0.0?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "wildcard", + "What is the wildcard mask for /12?", + "arb:definitional->definitional_encyclope", + "[ev:direct] I have no admitted entry for \u201cwildcard mask for /12\u201d. The related term \u201c12\u201d is" + ], + [ + "hosts", + "How many usable hosts are in a /12 subnet?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "total", + "How many addresses are in a /12 block in total?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "network", + "What is the network address of 100.100.94.78/12?", + "organ:math>evaluate", + "[ev:derived] 7.89833333333333. In steps: read 7.89833333333333; then evaluate. Checked: re" + ], + [ + "broadcast", + "What is the broadcast address for 100.100.94.78/12?", + "organ:math>evaluate", + "[ev:derived] 7.89833333333333. In steps: read 7.89833333333333; then evaluate. Checked: re" + ], + [ + "first", + "What is the first usable host address in 100.100.94.78/12?", + "organ:math>evaluate", + "[ev:derived] 7.89833333333333. In steps: read 7.89833333333333; then evaluate. Checked: re" + ] + ] + }, + "spec": { + "correct": 74, + "false_yes": 0, + "wrong": 0, + "n": 74, + "p50_ms": 0.03, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/networking/verdict_heldout.json b/root/specialists/networking/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..aceb7e81eb3eaea2e78bc3b8596baa6dd0928bfb --- /dev/null +++ b/root/specialists/networking/verdict_heldout.json @@ -0,0 +1,138 @@ +{ + "id": "networking", + "name": "Oracle7 Networking & Protocols (IPv4 addressing)", + "tier": "A", + "split": "heldout", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T07:38:08Z", + "domain": { + "head": { + "correct": 2, + "false_yes": 2, + "wrong": 14, + "n": 71, + "p50_ms": 38.02, + "fails": [ + [ + "mask", + "Convert /24 to a dotted-decimal subnet mask.", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "prefix", + "Express the netmask 255.255.255.0 in CIDR notation (prefix length).", + "organ:converse>statement", + "Got it. Since you mention prefix: A prefix is an affix which is placed before the stem and" + ], + [ + "wildcard", + "Give the ACL wildcard mask for a /24 network.", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "hosts", + "How many hosts can be assigned in a /24 network?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "total", + "What is the total number of IP addresses in a /24?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "network", + "Find the network ID for host 172.16.124.28 with subnet mask 255.255.25", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "broadcast", + "Host 172.16.124.28/24: which broadcast address does it use?", + "factoid:withheld|vessel:receipt", + "I have no admitted record that answers that about \"Host\", so I will not guess. The reply I" + ], + [ + "first", + "Give the first usable address of the subnet containing 172.16.124.28/2", + "factoid:withheld|vessel:receipt", + "I have no admitted record that answers that about \"usable\", so I will not guess. The reply" + ] + ] + }, + "spec": { + "correct": 67, + "false_yes": 1, + "wrong": 0, + "n": 71, + "p50_ms": 0.05, + "fails": [ + [ + "forhosts", + "Which prefix would you use to fit 4000 devices?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "forhosts", + "Which prefix would you use to fit 200 devices?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "forhosts", + "Which prefix would you use to fit 2 devices?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "decline", + "How many /20 networks can you carve out of a /24?", + "organ:converse>addressed", + "You've reached Oracle7, an AI assistant rather than a person or a front desk, so I can't d" + ] + ] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/nutrition-label-v2/manifest.json b/root/specialists/nutrition-label-v2/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..d737e2374215f89aca0f0465c639dcd14b52e7ea --- /dev/null +++ b/root/specialists/nutrition-label-v2/manifest.json @@ -0,0 +1,66 @@ +{ + "id": "nutrition-label-v2", + "name": "Oracle7 Nutrition (label & public-health arithmetic)", + "number": 62, + "tier": "C", + "sources": [ + { + "name": "FDA Nutrition Facts label Daily Values (2020 rule) and Atwater factors 4/4/9/7", + "licence": "public domain (US government)", + "url": "https://www.fda.gov/food/nutrition-facts-label/daily-value-nutrition-and-supplement-facts-labels" + }, + { + "name": "CDC adult BMI calculation and categories", + "licence": "public domain (US government)", + "url": "https://www.cdc.gov/bmi/adult-calculator/bmi-categories.html" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/nutrition-label/organ_nutrition_label_v1.py" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/nutrition-label-v2", + "module": "organ_nutrition_label_v2", + "class": "NutritionLabelOrganV2", + "init": {} + }, + "accept": { + "kinds": [ + "bmi", + "bmi_category", + "kcal_macros", + "pct_dv", + "pct_fat_cal" + ], + "declines_in_domain": [ + "underspecified" + ], + "context_regex": "\\b(?:bmi|body mass index|calories|calorie|kcal|daily value|dv|protein|carbs?|carbohydrates?|fat|sodium|fiber|sugars?|cholesterol|calcium|iron|potassium)\\b" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/nutrition-label-v2/nutrition_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "nutrition_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [ + "BMI", + "BMI category", + "calories from protein carbs fat", + "percent Daily Value", + "percent of calories from fat" + ], + "budgets": { + "latency_p50_ms": 50, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20260928 + }, + "notes": "v2 of nutrition-label (v1 NEGATIVE 2026-09-29: '150-calorie snack ... percent of its calories are from fat' unread -> head computed 3/150). Reads N-calorie and the 'of its calories' forms; recognise-then-decline on numeric label turns; personal advice still falls through. Fresh panel v2." +} \ No newline at end of file diff --git a/root/specialists/nutrition-label-v2/narrow_v1.py b/root/specialists/nutrition-label-v2/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/nutrition-label-v2/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/nutrition-label-v2/nutrition_panel_v2.json b/root/specialists/nutrition-label-v2/nutrition_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..6bc755cf997807025b31e3956207ebe39daa324b --- /dev/null +++ b/root/specialists/nutrition-label-v2/nutrition_panel_v2.json @@ -0,0 +1,338 @@ +[ + { + "split": "dev", + "kind": "bmi", + "valid": true, + "q": "What is the BMI of someone who weighs 90 kg and is 1.8 m tall?", + "expect": 27.777777777777775 + }, + { + "split": "dev", + "kind": "bmi", + "valid": true, + "q": "What is the BMI of someone who weighs 70 kg and is 1.75 m tall?", + "expect": 22.857142857142858 + }, + { + "split": "dev", + "kind": "bmii", + "valid": true, + "q": "What is the BMI for 200 lb at 6 ft 0 in?", + "expect": 27.121913580246915 + }, + { + "split": "dev", + "kind": "bmii", + "valid": true, + "q": "What is the BMI for 180 lb at 5 ft 11 in?", + "expect": 25.102162269390995 + }, + { + "split": "dev", + "kind": "cat", + "valid": true, + "q": "What BMI category is a person weighing 85 kg at 175 cm?", + "expect": "overweight" + }, + { + "split": "dev", + "kind": "cat", + "valid": true, + "q": "What BMI category is a person weighing 60 kg at 180 cm?", + "expect": "healthy weight" + }, + { + "split": "dev", + "kind": "cat", + "valid": true, + "q": "What BMI category is a person weighing 50 kg at 170 cm?", + "expect": "underweight" + }, + { + "split": "dev", + "kind": "kcal", + "valid": true, + "q": "How many calories are in a food with 25 g protein, 0 g carbohydrate and 15 g fat?", + "expect": 235 + }, + { + "split": "dev", + "kind": "kcal", + "valid": true, + "q": "How many calories are in a food with 10 g protein, 30 g carbohydrate and 5 g fat?", + "expect": 205 + }, + { + "split": "dev", + "kind": "dv", + "valid": true, + "q": "What percent of the Daily Value is 14 g of added sugars?", + "expect": 28.000000000000004 + }, + { + "split": "dev", + "kind": "dv", + "valid": true, + "q": "What percent of the Daily Value is 460 mg of cholesterol?", + "expect": 153.33333333333334 + }, + { + "split": "dev", + "kind": "dv", + "valid": true, + "q": "What percent of the Daily Value is 230 mg of potassium?", + "expect": 4.8936170212765955 + }, + { + "split": "dev", + "kind": "fatpct", + "valid": true, + "q": "What percentage of calories comes from fat in a 90 kcal serving with 5 g of fat?", + "expect": 50.0 + }, + { + "split": "dev", + "kind": "fatpct", + "valid": true, + "q": "What percentage of calories comes from fat in a 150 kcal serving with 3 g of fat?", + "expect": 18.0 + }, + { + "split": "dev", + "kind": "bmi", + "valid": true, + "q": "Body mass index for 70 kg and a height of 1.75 m?", + "expect": 22.857142857142858 + }, + { + "split": "dev", + "kind": "bmi", + "valid": true, + "q": "Body mass index for 90 kg and a height of 1.8 m?", + "expect": 27.777777777777775 + }, + { + "split": "dev", + "kind": "bmii", + "valid": true, + "q": "Someone is 6 ft 0 in and 200 pounds. What is their BMI?", + "expect": 27.121913580246915 + }, + { + "split": "dev", + "kind": "bmii", + "valid": true, + "q": "Someone is 5 ft 4 in and 120 pounds. What is their BMI?", + "expect": 20.595703125 + }, + { + "split": "dev", + "kind": "cat", + "valid": true, + "q": "70 kg, 175 cm tall: which BMI category is that?", + "expect": "healthy weight" + }, + { + "split": "dev", + "kind": "cat", + "valid": true, + "q": "50 kg, 170 cm tall: which BMI category is that?", + "expect": "underweight" + }, + { + "split": "dev", + "kind": "cat", + "valid": true, + "q": "60 kg, 180 cm tall: which BMI category is that?", + "expect": "healthy weight" + }, + { + "split": "dev", + "kind": "kcal", + "valid": true, + "q": "Total calories from 20 g fat, 20 g carbs and 20 g protein?", + "expect": 340 + }, + { + "split": "dev", + "kind": "kcal", + "valid": true, + "q": "Total calories from 1 g fat, 45 g carbs and 3 g protein?", + "expect": 201 + }, + { + "split": "dev", + "kind": "dv", + "valid": true, + "q": "A label lists 5 g of added sugars. What %DV is that?", + "expect": 10.0 + }, + { + "split": "dev", + "kind": "dv", + "valid": true, + "q": "A label lists 260 mg of iron. What %DV is that?", + "expect": 1444.4444444444446 + }, + { + "split": "dev", + "kind": "dv", + "valid": true, + "q": "A label lists 5 g of dietary fiber. What %DV is that?", + "expect": 17.857142857142858 + }, + { + "split": "dev", + "kind": "fatpct", + "valid": true, + "q": "A 90-calorie snack has 5 g of fat. What percent of its calories are from fat?", + "expect": 50.0 + }, + { + "split": "dev", + "kind": "fatpct", + "valid": true, + "q": "A 200-calorie snack has 10 g of fat. What percent of its calories are from fat?", + "expect": 45.0 + }, + { + "split": "dev", + "kind": "off", + "valid": false, + "q": "Should I eat fewer carbs to lose weight?", + "expect": "not taken" + }, + { + "split": "dev", + "kind": "off", + "valid": false, + "q": "How much protein should my child eat?", + "expect": "not taken" + }, + { + "split": "dev", + "kind": "off", + "valid": false, + "q": "Is keto healthy for me?", + "expect": "not taken" + }, + { + "split": "dev", + "kind": "off", + "valid": false, + "q": "What should I eat while pregnant?", + "expect": "not taken" + }, + { + "split": "heldout", + "kind": "bmi", + "valid": true, + "q": "A person who is 1.85 m tall weighs 95 kg. What is their body mass index?", + "expect": 27.757487216946675 + }, + { + "split": "heldout", + "kind": "bmi", + "valid": true, + "q": "A person who is 1.72 m tall weighs 80 kg. What is their body mass index?", + "expect": 27.041644131963228 + }, + { + "split": "heldout", + "kind": "bmii", + "valid": true, + "q": "What BMI does 105 pounds at 5 feet 1 inches work out to?", + "expect": 19.83740929857565 + }, + { + "split": "heldout", + "kind": "bmii", + "valid": true, + "q": "What BMI does 165 pounds at 5 feet 7 inches work out to?", + "expect": 25.83983069725997 + }, + { + "split": "heldout", + "kind": "cat", + "valid": true, + "q": "Which CDC BMI category does 92 kg at a height of 178 cm fall into?", + "expect": "overweight" + }, + { + "split": "heldout", + "kind": "cat", + "valid": true, + "q": "Which CDC BMI category does 45 kg at a height of 165 cm fall into?", + "expect": "underweight" + }, + { + "split": "heldout", + "kind": "cat", + "valid": true, + "q": "Which CDC BMI category does 120 kg at a height of 180 cm fall into?", + "expect": "obesity" + }, + { + "split": "heldout", + "kind": "kcal", + "valid": true, + "q": "A bar has 6 g of protein, 40 g of carbs and 2 g of fat. How many calories does it have in total?", + "expect": 202 + }, + { + "split": "heldout", + "kind": "kcal", + "valid": true, + "q": "A bar has 30 g of protein, 5 g of carbs and 12 g of fat. How many calories does it have in total?", + "expect": 248 + }, + { + "split": "heldout", + "kind": "dv", + "valid": true, + "q": "How much of the Daily Value is 195 mg of cholesterol, as a percent?", + "expect": 65.0 + }, + { + "split": "heldout", + "kind": "dv", + "valid": true, + "q": "How much of the Daily Value is 6 g of saturated fat, as a percent?", + "expect": 30.0 + }, + { + "split": "heldout", + "kind": "dv", + "valid": true, + "q": "How much of the Daily Value is 6 g of added sugars, as a percent?", + "expect": 12.0 + }, + { + "split": "heldout", + "kind": "fatpct", + "valid": true, + "q": "If a 250 calorie meal contains 12 grams of fat, what share of the calories comes from fat, in percent?", + "expect": 43.2 + }, + { + "split": "heldout", + "kind": "fatpct", + "valid": true, + "q": "If a 300 calorie meal contains 5 grams of fat, what share of the calories comes from fat, in percent?", + "expect": 15.0 + }, + { + "split": "heldout", + "kind": "off", + "valid": false, + "q": "Should I cut out sugar to lose weight fast?", + "expect": "not taken" + }, + { + "split": "heldout", + "kind": "off", + "valid": false, + "q": "How many calories should I eat to gain weight?", + "expect": "not taken" + } +] \ No newline at end of file diff --git a/root/specialists/nutrition-label-v2/nutrition_panel_v2.py b/root/specialists/nutrition-label-v2/nutrition_panel_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..bbae0cb6ffe64d9cd4645e79c54f2775f5126740 --- /dev/null +++ b/root/specialists/nutrition-label-v2/nutrition_panel_v2.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +"""nutrition_panel_v2 - the FRESH sealed panel for nutrition-label-v2 (#62, tier C). v1's held-out was measured once +(NEGATIVE) and is burned: its phrasings join DEV here. The v2 held-out is new phrasing and new numbers, written for +people. Expected values from the rules written here: BMI = kg/m2 or 703 lb/in2 with CDC adult categories; kcal = 4P + 4C ++ 9F; %DV = amount / FDA 2020 DV x 100; % calories from fat = 9F / kcal x 100. Must-NOT-take: personal advice turns. +usage: nutrition_panel_v2.py """ +import collections +import json +import random +import sys + +DEV_T = [{"bmi": "What is the BMI of someone who weighs {kg} kg and is {m} m tall?", + "bmii": "What is the BMI for {lb} lb at {ft} ft {inch} in?", + "cat": "What BMI category is a person weighing {kg} kg at {cm} cm?", + "kcal": "How many calories are in a food with {p} g protein, {c} g carbohydrate and {f} g fat?", + "dv": "What percent of the Daily Value is {amt} {u} of {nut}?", + "fatpct": "What percentage of calories comes from fat in a {k} kcal serving with {f} g of fat?"}, + {"bmi": "Body mass index for {kg} kg and a height of {m} m?", + "bmii": "Someone is {ft} ft {inch} in and {lb} pounds. What is their BMI?", + "cat": "{kg} kg, {cm} cm tall: which BMI category is that?", + "kcal": "Total calories from {f} g fat, {c} g carbs and {p} g protein?", + "dv": "A label lists {amt} {u} of {nut}. What %DV is that?", + "fatpct": "A {k}-calorie snack has {f} g of fat. What percent of its calories are from fat?"}] +HELD_T = {"bmi": "A person who is {m} m tall weighs {kg} kg. What is their body mass index?", + "bmii": "What BMI does {lb} pounds at {ft} feet {inch} inches work out to?", + "cat": "Which CDC BMI category does {kg} kg at a height of {cm} cm fall into?", + "kcal": "A bar has {p} g of protein, {c} g of carbs and {f} g of fat. How many calories does it have in total?", + "dv": "How much of the Daily Value is {amt} {u} of {nut}, as a percent?", + "fatpct": "If a {k} calorie meal contains {f} grams of fat, what share of the calories comes from fat, in percent?"} +OFF = {"dev": ["Should I eat fewer carbs to lose weight?", "How much protein should my child eat?", "Is keto healthy for me?", + "What should I eat while pregnant?"], + "heldout": ["Should I cut out sugar to lose weight fast?", "How many calories should I eat to gain weight?"]} +DVS = {"sodium": (2300, "mg"), "dietary fiber": (28, "g"), "added sugars": (50, "g"), "saturated fat": (20, "g"), "calcium": (1300, "mg"), + "iron": (18, "mg"), "potassium": (4700, "mg"), "cholesterol": (300, "mg")} +POOL = {"dev": {"bmi": [(70, 1.75), (90, 1.8), (55, 1.65), (110, 1.7)], "bmii": [(150, 5, 9), (200, 6, 0), (120, 5, 4), (180, 5, 11)], + "cat": [(50, 170), (70, 175), (85, 175), (100, 170), (60, 180)], "kcal": [(10, 30, 5), (25, 0, 15), (3, 45, 1), (20, 20, 20)], + "fat": [(200, 10), (150, 3), (400, 20), (90, 5)], "mg": [230, 460, 690, 115, 130, 260, 36, 9], "g": [7, 14, 5, 2]}, + "heldout": {"bmi": [(62, 1.6), (95, 1.85), (48, 1.58), (80, 1.72)], "bmii": [(165, 5, 7), (230, 6, 2), (105, 5, 1), (140, 5, 10)], + "cat": [(45, 165), (68, 172), (92, 178), (120, 180)], "kcal": [(12, 22, 8), (6, 40, 2), (30, 5, 12)], + "fat": [(250, 12), (300, 5), (120, 8), (500, 25)], "mg": [345, 920, 65, 195, 1150], "g": [3, 10, 4, 6]}} + + +def cat(b): + return "underweight" if b < 18.5 else "healthy weight" if b < 25 else "overweight" if b < 30 else "obesity" + + +def main(): + items = [] + for split, seed, temps in (("dev", 62, DEV_T), ("heldout", 626262, [HELD_T])): + rng = random.Random(seed) + P = POOL[split] + for T in temps: + add = [] + for kg, m in rng.sample(P["bmi"], 2): + add.append(("bmi", {"kg": kg, "m": m}, kg / m ** 2)) + for lb, ft, inch in rng.sample(P["bmii"], 2): + add.append(("bmii", {"lb": lb, "ft": ft, "inch": inch}, 703 * lb / (ft * 12 + inch) ** 2)) + for kg, cm in rng.sample(P["cat"], 3): + add.append(("cat", {"kg": kg, "cm": cm}, cat(kg / (cm / 100) ** 2))) + for p, c, f in rng.sample(P["kcal"], 2): + add.append(("kcal", {"p": p, "c": c, "f": f}, 4 * p + 4 * c + 9 * f)) + for nut in rng.sample(sorted(DVS), 3): + dv, u = DVS[nut] + amt = rng.choice(P[u]) + add.append(("dv", {"amt": amt, "u": u, "nut": nut}, amt / dv * 100)) + for k, f in rng.sample(P["fat"], 2): + add.append(("fatpct", {"k": k, "f": f}, 9 * f / k * 100)) + for kind, kw, exp in add: + items.append({"split": split, "kind": kind, "valid": True, "q": T[kind].format(**kw), "expect": exp}) + for q in OFF[split]: + items.append({"split": split, "kind": "off", "valid": False, "q": q, "expect": "not taken"}) + json.dump(items, open(sys.argv[1], "w", encoding="utf-8"), indent=1, ensure_ascii=False) + print("panel:", dict(collections.Counter(i["split"] for i in items))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/nutrition-label-v2/nutrition_scorer.py b/root/specialists/nutrition-label-v2/nutrition_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..78d7080b72e3669d4d82bfca50be7591d06d6fcb --- /dev/null +++ b/root/specialists/nutrition-label-v2/nutrition_scorer.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +"""nutrition_scorer - reads the REPLY TEXT. BMI categories: the category right after "is" must equal the expected one +("healthy weight" / "underweight" / "overweight" / "obesity"). Numbers: the first number after "is" within 0.5% +(0.05 absolute). Personal-advice items (valid False) must not be answered - answering one is a false yes. +(ok, asserted).""" +import re + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + e = p["expect"] + if isinstance(e, str): + m = re.search(r"\bis\s+(healthy weight|underweight|overweight|obesity)\b", text, re.I) + return bool(m) and m.group(1).lower() == e, True + m = re.search(r"\bis\s+(?:about\s+)?([\d,]*\.?\d+)", text) + if not m: + return False, True + got = float(m.group(1).replace(",", "")) + return abs(got - e) <= max(0.005 * abs(e), 0.05), True diff --git a/root/specialists/nutrition-label-v2/organ_nutrition_label_v1.py b/root/specialists/nutrition-label-v2/organ_nutrition_label_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..80fc162588e615a20d27b70db3c5b0c729efcd00 --- /dev/null +++ b/root/specialists/nutrition-label-v2/organ_nutrition_label_v1.py @@ -0,0 +1,115 @@ +#!/usr/bin/env python3 +"""organ_nutrition_label_v1 - nutrition-label and public-health arithmetic (tier C: decline-heavy), rule named in every +answer; NEVER personal dietary or medical advice: +- BMI = kg / m^2 (or 703 x lb / in^2), with the CDC adult category (underweight < 18.5, healthy 18.5 - < 25, + overweight 25 - < 30, obesity >= 30) - stated as a screening category, not a diagnosis; +- calories from macronutrients: 4 kcal/g protein and carbohydrate, 9 fat, 7 alcohol (USDA / FDA Atwater factors); +- percent Daily Value = amount / DV x 100, FDA 2020 label DVs (adults): sodium 2,300 mg, total fat 78 g, saturated fat + 20 g, cholesterol 300 mg, total carbohydrate 275 g, dietary fiber 28 g, added sugars 50 g, protein 50 g, calcium + 1,300 mg, iron 18 mg, potassium 4,700 mg, vitamin D 20 mcg; +- percent of calories from fat = 9 x fat g / total kcal x 100. +Turns asking what a PERSON should eat, weigh or do ("should I", "how much should I", "is it healthy for me", "lose +weight", "my child", "pregnant") fall through. Narrowed from the start (narrow_v1). Returns {kind, status, response, value}.""" +from __future__ import annotations + +import re + +from narrow_v1 import narrative, short_direct + +N = r"(\d+(?:,\d{3})*(?:\.\d+)?)" +DV = [(r"\bsodium\b", 2300, "mg", "sodium"), (r"\bsaturated fat\b", 20, "g", "saturated fat"), (r"\btotal fat\b|\bfat\b", 78, "g", "total fat"), + (r"\bcholesterol\b", 300, "mg", "cholesterol"), (r"\bdietary fiber\b|\bfiber\b|\bfibre\b", 28, "g", "dietary fiber"), + (r"\badded sugars?\b", 50, "g", "added sugars"), (r"\btotal carbohydrates?\b|\bcarbohydrates?\b|\bcarbs\b", 275, "g", "total carbohydrate"), + (r"\bprotein\b", 50, "g", "protein"), (r"\bcalcium\b", 1300, "mg", "calcium"), (r"\biron\b", 18, "mg", "iron"), + (r"\bpotassium\b", 4700, "mg", "potassium"), (r"\bvitamin d\b", 20, "mcg", "vitamin D")] + + +def num(s): + return float(s.replace(",", "")) + + +def g(x): + return ("%.2f" % x).rstrip("0").rstrip(".") + + +def category(b): + return "underweight" if b < 18.5 else "healthy weight" if b < 25 else "overweight" if b < 30 else "obesity" + + +class NutritionLabelOrgan: + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def answer(self, text, session_id="default"): + if narrative(text): + return None + r = self._answer(text) + if r and r.get("status") != "answered" and not short_direct(text): + return None + return r + + def _answer(self, text): + t = " ".join(str(text or "").split()) + low = t.lower() + if re.search(r"\bshould (?:i|we|my)\b|\bhow much should\b|\bhealthy for (?:me|my)\b|\blose weight\b|\bgain weight\b|\bmy (?:child|son|daughter|baby|doctor)\b|\bpregnan\w*\b|\bdiet plan\b|\bam i\b", low): + return None + # --- BMI + if re.search(r"\bbmi\b|\bbody mass index\b", low): + kg = re.search(N + r"\s*(?:kg|kilograms?)\b", low) + m = re.search(N + r"\s*(m|meters?|metres?|cm|centimet\w+)\b(?!\s*/)", low) + lb = re.search(N + r"\s*(?:lb|lbs|pounds)\b", low) + fi = re.search(r"\b(\d)\s*(?:ft|feet|foot|')\s*(\d{1,2}(?:\.\d+)?)\s*(?:in|inches|\")?", low) + inch = re.search(N + r"\s*(?:in|inches)\b", low) + if kg and m: + h = num(m.group(1)) / (100 if m.group(2).startswith("c") else 1) + if h <= 0: + return None + b = num(kg.group(1)) / h ** 2 + src = "%s kg ÷ (%s m)²" % (g(num(kg.group(1))), g(h)) + elif lb and (fi or inch): + hin = int(fi.group(1)) * 12 + float(fi.group(2)) if fi else num(inch.group(1)) + if hin <= 0: + return None + b = 703 * num(lb.group(1)) / hin ** 2 + src = "703 × %s lb ÷ (%s in)²" % (g(num(lb.group(1))), g(hin)) + else: + return None + if re.search(r"\bcategory\b|\bclass\w*\b|\bwhat (?:range|group)\b", low): + return self._say("bmi_category", "The BMI category is %s (BMI %s = %s; CDC adult screening categories, not a diagnosis)." % (category(b), g(b), src), category(b)) + return self._say("bmi", "The BMI is %s (%s; CDC adult category: %s - a screening measure, not a diagnosis)." % (g(b), src, category(b)), b) + # --- calories from macros + if re.search(r"\bcalories\b|\bkcal\b", low) and re.search(r"\bprotein\b|\bcarb\w*\b|\bfat\b", low) and re.search(r"\bhow many calories\b|\btotal calories\b|\bcalories (?:are )?in\b|\bcalories does\b", low): + def grams(name): + mm = re.search(N + r"\s*g(?:rams?)?\s*(?:of\s+)?" + name, low) or re.search(name + r"\s*(?:of|:|=)?\s*" + N + r"\s*g(?:rams?)?\b", low) + return num(mm.group(1)) if mm else 0.0 + p, c, f, a = grams(r"protein"), grams(r"carb\w*"), grams(r"fat"), grams(r"alcohol") + if p + c + f + a == 0: + return None + kcal = 4 * p + 4 * c + 9 * f + 7 * a + return self._say("kcal_macros", "The total is %s kcal (4 × %s g protein + 4 × %s g carbohydrate + 9 × %s g fat%s)." % ( + g(kcal), g(p), g(c), g(f), " + 7 × %s g alcohol" % g(a) if a else ""), kcal) + # --- % calories from fat + if re.search(r"\bpercent\w*\b|\b%\b|\bshare\b|\bproportion\b", low) and re.search(r"\bcalories from fat\b|\bof (?:the )?calories\b.*\bfat\b|\bfat\b.*\bof (?:the )?calories\b", low): + fm = re.search(N + r"\s*g(?:rams?)?\s*(?:of\s+)?(?:total\s+)?fat\b", low) + km = re.search(N + r"\s*(?:calories|kcal)\b", low) + if not fm or not km or num(km.group(1)) <= 0: + return None + v = 9 * num(fm.group(1)) / num(km.group(1)) * 100 + return self._say("pct_fat_cal", "The share of calories from fat is %s%% (9 × %s g ÷ %s kcal)." % (g(v), g(num(fm.group(1))), g(num(km.group(1)))), v) + # --- % Daily Value + if re.search(r"\bdaily value\b|\b%\s*dv\b|\bpercent dv\b|\bdv\b", low): + for rx, dv, unit, name in DV: + if re.search(rx, low): + am = re.search(N + r"\s*(mg|g|mcg|µg)\b", low) + if not am: + return None + amt = num(am.group(1)) + u = am.group(2).replace("µg", "mcg") + if u != unit: + f = {("g", "mg"): 1000, ("mg", "g"): 0.001, ("mcg", "mg"): 0.001, ("mg", "mcg"): 1000}.get((u, unit)) + if f is None: + return None + amt *= f + v = amt / dv * 100 + return self._say("pct_dv", "That is %s%% of the Daily Value (%s %s ÷ %s %s DV for %s; FDA 2020 label, adults)." % (g(v), g(amt), unit, g(dv), unit, name), v) + return None diff --git a/root/specialists/nutrition-label-v2/organ_nutrition_label_v2.py b/root/specialists/nutrition-label-v2/organ_nutrition_label_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..d6a69b8af31c22667b5d5e4abdae6c0a61080675 --- /dev/null +++ b/root/specialists/nutrition-label-v2/organ_nutrition_label_v2.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +"""organ_nutrition_label_v2 - organ_nutrition_label_v1 (NEGATIVE under gate v3, 2026-09-29: held-out 14/16 vs head 2/16 +but 2 WRONG) with the held-out class fixed: +- "A 150-calorie snack has 3 g of fat. What percent of its calories are from fat?" - v1 read neither "150-calorie" (a + hyphenated, singular count) nor "of its calories are from fat", fell SILENT, and the head computed 3 / 150 (wrong: fat + is 9 kcal per gram). v2 reads "N-calorie" / "N calorie" / "N-kcal" as N calories and the question forms "of its / + their / the calories", "calories are / come from fat", "calories that come from fat". +- RECOGNISE-THEN-DECLINE (2026-09-29 law): a numeric turn that is recognisably a BMI / calories-from-macros / %DV / + %-calories-from-fat question but that v2 still cannot read DECLINES in-domain instead of falling silent; v1's own + declines are kept on numeric turns of any length. Personal-advice turns still fall through untouched. +Everything else v1. Judged on a FRESH panel v2.""" +from __future__ import annotations + +import re + +from narrow_v1 import narrative +from organ_nutrition_label_v1 import NutritionLabelOrgan + +PERSONAL = r"\bshould (?:i|we|my)\b|\bhow much should\b|\bhealthy for (?:me|my)\b|\blose weight\b|\bgain weight\b|\bmy (?:child|son|daughter|baby|doctor)\b|\bpregnan\w*\b|\bdiet plan\b|\bam i\b" + + +class NutritionLabelOrganV2(NutritionLabelOrgan): + def answer(self, text, session_id="default"): + if narrative(text): + return None + t = " ".join(str(text or "").split()) + t = re.sub(r"\b(\d+(?:,\d{3})*(?:\.\d+)?)[- ](?:calorie|cal|kcal)s?\b", r"\1 calories", t, flags=re.I) # "150-calorie" + t = re.sub(r"\bof (?:its|their|the|this|that) calories\b", "of the calories", t, flags=re.I) + t = re.sub(r"\bcalories (?:are |is |that are |that come |come |comes |coming )?from fat\b", "calories from fat", t, flags=re.I) + low = t.lower() + if re.search(PERSONAL, low): + return None + r = self._answer(t) + if r is not None: + if r.get("status") != "answered" and not re.search(r"\d", t): + return None + return r + if not re.search(r"\d", low): + return None + if (re.search(r"\bbmi\b|\bbody mass index\b", low) or + (re.search(r"\bpercent\w*\b|%|\bshare\b|\bproportion\b", low) and re.search(r"\bcalories\b", low) and re.search(r"\bfat\b", low)) or + re.search(r"\bdaily value\b|%\s*dv\b|\bpercent dv\b", low) or + (re.search(r"\bhow many calories\b|\btotal calories\b", low) and re.search(r"\bprotein\b|\bcarb\w*\b|\bfat\b", low))): + return self._say("underspecified", "I couldn't read every amount I need from that; give the grams, calories, weight or height " + "with units and I'll work it out.", status="withheld") + return None diff --git a/root/specialists/nutrition-label-v2/verdict_dev.json b/root/specialists/nutrition-label-v2/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..2a5f3405982b54c091a8ab7380d33c4df9b90abd --- /dev/null +++ b/root/specialists/nutrition-label-v2/verdict_dev.json @@ -0,0 +1,113 @@ +{ + "id": "nutrition-label-v2", + "name": "Oracle7 Nutrition (label & public-health arithmetic)", + "tier": "C", + "split": "dev", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T12:40:28Z", + "domain": { + "head": { + "correct": 4, + "false_yes": 0, + "wrong": 10, + "n": 32, + "p50_ms": 41.21, + "fails": [ + [ + "bmi", + "What is the BMI of someone who weighs 90 kg and is 1.8 m tall?", + "organ:math>evaluate", + "[ev:derived] 1.8*m. In steps: read 1.8*m; then simplify. Checked: equivalent to the input " + ], + [ + "bmi", + "What is the BMI of someone who weighs 70 kg and is 1.75 m tall?", + "organ:math>evaluate", + "[ev:derived] 1.75*m. In steps: read 1.75*m; then simplify. Checked: equivalent to the inpu" + ], + [ + "bmii", + "What is the BMI for 200 lb at 6 ft 0 in?", + "arb:definitional->document_runtime|subst", + "[ev:unknown] I have no admitted entry for \u201cBMI for 200 lb at 6 ft 0 in\u201d. The related term " + ], + [ + "bmii", + "What is the BMI for 180 lb at 5 ft 11 in?", + "arb:definitional->definitional_encyclope", + "[ev:direct] I have no admitted entry for \u201cBMI for 180 lb at 5 ft 11 in\u201d. The related term " + ], + [ + "cat", + "What BMI category is a person weighing 85 kg at 175 cm?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "cat", + "What BMI category is a person weighing 60 kg at 180 cm?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "cat", + "What BMI category is a person weighing 50 kg at 170 cm?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "kcal", + "How many calories are in a food with 25 g protein, 0 g carbohydrate an", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 32, + "false_yes": 0, + "wrong": 0, + "n": 32, + "p50_ms": 0.1, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/nutrition-label-v2/verdict_heldout.json b/root/specialists/nutrition-label-v2/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..272780df005eac0b971111a5c47e9cb3f3cccaf7 --- /dev/null +++ b/root/specialists/nutrition-label-v2/verdict_heldout.json @@ -0,0 +1,113 @@ +{ + "id": "nutrition-label-v2", + "name": "Oracle7 Nutrition (label & public-health arithmetic)", + "tier": "C", + "split": "heldout", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T12:44:19Z", + "domain": { + "head": { + "correct": 2, + "false_yes": 0, + "wrong": 0, + "n": 16, + "p50_ms": 230.11, + "fails": [ + [ + "bmi", + "A person who is 1.85 m tall weighs 95 kg. What is their body mass inde", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "bmi", + "A person who is 1.72 m tall weighs 80 kg. What is their body mass inde", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "bmii", + "What BMI does 105 pounds at 5 feet 1 inches work out to?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "bmii", + "What BMI does 165 pounds at 5 feet 7 inches work out to?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "cat", + "Which CDC BMI category does 92 kg at a height of 178 cm fall into?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "cat", + "Which CDC BMI category does 45 kg at a height of 165 cm fall into?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "cat", + "Which CDC BMI category does 120 kg at a height of 180 cm fall into?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "kcal", + "A bar has 6 g of protein, 40 g of carbs and 2 g of fat. How many calor", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ] + ] + }, + "spec": { + "correct": 16, + "false_yes": 0, + "wrong": 0, + "n": 16, + "p50_ms": 0.18, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/ocean/manifest.json b/root/specialists/ocean/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..045dc9ed06c21c4d043cfc80108aa14336bf6c00 --- /dev/null +++ b/root/specialists/ocean/manifest.json @@ -0,0 +1,22 @@ +{ + "id": "ocean", + "name": "Oracle7 Oceanography", + "number": 21, + "tier": "B", + "sources": [ + {"name": "NOAA Ocean Service / NOAA Tsunami program - shallow-water wave speed sqrt(g d), deep-water dispersion, pressure with depth, echo sounding", "licence": "public domain (US government)", "url": "https://oceanservice.noaa.gov/facts/"} + ], + "store": {"path": "__ORACLE7_ROOT__/specialists/ocean/organ_ocean_v1.py"}, + "organ": {"dir": "__ORACLE7_ROOT__/specialists/ocean", "module": "organ_ocean_v1", "class": "OceanOrgan", "init": {}}, + "accept": { + "kinds": ["shallow_speed", "tsunami_time", "deep_speed", "deep_wavelength", "pressure", "pressure_abs", "sonar_depth"], + "declines_in_domain": [], + "context_regex": "\\b(?:tsunami|ocean|seawater|sonar|echo sounder|deep[- ]water wave)\\b" + }, + "panel": {"path": "__ORACLE7_ROOT__/specialists/ocean/ocean_panel_v1.json", "splits": ["dev", "heldout"], + "exclude_kinds_composed": [], "scorer_module": "ocean_scorer", "scorer_fn": "ok"}, + "routing_cues": ["tsunami speed", "tsunami travel time", "deep-water wave speed", "wavelength from period", "pressure at depth", "sonar depth"], + "budgets": {"latency_p50_ms": 50, "store_mb": 1}, + "core_sample": {"n": 400, "seed": 20260928}, + "notes": "g = 9.81; seawater 1,025 kg/m3 and sound 1,500 m/s unless given (said so). No in-domain declines in v1: the organ answers what it can compute and is silent otherwise; the panel's invalid items are off-domain ocean questions it must NOT take. Narrowed from the start (narrow_v1)." +} diff --git a/root/specialists/ocean/narrow_v1.py b/root/specialists/ocean/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/ocean/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/ocean/ocean_panel_v1.json b/root/specialists/ocean/ocean_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..e3328c90146aaf40ecae2a31fe5e5b30fa1704e5 --- /dev/null +++ b/root/specialists/ocean/ocean_panel_v1.json @@ -0,0 +1,324 @@ +[ + { + "split": "dev", + "kind": "tsp", + "valid": true, + "q": "How fast does a tsunami travel in water 1000 m deep?", + "expect": 99.04544411531506 + }, + { + "split": "dev", + "kind": "tsp", + "valid": true, + "q": "How fast does a tsunami travel in water 200 m deep?", + "expect": 44.294469180700204 + }, + { + "split": "dev", + "kind": "tsp", + "valid": true, + "q": "How fast does a tsunami travel in water 50 m deep?", + "expect": 22.147234590350102 + }, + { + "split": "dev", + "kind": "ttime", + "valid": true, + "q": "How long does a tsunami take to travel 2,000 km across ocean 3000 m deep, in hours?", + "expect": 3.2384139665864304 + }, + { + "split": "dev", + "kind": "ttime", + "valid": true, + "q": "How long does a tsunami take to travel 300 km across ocean 100 m deep, in hours?", + "expect": 2.660628570058754 + }, + { + "split": "dev", + "kind": "ttime", + "valid": true, + "q": "How long does a tsunami take to travel 5,000 km across ocean 4500 m deep, in hours?", + "expect": 6.61038482836604 + }, + { + "split": "dev", + "kind": "dsp", + "valid": true, + "q": "What is the speed of a deep-water wave with a period of 12 s?", + "expect": 18.73571990077792 + }, + { + "split": "dev", + "kind": "dsp", + "valid": true, + "q": "What is the speed of a deep-water wave with a period of 8 s?", + "expect": 12.490479933851947 + }, + { + "split": "dev", + "kind": "dsp", + "valid": true, + "q": "What is the speed of a deep-water wave with a period of 15 s?", + "expect": 23.4196498759724 + }, + { + "split": "dev", + "kind": "dwl", + "valid": true, + "q": "What is the wavelength of a deep-water wave with a period of 15 s?", + "expect": 351.294748139586 + }, + { + "split": "dev", + "kind": "dwl", + "valid": true, + "q": "What is the wavelength of a deep-water wave with a period of 8 s?", + "expect": 99.92383947081558 + }, + { + "split": "dev", + "kind": "dwl", + "valid": true, + "q": "What is the wavelength of a deep-water wave with a period of 10 s?", + "expect": 156.13099917314932 + }, + { + "split": "dev", + "kind": "pg", + "valid": true, + "q": "What is the water pressure in the ocean at a depth of 30 m?", + "expect": 301.6575 + }, + { + "split": "dev", + "kind": "pg", + "valid": true, + "q": "What is the water pressure in the ocean at a depth of 10 m?", + "expect": 100.5525 + }, + { + "split": "dev", + "kind": "pg", + "valid": true, + "q": "What is the water pressure in the ocean at a depth of 100 m?", + "expect": 1005.525 + }, + { + "split": "dev", + "kind": "pa", + "valid": true, + "q": "What is the absolute pressure at 50 m deep in seawater?", + "expect": 604.0875 + }, + { + "split": "dev", + "kind": "pa", + "valid": true, + "q": "What is the absolute pressure at 300 m deep in seawater?", + "expect": 3117.9 + }, + { + "split": "dev", + "kind": "sonar", + "valid": true, + "q": "A sonar ping returns after 2 s. How deep is the sea floor?", + "expect": 1500.0 + }, + { + "split": "dev", + "kind": "sonar", + "valid": true, + "q": "A sonar ping returns after 6.4 s. How deep is the sea floor?", + "expect": 4800.0 + }, + { + "split": "dev", + "kind": "sonarv", + "valid": true, + "q": "An echo sounder ping comes back in 2 s with sound traveling at 1480 m/s. What is the depth?", + "expect": 1480.0 + }, + { + "split": "dev", + "kind": "sonarv", + "valid": true, + "q": "An echo sounder ping comes back in 1.2 s with sound traveling at 1500 m/s. What is the depth?", + "expect": 900.0 + }, + { + "split": "dev", + "kind": "off", + "valid": false, + "q": "How deep is the Mariana Trench?", + "expect": "not taken" + }, + { + "split": "dev", + "kind": "off", + "valid": false, + "q": "What causes tsunamis?", + "expect": "not taken" + }, + { + "split": "heldout", + "kind": "tsp", + "valid": true, + "q": "Tsunami speed over an ocean depth of 1000 m?", + "expect": 99.04544411531506 + }, + { + "split": "heldout", + "kind": "tsp", + "valid": true, + "q": "Tsunami speed over an ocean depth of 4000 m?", + "expect": 198.09088823063013 + }, + { + "split": "heldout", + "kind": "tsp", + "valid": true, + "q": "Tsunami speed over an ocean depth of 5000 m?", + "expect": 221.472345903501 + }, + { + "split": "heldout", + "kind": "ttime", + "valid": true, + "q": "A tsunami must cross 2,000 km of ocean averaging 3000 m deep. Travel time in hours?", + "expect": 3.2384139665864304 + }, + { + "split": "heldout", + "kind": "ttime", + "valid": true, + "q": "A tsunami must cross 300 km of ocean averaging 100 m deep. Travel time in hours?", + "expect": 2.660628570058754 + }, + { + "split": "heldout", + "kind": "ttime", + "valid": true, + "q": "A tsunami must cross 1,000 km of ocean averaging 4000 m deep. Travel time in hours?", + "expect": 1.4022743815170897 + }, + { + "split": "heldout", + "kind": "dsp", + "valid": true, + "q": "Deep-water swell has a 10-second period. How fast does it move?", + "expect": 15.613099917314935 + }, + { + "split": "heldout", + "kind": "dsp", + "valid": true, + "q": "Deep-water swell has a 8-second period. How fast does it move?", + "expect": 12.490479933851947 + }, + { + "split": "heldout", + "kind": "dsp", + "valid": true, + "q": "Deep-water swell has a 12-second period. How fast does it move?", + "expect": 18.73571990077792 + }, + { + "split": "heldout", + "kind": "dwl", + "valid": true, + "q": "Find the deep-water wavelength for waves with period 6 s.", + "expect": 56.20715970233376 + }, + { + "split": "heldout", + "kind": "dwl", + "valid": true, + "q": "Find the deep-water wavelength for waves with period 15 s.", + "expect": 351.294748139586 + }, + { + "split": "heldout", + "kind": "dwl", + "valid": true, + "q": "Find the deep-water wavelength for waves with period 12 s.", + "expect": 224.82863880933505 + }, + { + "split": "heldout", + "kind": "pg", + "valid": true, + "q": "A diver is 10 m below the sea surface. What water pressure acts on them?", + "expect": 100.5525 + }, + { + "split": "heldout", + "kind": "pg", + "valid": true, + "q": "A diver is 100 m below the sea surface. What water pressure acts on them?", + "expect": 1005.525 + }, + { + "split": "heldout", + "kind": "pg", + "valid": true, + "q": "A diver is 30 m below the sea surface. What water pressure acts on them?", + "expect": 301.6575 + }, + { + "split": "heldout", + "kind": "pa", + "valid": true, + "q": "Total pressure including the atmosphere on a submarine at 10 m depth?", + "expect": 201.8775 + }, + { + "split": "heldout", + "kind": "pa", + "valid": true, + "q": "Total pressure including the atmosphere on a submarine at 300 m depth?", + "expect": 3117.9 + }, + { + "split": "heldout", + "kind": "sonar", + "valid": true, + "q": "Sonar echo: the pulse returns 2 seconds later. What is the water depth?", + "expect": 1500.0 + }, + { + "split": "heldout", + "kind": "sonar", + "valid": true, + "q": "Sonar echo: the pulse returns 4 seconds later. What is the water depth?", + "expect": 3000.0 + }, + { + "split": "heldout", + "kind": "sonarv", + "valid": true, + "q": "Using a sound speed of 1500 m/s, an echo returns after 1.2 s. How deep is the ocean there?", + "expect": 900.0 + }, + { + "split": "heldout", + "kind": "sonarv", + "valid": true, + "q": "Using a sound speed of 1520 m/s, an echo returns after 5 s. How deep is the ocean there?", + "expect": 3800.0 + }, + { + "split": "heldout", + "kind": "off", + "valid": false, + "q": "Why is the ocean salty?", + "expect": "not taken" + }, + { + "split": "heldout", + "kind": "off", + "valid": false, + "q": "How long is the coastline of Norway?", + "expect": "not taken" + } +] \ No newline at end of file diff --git a/root/specialists/ocean/ocean_panel_v1.py b/root/specialists/ocean/ocean_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..50df6211852896e0db4cdc8bd8e43a0f274569c6 --- /dev/null +++ b/root/specialists/ocean/ocean_panel_v1.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python3 +"""ocean_panel_v1 - the sealed panel for specialist #21 (oceanography). Expected values from the relations written +here (g 9.81): c = sqrt(g d); t = D / sqrt(g d) (hours); c = gT/2pi; L = gT^2/2pi; P = 1025 g h (kPa, gauge) or ++ 101.325 (absolute); depth = v t / 2 (1500 m/s unless given). No must-decline items in v1 (the organ has no in-domain +declines); off-domain distractors must NOT be taken. Dev / held-out differ in seed and phrasing. +usage: ocean_panel_v1.py """ +import collections +import json +import math +import random +import sys + +G = 9.81 +T = {"dev": {"tsp": "How fast does a tsunami travel in water {d} m deep?", + "ttime": "How long does a tsunami take to travel {D} km across ocean {d} m deep, in hours?", + "dsp": "What is the speed of a deep-water wave with a period of {T} s?", + "dwl": "What is the wavelength of a deep-water wave with a period of {T} s?", + "pg": "What is the water pressure in the ocean at a depth of {h} m?", + "pa": "What is the absolute pressure at {h} m deep in seawater?", + "sonar": "A sonar ping returns after {t} s. How deep is the sea floor?", + "sonarv": "An echo sounder ping comes back in {t} s with sound traveling at {v} m/s. What is the depth?"}, + "heldout": {"tsp": "Tsunami speed over an ocean depth of {d} m?", + "ttime": "A tsunami must cross {D} km of ocean averaging {d} m deep. Travel time in hours?", + "dsp": "Deep-water swell has a {T}-second period. How fast does it move?", + "dwl": "Find the deep-water wavelength for waves with period {T} s.", + "pg": "A diver is {h} m below the sea surface. What water pressure acts on them?", + "pa": "Total pressure including the atmosphere on a submarine at {h} m depth?", + "sonar": "Sonar echo: the pulse returns {t} seconds later. What is the water depth?", + "sonarv": "Using a sound speed of {v} m/s, an echo returns after {t} s. How deep is the ocean there?"}} +OFF = {"dev": ["How deep is the Mariana Trench?", "What causes tsunamis?"], + "heldout": ["Why is the ocean salty?", "How long is the coastline of Norway?"]} + + +def main(): + items = [] + for split, seed in (("dev", 21), ("heldout", 2121)): + rng = random.Random(seed) + t = T[split] + add = [] + for d in rng.sample([4000, 1000, 50, 200, 5000], 3): + add.append(("tsp", {"d": d}, math.sqrt(G * d))) + for D, d in rng.sample([(1000, 4000), (5000, 4500), (300, 100), (2000, 3000)], 3): + add.append(("ttime", {"D": format(D, ","), "d": d}, D * 1000 / math.sqrt(G * d) / 3600)) + for T_ in rng.sample([6, 8, 10, 12, 15], 3): + add.append(("dsp", {"T": T_}, G * T_ / (2 * math.pi))) + for T_ in rng.sample([6, 8, 10, 12, 15], 3): + add.append(("dwl", {"T": T_}, G * T_ ** 2 / (2 * math.pi))) + for h in rng.sample([10, 30, 100, 1000], 3): + add.append(("pg", {"h": h}, 1025 * G * h / 1000)) + for h in rng.sample([10, 50, 300], 2): + add.append(("pa", {"h": h}, (1025 * G * h + 101325) / 1000)) + for tt in rng.sample([2, 4, 0.8, 6.4], 2): + add.append(("sonar", {"t": tt}, 1500 * tt / 2)) + for tt, v in rng.sample([(2, 1480), (5, 1520), (1.2, 1500)], 2): + add.append(("sonarv", {"t": tt, "v": v}, v * tt / 2)) + for kind, kw, exp in add: + items.append({"split": split, "kind": kind, "valid": True, "q": t[kind].format(**kw), "expect": exp}) + for q in OFF[split]: + items.append({"split": split, "kind": "off", "valid": False, "q": q, "expect": "not taken"}) + json.dump(items, open(sys.argv[1], "w"), indent=1) + print("panel:", dict(collections.Counter(i["split"] for i in items))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/ocean/ocean_scorer.py b/root/specialists/ocean/ocean_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..51c6cbc6332f91885b90b87c16e24f61321aee98 --- /dev/null +++ b/root/specialists/ocean/ocean_scorer.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +"""ocean_scorer - the first number after "is" in the REPLY TEXT must be within 0.5% of the panel's relation (m/s, +hours, m, kPa). Off-domain items (valid False) must not be answered by the organ - answering one is a false yes. +(ok, asserted).""" +import re + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + m = re.search(r"\bis\s+(?:about\s+)?(-?[\d,]*\.?\d+)", text) + if not m: + return False, True + got, e = float(m.group(1).replace(",", "")), float(p["expect"]) + return abs(got - e) <= max(0.005 * abs(e), 0.005), True diff --git a/root/specialists/ocean/organ_ocean_v1.py b/root/specialists/ocean/organ_ocean_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..5fa03bfb701c55656b0bdbb1aa42a8db26582d25 --- /dev/null +++ b/root/specialists/ocean/organ_ocean_v1.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python3 +"""organ_ocean_v1 - physical-oceanography arithmetic (NOAA ocean-science relations), stated in every answer: +- shallow-water wave speed c = sqrt(g d) (tsunamis are shallow-water waves everywhere in the ocean); tsunami travel + time = distance / sqrt(g d); +- deep-water waves: speed c = g T / (2 pi), wavelength L = g T^2 / (2 pi), from the period T; +- pressure at depth: gauge P = rho g h (seawater 1,025 kg/m3 unless given); absolute adds 101.325 kPa; +- echo sounding: depth = v t / 2 (sound speed in seawater 1,500 m/s unless given) for a round-trip time t. +g = 9.81 m/s2. Declines: negative depth or time. Narrowed from the start (narrow_v1). Returns {kind, status, response, value}.""" +from __future__ import annotations + +import math +import re + +from narrow_v1 import narrative, short_direct + +N = r"(\d+(?:,\d{3})*(?:\.\d+)?)" +G = 9.81 + + +def num(s): + return float(s.replace(",", "")) + + +def g(x): + return ("%.3f" % x).rstrip("0").rstrip(".") if abs(x) < 1e5 else format(round(x), ",") + + +def metres(v, u): + u = (u or "m").lower() + return v * 1000 if u.startswith("k") else v + + +class OceanOrgan: + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def answer(self, text, session_id="default"): + if narrative(text): + return None + return self._answer(text) + + def _answer(self, text): + t = " ".join(str(text or "").split()) + low = t.lower() + depth = re.search(r"\b(?:depth|deep)\s*(?:of|is|=)?\s*" + N + r"\s*(km|m|meters?|metres?)\b|" + N + r"\s*(km|m|meters?|metres?)\s*(?:deep|depth|of water|below|down|beneath)\b|\bat\s+" + N + r"\s*(km|m|meters?|metres?)\b", low) + dval = None + if depth: + gs = depth.groups() + v, u = next((gs[i], gs[i + 1]) for i in (0, 2, 4) if gs[i]) + dval = metres(num(v), u) + # --- echo sounding + if re.search(r"\becho\b|\bsonar\b|\bping\b|\bsound(?:ing)?\b.*\b(?:return|back|echo)\w*\b", low) and re.search(r"\bdepth\b|\bhow deep\b|\bdeep\b", low): + tm = re.search(N + r"\s*(s|sec\w*|seconds?|ms|milliseconds?)\b", low) + if not tm: + return None + tt = num(tm.group(1)) / (1000 if tm.group(2).startswith("m") else 1) + vm = re.search(r"\b(?:speed of sound|sound speed|sound travels at)\s*(?:of|is|=|at)?\s*" + N + r"\s*m\s*/\s*s|" + N + r"\s*m\s*/\s*s", low) + v = num(vm.group(1) or vm.group(2)) if vm else 1500.0 + d = v * tt / 2 + return self._say("sonar_depth", "The depth is %s m (%s m/s × %s s ÷ 2 for the round trip%s)." % (g(d), g(v), g(tt), "" if vm else "; 1,500 m/s typical seawater"), d) + # --- pressure at depth + if re.search(r"\bpressure\b", low) and dval is not None and re.search(r"\bsea\b|\bocean\b|\bseawater\b|\bwater\b|\bdiver\b|\bsubmarine\b|\bunderwater\b", low): + rm = re.search(r"\bdensity\s*(?:of|is|=)?\s*" + N + r"\s*kg", low) + rho = num(rm.group(1)) if rm else (1000.0 if re.search(r"\bfresh ?water\b|\blake\b", low) else 1025.0) + p = rho * G * dval + if re.search(r"\babsolute\b|\btotal pressure\b|\bincluding (?:the )?atmospher\w*\b", low): + pa = p + 101325 + return self._say("pressure_abs", "The absolute pressure is %s kPa (ρ g h + 101.325 kPa = %s × 9.81 × %s m + 1 atm)." % (g(pa / 1000), g(rho), g(dval)), pa / 1000) + return self._say("pressure", "The gauge pressure is %s kPa (ρ g h = %s kg/m³ × 9.81 × %s m; add 101.325 kPa for absolute)." % (g(p / 1000), g(rho), g(dval)), p / 1000) + # --- tsunami / shallow-water speed and travel time + if re.search(r"\btsunami\b|\bshallow[- ]water wave\b|\bshallow water\b", low) and dval is not None: + c = math.sqrt(G * dval) + dist = re.search(r"\b(?:travel|cross|reach|cover|distance of|away|across)\w*\s*(?:\w+\s+){0,3}?" + N + r"\s*(km|kilomet\w+)\b|" + N + r"\s*(km|kilomet\w+)\s*(?:away|across|to\b|distant)", low) + if dist and re.search(r"\bhow long\b|\btime\b|\bhours?\b|\bminutes?\b", low): + D = num(dist.group(1) or dist.group(3)) * 1000 + h = D / c / 3600 + return self._say("tsunami_time", "The travel time is %s hours (%s km ÷ %s m/s, c = √(g d) = √(9.81 × %s m))." % (g(h), g(D / 1000), g(c), g(dval)), h) + if re.search(r"\bspeed\b|\bhow fast\b|\bvelocity\b", low): + return self._say("shallow_speed", "The wave speed is %s m/s (%s km/h; c = √(g d) = √(9.81 × %s m), shallow-water wave)." % (g(c), g(c * 3.6), g(dval)), c) + # --- deep-water waves from period + tp = re.search(r"\bperiod\s*(?:of|is|=)?\s*" + N + r"\s*(?:s|sec\w*)\b|" + N + r"[- ]?(?:s|sec\w*|second)\s*(?:wave )?period\b", low) + if tp and re.search(r"\bdeep[- ]water\b|\bdeep ocean\b|\bopen ocean\b", low): + T_ = num(tp.group(1) or tp.group(2)) + if re.search(r"\bwavelength\b|\bhow long\b.*\bwave\b", low): + L = G * T_ ** 2 / (2 * math.pi) + return self._say("deep_wavelength", "The wavelength is %s m (L = g T² / 2π = 9.81 × %s² / 2π; deep water)." % (g(L), g(T_)), L) + if re.search(r"\bspeed\b|\bhow fast\b|\bvelocity\b|\bcelerity\b", low): + c = G * T_ / (2 * math.pi) + return self._say("deep_speed", "The wave speed is %s m/s (c = g T / 2π = 9.81 × %s / 2π; deep water)." % (g(c), g(T_)), c) + return None diff --git a/root/specialists/ocean/verdict_dev.json b/root/specialists/ocean/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..1c031a1ec08af9dd929c3dadf8b77a3fbf5fcc4d --- /dev/null +++ b/root/specialists/ocean/verdict_dev.json @@ -0,0 +1,126 @@ +{ + "id": "ocean", + "name": "Oracle7 Oceanography", + "tier": "B", + "split": "dev", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T09:00:57Z", + "domain": { + "head": { + "correct": 0, + "false_yes": 2, + "wrong": 11, + "n": 23, + "p50_ms": 50.13, + "fails": [ + [ + "tsp", + "How fast does a tsunami travel in water 1000 m deep?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "tsp", + "How fast does a tsunami travel in water 200 m deep?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "tsp", + "How fast does a tsunami travel in water 50 m deep?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "ttime", + "How long does a tsunami take to travel 2,000 km across ocean 3000 m de", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "ttime", + "How long does a tsunami take to travel 300 km across ocean 100 m deep,", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "ttime", + "How long does a tsunami take to travel 5,000 km across ocean 4500 m de", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "dsp", + "What is the speed of a deep-water wave with a period of 12 s?", + "organ:math>evaluate", + "[ev:derived] 12*s. In steps: read 12*s; then simplify. Checked: equivalent to the input at" + ], + [ + "dsp", + "What is the speed of a deep-water wave with a period of 8 s?", + "organ:math>evaluate", + "[ev:derived] 8*s. In steps: read 8*s; then simplify. Checked: equivalent to the input at r" + ] + ] + }, + "spec": { + "correct": 21, + "false_yes": 2, + "wrong": 0, + "n": 23, + "p50_ms": 0.03, + "fails": [ + [ + "off", + "How deep is the Mariana Trench?", + "compose:bridge", + "[ev:derived] The Challenger Deep is the deepest known point of the seabed of Earth, locate" + ], + [ + "off", + "What causes tsunamis?", + "capability:what_causes", + "[ev:direct] According to Tsunami, A tsunami (from Japanese, meaning \u201charbor wave\u201d ) is a n" + ] + ] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/ocean/verdict_heldout.json b/root/specialists/ocean/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..5c2d55bf0d55a2553c1c96ad33f1baae1385cdf8 --- /dev/null +++ b/root/specialists/ocean/verdict_heldout.json @@ -0,0 +1,113 @@ +{ + "id": "ocean", + "name": "Oracle7 Oceanography", + "tier": "B", + "split": "heldout", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T09:04:51Z", + "domain": { + "head": { + "correct": 2, + "false_yes": 0, + "wrong": 0, + "n": 23, + "p50_ms": 141.76, + "fails": [ + [ + "tsp", + "Tsunami speed over an ocean depth of 1000 m?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "tsp", + "Tsunami speed over an ocean depth of 4000 m?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "tsp", + "Tsunami speed over an ocean depth of 5000 m?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "ttime", + "A tsunami must cross 2,000 km of ocean averaging 3000 m deep. Travel t", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "ttime", + "A tsunami must cross 300 km of ocean averaging 100 m deep. Travel time", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "ttime", + "A tsunami must cross 1,000 km of ocean averaging 4000 m deep. Travel t", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "dsp", + "Deep-water swell has a 10-second period. How fast does it move?", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ], + [ + "dsp", + "Deep-water swell has a 8-second period. How fast does it move?", + "act:clarify_specific", + "What does \"it\" refer to? Nothing earlier in this conversation names it. Tell me the name." + ] + ] + }, + "spec": { + "correct": 23, + "false_yes": 0, + "wrong": 0, + "n": 23, + "p50_ms": 0.03, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/printing/manifest.json b/root/specialists/printing/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..4bc294ed87e7bdaf319aa566291d2bbad9bfe23a --- /dev/null +++ b/root/specialists/printing/manifest.json @@ -0,0 +1,22 @@ +{ + "id": "printing", + "name": "Oracle7 Workshop & 3D Printing", + "number": 8, + "tier": "B", + "sources": [ + {"name": "Cylinder volume and mass (geometry), typical polymer densities (PLA 1.24, PETG 1.27, ABS 1.04, ASA 1.07, TPU 1.21, nylon 1.14 g/cm^3) as published on manufacturer technical data sheets - stated as typical in every answer", "licence": "facts", "url": "https://reprap.org/wiki/Filament"} + ], + "store": {"path": "__ORACLE7_ROOT__/specialists/printing/organ_printing_v1.py"}, + "organ": {"dir": "__ORACLE7_ROOT__/specialists/printing", "module": "organ_printing_v1", "class": "PrintingOrgan", "init": {}}, + "accept": { + "kinds": ["shrink_scale", "layers", "flow", "cost", "length", "mass"], + "declines_in_domain": ["underspecified", "impossible"], + "context_regex": "\\b(?:3d[- ]?print\\w*|filament|print(?:er|ing)?|layer height|nozzle|shrink\\w*|pla|petg|abs)\\b" + }, + "panel": {"path": "__ORACLE7_ROOT__/specialists/printing/printing_panel_v1.json", "splits": ["dev", "heldout"], + "exclude_kinds_composed": [], "scorer_module": "printing_scorer", "scorer_fn": "ok"}, + "routing_cues": ["filament length", "filament weight", "print cost", "layer count", "volumetric flow", "shrinkage"], + "budgets": {"latency_p50_ms": 50, "store_mb": 1}, + "core_sample": {"n": 400, "seed": 20260928}, + "notes": "Densities are typical values, named in each answer; a given density overrides; unknown materials must state one. Dev fix before held-out: the diameter reader required 'N mm filament' adjacency ('2.85 mm PLA filament' was missed). Narrowed from the start (narrow_v1)." +} diff --git a/root/specialists/printing/narrow_v1.py b/root/specialists/printing/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/printing/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/printing/organ_printing_v1.py b/root/specialists/printing/organ_printing_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..b3037139a27829e124758cc2a3db3931bd38fa59 --- /dev/null +++ b/root/specialists/printing/organ_printing_v1.py @@ -0,0 +1,124 @@ +#!/usr/bin/env python3 +"""organ_printing_v1 - 3D-printing and workshop arithmetic, formula and assumption stated every time: +- filament length <-> mass: m = rho x pi (d/2)^2 x L (typical densities, named in the answer: PLA 1.24, PETG 1.27, + ABS 1.04, ASA 1.07, TPU 1.21, nylon 1.14 g/cm^3 - a given density overrides; other materials must state one); +- material cost = grams x price per kg / 1000; +- layer count = part height / layer height (rounded up); +- volumetric flow = layer height x line width x print speed (mm^3/s); +- shrinkage compensation: scale = 1 / (1 - shrink). +Returns {kind, status, response, value}.""" +from __future__ import annotations + +import math +import re + +from narrow_v1 import narrative, short_direct + +RHO = {"pla": 1.24, "petg": 1.27, "abs": 1.04, "asa": 1.07, "tpu": 1.21, "nylon": 1.14} +N = r"(\d+(?:,\d{3})*(?:\.\d+)?)" + + +def num(s): + return float(s.replace(",", "")) + + +def g(x): + return "%.4g" % x if abs(x) < 1e4 else format(round(x), ",") + + +class PrintingOrgan: + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def _need(self, what): + return self._say("underspecified", "I need %s to work that out; I won't assume it." % what, status="withheld") + + def answer(self, text, session_id="default"): + if narrative(text): + return None + r = self._answer(text, session_id) + if r and r.get("status") != "answered" and not short_direct(text): + return None + return r + + def _answer(self, text, session_id="default"): + t = " ".join(str(text or "").split()) + low = t.lower() + if not re.search(r"\b3d[- ]?print\w*\b|\bfilament\b|\bprint(?:er|ing)?\b|\blayer height\b|\bnozzle\b|\bshrink\w*\b|\bpla\b|\bpetg\b|\babs\b", low): + return None + mat = next((k for k in RHO if re.search(r"\b%s\b" % k, low)), None) + dm = re.search(r"\bdensity\s*(?:of|is|=)?\s*" + N, low) + rho = num(dm.group(1)) if dm else (RHO[mat] if mat else None) + rho_note = ("given density %s g/cm³" % g(rho)) if dm else ("typical %s density %s g/cm³" % (mat.upper() if mat != "nylon" else "nylon", g(rho)) if mat else "") + # filament diameter: "1.75 mm PLA filament", "diameter 2.85 mm" - the first N mm in the filament range + d_mm = None + if re.search(r"\bfilament\b|\bdiameter\b|\bspool\b", low): + for m in re.finditer(N + r"\s*mm\b(?!\s*(?:/s|layer|tall|high|line|extrusion))", low): + if 1.5 <= num(m.group(1)) <= 3.2: + d_mm = num(m.group(1)) + break + # shrinkage compensation + if re.search(r"\bshrink\w*\b", low) and re.search(r"\bscale\b|\bcompensat\w*\b|\bhow much (?:bigger|larger)\b", low): + sm = re.search(N + r"\s*%", low) + if not sm: + return self._need("the shrinkage percentage") + s = num(sm.group(1)) / 100 + if not 0 <= s < 1: + return self._say("impossible", "Shrinkage must be between 0 and 100%.", status="withheld") + f = 1 / (1 - s) + return self._say("shrink_scale", "The scale factor is %s (%s%%: 1 / (1 − %s)), i.e. model it %s%% larger." % (g(f), g(100 * s), g(s), g(100 * (f - 1))), f) + # layer count + if re.search(r"\bhow many layers\b|\blayer count\b|\bnumber of layers\b", low): + hm = re.search(N + r"\s*mm\s*(?:tall|high)|\b(?:height|tall|high)\s*(?:of|is)?\s*" + N + r"\s*mm", low) + lm = re.search(N + r"\s*mm\s*layer(?:s| height)?|\blayer height\s*(?:of|is)?\s*" + N + r"\s*mm", low) + if not hm or not lm: + return self._need("the part height and the layer height") + H, L = num(hm.group(1) or hm.group(2)), num(lm.group(1) or lm.group(2)) + if L <= 0: + return self._say("impossible", "A layer height must be positive.", status="withheld") + n = math.ceil(H / L - 1e-9) + return self._say("layers", "That is %d layers (%s mm ÷ %s mm, rounded up)." % (n, g(H), g(L)), n) + # volumetric flow + if re.search(r"\bvolumetric\b|\bflow rate\b|\bmm3/s\b|\bmm³/s\b", low): + lh = re.search(r"\blayer height\s*(?:of|is)?\s*" + N + r"|" + N + r"\s*mm\s*layer", low) + lw = re.search(r"\b(?:line|extrusion) width\s*(?:of|is)?\s*" + N + r"|" + N + r"\s*mm\s*(?:line|extrusion) width", low) + sp = re.search(N + r"\s*mm/s\b", low) + if not (lh and lw and sp): + return self._need("the layer height, the line width and the print speed") + q = num(lh.group(1) or lh.group(2)) * num(lw.group(1) or lw.group(2)) * num(sp.group(1)) + return self._say("flow", "The volumetric flow is %s mm³/s (layer height × line width × speed)." % g(q), q) + # cost + grams = re.search(N + r"\s*(?:g|grams?)\b(?!/)", low) + price = re.search(r"\$\s*" + N + r"\s*(?:per|/|a)\s*(kg|kilogram|spool)", low) + if price and grams and re.search(r"\bcost\b|\bhow much\b|\bprice\b", low): + if price.group(2) == "spool": + sw = re.search(N + r"\s*(kg|g)\s*spool", low) + if not sw: + return self._need("the spool's weight") + per_kg = num(price.group(1)) / (num(sw.group(1)) / (1 if sw.group(2) == "kg" else 1000)) + else: + per_kg = num(price.group(1)) + c = num(grams.group(1)) * per_kg / 1000 + return self._say("cost", "The material cost is $%.2f (%s g at $%s/kg)." % (c, g(num(grams.group(1))), g(per_kg)), c) + # length <-> mass + lm = re.search(N + r"\s*(m|meters?|metres?)\s*of\b|\b" + N + r"\s*(m|meters?|metres?)\b(?!\s*/)", low) + km = re.search(N + r"\s*(kg|g|grams?|kilograms?)\b(?!/)", low) + if re.search(r"\bhow (?:long|many meters|many metres|much length)\b|\blength\b", low) and km and not re.search(r"\bweigh|\bmass\b|\bhow (?:much|many grams)\b(?! length)", low.replace(km.group(0), "")): + if d_mm is None: + return self._need("the filament diameter") + if rho is None: + return self._need("the material (or its density)") + m_g = num(km.group(1)) * (1000 if km.group(2).startswith("k") else 1) + area = math.pi * (d_mm / 20) ** 2 + L = m_g / (rho * area) / 100 + return self._say("length", "That is about %s m of filament (%s g ÷ (%s × π(%s mm/2)²); %s)." % (g(L), g(m_g), g(rho), g(d_mm), rho_note), L) + if lm and re.search(r"\bweigh|\bmass\b|\bhow (?:much|many grams)\b", low): + if d_mm is None: + return self._need("the filament diameter") + if rho is None: + return self._need("the material (or its density)") + L_m = num(lm.group(1) or lm.group(3)) + area = math.pi * (d_mm / 20) ** 2 + m_g = rho * area * L_m * 100 + return self._say("mass", "That is about %s g of filament (%s m × π(%s mm/2)² × %s; %s)." % (g(m_g), g(L_m), g(d_mm), g(rho), rho_note), m_g) + return None diff --git a/root/specialists/printing/printing_panel_v1.json b/root/specialists/printing/printing_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..79a9946eac9e061f5a70c93f8f6c1fbb69801ea8 --- /dev/null +++ b/root/specialists/printing/printing_panel_v1.json @@ -0,0 +1,527 @@ +[ + { + "split": "dev", + "kind": "len", + "valid": true, + "q": "How long is 1 kg of 2.85 mm PLA filament?", + "expect": 126.415030404905 + }, + { + "split": "dev", + "kind": "mass", + "valid": true, + "q": "How much does 50 m of 2.85 mm PLA filament weigh?", + "expect": 395.522588096138 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "How much does a 45 g print cost with filament at $18 per kg?", + "expect": 0.81 + }, + { + "split": "dev", + "kind": "layers", + "valid": true, + "q": "How many layers is a 20 mm tall print at a 0.12 mm layer height?", + "expect": 167 + }, + { + "split": "dev", + "kind": "flow", + "valid": true, + "q": "What is the volumetric flow rate at a layer height of 0.2 mm, a line width of 0.6 mm and 60 mm/s?", + "expect": 7.199999999999999 + }, + { + "split": "dev", + "kind": "shrink", + "valid": true, + "q": "My print material shrinks 3%. What scale factor compensates for the shrinkage?", + "expect": 1.0309278350515465 + }, + { + "split": "dev", + "kind": "len", + "valid": true, + "q": "How long is 1 kg of 1.75 mm ABS filament?", + "expect": 399.76123853537297 + }, + { + "split": "dev", + "kind": "mass", + "valid": true, + "q": "How much does 330 m of 1.75 mm ABS filament weigh?", + "expect": 825.492739638888 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "How much does a 600 g print cost with filament at $35 per kg?", + "expect": 21.0 + }, + { + "split": "dev", + "kind": "layers", + "valid": true, + "q": "How many layers is a 180 mm tall print at a 0.12 mm layer height?", + "expect": 1500 + }, + { + "split": "dev", + "kind": "flow", + "valid": true, + "q": "What is the volumetric flow rate at a layer height of 0.28 mm, a line width of 0.4 mm and 150 mm/s?", + "expect": 16.8 + }, + { + "split": "dev", + "kind": "shrink", + "valid": true, + "q": "My print material shrinks 1.5%. What scale factor compensates for the shrinkage?", + "expect": 1.015228426395939 + }, + { + "split": "dev", + "kind": "len", + "valid": true, + "q": "How long is 2.5 kg of 2.85 mm PLA filament?", + "expect": 316.0375760122625 + }, + { + "split": "dev", + "kind": "mass", + "valid": true, + "q": "How much does 330 m of 2.85 mm PLA filament weigh?", + "expect": 2610.449081434511 + }, + { + "split": "dev", + "kind": "layers", + "valid": true, + "q": "How many layers is a 20 mm tall print at a 0.2 mm layer height?", + "expect": 100 + }, + { + "split": "dev", + "kind": "flow", + "valid": true, + "q": "What is the volumetric flow rate at a layer height of 0.2 mm, a line width of 0.4 mm and 150 mm/s?", + "expect": 12.000000000000002 + }, + { + "split": "dev", + "kind": "len", + "valid": true, + "q": "How long is 1 kg of 1.75 mm PLA filament?", + "expect": 335.2836194167644 + }, + { + "split": "dev", + "kind": "mass", + "valid": true, + "q": "How much does 50 m of 1.75 mm PLA filament weigh?", + "expect": 149.12747627509046 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "How much does a 12 g print cost with filament at $35 per kg?", + "expect": 0.42 + }, + { + "split": "dev", + "kind": "layers", + "valid": true, + "q": "How many layers is a 47.5 mm tall print at a 0.12 mm layer height?", + "expect": 396 + }, + { + "split": "dev", + "kind": "flow", + "valid": true, + "q": "What is the volumetric flow rate at a layer height of 0.2 mm, a line width of 0.6 mm and 40 mm/s?", + "expect": 4.8 + }, + { + "split": "dev", + "kind": "len", + "valid": true, + "q": "How long is 0.5 kg of 1.75 mm ABS filament?", + "expect": 199.88061926768648 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "How much does a 600 g print cost with filament at $25 per kg?", + "expect": 15.0 + }, + { + "split": "dev", + "kind": "layers", + "valid": true, + "q": "How many layers is a 100 mm tall print at a 0.28 mm layer height?", + "expect": 358 + }, + { + "split": "dev", + "kind": "flow", + "valid": true, + "q": "What is the volumetric flow rate at a layer height of 0.2 mm, a line width of 0.4 mm and 40 mm/s?", + "expect": 3.2000000000000006 + }, + { + "split": "dev", + "kind": "shrink", + "valid": true, + "q": "My print material shrinks 2%. What scale factor compensates for the shrinkage?", + "expect": 1.0204081632653061 + }, + { + "split": "dev", + "kind": "len", + "valid": true, + "q": "How long is 2.5 kg of 2.85 mm ABS filament?", + "expect": 376.81403293769756 + }, + { + "split": "dev", + "kind": "mass", + "valid": true, + "q": "How much does 330 m of 2.85 mm ABS filament weigh?", + "expect": 2189.4089070095897 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "How much does a 45 g print cost with filament at $25 per kg?", + "expect": 1.125 + }, + { + "split": "dev", + "kind": "layers", + "valid": true, + "q": "How many layers is a 47.5 mm tall print at a 0.2 mm layer height?", + "expect": 238 + }, + { + "split": "dev", + "kind": "flow", + "valid": true, + "q": "What is the volumetric flow rate at a layer height of 0.28 mm, a line width of 0.6 mm and 40 mm/s?", + "expect": 6.720000000000001 + }, + { + "split": "dev", + "kind": "len", + "valid": true, + "q": "How long is 0.5 kg of 1.75 mm PETG filament?", + "expect": 163.68176695936532 + }, + { + "split": "dev", + "kind": "mass", + "valid": true, + "q": "How much does 120 m of 1.75 mm PETG filament weigh?", + "expect": 366.564957811674 + }, + { + "split": "dev", + "kind": "cost", + "valid": true, + "q": "How much does a 180 g print cost with filament at $22 per kg?", + "expect": 3.96 + }, + { + "split": "dev", + "kind": "layers", + "valid": true, + "q": "How many layers is a 100 mm tall print at a 0.1 mm layer height?", + "expect": 1000 + }, + { + "split": "dev", + "kind": "flow", + "valid": true, + "q": "What is the volumetric flow rate at a layer height of 0.28 mm, a line width of 0.45 mm and 150 mm/s?", + "expect": 18.900000000000006 + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "How long is 1 kg of PLA filament?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "How long is 1 kg of 1.75 mm unobtainium filament?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "How many layers is a 50 mm tall print?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "len", + "valid": true, + "q": "What length of filament (m) is on a 2.5 kg spool of 1.75 mm ABS?", + "expect": 999.4030963384324 + }, + { + "split": "heldout", + "kind": "mass", + "valid": true, + "q": "What is the mass of 50 m of ABS filament, 1.75 mm diameter (how many grams)?", + "expect": 125.07465752104363 + }, + { + "split": "heldout", + "kind": "cost", + "valid": true, + "q": "Filament costs $35 per kg. What is the material cost of a 45 g part?", + "expect": 1.575 + }, + { + "split": "heldout", + "kind": "layers", + "valid": true, + "q": "A part 180 mm high is printed with 0.2 mm layers. What is the layer count?", + "expect": 900 + }, + { + "split": "heldout", + "kind": "flow", + "valid": true, + "q": "Calculate the volumetric flow for 100 mm/s with line width 0.6 mm and layer height 0.28 mm.", + "expect": 16.8 + }, + { + "split": "heldout", + "kind": "shrink", + "valid": true, + "q": "To compensate for 3% shrinkage, what scale should I apply?", + "expect": 1.0309278350515465 + }, + { + "split": "heldout", + "kind": "len", + "valid": true, + "q": "What length of filament (m) is on a 0.5 kg spool of 2.85 mm PLA?", + "expect": 63.2075152024525 + }, + { + "split": "heldout", + "kind": "mass", + "valid": true, + "q": "What is the mass of 330 m of PLA filament, 2.85 mm diameter (how many grams)?", + "expect": 2610.449081434511 + }, + { + "split": "heldout", + "kind": "cost", + "valid": true, + "q": "Filament costs $18 per kg. What is the material cost of a 12 g part?", + "expect": 0.216 + }, + { + "split": "heldout", + "kind": "layers", + "valid": true, + "q": "A part 20 mm high is printed with 0.12 mm layers. What is the layer count?", + "expect": 167 + }, + { + "split": "heldout", + "kind": "flow", + "valid": true, + "q": "Calculate the volumetric flow for 40 mm/s with line width 0.45 mm and layer height 0.2 mm.", + "expect": 3.6000000000000005 + }, + { + "split": "heldout", + "kind": "shrink", + "valid": true, + "q": "To compensate for 2% shrinkage, what scale should I apply?", + "expect": 1.0204081632653061 + }, + { + "split": "heldout", + "kind": "len", + "valid": true, + "q": "What length of filament (m) is on a 1 kg spool of 2.85 mm ABS?", + "expect": 150.72561317507905 + }, + { + "split": "heldout", + "kind": "mass", + "valid": true, + "q": "What is the mass of 330 m of ABS filament, 2.85 mm diameter (how many grams)?", + "expect": 2189.4089070095897 + }, + { + "split": "heldout", + "kind": "cost", + "valid": true, + "q": "Filament costs $25 per kg. What is the material cost of a 600 g part?", + "expect": 15.0 + }, + { + "split": "heldout", + "kind": "layers", + "valid": true, + "q": "A part 20 mm high is printed with 0.1 mm layers. What is the layer count?", + "expect": 200 + }, + { + "split": "heldout", + "kind": "flow", + "valid": true, + "q": "Calculate the volumetric flow for 60 mm/s with line width 0.45 mm and layer height 0.2 mm.", + "expect": 5.4 + }, + { + "split": "heldout", + "kind": "len", + "valid": true, + "q": "What length of filament (m) is on a 2.5 kg spool of 2.85 mm PETG?", + "expect": 308.57212146079166 + }, + { + "split": "heldout", + "kind": "mass", + "valid": true, + "q": "What is the mass of 330 m of PETG filament, 2.85 mm diameter (how many grams)?", + "expect": 2673.605107598249 + }, + { + "split": "heldout", + "kind": "cost", + "valid": true, + "q": "Filament costs $25 per kg. What is the material cost of a 45 g part?", + "expect": 1.125 + }, + { + "split": "heldout", + "kind": "flow", + "valid": true, + "q": "Calculate the volumetric flow for 100 mm/s with line width 0.4 mm and layer height 0.2 mm.", + "expect": 8.000000000000002 + }, + { + "split": "heldout", + "kind": "len", + "valid": true, + "q": "What length of filament (m) is on a 1 kg spool of 2.85 mm PLA?", + "expect": 126.415030404905 + }, + { + "split": "heldout", + "kind": "mass", + "valid": true, + "q": "What is the mass of 10 m of PLA filament, 2.85 mm diameter (how many grams)?", + "expect": 79.1045176192276 + }, + { + "split": "heldout", + "kind": "layers", + "valid": true, + "q": "A part 100 mm high is printed with 0.2 mm layers. What is the layer count?", + "expect": 500 + }, + { + "split": "heldout", + "kind": "flow", + "valid": true, + "q": "Calculate the volumetric flow for 150 mm/s with line width 0.4 mm and layer height 0.2 mm.", + "expect": 12.000000000000002 + }, + { + "split": "heldout", + "kind": "len", + "valid": true, + "q": "What length of filament (m) is on a 0.5 kg spool of 2.85 mm ABS?", + "expect": 75.36280658753952 + }, + { + "split": "heldout", + "kind": "cost", + "valid": true, + "q": "Filament costs $18 per kg. What is the material cost of a 180 g part?", + "expect": 3.24 + }, + { + "split": "heldout", + "kind": "layers", + "valid": true, + "q": "A part 180 mm high is printed with 0.12 mm layers. What is the layer count?", + "expect": 1500 + }, + { + "split": "heldout", + "kind": "flow", + "valid": true, + "q": "Calculate the volumetric flow for 60 mm/s with line width 0.6 mm and layer height 0.2 mm.", + "expect": 7.199999999999999 + }, + { + "split": "heldout", + "kind": "len", + "valid": true, + "q": "What length of filament (m) is on a 2.5 kg spool of 1.75 mm PLA?", + "expect": 838.209048541911 + }, + { + "split": "heldout", + "kind": "mass", + "valid": true, + "q": "What is the mass of 50 m of PLA filament, 1.75 mm diameter (how many grams)?", + "expect": 149.12747627509046 + }, + { + "split": "heldout", + "kind": "layers", + "valid": true, + "q": "A part 47.5 mm high is printed with 0.1 mm layers. What is the layer count?", + "expect": 475 + }, + { + "split": "heldout", + "kind": "flow", + "valid": true, + "q": "Calculate the volumetric flow for 40 mm/s with line width 0.45 mm and layer height 0.28 mm.", + "expect": 5.040000000000001 + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "What length of filament is on a 1 kg spool of 2.85 mm mystery-mix?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "What is the mass of 100 m of PETG filament?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "A part 30 mm high is printed. What is the layer count?", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/printing/printing_scorer.py b/root/specialists/printing/printing_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..72ceb387c147b592a0fc6a5f0f5ebc6bf4b31b7f --- /dev/null +++ b/root/specialists/printing/printing_scorer.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +"""printing_scorer - the first result number in the REPLY TEXT (after "is", "is about", "takes") must be +within 0.3% (or one cent) of the panel's formula. A must-decline item answered is a false yes. (ok, asserted).""" +import re + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + m = re.search(r"\b(?:is about|is|takes)\s+\$?([\d,]+(?:\.\d+)?)", text) + if not m: + return False, True + got, want = float(m.group(1).replace(",", "")), float(p["expect"]) + return abs(got - want) <= max(0.003 * abs(want), 0.01), True diff --git a/root/specialists/printing/verdict_dev.json b/root/specialists/printing/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..9db3867d3163f5c745627d6030eeaabd89eb231b --- /dev/null +++ b/root/specialists/printing/verdict_dev.json @@ -0,0 +1,111 @@ +{ + "id": "printing", + "name": "Oracle7 Workshop & 3D Printing", + "tier": "B", + "split": "dev", + "head": "oracle_release_runtime_w363", + "time": "2026-09-29T03:32:06Z", + "domain": { + "head": { + "correct": 3, + "false_yes": 0, + "n": 39, + "p50_ms": 36.79, + "fails": [ + [ + "len", + "How long is 1 kg of 2.85 mm PLA filament?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mass", + "How much does 50 m of 2.85 mm PLA filament weigh?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "cost", + "How much does a 45 g print cost with filament at $18 per kg?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "layers", + "How many layers is a 20 mm tall print at a 0.12 mm layer height?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "flow", + "What is the volumetric flow rate at a layer height of 0.2 mm, a line w", + "organ:math>evaluate", + "[ev:derived] 60*m**2/s. In steps: read 60*m**2/s; then simplify. Checked: equivalent to th" + ], + [ + "shrink", + "My print material shrinks 3%. What scale factor compensates for the sh", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "len", + "How long is 1 kg of 1.75 mm ABS filament?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mass", + "How much does 330 m of 1.75 mm ABS filament weigh?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 39, + "false_yes": 0, + "n": 39, + "p50_ms": 0.04, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/printing/verdict_heldout.json b/root/specialists/printing/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..ef529c3e1eb1085be78e37d55054f08d0c68efed --- /dev/null +++ b/root/specialists/printing/verdict_heldout.json @@ -0,0 +1,148 @@ +{ + "id": "printing", + "name": "Oracle7 Workshop & 3D Printing", + "tier": "B", + "split": "heldout", + "head": "oracle_release_runtime_w363", + "time": "2026-09-29T03:36:06Z", + "domain": { + "head": { + "correct": 2, + "false_yes": 1, + "n": 36, + "p50_ms": 45.04, + "fails": [ + [ + "len", + "What length of filament (m) is on a 2.5 kg spool of 1.75 mm ABS?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mass", + "What is the mass of 50 m of ABS filament, 1.75 mm diameter (how many g", + "organ:math>evaluate", + "[ev:derived] 50*m. In steps: read 50*m; then simplify. Checked: equivalent to the input at" + ], + [ + "cost", + "Filament costs $35 per kg. What is the material cost of a 45 g part?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "layers", + "A part 180 mm high is printed with 0.2 mm layers. What is the layer co", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "flow", + "Calculate the volumetric flow for 100 mm/s with line width 0.6 mm and ", + "organ:math>evaluate", + "[ev:derived] 100*m**2/s. In steps: read 100*m**2/s; then simplify. Checked: equivalent to " + ], + [ + "shrink", + "To compensate for 3% shrinkage, what scale should I apply?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "len", + "What length of filament (m) is on a 0.5 kg spool of 2.85 mm PLA?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mass", + "What is the mass of 330 m of PLA filament, 2.85 mm diameter (how many ", + "organ:math>evaluate", + "[ev:derived] 330*m. In steps: read 330*m; then simplify. Checked: equivalent to the input " + ] + ] + }, + "spec": { + "correct": 30, + "false_yes": 0, + "n": 36, + "p50_ms": 0.08, + "fails": [ + [ + "layers", + "A part 180 mm high is printed with 0.2 mm layers. What is the layer co", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "layers", + "A part 20 mm high is printed with 0.12 mm layers. What is the layer co", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "layers", + "A part 20 mm high is printed with 0.1 mm layers. What is the layer cou", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "layers", + "A part 100 mm high is printed with 0.2 mm layers. What is the layer co", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "layers", + "A part 180 mm high is printed with 0.12 mm layers. What is the layer c", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "layers", + "A part 47.5 mm high is printed with 0.1 mm layers. What is the layer c", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/python/build_pyref_v1.py b/root/specialists/python/build_pyref_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..95190488a59efea10e59e675b4d4fab9baaf44e2 --- /dev/null +++ b/root/specialists/python/build_pyref_v1.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 +"""build_pyref_v1 - a Python reference store read by INTROSPECTION from the interpreter itself (PSF licence): for every +public function / method / class in a fixed set of standard-library modules and the builtins, its qualified name, +signature, first docstring line, and module. Exact by construction - the source is the running Python, stamped with its +version. usage: build_pyref_v1.py """ +import builtins +import importlib +import inspect +import json +import sys + +MODULES = ["builtins", "math", "statistics", "random", "string", "re", "json", "os", "os.path", "sys", "time", "datetime", + "collections", "itertools", "functools", "operator", "pathlib", "shutil", "csv", "hashlib", "base64", "textwrap", + "fractions", "decimal", "heapq", "bisect", "copy", "glob", "uuid", "urllib.parse", "zlib", "gzip", "sqlite3"] +TYPES = {"str": str, "list": list, "dict": dict, "set": set, "tuple": tuple, "int": int, "float": float, "bytes": bytes} + + +def entry(qual, obj, module): + try: + sig = str(inspect.signature(obj)) + except (TypeError, ValueError): + sig = None + doc = (inspect.getdoc(obj) or "").strip().split("\n")[0] + kind = "class" if inspect.isclass(obj) else "function" + return {"name": qual, "module": module, "kind": kind, "signature": sig, "doc": doc} + + +def main(): + out = {"python": sys.version.split()[0], "entries": {}} + for mname in MODULES: + mod = builtins if mname == "builtins" else importlib.import_module(mname) + for n in dir(mod): + if n.startswith("_"): + continue + obj = getattr(mod, n) + if not (inspect.isroutine(obj) or inspect.isclass(obj)): + continue + # only where it is DEFINED: statistics re-exports itertools.groupby, which made "groupby" look ambiguous + home = getattr(obj, "__module__", None) or mname + base = mname.split(".")[0] + if mname != "builtins" and not (home == mname or home.startswith(base) or home.startswith("_" + base) + or (mname == "os.path" and home in ("posixpath", "ntpath", "genericpath"))): + continue + qual = n if mname == "builtins" else "%s.%s" % (mname, n) + out["entries"][qual] = entry(qual, obj, mname) + for tname, typ in TYPES.items(): + for n in dir(typ): + if n.startswith("_"): + continue + obj = getattr(typ, n) + if inspect.isroutine(obj): + out["entries"]["%s.%s" % (tname, n)] = entry("%s.%s" % (tname, n), obj, "builtins") + json.dump(out, open(sys.argv[1], "w"), indent=0) + print("python %s: %d entries (%d with signatures)" % (out["python"], len(out["entries"]), + sum(1 for e in out["entries"].values() if e["signature"]))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/python/manifest.json b/root/specialists/python/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..1741d3ed4fb03be4991a16acb58e92fcfe0ef402 --- /dev/null +++ b/root/specialists/python/manifest.json @@ -0,0 +1,23 @@ +{ + "id": "python", + "name": "Oracle7 Python Reference", + "number": 51, + "tier": "A", + "sources": [ + {"name": "Python 3.12.3 standard library, read by introspection (signatures, modules, docstrings; 856 entries)", "licence": "PSF License", "url": "https://docs.python.org/3.12/"} + ], + "store": {"path": "__ORACLE7_ROOT__/specialists/python/pyref_v1.json"}, + "organ": {"dir": "__ORACLE7_ROOT__/specialists/python", "module": "organ_pyref_v1", "class": "PyRefOrgan", + "init": {"ref_path": "__ORACLE7_ROOT__/specialists/python/pyref_v1.json"}}, + "accept": { + "kinds": ["signature", "module", "doc"], + "declines_in_domain": ["unknown", "clarify", "no_signature"], + "context_regex": "\\b(?:python|stdlib|standard library|module|function|method)\\b" + }, + "panel": {"path": "__ORACLE7_ROOT__/specialists/python/pyref_panel_v1.json", "splits": ["dev", "heldout"], + "exclude_kinds_composed": [], "scorer_module": "pyref_scorer", "scorer_fn": "ok"}, + "routing_cues": ["python", "signature", "parameters of", "which module", "stdlib", "what does .* do"], + "budgets": {"latency_p50_ms": 50, "store_mb": 1}, + "core_sample": {"n": 400, "seed": 20260928}, + "notes": "The core's code organ WRITES programs (MBPP-graded); this specialist answers reference questions exactly, from the interpreter's own introspection, version-stamped. Answer keys read from the same introspection data (the source of truth). Held-out phrasings written by the same author, not used to tune the organ." +} diff --git a/root/specialists/python/organ_pyref_v1.py b/root/specialists/python/organ_pyref_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..c71b3cc8ee4b7028002437a0f408782251e75d31 --- /dev/null +++ b/root/specialists/python/organ_pyref_v1.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +"""organ_pyref_v1 - exact Python reference answers from the interpreter's own introspection (pyref_v1.json, Python +3.12): parameters / signature, what a function does (its own docstring line), which module provides it. Asks when a bare +name is ambiguous (split: str.split, re.split, os.path.split); declines a name the stdlib does not have. The core's +code organ WRITES programs; this organ answers reference questions it cannot. Returns {kind, status, response, value}.""" +from __future__ import annotations + +import json +import re + +SIG = re.compile(r"\b(?:parameters?|arguments?|args|signature|what does .* take|how (?:do i|to) call|call signature)\b", re.I) +DOES = re.compile(r"\bwhat does\b.*\b(?:do|return)\b|\bwhat is\b.*\b(?:for|used for)\b|\bexplain\b|\bdescribe\b", re.I) +MOD = re.compile(r"\bwhich module\b|\bwhat module\b|\bwhere (?:is|does)\b.*\b(?:defined|live|come from)\b|\bimport\b.*\bfrom\b", re.I) +PY = re.compile(r"\bpython\b|`|\bfunction\b|\bmethod\b|\bmodule\b|\bbuilt-?in\b|\bstdlib\b|\bstandard library\b|\w\.\w+|\(\)", re.I) + + +class PyRefOrgan: + def __init__(self, ref_path): + d = json.load(open(ref_path, encoding="utf-8")) + self.ver = d["python"] + self.e = d["entries"] + self.by_short = {} + for q in self.e: + self.by_short.setdefault(q.split(".")[-1], []).append(q) + self.modules = {q.rsplit(".", 1)[0] for q in self.e if "." in q} | {"math", "os", "sys", "re", "json"} + + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def _name(self, t): + """the Python name asked about: backticked, dotted, or a bare known short name""" + m = re.search(r"`([A-Za-z_][\w.]*)(?:\(\))?`", t) + cands = [m.group(1)] if m else [] + cands += re.findall(r"\b([A-Za-z_]\w*(?:\.[A-Za-z_]\w*)+)(?:\(\))?", t) + cands += re.findall(r"\b([A-Za-z_]\w*)\(\)", t) + cands += re.findall(r"\b(?:function|method|builtin|built-in)\s+`?([A-Za-z_]\w*)`?", t, re.I) + cands += re.findall(r"\b(?:of|does|is|for|provides)\s+`?([A-Za-z_][A-Za-z0-9_]*)`?\b", t) + for c in cands: + c = c.rstrip(".") + if c in self.e: + return c, None + if "." in c: + mod, _, attr = c.rpartition(".") + if mod in self.modules or mod in ("str", "list", "dict", "set", "tuple", "int", "float", "bytes"): + return None, c # a real module / type, but no such member + elif c in self.by_short and len(c) > 2: + opts = self.by_short[c] + if len(opts) == 1: + return opts[0], None + return ("?", opts), None + return None, None + + def answer(self, text, session_id="default"): + t = " ".join(str(text or "").split()) + if not t or not (SIG.search(t) or DOES.search(t) or MOD.search(t)) or not PY.search(t): + return None + name, missing = self._name(t) + if missing: + mod, _, attr = missing.rpartition(".") + return self._say("unknown", "Python %s's %s has no %s, so I can't describe it." % (self.ver, mod, attr), status="withheld") + if not name: + return None + if isinstance(name, tuple): + return self._say("clarify", "Several standard-library names match: %s. Which one do you mean?" % ", ".join(sorted(name[1])[:5]), status="clarify") + e = self.e[name] + call = "%s%s" % (name, e["signature"]) if e["signature"] else name + if MOD.search(t): + return self._say("module", "%s is in the %s module (Python %s)." % (name, e["module"], self.ver), e["module"]) + if SIG.search(t): + if not e["signature"]: + return self._say("no_signature", "Python %s doesn't expose a signature for %s, so I won't guess its parameters." % (self.ver, name), status="withheld") + return self._say("signature", "%s — signature %s (Python %s)." % (name, e["signature"], self.ver), e["signature"]) + doc = e["doc"] or "(no docstring)" + return self._say("doc", "%s: %s Call it as %s (Python %s)." % (name, doc, call, self.ver), doc) diff --git a/root/specialists/python/pyref_panel_v1.json b/root/specialists/python/pyref_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..aad1537558cd59d0a8a5601206d9ec23c1ed78a7 --- /dev/null +++ b/root/specialists/python/pyref_panel_v1.json @@ -0,0 +1,2956 @@ +[ + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's bytes.partition take?", + "expect": "(self, sep, /)" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of random.shuffle in Python?", + "expect": "(x)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function gzip.GzipFile do?", + "expect": "The GzipFile class simulates most of the methods of a file object with" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function str.casefold do?", + "expect": "Return a version of the string suitable for caseless comparisons." + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's random.vonmisesvariate take?", + "expect": "(mu, kappa)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function pow do?", + "expect": "Equivalent to base**exp with 2 arguments or base**exp % mod with 3 arguments" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what bytes.replace does in Python.", + "expect": "Return a copy with all occurrences of substring old replaced by new." + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's functools.lru_cache take?", + "expect": "(maxsize=128, typed=False)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's heapq.merge take?", + "expect": "(*iterables, key=None, reverse=False)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function str.lower do?", + "expect": "Return a copy of the string converted to lowercase." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what ImportWarning does in Python.", + "expect": "Base class for warnings about probable mistakes in module imports" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's sys.set_coroutine_origin_tracking_depth take?", + "expect": "(depth)" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides set_asyncgen_hooks in Python?", + "expect": "sys" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what json.dumps does in Python.", + "expect": "Serialize ``obj`` to a JSON formatted ``str``." + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of statistics.fmean in Python?", + "expect": "(data, weights=None)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function UnboundLocalError do?", + "expect": "Local name referenced but not bound to a value." + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of itertools.count in Python?", + "expect": "(start=0, step=1)" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of urllib.parse.SplitResult in Python?", + "expect": "(scheme, netloc, path, query, fragment)" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of sys.getdlopenflags in Python?", + "expect": "()" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's math.isqrt take?", + "expect": "(n, /)" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is unregister_archive_format in, in Python?", + "expect": "shutil" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of globals in Python?", + "expect": "()" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's format take?", + "expect": "(value, format_spec='', /)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what bytes.rsplit does in Python.", + "expect": "Return a list of the sections in the bytes, using sep as the delimiter." + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of shutil.disk_usage in Python?", + "expect": "(path)" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides log10 in Python?", + "expect": "math" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides SameFileError in Python?", + "expect": "shutil" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of operator.concat in Python?", + "expect": "(a, b, /)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what set.add does in Python.", + "expect": "Add an element to a set." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what glob.iglob does in Python.", + "expect": "Return an iterator which yields the paths matching a pathname pattern." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function Warning do?", + "expect": "Base class for warning categories." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what NotADirectoryError does in Python.", + "expect": "Operation only works on directories." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function bytes.isascii do?", + "expect": "B.isascii() -> bool" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function os.execle do?", + "expect": "execle(file, *args, env)" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of os.path.normpath in Python?", + "expect": "(path)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what bytes.isspace does in Python.", + "expect": "B.isspace() -> bool" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what operator.isub does in Python.", + "expect": "Same as a -= b." + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of hashlib.scrypt in Python?", + "expect": "(password, *, salt=None, n=None, r=None, p=None, maxmem=0, dklen=64)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function decimal.DivisionUndefined do?", + "expect": "Second argument to a division or modulo operation was zero." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what math.degrees does in Python.", + "expect": "Convert angle x from radians to degrees." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what super does in Python.", + "expect": "super() -> same as super(__class__, )" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what str.translate does in Python.", + "expect": "Replace each character in the string using the given translation table." + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides deque in Python?", + "expect": "collections" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is splitext in, in Python?", + "expect": "os.path" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is getunicodeinternedsize in, in Python?", + "expect": "sys" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides get_dialect in Python?", + "expect": "csv" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what ModuleNotFoundError does in Python.", + "expect": "Module not found." + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of json.JSONEncoder in Python?", + "expect": "(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of urllib.parse.urljoin in Python?", + "expect": "(base, url, allow_fragments=True)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's operator.irshift take?", + "expect": "(a, b, /)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's statistics.quantiles take?", + "expect": "(data, *, n=4, method='exclusive')" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function list.sort do?", + "expect": "Sort the list in ascending order and return None." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what hasattr does in Python.", + "expect": "Return whether the object has an attribute with the given name." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what os.path.splitroot does in Python.", + "expect": "Split a pathname into drive, root and tail. On Posix, drive is always" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what isinstance does in Python.", + "expect": "Return whether an object is an instance of a class or of a subclass thereof." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what decimal.Clamped does in Python.", + "expect": "Base class for arithmetic errors." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function str.count do?", + "expect": "S.count(sub[, start[, end]]) -> int" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function float do?", + "expect": "Convert a string or number to a floating point number, if possible." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function math.log2 do?", + "expect": "Return the base 2 logarithm of x." + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is get_terminal_size in, in Python?", + "expect": "shutil" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what re.sub does in Python.", + "expect": "Return the string obtained by replacing the leftmost" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's string.Template take?", + "expect": "(template)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's bytes.removeprefix take?", + "expect": "(self, prefix, /)" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides imod in Python?", + "expect": "operator" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what PermissionError does in Python.", + "expect": "Not enough permissions." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function eval do?", + "expect": "Evaluate the given source in the context of globals and locals." + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's hashlib.sha224 take?", + "expect": "(string=b'', *, usedforsecurity=True)" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of shutil.move in Python?", + "expect": "(src, dst, copy_function=)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what TabError does in Python.", + "expect": "Improper mixture of spaces and tabs." + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's urllib.parse.splithost take?", + "expect": "(url)" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides execl in Python?", + "expect": "os" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides quote in Python?", + "expect": "urllib.parse" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of enumerate in Python?", + "expect": "(iterable, start=0)" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of sys.getallocatedblocks in Python?", + "expect": "()" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of statistics.covariance in Python?", + "expect": "(x, y, /)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function math.sumprod do?", + "expect": "Return the sum of products of values from two iterables p and q." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function ArithmeticError do?", + "expect": "Base class for arithmetic errors." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function hashlib.pbkdf2_hmac do?", + "expect": "Password based key derivation function 2 (PKCS #5 v2.0) with HMAC as pseudorandom function." + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's math.isinf take?", + "expect": "(x, /)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's os.path.dirname take?", + "expect": "(p)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what os.fsdecode does in Python.", + "expect": "Decode filename (an os.PathLike, bytes, or str) from the filesystem" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's re.split take?", + "expect": "(pattern, string, maxsplit=0, flags=0)" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of str.isprintable in Python?", + "expect": "(self, /)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function csv.register_dialect do?", + "expect": "Create a mapping from a string name to a dialect class." + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of math.lcm in Python?", + "expect": "(*integers)" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of glob.has_magic in Python?", + "expect": "(s)" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is splitvalue in, in Python?", + "expect": "urllib.parse" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what str.removeprefix does in Python.", + "expect": "Return a str with the given prefix string removed if present." + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of zlib.crc32 in Python?", + "expect": "(data, value=0, /)" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is geometric_mean in, in Python?", + "expect": "statistics" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what getattr does in Python.", + "expect": "Get a named attribute from an object." + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's int.from_bytes take?", + "expect": "(bytes, byteorder='big', *, signed=False)" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of base64.b32encode in Python?", + "expect": "(s)" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides decompressobj in Python?", + "expect": "zlib" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what bytes.rindex does in Python.", + "expect": "B.rindex(sub[, start[, end]]) -> int" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is enable_callback_tracebacks in, in Python?", + "expect": "sqlite3" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function datetime.datetime do?", + "expect": "datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function bool do?", + "expect": "bool(x) -> bool" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's math.erf take?", + "expect": "(x, /)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's gzip.decompress take?", + "expect": "(data)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what set.copy does in Python.", + "expect": "Return a shallow copy of a set." + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's os.path.samefile take?", + "expect": "(f1, f2)" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides tzset in Python?", + "expect": "time" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what sys.getdefaultencoding does in Python.", + "expect": "Return the current default encoding used by the Unicode implementation." + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is is_not in, in Python?", + "expect": "operator" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's str.title take?", + "expect": "(self, /)" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is file_digest in, in Python?", + "expect": "hashlib" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is process_time in, in Python?", + "expect": "time" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function min do?", + "expect": "min(iterable, *[, default=obj, key=func]) -> value" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's os.path.expandvars take?", + "expect": "(path)" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of dict.popitem in Python?", + "expect": "(self, /)" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is deactivate_stack_trampoline in, in Python?", + "expect": "sys" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function datetime.time do?", + "expect": "time([hour[, minute[, second[, microsecond[, tzinfo]]]]]) --> a time object" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides connect in Python?", + "expect": "sqlite3" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is atanh in, in Python?", + "expect": "math" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's bisect.bisect_right take?", + "expect": "(a, x, lo=0, hi=None, *, key=None)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function memoryview do?", + "expect": "Create a new memoryview object which references the given object." + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is urlsafe_b64decode in, in Python?", + "expect": "base64" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is encodebytes in, in Python?", + "expect": "base64" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides DecimalException in Python?", + "expect": "decimal" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's sys.set_int_max_str_digits take?", + "expect": "(maxdigits)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function tuple.index do?", + "expect": "Return first index of value." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what str.isupper does in Python.", + "expect": "Return True if the string is an uppercase string, False otherwise." + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's sqlite3.DateFromTicks take?", + "expect": "(ticks)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what sqlite3.Connection does in Python.", + "expect": "SQLite database connection object." + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides shake_128 in Python?", + "expect": "hashlib" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what PendingDeprecationWarning does in Python.", + "expect": "Base class for warnings about features which will be deprecated" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of functools.update_wrapper in Python?", + "expect": "(wrapper, wrapped, assigned=('__module__', '__name__', '__qualname__', '__doc__', '__annotations__', '__type_params__'), updated=('__dict__',))" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function bytes.startswith do?", + "expect": "B.startswith(prefix[, start[, end]]) -> bool" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is makedirs in, in Python?", + "expect": "os" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function list.remove do?", + "expect": "Remove first occurrence of value." + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides tan in Python?", + "expect": "math" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is modf in, in Python?", + "expect": "math" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what math.cbrt does in Python.", + "expect": "Return the cube root of x." + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's os.spawnvp take?", + "expect": "(mode, file, args)" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides median in Python?", + "expect": "statistics" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of os.path.expanduser in Python?", + "expect": "(path)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's itertools.compress take?", + "expect": "(data, selectors)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's base64.standard_b64decode take?", + "expect": "(s)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what sqlite3.Cursor does in Python.", + "expect": "SQLite database cursor class." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function base64.urlsafe_b64encode do?", + "expect": "Encode bytes using the URL- and filesystem-safe Base64 alphabet." + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is filterfalse in, in Python?", + "expect": "itertools" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's aiter take?", + "expect": "(async_iterable, /)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what statistics.LinearRegression does in Python.", + "expect": "LinearRegression(slope, intercept)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what functools.singledispatch does in Python.", + "expect": "Single-dispatch generic function decorator." + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of math.acosh in Python?", + "expect": "(x, /)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what str.upper does in Python.", + "expect": "Return a copy of the string converted to uppercase." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what re.findall does in Python.", + "expect": "Return a list of all non-overlapping matches in the string." + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is atan2 in, in Python?", + "expect": "math" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides reader in Python?", + "expect": "csv" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides remainder in Python?", + "expect": "math" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides relpath in Python?", + "expect": "os.path" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's urllib.parse.urlunsplit take?", + "expect": "(components)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function csv.Error do?", + "expect": "Common base class for all non-exit exceptions." + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides getsizeof in Python?", + "expect": "sys" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function RuntimeWarning do?", + "expect": "Base class for warnings about dubious runtime behavior." + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is isidentifier in, in Python?", + "expect": "builtins" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of base64.b16encode in Python?", + "expect": "(s)" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides BadGzipFile in Python?", + "expect": "gzip" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is ExecError in, in Python?", + "expect": "shutil" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is methodcaller in, in Python?", + "expect": "operator" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what Exception does in Python.", + "expect": "Common base class for all non-exit exceptions." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what bytearray does in Python.", + "expect": "bytearray(iterable_of_ints) -> bytearray" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's bytes.join take?", + "expect": "(self, iterable_of_bytes, /)" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of sys.unraisablehook in Python?", + "expect": "(unraisable, /)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function glob.glob do?", + "expect": "Return a list of paths matching a pathname pattern." + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's set.issuperset take?", + "expect": "(self, other, /)" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides a85decode in Python?", + "expect": "base64" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function oct do?", + "expect": "Return the octal representation of an integer." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what math.ldexp does in Python.", + "expect": "Return x * (2**i)." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what BytesWarning does in Python.", + "expect": "Base class for warnings about bytes and buffer related problems, mostly" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of int.as_integer_ratio in Python?", + "expect": "(self, /)" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is gauss in, in Python?", + "expect": "random" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's functools.cached_property take?", + "expect": "(func)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's glob.glob1 take?", + "expect": "(dirname, pattern)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what bytes does in Python.", + "expect": "bytes(iterable_of_ints) -> bytes" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of shutil.unregister_unpack_format in Python?", + "expect": "(name)" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of math.sin in Python?", + "expect": "(x, /)" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides DataError in Python?", + "expect": "sqlite3" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's str.capitalize take?", + "expect": "(self, /)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's str.replace take?", + "expect": "(self, old, new, count=-1, /)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what TimeoutError does in Python.", + "expect": "Timeout expired." + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides register_converter in Python?", + "expect": "sqlite3" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's json.detect_encoding take?", + "expect": "(b)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what UnicodeWarning does in Python.", + "expect": "Base class for warnings about Unicode related problems, mostly" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function locals do?", + "expect": "Return a dictionary containing the current scope's local variables." + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of heapq.nsmallest in Python?", + "expect": "(n, iterable, key=None)" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of random.setstate in Python?", + "expect": "(state)" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of sys.exc_info in Python?", + "expect": "()" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's sys.get_coroutine_origin_tracking_depth take?", + "expect": "()" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's random.weibullvariate take?", + "expect": "(alpha, beta)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's urllib.parse.urlparse take?", + "expect": "(url, scheme='', allow_fragments=True)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function str.isalnum do?", + "expect": "Return True if the string is an alpha-numeric string, False otherwise." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function itertools.product do?", + "expect": "product(*iterables, repeat=1) --> product object" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's textwrap.TextWrapper take?", + "expect": "(width=70, initial_indent='', subsequent_indent='', expand_tabs=True, replace_whitespace=True, fix_sentence_endings=False, break_long_words=True, drop_whitespace=True, break_on_hyphens=True, tabsize=8, *, max_lines=None, placeholder=' [...]')" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function urllib.parse.unquote do?", + "expect": "Replace %xx escapes by their single-character equivalent. The optional" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function LookupError do?", + "expect": "Base class for lookup errors." + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's urllib.parse.ParseResult take?", + "expect": "(scheme, netloc, path, params, query, fragment)" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides InvalidOperation in Python?", + "expect": "decimal" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides sha3_224 in Python?", + "expect": "hashlib" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides asctime in Python?", + "expect": "time" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's math.exp take?", + "expect": "(x, /)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's ord take?", + "expect": "(c, /)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's sqlite3.TimestampFromTicks take?", + "expect": "(ticks)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's uuid.getnode take?", + "expect": "()" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides symmetric_difference in Python?", + "expect": "builtins" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of hashlib.sha3_256 in Python?", + "expect": "(string=b'', *, usedforsecurity=True)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what FutureWarning does in Python.", + "expect": "Base class for warnings about constructs that will change semantically" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is pvariance in, in Python?", + "expect": "statistics" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function FloatingPointError do?", + "expect": "Floating point operation failed." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what bytes.istitle does in Python.", + "expect": "B.istitle() -> bool" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides clock_gettime in Python?", + "expect": "time" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of os.spawnlpe in Python?", + "expect": "(mode, file, *args)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what math.asinh does in Python.", + "expect": "Return the inverse hyperbolic sine of x." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function str.splitlines do?", + "expect": "Return a list of the lines in the string, breaking at line boundaries." + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is timedelta in, in Python?", + "expect": "datetime" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function bytes.removesuffix do?", + "expect": "Return a bytes object with the given suffix string removed if present." + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's uuid.uuid1 take?", + "expect": "(node=None, clock_seq=None)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what GeneratorExit does in Python.", + "expect": "Request that a generator exit." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what bytes.endswith does in Python.", + "expect": "B.endswith(suffix[, start[, end]]) -> bool" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's all take?", + "expect": "(iterable, /)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function dict.items do?", + "expect": "D.items() -> a set-like object providing a view on D's items" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides randbytes in Python?", + "expect": "random" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of urllib.parse.unwrap in Python?", + "expect": "(url)" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides register_unpack_format in Python?", + "expect": "shutil" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of any in Python?", + "expect": "(iterable, /)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function complex do?", + "expect": "Create a complex number from a real part and an optional imaginary part." + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of int.bit_count in Python?", + "expect": "(self, /)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function bytes.zfill do?", + "expect": "Pad a numeric string with zeros on the left, to fill a field of the given width." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what hex does in Python.", + "expect": "Return the hexadecimal representation of an integer." + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is UserList in, in Python?", + "expect": "collections" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's statistics.stdev take?", + "expect": "(data, xbar=None)" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of statistics.mean in Python?", + "expect": "(data)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what uuid.uuid3 does in Python.", + "expect": "Generate a UUID from the MD5 hash of a namespace UUID and a name." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function abs do?", + "expect": "Return the absolute value of the argument." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function random.seed do?", + "expect": "Initialize internal state from a seed." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function type do?", + "expect": "type(object) -> the object's type" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's math.gamma take?", + "expect": "(x, /)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function DeprecationWarning do?", + "expect": "Base class for warnings about deprecated features." + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is copytree in, in Python?", + "expect": "shutil" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function IsADirectoryError do?", + "expect": "Operation doesn't work on directories." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what set.difference does in Python.", + "expect": "Return the difference of two or more sets as a new set." + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of operator.itruediv in Python?", + "expect": "(a, b, /)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what shutil.Error does in Python.", + "expect": "Base class for I/O related errors." + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of random.getstate in Python?", + "expect": "()" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what dict.pop does in Python.", + "expect": "D.pop(k[,d]) -> v, remove specified key and return the corresponding value." + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's os.execvp take?", + "expect": "(file, args)" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is settrace in, in Python?", + "expect": "sys" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is pos in, in Python?", + "expect": "operator" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what UnicodeEncodeError does in Python.", + "expect": "Unicode encoding error." + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is mktime in, in Python?", + "expect": "time" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is audit in, in Python?", + "expect": "sys" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is process_time_ns in, in Python?", + "expect": "time" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function decimal.DecimalTuple do?", + "expect": "DecimalTuple(sign, digits, exponent)" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides tzinfo in Python?", + "expect": "datetime" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function max do?", + "expect": "max(iterable, *[, default=obj, key=func]) -> value" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function tuple do?", + "expect": "Built-in immutable sequence." + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is PosixPath in, in Python?", + "expect": "pathlib" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's hashlib.sha512 take?", + "expect": "(string=b'', *, usedforsecurity=True)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what sys.exit does in Python.", + "expect": "Exit the interpreter by raising SystemExit(status)." + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides InvalidContext in Python?", + "expect": "decimal" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is sleep in, in Python?", + "expect": "time" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what zlib.error does in Python.", + "expect": "Common base class for all non-exit exceptions." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what str.isspace does in Python.", + "expect": "Return True if the string is a whitespace string, False otherwise." + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides log1p in Python?", + "expect": "math" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function operator.ge do?", + "expect": "Same as a >= b." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function input do?", + "expect": "Read a string from standard input. The trailing newline is stripped." + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of urllib.parse.DefragResultBytes in Python?", + "expect": "(url, fragment)" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of math.perm in Python?", + "expect": "(n, k=None, /)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's functools.partialmethod take?", + "expect": "(func, /, *args, **keywords)" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides cosh in Python?", + "expect": "math" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what hashlib.sha3_512 does in Python.", + "expect": "Returns a sha3-512 hash object; optionally initialized with a string" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is repeat in, in Python?", + "expect": "itertools" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides clock_settime in Python?", + "expect": "time" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of shutil.rmtree in Python?", + "expect": "(path, ignore_errors=False, onerror=None, *, onexc=None, dir_fd=None)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's os.path.sameopenfile take?", + "expect": "(fp1, fp2)" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is total_ordering in, in Python?", + "expect": "functools" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is getswitchinterval in, in Python?", + "expect": "sys" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what str.index does in Python.", + "expect": "S.index(sub[, start[, end]]) -> int" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's os.path.getmtime take?", + "expect": "(filename)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what dict.update does in Python.", + "expect": "D.update([E, ]**F) -> None. Update D from dict/iterable E and F." + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of sys.setswitchinterval in Python?", + "expect": "(interval, /)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function bisect.bisect_left do?", + "expect": "Return the index where to insert item x in list a, assuming a is sorted." + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of textwrap.shorten in Python?", + "expect": "(text, width, **kwargs)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's divmod take?", + "expect": "(x, y, /)" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is capwords in, in Python?", + "expect": "string" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's sys.intern take?", + "expect": "(string, /)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function json.JSONDecodeError do?", + "expect": "Subclass of ValueError with the following additional properties:" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what time.strptime does in Python.", + "expect": "strptime(string, format) -> struct_time" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides intersection in Python?", + "expect": "builtins" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function bytes.splitlines do?", + "expect": "Return a list of the lines in the bytes, breaking at line boundaries." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what decimal.Overflow does in Python.", + "expect": "Base class for arithmetic errors." + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is erfc in, in Python?", + "expect": "math" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of csv.list_dialects in Python?", + "expect": "()" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of sqlite3.complete_statement in Python?", + "expect": "(statement)" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides b64decode in Python?", + "expect": "base64" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what os.path.splitdrive does in Python.", + "expect": "Split a pathname into drive and path. On Posix, drive is always" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides ctime in Python?", + "expect": "time" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what sqlite3.Error does in Python.", + "expect": "Common base class for all non-exit exceptions." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function str.format do?", + "expect": "S.format(*args, **kwargs) -> str" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's uuid.uuid5 take?", + "expect": "(namespace, name)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what operator.ipow does in Python.", + "expect": "Same as a **= b." + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides cmp_to_key in Python?", + "expect": "functools" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what decimal.DivisionImpossible does in Python.", + "expect": "Base class for arithmetic errors." + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of os.path.realpath in Python?", + "expect": "(filename, *, strict=False)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what classmethod does in Python.", + "expect": "classmethod(function) -> method" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function datetime.timezone do?", + "expect": "Fixed offset from UTC implementation of tzinfo." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function str.isnumeric do?", + "expect": "Return True if the string is a numeric string, False otherwise." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what StopIteration does in Python.", + "expect": "Signal the end from iterator.__next__()." + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of hashlib.sha384 in Python?", + "expect": "(string=b'', *, usedforsecurity=True)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function ConnectionRefusedError do?", + "expect": "Connection refused." + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is rshift in, in Python?", + "expect": "operator" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is heappop in, in Python?", + "expect": "heapq" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what base64.b32hexencode does in Python.", + "expect": "Encode the bytes-like objects using base32hex and return a bytes object." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function filter do?", + "expect": "filter(function or None, iterable) --> filter object" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is call_tracing in, in Python?", + "expect": "sys" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is delitem in, in Python?", + "expect": "operator" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of math.fmod in Python?", + "expect": "(x, y, /)" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of statistics.NormalDist in Python?", + "expect": "(mu=0.0, sigma=1.0)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's math.frexp take?", + "expect": "(x, /)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's math.prod take?", + "expect": "(iterable, /, *, start=1)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what MemoryError does in Python.", + "expect": "Out of memory." + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides starmap in Python?", + "expect": "itertools" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what ProcessLookupError does in Python.", + "expect": "Process not found." + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's math.asin take?", + "expect": "(x, /)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what print does in Python.", + "expect": "Prints the values to a stream, or to sys.stdout by default." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what float.as_integer_ratio does in Python.", + "expect": "Return a pair of integers, whose ratio is exactly equal to the original float." + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is b16decode in, in Python?", + "expect": "base64" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides renames in Python?", + "expect": "os" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what sqlite3.OperationalError does in Python.", + "expect": "Common base class for all non-exit exceptions." + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's urllib.parse.unquote_plus take?", + "expect": "(string, encoding='utf-8', errors='replace')" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is reverse in, in Python?", + "expect": "builtins" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of os.spawnvpe in Python?", + "expect": "(mode, file, args, env)" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides strftime in Python?", + "expect": "time" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what compile does in Python.", + "expect": "Compile source into a code object that can be executed by exec() or eval()." + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's gzip.write32u take?", + "expect": "(output, value)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's bisect.insort take?", + "expect": "(a, x, lo=0, hi=None, *, key=None)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what bytes.upper does in Python.", + "expect": "B.upper() -> copy of B" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what exec does in Python.", + "expect": "Execute the given source in the context of globals and locals." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what re.error does in Python.", + "expect": "Exception raised for invalid regular expressions." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what str does in Python.", + "expect": "str(object='') -> str" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function sqlite3.DatabaseError do?", + "expect": "Common base class for all non-exit exceptions." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function int.is_integer do?", + "expect": "Returns True. Exists for duck type compatibility with float.is_integer." + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's str.join take?", + "expect": "(self, iterable, /)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what itertools.zip_longest does in Python.", + "expect": "zip_longest(iter1 [,iter2 [...]], [fillvalue=None]) --> zip_longest object" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is sha1 in, in Python?", + "expect": "hashlib" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what str.rindex does in Python.", + "expect": "S.rindex(sub[, start[, end]]) -> int" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's hashlib.md5 take?", + "expect": "(string=b'', *, usedforsecurity=True)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function bytes.islower do?", + "expect": "B.islower() -> bool" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function base64.main do?", + "expect": "Small main program" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides get_asyncgen_hooks in Python?", + "expect": "sys" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function operator.ixor do?", + "expect": "Same as a ^= b." + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of math.gcd in Python?", + "expect": "(*integers)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what dict.copy does in Python.", + "expect": "D.copy() -> a shallow copy of D" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is iadd in, in Python?", + "expect": "operator" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of os.path.getsize in Python?", + "expect": "(filename)" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is commonprefix in, in Python?", + "expect": "os.path" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's os.getenv take?", + "expect": "(key, default=None)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's str.isalpha take?", + "expect": "(self, /)" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of str.zfill in Python?", + "expect": "(self, width, /)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function pathlib.PureWindowsPath do?", + "expect": "PurePath subclass for Windows systems." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function math.isclose do?", + "expect": "Determine whether two floating point numbers are close in value." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what str.rsplit does in Python.", + "expect": "Return a list of the substrings in the string, using sep as the separator string." + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of urllib.parse.quote_plus in Python?", + "expect": "(string, safe='', encoding=None, errors=None)" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is sha3_384 in, in Python?", + "expect": "hashlib" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what shutil.copyfileobj does in Python.", + "expect": "copy data from file-like object fsrc to file-like object fdst" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is Context in, in Python?", + "expect": "decimal" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function operator.or_ do?", + "expect": "Same as a | b." + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is PrepareProtocol in, in Python?", + "expect": "sqlite3" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides nextafter in Python?", + "expect": "math" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function anext do?", + "expect": "async anext(aiterator[, default])" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is field_size_limit in, in Python?", + "expect": "csv" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of sqlite3.register_adapter in Python?", + "expect": "(type, adapter, /)" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides Counter in Python?", + "expect": "collections" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what float.hex does in Python.", + "expect": "Return a hexadecimal representation of a floating-point number." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function dict.keys do?", + "expect": "D.keys() -> a set-like object providing a view on D's keys" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what NotImplementedError does in Python.", + "expect": "Method or function hasn't been implemented yet." + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides choices in Python?", + "expect": "random" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function operator.countOf do?", + "expect": "Return the number of items in a which are, or which equal, b." + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function open do?", + "expect": "Open file and return a stream. Raise OSError upon failure." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what operator.ne does in Python.", + "expect": "Same as a != b." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what float.is_integer does in Python.", + "expect": "Return True if the float is an integer." + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's shutil.get_unpack_formats take?", + "expect": "()" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what sum does in Python.", + "expect": "Return the sum of a 'start' value (default: 0) plus an iterable of numbers" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's random.randint take?", + "expect": "(a, b)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what next does in Python.", + "expect": "Return the next item from the iterator." + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is OrderedDict in, in Python?", + "expect": "collections" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of zlib.compressobj in Python?", + "expect": "(level=-1, method=8, wbits=15, memLevel=8, strategy=0, zdict=None)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's pathlib.Path take?", + "expect": "(*args, **kwargs)" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is Blob in, in Python?", + "expect": "sqlite3" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of str.swapcase in Python?", + "expect": "(self, /)" + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of urllib.parse.unquote_to_bytes in Python?", + "expect": "(string)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function FileExistsError do?", + "expect": "File already exists." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what os.spawnv does in Python.", + "expect": "spawnv(mode, file, args) -> integer" + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is StatisticsError in, in Python?", + "expect": "statistics" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides UserString in Python?", + "expect": "collections" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides monotonic in Python?", + "expect": "time" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function map do?", + "expect": "map(func, *iterables) --> map object" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what UserWarning does in Python.", + "expect": "Base class for warnings generated by user code." + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides nlargest in Python?", + "expect": "heapq" + }, + { + "split": "heldout", + "kind": "module", + "valid": true, + "q": "What module provides xor in Python?", + "expect": "operator" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what int does in Python.", + "expect": "int([x]) -> integer" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's shutil.register_archive_format take?", + "expect": "(name, function, extra_args=None, description='')" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what urllib.parse.urldefrag does in Python.", + "expect": "Removes any existing fragment from URL." + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's math.lgamma take?", + "expect": "(x, /)" + }, + { + "split": "heldout", + "kind": "signature", + "valid": true, + "q": "What arguments does Python's bytes.expandtabs take?", + "expect": "(self, /, tabsize=8)" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function decimal.Decimal do?", + "expect": "Construct a new Decimal object. 'value' can be an integer, string, tuple," + }, + { + "split": "dev", + "kind": "module", + "valid": true, + "q": "Which module is load in, in Python?", + "expect": "json" + }, + { + "split": "dev", + "kind": "doc", + "valid": true, + "q": "What does the Python function shutil.copy do?", + "expect": "Copy data and mode bits (\"cp src dst\"). Return the file's destination." + }, + { + "split": "dev", + "kind": "signature", + "valid": true, + "q": "What are the parameters of delattr in Python?", + "expect": "(obj, name, /)" + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what itertools.accumulate does in Python.", + "expect": "Return series of accumulated sums (or other binary function results)." + }, + { + "split": "heldout", + "kind": "doc", + "valid": true, + "q": "Explain what bytes.capitalize does in Python.", + "expect": "B.capitalize() -> copy of B" + }, + { + "split": "dev", + "kind": "unknown", + "valid": false, + "q": "What does the Python function math.frobnicate do?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown", + "valid": false, + "q": "Explain what str.shout does in Python.", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown", + "valid": false, + "q": "What does the Python function itertools.teleport do?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown", + "valid": false, + "q": "Explain what json.telepathy does in Python.", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown", + "valid": false, + "q": "What does the Python function os.path.wormhole do?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown", + "valid": false, + "q": "Explain what random.certainty does in Python.", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown", + "valid": false, + "q": "What does the Python function collections.hypercube do?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown", + "valid": false, + "q": "Explain what datetime.rewind does in Python.", + "expect": "decline" + }, + { + "split": "dev", + "kind": "unknown", + "valid": false, + "q": "What does the Python function re.mindread do?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "unknown", + "valid": false, + "q": "Explain what statistics.oracle does in Python.", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/python/pyref_panel_v1.py b/root/specialists/python/pyref_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..ceae4ddd31c0331ec01a1ad77f5a51a9e001f1df --- /dev/null +++ b/root/specialists/python/pyref_panel_v1.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +"""pyref_panel_v1 - the sealed panel for specialist #51, answer keys read directly from the introspection store (the +interpreter's own signatures, modules, docstrings). Items: parameters (signature), module, what-it-does (docstring line); +must-decline: members that do not exist in real modules. Names split dev / held-out; different phrasings per split. +Ambiguous bare names are not asked (they should draw a clarifying question, not an answer). +usage: pyref_panel_v1.py """ +import json +import random +import sys + +T = {"dev": {"sig": "What are the parameters of {n} in Python?", "mod": "Which module is {s} in, in Python?", "doc": "What does the Python function {n} do?"}, + "heldout": {"sig": "What arguments does Python's {n} take?", "mod": "What module provides {s} in Python?", "doc": "Explain what {n} does in Python."}} +FAKE = ["math.frobnicate", "str.shout", "itertools.teleport", "json.telepathy", "os.path.wormhole", "random.certainty", + "collections.hypercube", "datetime.rewind", "re.mindread", "statistics.oracle"] + + +def main(): + d = json.load(open(sys.argv[1])) + e = d["entries"] + short = {} + for q in e: + short.setdefault(q.split(".")[-1], []).append(q) + rng = random.Random(51) + names = sorted(e) + rng.shuffle(names) + items = [] + for q in names[:420]: + x = e[q] + sp = "dev" if sum(map(ord, q)) % 2 == 0 else "heldout" + s = q.split(".")[-1] + if x["signature"] and rng.random() < 0.45: + items.append({"split": sp, "kind": "signature", "valid": True, "q": T[sp]["sig"].format(n=q), "expect": x["signature"]}) + elif "." in q and len(short[s]) == 1 and len(s) > 2 and rng.random() < 0.6: + items.append({"split": sp, "kind": "module", "valid": True, "q": T[sp]["mod"].format(s=s), "expect": x["module"]}) + elif x["doc"] and len(x["doc"]) > 12: + items.append({"split": sp, "kind": "doc", "valid": True, "q": T[sp]["doc"].format(n=q), "expect": x["doc"]}) + for i, f in enumerate(FAKE): + sp = "dev" if i % 2 == 0 else "heldout" + items.append({"split": sp, "kind": "unknown", "valid": False, "q": T[sp]["doc"].format(n=f), "expect": "decline"}) + json.dump(items, open(sys.argv[2], "w"), indent=1) + import collections + print("panel (python %s):" % d["python"], dict(collections.Counter((i["split"], i["kind"]) for i in items))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/python/pyref_scorer.py b/root/specialists/python/pyref_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..c90acf0b733eb2f54ba9a0b38e27ef6b8f96a2ae --- /dev/null +++ b/root/specialists/python/pyref_scorer.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +"""pyref_scorer - answer identity in the REPLY TEXT: the interpreter's exact signature / module name / docstring line +must appear in the reply. A must-decline item answered is a false yes. (ok, asserted).""" + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + if p["kind"] == "module": + return ("the %s module" % p["expect"]) in text, True + return str(p["expect"]) in text, True diff --git a/root/specialists/python/pyref_v1.json b/root/specialists/python/pyref_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..57dfcc072d1b268522e7408ef41abfaa01aa3279 --- /dev/null +++ b/root/specialists/python/pyref_v1.json @@ -0,0 +1,5997 @@ +{ +"python": "3.12.3", +"entries": { +"ArithmeticError": { +"name": "ArithmeticError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Base class for arithmetic errors." +}, +"AssertionError": { +"name": "AssertionError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Assertion failed." +}, +"AttributeError": { +"name": "AttributeError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Attribute not found." +}, +"BaseException": { +"name": "BaseException", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Common base class for all exceptions" +}, +"BaseExceptionGroup": { +"name": "BaseExceptionGroup", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "A combination of multiple unrelated exceptions." +}, +"BlockingIOError": { +"name": "BlockingIOError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "I/O operation would block." +}, +"BrokenPipeError": { +"name": "BrokenPipeError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Broken pipe." +}, +"BufferError": { +"name": "BufferError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Buffer error." +}, +"BytesWarning": { +"name": "BytesWarning", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Base class for warnings about bytes and buffer related problems, mostly" +}, +"ChildProcessError": { +"name": "ChildProcessError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Child process error." +}, +"ConnectionAbortedError": { +"name": "ConnectionAbortedError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Connection aborted." +}, +"ConnectionError": { +"name": "ConnectionError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Connection error." +}, +"ConnectionRefusedError": { +"name": "ConnectionRefusedError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Connection refused." +}, +"ConnectionResetError": { +"name": "ConnectionResetError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Connection reset." +}, +"DeprecationWarning": { +"name": "DeprecationWarning", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Base class for warnings about deprecated features." +}, +"EOFError": { +"name": "EOFError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Read beyond end of file." +}, +"EncodingWarning": { +"name": "EncodingWarning", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Base class for warnings about encodings." +}, +"EnvironmentError": { +"name": "EnvironmentError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Base class for I/O related errors." +}, +"Exception": { +"name": "Exception", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Common base class for all non-exit exceptions." +}, +"ExceptionGroup": { +"name": "ExceptionGroup", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "A combination of multiple unrelated exceptions." +}, +"FileExistsError": { +"name": "FileExistsError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "File already exists." +}, +"FileNotFoundError": { +"name": "FileNotFoundError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "File not found." +}, +"FloatingPointError": { +"name": "FloatingPointError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Floating point operation failed." +}, +"FutureWarning": { +"name": "FutureWarning", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Base class for warnings about constructs that will change semantically" +}, +"GeneratorExit": { +"name": "GeneratorExit", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Request that a generator exit." +}, +"IOError": { +"name": "IOError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Base class for I/O related errors." +}, +"ImportError": { +"name": "ImportError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Import can't find module, or can't find name in module." +}, +"ImportWarning": { +"name": "ImportWarning", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Base class for warnings about probable mistakes in module imports" +}, +"IndentationError": { +"name": "IndentationError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Improper indentation." +}, +"IndexError": { +"name": "IndexError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Sequence index out of range." +}, +"InterruptedError": { +"name": "InterruptedError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Interrupted by signal." +}, +"IsADirectoryError": { +"name": "IsADirectoryError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Operation doesn't work on directories." +}, +"KeyError": { +"name": "KeyError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Mapping key not found." +}, +"KeyboardInterrupt": { +"name": "KeyboardInterrupt", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Program interrupted by user." +}, +"LookupError": { +"name": "LookupError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Base class for lookup errors." +}, +"MemoryError": { +"name": "MemoryError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Out of memory." +}, +"ModuleNotFoundError": { +"name": "ModuleNotFoundError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Module not found." +}, +"NameError": { +"name": "NameError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Name not found globally." +}, +"NotADirectoryError": { +"name": "NotADirectoryError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Operation only works on directories." +}, +"NotImplementedError": { +"name": "NotImplementedError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Method or function hasn't been implemented yet." +}, +"OSError": { +"name": "OSError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Base class for I/O related errors." +}, +"OverflowError": { +"name": "OverflowError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Result too large to be represented." +}, +"PendingDeprecationWarning": { +"name": "PendingDeprecationWarning", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Base class for warnings about features which will be deprecated" +}, +"PermissionError": { +"name": "PermissionError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Not enough permissions." +}, +"ProcessLookupError": { +"name": "ProcessLookupError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Process not found." +}, +"RecursionError": { +"name": "RecursionError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Recursion limit exceeded." +}, +"ReferenceError": { +"name": "ReferenceError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Weak ref proxy used after referent went away." +}, +"ResourceWarning": { +"name": "ResourceWarning", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Base class for warnings about resource usage." +}, +"RuntimeError": { +"name": "RuntimeError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Unspecified run-time error." +}, +"RuntimeWarning": { +"name": "RuntimeWarning", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Base class for warnings about dubious runtime behavior." +}, +"StopAsyncIteration": { +"name": "StopAsyncIteration", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Signal the end from iterator.__anext__()." +}, +"StopIteration": { +"name": "StopIteration", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Signal the end from iterator.__next__()." +}, +"SyntaxError": { +"name": "SyntaxError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Invalid syntax." +}, +"SyntaxWarning": { +"name": "SyntaxWarning", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Base class for warnings about dubious syntax." +}, +"SystemError": { +"name": "SystemError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Internal error in the Python interpreter." +}, +"SystemExit": { +"name": "SystemExit", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Request to exit from the interpreter." +}, +"TabError": { +"name": "TabError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Improper mixture of spaces and tabs." +}, +"TimeoutError": { +"name": "TimeoutError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Timeout expired." +}, +"TypeError": { +"name": "TypeError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Inappropriate argument type." +}, +"UnboundLocalError": { +"name": "UnboundLocalError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Local name referenced but not bound to a value." +}, +"UnicodeDecodeError": { +"name": "UnicodeDecodeError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Unicode decoding error." +}, +"UnicodeEncodeError": { +"name": "UnicodeEncodeError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Unicode encoding error." +}, +"UnicodeError": { +"name": "UnicodeError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Unicode related error." +}, +"UnicodeTranslateError": { +"name": "UnicodeTranslateError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Unicode translation error." +}, +"UnicodeWarning": { +"name": "UnicodeWarning", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Base class for warnings about Unicode related problems, mostly" +}, +"UserWarning": { +"name": "UserWarning", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Base class for warnings generated by user code." +}, +"ValueError": { +"name": "ValueError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Inappropriate argument value (of correct type)." +}, +"Warning": { +"name": "Warning", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Base class for warning categories." +}, +"ZeroDivisionError": { +"name": "ZeroDivisionError", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "Second argument to a division or modulo operation was zero." +}, +"abs": { +"name": "abs", +"module": "builtins", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the absolute value of the argument." +}, +"aiter": { +"name": "aiter", +"module": "builtins", +"kind": "function", +"signature": "(async_iterable, /)", +"doc": "Return an AsyncIterator for an AsyncIterable object." +}, +"all": { +"name": "all", +"module": "builtins", +"kind": "function", +"signature": "(iterable, /)", +"doc": "Return True if bool(x) is True for all values x in the iterable." +}, +"anext": { +"name": "anext", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "async anext(aiterator[, default])" +}, +"any": { +"name": "any", +"module": "builtins", +"kind": "function", +"signature": "(iterable, /)", +"doc": "Return True if bool(x) is True for any x in the iterable." +}, +"ascii": { +"name": "ascii", +"module": "builtins", +"kind": "function", +"signature": "(obj, /)", +"doc": "Return an ASCII-only representation of an object." +}, +"bin": { +"name": "bin", +"module": "builtins", +"kind": "function", +"signature": "(number, /)", +"doc": "Return the binary representation of an integer." +}, +"bool": { +"name": "bool", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "bool(x) -> bool" +}, +"breakpoint": { +"name": "breakpoint", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "breakpoint(*args, **kws)" +}, +"bytearray": { +"name": "bytearray", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "bytearray(iterable_of_ints) -> bytearray" +}, +"bytes": { +"name": "bytes", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "bytes(iterable_of_ints) -> bytes" +}, +"callable": { +"name": "callable", +"module": "builtins", +"kind": "function", +"signature": "(obj, /)", +"doc": "Return whether the object is callable (i.e., some kind of function)." +}, +"chr": { +"name": "chr", +"module": "builtins", +"kind": "function", +"signature": "(i, /)", +"doc": "Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff." +}, +"classmethod": { +"name": "classmethod", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "classmethod(function) -> method" +}, +"compile": { +"name": "compile", +"module": "builtins", +"kind": "function", +"signature": "(source, filename, mode, flags=0, dont_inherit=False, optimize=-1, *, _feature_version=-1)", +"doc": "Compile source into a code object that can be executed by exec() or eval()." +}, +"complex": { +"name": "complex", +"module": "builtins", +"kind": "class", +"signature": "(real=0, imag=0)", +"doc": "Create a complex number from a real part and an optional imaginary part." +}, +"delattr": { +"name": "delattr", +"module": "builtins", +"kind": "function", +"signature": "(obj, name, /)", +"doc": "Deletes the named attribute from the given object." +}, +"dict": { +"name": "dict", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "dict() -> new empty dictionary" +}, +"dir": { +"name": "dir", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Show attributes of an object." +}, +"divmod": { +"name": "divmod", +"module": "builtins", +"kind": "function", +"signature": "(x, y, /)", +"doc": "Return the tuple (x//y, x%y). Invariant: div*y + mod == x." +}, +"enumerate": { +"name": "enumerate", +"module": "builtins", +"kind": "class", +"signature": "(iterable, start=0)", +"doc": "Return an enumerate object." +}, +"eval": { +"name": "eval", +"module": "builtins", +"kind": "function", +"signature": "(source, globals=None, locals=None, /)", +"doc": "Evaluate the given source in the context of globals and locals." +}, +"exec": { +"name": "exec", +"module": "builtins", +"kind": "function", +"signature": "(source, globals=None, locals=None, /, *, closure=None)", +"doc": "Execute the given source in the context of globals and locals." +}, +"filter": { +"name": "filter", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "filter(function or None, iterable) --> filter object" +}, +"float": { +"name": "float", +"module": "builtins", +"kind": "class", +"signature": "(x=0, /)", +"doc": "Convert a string or number to a floating point number, if possible." +}, +"format": { +"name": "format", +"module": "builtins", +"kind": "function", +"signature": "(value, format_spec='', /)", +"doc": "Return type(value).__format__(value, format_spec)" +}, +"frozenset": { +"name": "frozenset", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "frozenset() -> empty frozenset object" +}, +"getattr": { +"name": "getattr", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Get a named attribute from an object." +}, +"globals": { +"name": "globals", +"module": "builtins", +"kind": "function", +"signature": "()", +"doc": "Return the dictionary containing the current scope's global variables." +}, +"hasattr": { +"name": "hasattr", +"module": "builtins", +"kind": "function", +"signature": "(obj, name, /)", +"doc": "Return whether the object has an attribute with the given name." +}, +"hash": { +"name": "hash", +"module": "builtins", +"kind": "function", +"signature": "(obj, /)", +"doc": "Return the hash value for the given object." +}, +"hex": { +"name": "hex", +"module": "builtins", +"kind": "function", +"signature": "(number, /)", +"doc": "Return the hexadecimal representation of an integer." +}, +"id": { +"name": "id", +"module": "builtins", +"kind": "function", +"signature": "(obj, /)", +"doc": "Return the identity of an object." +}, +"input": { +"name": "input", +"module": "builtins", +"kind": "function", +"signature": "(prompt='', /)", +"doc": "Read a string from standard input. The trailing newline is stripped." +}, +"int": { +"name": "int", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "int([x]) -> integer" +}, +"isinstance": { +"name": "isinstance", +"module": "builtins", +"kind": "function", +"signature": "(obj, class_or_tuple, /)", +"doc": "Return whether an object is an instance of a class or of a subclass thereof." +}, +"issubclass": { +"name": "issubclass", +"module": "builtins", +"kind": "function", +"signature": "(cls, class_or_tuple, /)", +"doc": "Return whether 'cls' is derived from another class or is the same class." +}, +"iter": { +"name": "iter", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Get an iterator from an object." +}, +"len": { +"name": "len", +"module": "builtins", +"kind": "function", +"signature": "(obj, /)", +"doc": "Return the number of items in a container." +}, +"list": { +"name": "list", +"module": "builtins", +"kind": "class", +"signature": "(iterable=(), /)", +"doc": "Built-in mutable sequence." +}, +"locals": { +"name": "locals", +"module": "builtins", +"kind": "function", +"signature": "()", +"doc": "Return a dictionary containing the current scope's local variables." +}, +"map": { +"name": "map", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "map(func, *iterables) --> map object" +}, +"max": { +"name": "max", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "max(iterable, *[, default=obj, key=func]) -> value" +}, +"memoryview": { +"name": "memoryview", +"module": "builtins", +"kind": "class", +"signature": "(object)", +"doc": "Create a new memoryview object which references the given object." +}, +"min": { +"name": "min", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "min(iterable, *[, default=obj, key=func]) -> value" +}, +"next": { +"name": "next", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Return the next item from the iterator." +}, +"object": { +"name": "object", +"module": "builtins", +"kind": "class", +"signature": "()", +"doc": "The base class of the class hierarchy." +}, +"oct": { +"name": "oct", +"module": "builtins", +"kind": "function", +"signature": "(number, /)", +"doc": "Return the octal representation of an integer." +}, +"open": { +"name": "open", +"module": "builtins", +"kind": "function", +"signature": "(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)", +"doc": "Open file and return a stream. Raise OSError upon failure." +}, +"ord": { +"name": "ord", +"module": "builtins", +"kind": "function", +"signature": "(c, /)", +"doc": "Return the Unicode code point for a one-character string." +}, +"pow": { +"name": "pow", +"module": "builtins", +"kind": "function", +"signature": "(base, exp, mod=None)", +"doc": "Equivalent to base**exp with 2 arguments or base**exp % mod with 3 arguments" +}, +"print": { +"name": "print", +"module": "builtins", +"kind": "function", +"signature": "(*args, sep=' ', end='\\n', file=None, flush=False)", +"doc": "Prints the values to a stream, or to sys.stdout by default." +}, +"property": { +"name": "property", +"module": "builtins", +"kind": "class", +"signature": "(fget=None, fset=None, fdel=None, doc=None)", +"doc": "Property attribute." +}, +"range": { +"name": "range", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "range(stop) -> range object" +}, +"repr": { +"name": "repr", +"module": "builtins", +"kind": "function", +"signature": "(obj, /)", +"doc": "Return the canonical string representation of the object." +}, +"reversed": { +"name": "reversed", +"module": "builtins", +"kind": "class", +"signature": "(sequence, /)", +"doc": "Return a reverse iterator over the values of the given sequence." +}, +"round": { +"name": "round", +"module": "builtins", +"kind": "function", +"signature": "(number, ndigits=None)", +"doc": "Round a number to a given precision in decimal digits." +}, +"set": { +"name": "set", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "set() -> new empty set object" +}, +"setattr": { +"name": "setattr", +"module": "builtins", +"kind": "function", +"signature": "(obj, name, value, /)", +"doc": "Sets the named attribute on the given object to the specified value." +}, +"slice": { +"name": "slice", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "slice(stop)" +}, +"sorted": { +"name": "sorted", +"module": "builtins", +"kind": "function", +"signature": "(iterable, /, *, key=None, reverse=False)", +"doc": "Return a new list containing all items from the iterable in ascending order." +}, +"staticmethod": { +"name": "staticmethod", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "staticmethod(function) -> method" +}, +"str": { +"name": "str", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "str(object='') -> str" +}, +"sum": { +"name": "sum", +"module": "builtins", +"kind": "function", +"signature": "(iterable, /, start=0)", +"doc": "Return the sum of a 'start' value (default: 0) plus an iterable of numbers" +}, +"super": { +"name": "super", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "super() -> same as super(__class__, )" +}, +"tuple": { +"name": "tuple", +"module": "builtins", +"kind": "class", +"signature": "(iterable=(), /)", +"doc": "Built-in immutable sequence." +}, +"type": { +"name": "type", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "type(object) -> the object's type" +}, +"vars": { +"name": "vars", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Show vars." +}, +"zip": { +"name": "zip", +"module": "builtins", +"kind": "class", +"signature": null, +"doc": "zip(*iterables, strict=False) --> Yield tuples until an input is exhausted." +}, +"math.acos": { +"name": "math.acos", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the arc cosine (measured in radians) of x." +}, +"math.acosh": { +"name": "math.acosh", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the inverse hyperbolic cosine of x." +}, +"math.asin": { +"name": "math.asin", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the arc sine (measured in radians) of x." +}, +"math.asinh": { +"name": "math.asinh", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the inverse hyperbolic sine of x." +}, +"math.atan": { +"name": "math.atan", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the arc tangent (measured in radians) of x." +}, +"math.atan2": { +"name": "math.atan2", +"module": "math", +"kind": "function", +"signature": "(y, x, /)", +"doc": "Return the arc tangent (measured in radians) of y/x." +}, +"math.atanh": { +"name": "math.atanh", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the inverse hyperbolic tangent of x." +}, +"math.cbrt": { +"name": "math.cbrt", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the cube root of x." +}, +"math.ceil": { +"name": "math.ceil", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the ceiling of x as an Integral." +}, +"math.comb": { +"name": "math.comb", +"module": "math", +"kind": "function", +"signature": "(n, k, /)", +"doc": "Number of ways to choose k items from n items without repetition and without order." +}, +"math.copysign": { +"name": "math.copysign", +"module": "math", +"kind": "function", +"signature": "(x, y, /)", +"doc": "Return a float with the magnitude (absolute value) of x but the sign of y." +}, +"math.cos": { +"name": "math.cos", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the cosine of x (measured in radians)." +}, +"math.cosh": { +"name": "math.cosh", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the hyperbolic cosine of x." +}, +"math.degrees": { +"name": "math.degrees", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Convert angle x from radians to degrees." +}, +"math.dist": { +"name": "math.dist", +"module": "math", +"kind": "function", +"signature": "(p, q, /)", +"doc": "Return the Euclidean distance between two points p and q." +}, +"math.erf": { +"name": "math.erf", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Error function at x." +}, +"math.erfc": { +"name": "math.erfc", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Complementary error function at x." +}, +"math.exp": { +"name": "math.exp", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return e raised to the power of x." +}, +"math.exp2": { +"name": "math.exp2", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return 2 raised to the power of x." +}, +"math.expm1": { +"name": "math.expm1", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return exp(x)-1." +}, +"math.fabs": { +"name": "math.fabs", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the absolute value of the float x." +}, +"math.factorial": { +"name": "math.factorial", +"module": "math", +"kind": "function", +"signature": "(n, /)", +"doc": "Find n!." +}, +"math.floor": { +"name": "math.floor", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the floor of x as an Integral." +}, +"math.fmod": { +"name": "math.fmod", +"module": "math", +"kind": "function", +"signature": "(x, y, /)", +"doc": "Return fmod(x, y), according to platform C." +}, +"math.frexp": { +"name": "math.frexp", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the mantissa and exponent of x, as pair (m, e)." +}, +"math.fsum": { +"name": "math.fsum", +"module": "math", +"kind": "function", +"signature": "(seq, /)", +"doc": "Return an accurate floating point sum of values in the iterable seq." +}, +"math.gamma": { +"name": "math.gamma", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Gamma function at x." +}, +"math.gcd": { +"name": "math.gcd", +"module": "math", +"kind": "function", +"signature": "(*integers)", +"doc": "Greatest Common Divisor." +}, +"math.hypot": { +"name": "math.hypot", +"module": "math", +"kind": "function", +"signature": null, +"doc": "hypot(*coordinates) -> value" +}, +"math.isclose": { +"name": "math.isclose", +"module": "math", +"kind": "function", +"signature": "(a, b, *, rel_tol=1e-09, abs_tol=0.0)", +"doc": "Determine whether two floating point numbers are close in value." +}, +"math.isfinite": { +"name": "math.isfinite", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return True if x is neither an infinity nor a NaN, and False otherwise." +}, +"math.isinf": { +"name": "math.isinf", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return True if x is a positive or negative infinity, and False otherwise." +}, +"math.isnan": { +"name": "math.isnan", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return True if x is a NaN (not a number), and False otherwise." +}, +"math.isqrt": { +"name": "math.isqrt", +"module": "math", +"kind": "function", +"signature": "(n, /)", +"doc": "Return the integer part of the square root of the input." +}, +"math.lcm": { +"name": "math.lcm", +"module": "math", +"kind": "function", +"signature": "(*integers)", +"doc": "Least Common Multiple." +}, +"math.ldexp": { +"name": "math.ldexp", +"module": "math", +"kind": "function", +"signature": "(x, i, /)", +"doc": "Return x * (2**i)." +}, +"math.lgamma": { +"name": "math.lgamma", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Natural logarithm of absolute value of Gamma function at x." +}, +"math.log": { +"name": "math.log", +"module": "math", +"kind": "function", +"signature": null, +"doc": "log(x, [base=math.e])" +}, +"math.log10": { +"name": "math.log10", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the base 10 logarithm of x." +}, +"math.log1p": { +"name": "math.log1p", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the natural logarithm of 1+x (base e)." +}, +"math.log2": { +"name": "math.log2", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the base 2 logarithm of x." +}, +"math.modf": { +"name": "math.modf", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the fractional and integer parts of x." +}, +"math.nextafter": { +"name": "math.nextafter", +"module": "math", +"kind": "function", +"signature": "(x, y, /, *, steps=None)", +"doc": "Return the floating-point value the given number of steps after x towards y." +}, +"math.perm": { +"name": "math.perm", +"module": "math", +"kind": "function", +"signature": "(n, k=None, /)", +"doc": "Number of ways to choose k items from n items without repetition and with order." +}, +"math.pow": { +"name": "math.pow", +"module": "math", +"kind": "function", +"signature": "(x, y, /)", +"doc": "Return x**y (x to the power of y)." +}, +"math.prod": { +"name": "math.prod", +"module": "math", +"kind": "function", +"signature": "(iterable, /, *, start=1)", +"doc": "Calculate the product of all the elements in the input iterable." +}, +"math.radians": { +"name": "math.radians", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Convert angle x from degrees to radians." +}, +"math.remainder": { +"name": "math.remainder", +"module": "math", +"kind": "function", +"signature": "(x, y, /)", +"doc": "Difference between x and the closest integer multiple of y." +}, +"math.sin": { +"name": "math.sin", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the sine of x (measured in radians)." +}, +"math.sinh": { +"name": "math.sinh", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the hyperbolic sine of x." +}, +"math.sqrt": { +"name": "math.sqrt", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the square root of x." +}, +"math.sumprod": { +"name": "math.sumprod", +"module": "math", +"kind": "function", +"signature": "(p, q, /)", +"doc": "Return the sum of products of values from two iterables p and q." +}, +"math.tan": { +"name": "math.tan", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the tangent of x (measured in radians)." +}, +"math.tanh": { +"name": "math.tanh", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the hyperbolic tangent of x." +}, +"math.trunc": { +"name": "math.trunc", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Truncates the Real x to the nearest Integral toward 0." +}, +"math.ulp": { +"name": "math.ulp", +"module": "math", +"kind": "function", +"signature": "(x, /)", +"doc": "Return the value of the least significant bit of the float x." +}, +"statistics.LinearRegression": { +"name": "statistics.LinearRegression", +"module": "statistics", +"kind": "class", +"signature": "(slope, intercept)", +"doc": "LinearRegression(slope, intercept)" +}, +"statistics.NormalDist": { +"name": "statistics.NormalDist", +"module": "statistics", +"kind": "class", +"signature": "(mu=0.0, sigma=1.0)", +"doc": "Normal distribution of a random variable" +}, +"statistics.StatisticsError": { +"name": "statistics.StatisticsError", +"module": "statistics", +"kind": "class", +"signature": null, +"doc": "Inappropriate argument value (of correct type)." +}, +"statistics.correlation": { +"name": "statistics.correlation", +"module": "statistics", +"kind": "function", +"signature": "(x, y, /, *, method='linear')", +"doc": "Pearson's correlation coefficient" +}, +"statistics.covariance": { +"name": "statistics.covariance", +"module": "statistics", +"kind": "function", +"signature": "(x, y, /)", +"doc": "Covariance" +}, +"statistics.fmean": { +"name": "statistics.fmean", +"module": "statistics", +"kind": "function", +"signature": "(data, weights=None)", +"doc": "Convert data to floats and compute the arithmetic mean." +}, +"statistics.geometric_mean": { +"name": "statistics.geometric_mean", +"module": "statistics", +"kind": "function", +"signature": "(data)", +"doc": "Convert data to floats and compute the geometric mean." +}, +"statistics.harmonic_mean": { +"name": "statistics.harmonic_mean", +"module": "statistics", +"kind": "function", +"signature": "(data, weights=None)", +"doc": "Return the harmonic mean of data." +}, +"statistics.linear_regression": { +"name": "statistics.linear_regression", +"module": "statistics", +"kind": "function", +"signature": "(x, y, /, *, proportional=False)", +"doc": "Slope and intercept for simple linear regression." +}, +"statistics.mean": { +"name": "statistics.mean", +"module": "statistics", +"kind": "function", +"signature": "(data)", +"doc": "Return the sample arithmetic mean of data." +}, +"statistics.median": { +"name": "statistics.median", +"module": "statistics", +"kind": "function", +"signature": "(data)", +"doc": "Return the median (middle value) of numeric data." +}, +"statistics.median_grouped": { +"name": "statistics.median_grouped", +"module": "statistics", +"kind": "function", +"signature": "(data, interval=1.0)", +"doc": "Estimates the median for numeric data binned around the midpoints" +}, +"statistics.median_high": { +"name": "statistics.median_high", +"module": "statistics", +"kind": "function", +"signature": "(data)", +"doc": "Return the high median of data." +}, +"statistics.median_low": { +"name": "statistics.median_low", +"module": "statistics", +"kind": "function", +"signature": "(data)", +"doc": "Return the low median of numeric data." +}, +"statistics.mode": { +"name": "statistics.mode", +"module": "statistics", +"kind": "function", +"signature": "(data)", +"doc": "Return the most common data point from discrete or nominal data." +}, +"statistics.multimode": { +"name": "statistics.multimode", +"module": "statistics", +"kind": "function", +"signature": "(data)", +"doc": "Return a list of the most frequently occurring values." +}, +"statistics.pstdev": { +"name": "statistics.pstdev", +"module": "statistics", +"kind": "function", +"signature": "(data, mu=None)", +"doc": "Return the square root of the population variance." +}, +"statistics.pvariance": { +"name": "statistics.pvariance", +"module": "statistics", +"kind": "function", +"signature": "(data, mu=None)", +"doc": "Return the population variance of ``data``." +}, +"statistics.quantiles": { +"name": "statistics.quantiles", +"module": "statistics", +"kind": "function", +"signature": "(data, *, n=4, method='exclusive')", +"doc": "Divide *data* into *n* continuous intervals with equal probability." +}, +"statistics.stdev": { +"name": "statistics.stdev", +"module": "statistics", +"kind": "function", +"signature": "(data, xbar=None)", +"doc": "Return the square root of the sample variance." +}, +"statistics.variance": { +"name": "statistics.variance", +"module": "statistics", +"kind": "function", +"signature": "(data, xbar=None)", +"doc": "Return the sample variance of data." +}, +"random.Random": { +"name": "random.Random", +"module": "random", +"kind": "class", +"signature": "(x=None)", +"doc": "Random number generator base class used by bound module functions." +}, +"random.SystemRandom": { +"name": "random.SystemRandom", +"module": "random", +"kind": "class", +"signature": "(x=None)", +"doc": "Alternate random number generator using sources provided" +}, +"random.betavariate": { +"name": "random.betavariate", +"module": "random", +"kind": "function", +"signature": "(alpha, beta)", +"doc": "Beta distribution." +}, +"random.binomialvariate": { +"name": "random.binomialvariate", +"module": "random", +"kind": "function", +"signature": "(n=1, p=0.5)", +"doc": "Binomial random variable." +}, +"random.choice": { +"name": "random.choice", +"module": "random", +"kind": "function", +"signature": "(seq)", +"doc": "Choose a random element from a non-empty sequence." +}, +"random.choices": { +"name": "random.choices", +"module": "random", +"kind": "function", +"signature": "(population, weights=None, *, cum_weights=None, k=1)", +"doc": "Return a k sized list of population elements chosen with replacement." +}, +"random.expovariate": { +"name": "random.expovariate", +"module": "random", +"kind": "function", +"signature": "(lambd=1.0)", +"doc": "Exponential distribution." +}, +"random.gammavariate": { +"name": "random.gammavariate", +"module": "random", +"kind": "function", +"signature": "(alpha, beta)", +"doc": "Gamma distribution. Not the gamma function!" +}, +"random.gauss": { +"name": "random.gauss", +"module": "random", +"kind": "function", +"signature": "(mu=0.0, sigma=1.0)", +"doc": "Gaussian distribution." +}, +"random.getrandbits": { +"name": "random.getrandbits", +"module": "random", +"kind": "function", +"signature": "(k, /)", +"doc": "getrandbits(k) -> x. Generates an int with k random bits." +}, +"random.getstate": { +"name": "random.getstate", +"module": "random", +"kind": "function", +"signature": "()", +"doc": "Return internal state; can be passed to setstate() later." +}, +"random.lognormvariate": { +"name": "random.lognormvariate", +"module": "random", +"kind": "function", +"signature": "(mu, sigma)", +"doc": "Log normal distribution." +}, +"random.normalvariate": { +"name": "random.normalvariate", +"module": "random", +"kind": "function", +"signature": "(mu=0.0, sigma=1.0)", +"doc": "Normal distribution." +}, +"random.paretovariate": { +"name": "random.paretovariate", +"module": "random", +"kind": "function", +"signature": "(alpha)", +"doc": "Pareto distribution. alpha is the shape parameter." +}, +"random.randbytes": { +"name": "random.randbytes", +"module": "random", +"kind": "function", +"signature": "(n)", +"doc": "Generate n random bytes." +}, +"random.randint": { +"name": "random.randint", +"module": "random", +"kind": "function", +"signature": "(a, b)", +"doc": "Return random integer in range [a, b], including both end points." +}, +"random.random": { +"name": "random.random", +"module": "random", +"kind": "function", +"signature": "()", +"doc": "random() -> x in the interval [0, 1)." +}, +"random.randrange": { +"name": "random.randrange", +"module": "random", +"kind": "function", +"signature": "(start, stop=None, step=1)", +"doc": "Choose a random item from range(stop) or range(start, stop[, step])." +}, +"random.sample": { +"name": "random.sample", +"module": "random", +"kind": "function", +"signature": "(population, k, *, counts=None)", +"doc": "Chooses k unique random elements from a population sequence." +}, +"random.seed": { +"name": "random.seed", +"module": "random", +"kind": "function", +"signature": "(a=None, version=2)", +"doc": "Initialize internal state from a seed." +}, +"random.setstate": { +"name": "random.setstate", +"module": "random", +"kind": "function", +"signature": "(state)", +"doc": "Restore internal state from object returned by getstate()." +}, +"random.shuffle": { +"name": "random.shuffle", +"module": "random", +"kind": "function", +"signature": "(x)", +"doc": "Shuffle list x in place, and return None." +}, +"random.triangular": { +"name": "random.triangular", +"module": "random", +"kind": "function", +"signature": "(low=0.0, high=1.0, mode=None)", +"doc": "Triangular distribution." +}, +"random.uniform": { +"name": "random.uniform", +"module": "random", +"kind": "function", +"signature": "(a, b)", +"doc": "Get a random number in the range [a, b) or [a, b] depending on rounding." +}, +"random.vonmisesvariate": { +"name": "random.vonmisesvariate", +"module": "random", +"kind": "function", +"signature": "(mu, kappa)", +"doc": "Circular data distribution." +}, +"random.weibullvariate": { +"name": "random.weibullvariate", +"module": "random", +"kind": "function", +"signature": "(alpha, beta)", +"doc": "Weibull distribution." +}, +"string.Formatter": { +"name": "string.Formatter", +"module": "string", +"kind": "class", +"signature": "()", +"doc": "" +}, +"string.Template": { +"name": "string.Template", +"module": "string", +"kind": "class", +"signature": "(template)", +"doc": "A string class for supporting $-substitutions." +}, +"string.capwords": { +"name": "string.capwords", +"module": "string", +"kind": "function", +"signature": "(s, sep=None)", +"doc": "capwords(s [,sep]) -> string" +}, +"re.Match": { +"name": "re.Match", +"module": "re", +"kind": "class", +"signature": "()", +"doc": "The result of re.match() and re.search()." +}, +"re.Pattern": { +"name": "re.Pattern", +"module": "re", +"kind": "class", +"signature": "()", +"doc": "Compiled regular expression object." +}, +"re.RegexFlag": { +"name": "re.RegexFlag", +"module": "re", +"kind": "class", +"signature": "(*values)", +"doc": "An enumeration." +}, +"re.Scanner": { +"name": "re.Scanner", +"module": "re", +"kind": "class", +"signature": "(lexicon, flags=0)", +"doc": "" +}, +"re.compile": { +"name": "re.compile", +"module": "re", +"kind": "function", +"signature": "(pattern, flags=0)", +"doc": "Compile a regular expression pattern, returning a Pattern object." +}, +"re.error": { +"name": "re.error", +"module": "re", +"kind": "class", +"signature": "(msg, pattern=None, pos=None)", +"doc": "Exception raised for invalid regular expressions." +}, +"re.escape": { +"name": "re.escape", +"module": "re", +"kind": "function", +"signature": "(pattern)", +"doc": "Escape special characters in a string." +}, +"re.findall": { +"name": "re.findall", +"module": "re", +"kind": "function", +"signature": "(pattern, string, flags=0)", +"doc": "Return a list of all non-overlapping matches in the string." +}, +"re.finditer": { +"name": "re.finditer", +"module": "re", +"kind": "function", +"signature": "(pattern, string, flags=0)", +"doc": "Return an iterator over all non-overlapping matches in the" +}, +"re.fullmatch": { +"name": "re.fullmatch", +"module": "re", +"kind": "function", +"signature": "(pattern, string, flags=0)", +"doc": "Try to apply the pattern to all of the string, returning" +}, +"re.match": { +"name": "re.match", +"module": "re", +"kind": "function", +"signature": "(pattern, string, flags=0)", +"doc": "Try to apply the pattern at the start of the string, returning" +}, +"re.purge": { +"name": "re.purge", +"module": "re", +"kind": "function", +"signature": "()", +"doc": "Clear the regular expression caches" +}, +"re.search": { +"name": "re.search", +"module": "re", +"kind": "function", +"signature": "(pattern, string, flags=0)", +"doc": "Scan through string looking for a match to the pattern, returning" +}, +"re.split": { +"name": "re.split", +"module": "re", +"kind": "function", +"signature": "(pattern, string, maxsplit=0, flags=0)", +"doc": "Split the source string by the occurrences of the pattern," +}, +"re.sub": { +"name": "re.sub", +"module": "re", +"kind": "function", +"signature": "(pattern, repl, string, count=0, flags=0)", +"doc": "Return the string obtained by replacing the leftmost" +}, +"re.subn": { +"name": "re.subn", +"module": "re", +"kind": "function", +"signature": "(pattern, repl, string, count=0, flags=0)", +"doc": "Return a 2-tuple containing (new_string, number)." +}, +"re.template": { +"name": "re.template", +"module": "re", +"kind": "function", +"signature": "(pattern, flags=0)", +"doc": "Compile a template pattern, returning a Pattern object, deprecated" +}, +"json.JSONDecodeError": { +"name": "json.JSONDecodeError", +"module": "json", +"kind": "class", +"signature": "(msg, doc, pos)", +"doc": "Subclass of ValueError with the following additional properties:" +}, +"json.JSONDecoder": { +"name": "json.JSONDecoder", +"module": "json", +"kind": "class", +"signature": "(*, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True, object_pairs_hook=None)", +"doc": "Simple JSON decoder" +}, +"json.JSONEncoder": { +"name": "json.JSONEncoder", +"module": "json", +"kind": "class", +"signature": "(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)", +"doc": "Extensible JSON encoder for Python data structures." +}, +"json.detect_encoding": { +"name": "json.detect_encoding", +"module": "json", +"kind": "function", +"signature": "(b)", +"doc": "" +}, +"json.dump": { +"name": "json.dump", +"module": "json", +"kind": "function", +"signature": "(obj, fp, *, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, default=None, sort_keys=False, **kw)", +"doc": "Serialize ``obj`` as a JSON formatted stream to ``fp`` (a" +}, +"json.dumps": { +"name": "json.dumps", +"module": "json", +"kind": "function", +"signature": "(obj, *, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, default=None, sort_keys=False, **kw)", +"doc": "Serialize ``obj`` to a JSON formatted ``str``." +}, +"json.load": { +"name": "json.load", +"module": "json", +"kind": "function", +"signature": "(fp, *, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)", +"doc": "Deserialize ``fp`` (a ``.read()``-supporting file-like object containing" +}, +"json.loads": { +"name": "json.loads", +"module": "json", +"kind": "function", +"signature": "(s, *, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)", +"doc": "Deserialize ``s`` (a ``str``, ``bytes`` or ``bytearray`` instance" +}, +"os.PathLike": { +"name": "os.PathLike", +"module": "os", +"kind": "class", +"signature": "()", +"doc": "Abstract base class for implementing the file system path protocol." +}, +"os.execl": { +"name": "os.execl", +"module": "os", +"kind": "function", +"signature": "(file, *args)", +"doc": "execl(file, *args)" +}, +"os.execle": { +"name": "os.execle", +"module": "os", +"kind": "function", +"signature": "(file, *args)", +"doc": "execle(file, *args, env)" +}, +"os.execlp": { +"name": "os.execlp", +"module": "os", +"kind": "function", +"signature": "(file, *args)", +"doc": "execlp(file, *args)" +}, +"os.execlpe": { +"name": "os.execlpe", +"module": "os", +"kind": "function", +"signature": "(file, *args)", +"doc": "execlpe(file, *args, env)" +}, +"os.execvp": { +"name": "os.execvp", +"module": "os", +"kind": "function", +"signature": "(file, args)", +"doc": "execvp(file, args)" +}, +"os.execvpe": { +"name": "os.execvpe", +"module": "os", +"kind": "function", +"signature": "(file, args, env)", +"doc": "execvpe(file, args, env)" +}, +"os.fdopen": { +"name": "os.fdopen", +"module": "os", +"kind": "function", +"signature": "(fd, mode='r', buffering=-1, encoding=None, *args, **kwargs)", +"doc": "" +}, +"os.fsdecode": { +"name": "os.fsdecode", +"module": "os", +"kind": "function", +"signature": "(filename)", +"doc": "Decode filename (an os.PathLike, bytes, or str) from the filesystem" +}, +"os.fsencode": { +"name": "os.fsencode", +"module": "os", +"kind": "function", +"signature": "(filename)", +"doc": "Encode filename (an os.PathLike, bytes, or str) to the filesystem" +}, +"os.fwalk": { +"name": "os.fwalk", +"module": "os", +"kind": "function", +"signature": "(top='.', topdown=True, onerror=None, *, follow_symlinks=False, dir_fd=None)", +"doc": "Directory tree generator." +}, +"os.get_exec_path": { +"name": "os.get_exec_path", +"module": "os", +"kind": "function", +"signature": "(env=None)", +"doc": "Returns the sequence of directories that will be searched for the" +}, +"os.getenv": { +"name": "os.getenv", +"module": "os", +"kind": "function", +"signature": "(key, default=None)", +"doc": "Get an environment variable, return None if it doesn't exist." +}, +"os.getenvb": { +"name": "os.getenvb", +"module": "os", +"kind": "function", +"signature": "(key, default=None)", +"doc": "Get an environment variable, return None if it doesn't exist." +}, +"os.makedirs": { +"name": "os.makedirs", +"module": "os", +"kind": "function", +"signature": "(name, mode=511, exist_ok=False)", +"doc": "makedirs(name [, mode=0o777][, exist_ok=False])" +}, +"os.popen": { +"name": "os.popen", +"module": "os", +"kind": "function", +"signature": "(cmd, mode='r', buffering=-1)", +"doc": "" +}, +"os.removedirs": { +"name": "os.removedirs", +"module": "os", +"kind": "function", +"signature": "(name)", +"doc": "removedirs(name)" +}, +"os.renames": { +"name": "os.renames", +"module": "os", +"kind": "function", +"signature": "(old, new)", +"doc": "renames(old, new)" +}, +"os.spawnl": { +"name": "os.spawnl", +"module": "os", +"kind": "function", +"signature": "(mode, file, *args)", +"doc": "spawnl(mode, file, *args) -> integer" +}, +"os.spawnle": { +"name": "os.spawnle", +"module": "os", +"kind": "function", +"signature": "(mode, file, *args)", +"doc": "spawnle(mode, file, *args, env) -> integer" +}, +"os.spawnlp": { +"name": "os.spawnlp", +"module": "os", +"kind": "function", +"signature": "(mode, file, *args)", +"doc": "spawnlp(mode, file, *args) -> integer" +}, +"os.spawnlpe": { +"name": "os.spawnlpe", +"module": "os", +"kind": "function", +"signature": "(mode, file, *args)", +"doc": "spawnlpe(mode, file, *args, env) -> integer" +}, +"os.spawnv": { +"name": "os.spawnv", +"module": "os", +"kind": "function", +"signature": "(mode, file, args)", +"doc": "spawnv(mode, file, args) -> integer" +}, +"os.spawnve": { +"name": "os.spawnve", +"module": "os", +"kind": "function", +"signature": "(mode, file, args, env)", +"doc": "spawnve(mode, file, args, env) -> integer" +}, +"os.spawnvp": { +"name": "os.spawnvp", +"module": "os", +"kind": "function", +"signature": "(mode, file, args)", +"doc": "spawnvp(mode, file, args) -> integer" +}, +"os.spawnvpe": { +"name": "os.spawnvpe", +"module": "os", +"kind": "function", +"signature": "(mode, file, args, env)", +"doc": "spawnvpe(mode, file, args, env) -> integer" +}, +"os.stat_result": { +"name": "os.stat_result", +"module": "os", +"kind": "class", +"signature": "(iterable=(), /)", +"doc": "stat_result: Result from stat, fstat, or lstat." +}, +"os.statvfs_result": { +"name": "os.statvfs_result", +"module": "os", +"kind": "class", +"signature": "(iterable=(), /)", +"doc": "statvfs_result: Result from statvfs or fstatvfs." +}, +"os.terminal_size": { +"name": "os.terminal_size", +"module": "os", +"kind": "class", +"signature": "(iterable=(), /)", +"doc": "A tuple of (columns, lines) for holding terminal window size" +}, +"os.walk": { +"name": "os.walk", +"module": "os", +"kind": "function", +"signature": "(top, topdown=True, onerror=None, followlinks=False)", +"doc": "Directory tree generator." +}, +"os.path.abspath": { +"name": "os.path.abspath", +"module": "os.path", +"kind": "function", +"signature": "(path)", +"doc": "Return an absolute path." +}, +"os.path.basename": { +"name": "os.path.basename", +"module": "os.path", +"kind": "function", +"signature": "(p)", +"doc": "Returns the final component of a pathname" +}, +"os.path.commonpath": { +"name": "os.path.commonpath", +"module": "os.path", +"kind": "function", +"signature": "(paths)", +"doc": "Given a sequence of path names, returns the longest common sub-path." +}, +"os.path.commonprefix": { +"name": "os.path.commonprefix", +"module": "os.path", +"kind": "function", +"signature": "(m)", +"doc": "Given a list of pathnames, returns the longest common leading component" +}, +"os.path.dirname": { +"name": "os.path.dirname", +"module": "os.path", +"kind": "function", +"signature": "(p)", +"doc": "Returns the directory component of a pathname" +}, +"os.path.exists": { +"name": "os.path.exists", +"module": "os.path", +"kind": "function", +"signature": "(path)", +"doc": "Test whether a path exists. Returns False for broken symbolic links" +}, +"os.path.expanduser": { +"name": "os.path.expanduser", +"module": "os.path", +"kind": "function", +"signature": "(path)", +"doc": "Expand ~ and ~user constructions. If user or $HOME is unknown," +}, +"os.path.expandvars": { +"name": "os.path.expandvars", +"module": "os.path", +"kind": "function", +"signature": "(path)", +"doc": "Expand shell variables of form $var and ${var}. Unknown variables" +}, +"os.path.getatime": { +"name": "os.path.getatime", +"module": "os.path", +"kind": "function", +"signature": "(filename)", +"doc": "Return the last access time of a file, reported by os.stat()." +}, +"os.path.getctime": { +"name": "os.path.getctime", +"module": "os.path", +"kind": "function", +"signature": "(filename)", +"doc": "Return the metadata change time of a file, reported by os.stat()." +}, +"os.path.getmtime": { +"name": "os.path.getmtime", +"module": "os.path", +"kind": "function", +"signature": "(filename)", +"doc": "Return the last modification time of a file, reported by os.stat()." +}, +"os.path.getsize": { +"name": "os.path.getsize", +"module": "os.path", +"kind": "function", +"signature": "(filename)", +"doc": "Return the size of a file, reported by os.stat()." +}, +"os.path.isabs": { +"name": "os.path.isabs", +"module": "os.path", +"kind": "function", +"signature": "(s)", +"doc": "Test whether a path is absolute" +}, +"os.path.isdir": { +"name": "os.path.isdir", +"module": "os.path", +"kind": "function", +"signature": "(s)", +"doc": "Return true if the pathname refers to an existing directory." +}, +"os.path.isfile": { +"name": "os.path.isfile", +"module": "os.path", +"kind": "function", +"signature": "(path)", +"doc": "Test whether a path is a regular file" +}, +"os.path.isjunction": { +"name": "os.path.isjunction", +"module": "os.path", +"kind": "function", +"signature": "(path)", +"doc": "Test whether a path is a junction" +}, +"os.path.islink": { +"name": "os.path.islink", +"module": "os.path", +"kind": "function", +"signature": "(path)", +"doc": "Test whether a path is a symbolic link" +}, +"os.path.ismount": { +"name": "os.path.ismount", +"module": "os.path", +"kind": "function", +"signature": "(path)", +"doc": "Test whether a path is a mount point" +}, +"os.path.join": { +"name": "os.path.join", +"module": "os.path", +"kind": "function", +"signature": "(a, *p)", +"doc": "Join two or more pathname components, inserting '/' as needed." +}, +"os.path.lexists": { +"name": "os.path.lexists", +"module": "os.path", +"kind": "function", +"signature": "(path)", +"doc": "Test whether a path exists. Returns True for broken symbolic links" +}, +"os.path.normcase": { +"name": "os.path.normcase", +"module": "os.path", +"kind": "function", +"signature": "(s)", +"doc": "Normalize case of pathname. Has no effect under Posix" +}, +"os.path.normpath": { +"name": "os.path.normpath", +"module": "os.path", +"kind": "function", +"signature": "(path)", +"doc": "Normalize path, eliminating double slashes, etc." +}, +"os.path.realpath": { +"name": "os.path.realpath", +"module": "os.path", +"kind": "function", +"signature": "(filename, *, strict=False)", +"doc": "Return the canonical path of the specified filename, eliminating any" +}, +"os.path.relpath": { +"name": "os.path.relpath", +"module": "os.path", +"kind": "function", +"signature": "(path, start=None)", +"doc": "Return a relative version of a path" +}, +"os.path.samefile": { +"name": "os.path.samefile", +"module": "os.path", +"kind": "function", +"signature": "(f1, f2)", +"doc": "Test whether two pathnames reference the same actual file or directory" +}, +"os.path.sameopenfile": { +"name": "os.path.sameopenfile", +"module": "os.path", +"kind": "function", +"signature": "(fp1, fp2)", +"doc": "Test whether two open file objects reference the same file" +}, +"os.path.samestat": { +"name": "os.path.samestat", +"module": "os.path", +"kind": "function", +"signature": "(s1, s2)", +"doc": "Test whether two stat buffers reference the same file" +}, +"os.path.split": { +"name": "os.path.split", +"module": "os.path", +"kind": "function", +"signature": "(p)", +"doc": "Split a pathname. Returns tuple \"(head, tail)\" where \"tail\" is" +}, +"os.path.splitdrive": { +"name": "os.path.splitdrive", +"module": "os.path", +"kind": "function", +"signature": "(p)", +"doc": "Split a pathname into drive and path. On Posix, drive is always" +}, +"os.path.splitext": { +"name": "os.path.splitext", +"module": "os.path", +"kind": "function", +"signature": "(p)", +"doc": "Split the extension from a pathname." +}, +"os.path.splitroot": { +"name": "os.path.splitroot", +"module": "os.path", +"kind": "function", +"signature": "(p)", +"doc": "Split a pathname into drive, root and tail. On Posix, drive is always" +}, +"sys.activate_stack_trampoline": { +"name": "sys.activate_stack_trampoline", +"module": "sys", +"kind": "function", +"signature": "(backend, /)", +"doc": "Activate stack profiler trampoline *backend*." +}, +"sys.addaudithook": { +"name": "sys.addaudithook", +"module": "sys", +"kind": "function", +"signature": "(hook)", +"doc": "Adds a new audit hook callback." +}, +"sys.audit": { +"name": "sys.audit", +"module": "sys", +"kind": "function", +"signature": null, +"doc": "audit(event, *args)" +}, +"sys.breakpointhook": { +"name": "sys.breakpointhook", +"module": "sys", +"kind": "function", +"signature": null, +"doc": "breakpointhook(*args, **kws)" +}, +"sys.call_tracing": { +"name": "sys.call_tracing", +"module": "sys", +"kind": "function", +"signature": "(func, args, /)", +"doc": "Call func(*args), while tracing is enabled." +}, +"sys.deactivate_stack_trampoline": { +"name": "sys.deactivate_stack_trampoline", +"module": "sys", +"kind": "function", +"signature": "()", +"doc": "Deactivate the current stack profiler trampoline backend." +}, +"sys.displayhook": { +"name": "sys.displayhook", +"module": "sys", +"kind": "function", +"signature": "(object, /)", +"doc": "Print an object to sys.stdout and also save it in builtins._" +}, +"sys.exc_info": { +"name": "sys.exc_info", +"module": "sys", +"kind": "function", +"signature": "()", +"doc": "Return current exception information: (type, value, traceback)." +}, +"sys.exception": { +"name": "sys.exception", +"module": "sys", +"kind": "function", +"signature": "()", +"doc": "Return the current exception." +}, +"sys.exit": { +"name": "sys.exit", +"module": "sys", +"kind": "function", +"signature": "(status=None, /)", +"doc": "Exit the interpreter by raising SystemExit(status)." +}, +"sys.get_asyncgen_hooks": { +"name": "sys.get_asyncgen_hooks", +"module": "sys", +"kind": "function", +"signature": "()", +"doc": "Return the installed asynchronous generators hooks." +}, +"sys.get_coroutine_origin_tracking_depth": { +"name": "sys.get_coroutine_origin_tracking_depth", +"module": "sys", +"kind": "function", +"signature": "()", +"doc": "Check status of origin tracking for coroutine objects in this thread." +}, +"sys.get_int_max_str_digits": { +"name": "sys.get_int_max_str_digits", +"module": "sys", +"kind": "function", +"signature": "()", +"doc": "Return the maximum string digits limit for non-binary int<->str conversions." +}, +"sys.getallocatedblocks": { +"name": "sys.getallocatedblocks", +"module": "sys", +"kind": "function", +"signature": "()", +"doc": "Return the number of memory blocks currently allocated." +}, +"sys.getdefaultencoding": { +"name": "sys.getdefaultencoding", +"module": "sys", +"kind": "function", +"signature": "()", +"doc": "Return the current default encoding used by the Unicode implementation." +}, +"sys.getdlopenflags": { +"name": "sys.getdlopenflags", +"module": "sys", +"kind": "function", +"signature": "()", +"doc": "Return the current value of the flags that are used for dlopen calls." +}, +"sys.getfilesystemencodeerrors": { +"name": "sys.getfilesystemencodeerrors", +"module": "sys", +"kind": "function", +"signature": "()", +"doc": "Return the error mode used Unicode to OS filename conversion." +}, +"sys.getfilesystemencoding": { +"name": "sys.getfilesystemencoding", +"module": "sys", +"kind": "function", +"signature": "()", +"doc": "Return the encoding used to convert Unicode filenames to OS filenames." +}, +"sys.getprofile": { +"name": "sys.getprofile", +"module": "sys", +"kind": "function", +"signature": "()", +"doc": "Return the profiling function set with sys.setprofile." +}, +"sys.getrecursionlimit": { +"name": "sys.getrecursionlimit", +"module": "sys", +"kind": "function", +"signature": "()", +"doc": "Return the current value of the recursion limit." +}, +"sys.getrefcount": { +"name": "sys.getrefcount", +"module": "sys", +"kind": "function", +"signature": "(object, /)", +"doc": "Return the reference count of object." +}, +"sys.getsizeof": { +"name": "sys.getsizeof", +"module": "sys", +"kind": "function", +"signature": null, +"doc": "getsizeof(object [, default]) -> int" +}, +"sys.getswitchinterval": { +"name": "sys.getswitchinterval", +"module": "sys", +"kind": "function", +"signature": "()", +"doc": "Return the current thread switch interval; see sys.setswitchinterval()." +}, +"sys.gettrace": { +"name": "sys.gettrace", +"module": "sys", +"kind": "function", +"signature": "()", +"doc": "Return the global debug tracing function set with sys.settrace." +}, +"sys.getunicodeinternedsize": { +"name": "sys.getunicodeinternedsize", +"module": "sys", +"kind": "function", +"signature": "()", +"doc": "Return the number of elements of the unicode interned dictionary" +}, +"sys.intern": { +"name": "sys.intern", +"module": "sys", +"kind": "function", +"signature": "(string, /)", +"doc": "``Intern'' the given string." +}, +"sys.is_finalizing": { +"name": "sys.is_finalizing", +"module": "sys", +"kind": "function", +"signature": "()", +"doc": "Return True if Python is exiting." +}, +"sys.is_stack_trampoline_active": { +"name": "sys.is_stack_trampoline_active", +"module": "sys", +"kind": "function", +"signature": "()", +"doc": "Return *True* if a stack profiler trampoline is active." +}, +"sys.set_asyncgen_hooks": { +"name": "sys.set_asyncgen_hooks", +"module": "sys", +"kind": "function", +"signature": null, +"doc": "set_asyncgen_hooks([firstiter] [, finalizer])" +}, +"sys.set_coroutine_origin_tracking_depth": { +"name": "sys.set_coroutine_origin_tracking_depth", +"module": "sys", +"kind": "function", +"signature": "(depth)", +"doc": "Enable or disable origin tracking for coroutine objects in this thread." +}, +"sys.set_int_max_str_digits": { +"name": "sys.set_int_max_str_digits", +"module": "sys", +"kind": "function", +"signature": "(maxdigits)", +"doc": "Set the maximum string digits limit for non-binary int<->str conversions." +}, +"sys.setdlopenflags": { +"name": "sys.setdlopenflags", +"module": "sys", +"kind": "function", +"signature": "(flags, /)", +"doc": "Set the flags used by the interpreter for dlopen calls." +}, +"sys.setprofile": { +"name": "sys.setprofile", +"module": "sys", +"kind": "function", +"signature": null, +"doc": "setprofile(function)" +}, +"sys.setrecursionlimit": { +"name": "sys.setrecursionlimit", +"module": "sys", +"kind": "function", +"signature": "(limit, /)", +"doc": "Set the maximum depth of the Python interpreter stack to n." +}, +"sys.setswitchinterval": { +"name": "sys.setswitchinterval", +"module": "sys", +"kind": "function", +"signature": "(interval, /)", +"doc": "Set the ideal thread switching delay inside the Python interpreter." +}, +"sys.settrace": { +"name": "sys.settrace", +"module": "sys", +"kind": "function", +"signature": null, +"doc": "settrace(function)" +}, +"sys.unraisablehook": { +"name": "sys.unraisablehook", +"module": "sys", +"kind": "function", +"signature": "(unraisable, /)", +"doc": "Handle an unraisable exception." +}, +"time.asctime": { +"name": "time.asctime", +"module": "time", +"kind": "function", +"signature": null, +"doc": "asctime([tuple]) -> string" +}, +"time.clock_getres": { +"name": "time.clock_getres", +"module": "time", +"kind": "function", +"signature": null, +"doc": "clock_getres(clk_id) -> floating point number" +}, +"time.clock_gettime": { +"name": "time.clock_gettime", +"module": "time", +"kind": "function", +"signature": null, +"doc": "clock_gettime(clk_id) -> float" +}, +"time.clock_gettime_ns": { +"name": "time.clock_gettime_ns", +"module": "time", +"kind": "function", +"signature": null, +"doc": "clock_gettime_ns(clk_id) -> int" +}, +"time.clock_settime": { +"name": "time.clock_settime", +"module": "time", +"kind": "function", +"signature": null, +"doc": "clock_settime(clk_id, time)" +}, +"time.clock_settime_ns": { +"name": "time.clock_settime_ns", +"module": "time", +"kind": "function", +"signature": null, +"doc": "clock_settime_ns(clk_id, time)" +}, +"time.ctime": { +"name": "time.ctime", +"module": "time", +"kind": "function", +"signature": null, +"doc": "ctime(seconds) -> string" +}, +"time.get_clock_info": { +"name": "time.get_clock_info", +"module": "time", +"kind": "function", +"signature": null, +"doc": "get_clock_info(name: str) -> dict" +}, +"time.gmtime": { +"name": "time.gmtime", +"module": "time", +"kind": "function", +"signature": null, +"doc": "gmtime([seconds]) -> (tm_year, tm_mon, tm_mday, tm_hour, tm_min," +}, +"time.localtime": { +"name": "time.localtime", +"module": "time", +"kind": "function", +"signature": null, +"doc": "localtime([seconds]) -> (tm_year,tm_mon,tm_mday,tm_hour,tm_min," +}, +"time.mktime": { +"name": "time.mktime", +"module": "time", +"kind": "function", +"signature": null, +"doc": "mktime(tuple) -> floating point number" +}, +"time.monotonic": { +"name": "time.monotonic", +"module": "time", +"kind": "function", +"signature": null, +"doc": "monotonic() -> float" +}, +"time.monotonic_ns": { +"name": "time.monotonic_ns", +"module": "time", +"kind": "function", +"signature": null, +"doc": "monotonic_ns() -> int" +}, +"time.perf_counter": { +"name": "time.perf_counter", +"module": "time", +"kind": "function", +"signature": null, +"doc": "perf_counter() -> float" +}, +"time.perf_counter_ns": { +"name": "time.perf_counter_ns", +"module": "time", +"kind": "function", +"signature": null, +"doc": "perf_counter_ns() -> int" +}, +"time.process_time": { +"name": "time.process_time", +"module": "time", +"kind": "function", +"signature": null, +"doc": "process_time() -> float" +}, +"time.process_time_ns": { +"name": "time.process_time_ns", +"module": "time", +"kind": "function", +"signature": null, +"doc": "process_time() -> int" +}, +"time.pthread_getcpuclockid": { +"name": "time.pthread_getcpuclockid", +"module": "time", +"kind": "function", +"signature": null, +"doc": "pthread_getcpuclockid(thread_id) -> int" +}, +"time.sleep": { +"name": "time.sleep", +"module": "time", +"kind": "function", +"signature": null, +"doc": "sleep(seconds)" +}, +"time.strftime": { +"name": "time.strftime", +"module": "time", +"kind": "function", +"signature": null, +"doc": "strftime(format[, tuple]) -> string" +}, +"time.strptime": { +"name": "time.strptime", +"module": "time", +"kind": "function", +"signature": null, +"doc": "strptime(string, format) -> struct_time" +}, +"time.struct_time": { +"name": "time.struct_time", +"module": "time", +"kind": "class", +"signature": "(iterable=(), /)", +"doc": "The time value as returned by gmtime(), localtime(), and strptime(), and" +}, +"time.thread_time": { +"name": "time.thread_time", +"module": "time", +"kind": "function", +"signature": null, +"doc": "thread_time() -> float" +}, +"time.thread_time_ns": { +"name": "time.thread_time_ns", +"module": "time", +"kind": "function", +"signature": null, +"doc": "thread_time() -> int" +}, +"time.time": { +"name": "time.time", +"module": "time", +"kind": "function", +"signature": null, +"doc": "time() -> floating point number" +}, +"time.time_ns": { +"name": "time.time_ns", +"module": "time", +"kind": "function", +"signature": null, +"doc": "time_ns() -> int" +}, +"time.tzset": { +"name": "time.tzset", +"module": "time", +"kind": "function", +"signature": null, +"doc": "tzset()" +}, +"datetime.date": { +"name": "datetime.date", +"module": "datetime", +"kind": "class", +"signature": null, +"doc": "date(year, month, day) --> date object" +}, +"datetime.datetime": { +"name": "datetime.datetime", +"module": "datetime", +"kind": "class", +"signature": null, +"doc": "datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])" +}, +"datetime.time": { +"name": "datetime.time", +"module": "datetime", +"kind": "class", +"signature": null, +"doc": "time([hour[, minute[, second[, microsecond[, tzinfo]]]]]) --> a time object" +}, +"datetime.timedelta": { +"name": "datetime.timedelta", +"module": "datetime", +"kind": "class", +"signature": null, +"doc": "Difference between two datetime values." +}, +"datetime.timezone": { +"name": "datetime.timezone", +"module": "datetime", +"kind": "class", +"signature": null, +"doc": "Fixed offset from UTC implementation of tzinfo." +}, +"datetime.tzinfo": { +"name": "datetime.tzinfo", +"module": "datetime", +"kind": "class", +"signature": null, +"doc": "Abstract base class for time zone info objects." +}, +"collections.ChainMap": { +"name": "collections.ChainMap", +"module": "collections", +"kind": "class", +"signature": "(*maps)", +"doc": "A ChainMap groups multiple dicts (or other mappings) together" +}, +"collections.Counter": { +"name": "collections.Counter", +"module": "collections", +"kind": "class", +"signature": "(iterable=None, /, **kwds)", +"doc": "Dict subclass for counting hashable items. Sometimes called a bag" +}, +"collections.OrderedDict": { +"name": "collections.OrderedDict", +"module": "collections", +"kind": "class", +"signature": null, +"doc": "Dictionary that remembers insertion order" +}, +"collections.UserDict": { +"name": "collections.UserDict", +"module": "collections", +"kind": "class", +"signature": "(dict=None, /, **kwargs)", +"doc": "A MutableMapping is a generic container for associating" +}, +"collections.UserList": { +"name": "collections.UserList", +"module": "collections", +"kind": "class", +"signature": "(initlist=None)", +"doc": "A more or less complete user-defined wrapper around list objects." +}, +"collections.UserString": { +"name": "collections.UserString", +"module": "collections", +"kind": "class", +"signature": "(seq)", +"doc": "All the operations on a read-only sequence." +}, +"collections.defaultdict": { +"name": "collections.defaultdict", +"module": "collections", +"kind": "class", +"signature": null, +"doc": "defaultdict(default_factory=None, /, [...]) --> dict with default factory" +}, +"collections.deque": { +"name": "collections.deque", +"module": "collections", +"kind": "class", +"signature": null, +"doc": "deque([iterable[, maxlen]]) --> deque object" +}, +"collections.namedtuple": { +"name": "collections.namedtuple", +"module": "collections", +"kind": "function", +"signature": "(typename, field_names, *, rename=False, defaults=None, module=None)", +"doc": "Returns a new subclass of tuple with named fields." +}, +"itertools.accumulate": { +"name": "itertools.accumulate", +"module": "itertools", +"kind": "class", +"signature": "(iterable, func=None, *, initial=None)", +"doc": "Return series of accumulated sums (or other binary function results)." +}, +"itertools.batched": { +"name": "itertools.batched", +"module": "itertools", +"kind": "class", +"signature": "(iterable, n)", +"doc": "Batch data into tuples of length n. The last batch may be shorter than n." +}, +"itertools.chain": { +"name": "itertools.chain", +"module": "itertools", +"kind": "class", +"signature": null, +"doc": "chain(*iterables) --> chain object" +}, +"itertools.combinations": { +"name": "itertools.combinations", +"module": "itertools", +"kind": "class", +"signature": "(iterable, r)", +"doc": "Return successive r-length combinations of elements in the iterable." +}, +"itertools.combinations_with_replacement": { +"name": "itertools.combinations_with_replacement", +"module": "itertools", +"kind": "class", +"signature": "(iterable, r)", +"doc": "Return successive r-length combinations of elements in the iterable allowing individual elements to have successive repeats." +}, +"itertools.compress": { +"name": "itertools.compress", +"module": "itertools", +"kind": "class", +"signature": "(data, selectors)", +"doc": "Return data elements corresponding to true selector elements." +}, +"itertools.count": { +"name": "itertools.count", +"module": "itertools", +"kind": "class", +"signature": "(start=0, step=1)", +"doc": "Return a count object whose .__next__() method returns consecutive values." +}, +"itertools.cycle": { +"name": "itertools.cycle", +"module": "itertools", +"kind": "class", +"signature": "(iterable, /)", +"doc": "Return elements from the iterable until it is exhausted. Then repeat the sequence indefinitely." +}, +"itertools.dropwhile": { +"name": "itertools.dropwhile", +"module": "itertools", +"kind": "class", +"signature": "(predicate, iterable, /)", +"doc": "Drop items from the iterable while predicate(item) is true." +}, +"itertools.filterfalse": { +"name": "itertools.filterfalse", +"module": "itertools", +"kind": "class", +"signature": "(function, iterable, /)", +"doc": "Return those items of iterable for which function(item) is false." +}, +"itertools.groupby": { +"name": "itertools.groupby", +"module": "itertools", +"kind": "class", +"signature": "(iterable, key=None)", +"doc": "make an iterator that returns consecutive keys and groups from the iterable" +}, +"itertools.islice": { +"name": "itertools.islice", +"module": "itertools", +"kind": "class", +"signature": null, +"doc": "islice(iterable, stop) --> islice object" +}, +"itertools.pairwise": { +"name": "itertools.pairwise", +"module": "itertools", +"kind": "class", +"signature": "(iterable, /)", +"doc": "Return an iterator of overlapping pairs taken from the input iterator." +}, +"itertools.permutations": { +"name": "itertools.permutations", +"module": "itertools", +"kind": "class", +"signature": "(iterable, r=None)", +"doc": "Return successive r-length permutations of elements in the iterable." +}, +"itertools.product": { +"name": "itertools.product", +"module": "itertools", +"kind": "class", +"signature": null, +"doc": "product(*iterables, repeat=1) --> product object" +}, +"itertools.repeat": { +"name": "itertools.repeat", +"module": "itertools", +"kind": "class", +"signature": null, +"doc": "repeat(object [,times]) -> create an iterator which returns the object" +}, +"itertools.starmap": { +"name": "itertools.starmap", +"module": "itertools", +"kind": "class", +"signature": "(function, iterable, /)", +"doc": "Return an iterator whose values are returned from the function evaluated with an argument tuple taken from the given sequence." +}, +"itertools.takewhile": { +"name": "itertools.takewhile", +"module": "itertools", +"kind": "class", +"signature": "(predicate, iterable, /)", +"doc": "Return successive entries from an iterable as long as the predicate evaluates to true for each entry." +}, +"itertools.tee": { +"name": "itertools.tee", +"module": "itertools", +"kind": "function", +"signature": "(iterable, n=2, /)", +"doc": "Returns a tuple of n independent iterators." +}, +"itertools.zip_longest": { +"name": "itertools.zip_longest", +"module": "itertools", +"kind": "class", +"signature": null, +"doc": "zip_longest(iter1 [,iter2 [...]], [fillvalue=None]) --> zip_longest object" +}, +"functools.cache": { +"name": "functools.cache", +"module": "functools", +"kind": "function", +"signature": "(user_function, /)", +"doc": "Simple lightweight unbounded cache. Sometimes called \"memoize\"." +}, +"functools.cached_property": { +"name": "functools.cached_property", +"module": "functools", +"kind": "class", +"signature": "(func)", +"doc": "" +}, +"functools.cmp_to_key": { +"name": "functools.cmp_to_key", +"module": "functools", +"kind": "function", +"signature": "(mycmp)", +"doc": "Convert a cmp= function into a key= function." +}, +"functools.lru_cache": { +"name": "functools.lru_cache", +"module": "functools", +"kind": "function", +"signature": "(maxsize=128, typed=False)", +"doc": "Least-recently-used cache decorator." +}, +"functools.partial": { +"name": "functools.partial", +"module": "functools", +"kind": "class", +"signature": null, +"doc": "partial(func, *args, **keywords) - new function with partial application" +}, +"functools.partialmethod": { +"name": "functools.partialmethod", +"module": "functools", +"kind": "class", +"signature": "(func, /, *args, **keywords)", +"doc": "Method descriptor with partial application of the given arguments" +}, +"functools.reduce": { +"name": "functools.reduce", +"module": "functools", +"kind": "function", +"signature": null, +"doc": "reduce(function, iterable[, initial]) -> value" +}, +"functools.singledispatch": { +"name": "functools.singledispatch", +"module": "functools", +"kind": "function", +"signature": "(func)", +"doc": "Single-dispatch generic function decorator." +}, +"functools.singledispatchmethod": { +"name": "functools.singledispatchmethod", +"module": "functools", +"kind": "class", +"signature": "(func)", +"doc": "Single-dispatch generic method descriptor." +}, +"functools.total_ordering": { +"name": "functools.total_ordering", +"module": "functools", +"kind": "function", +"signature": "(cls)", +"doc": "Class decorator that fills in missing ordering methods" +}, +"functools.update_wrapper": { +"name": "functools.update_wrapper", +"module": "functools", +"kind": "function", +"signature": "(wrapper, wrapped, assigned=('__module__', '__name__', '__qualname__', '__doc__', '__annotations__', '__type_params__'), updated=('__dict__',))", +"doc": "Update a wrapper function to look like the wrapped function" +}, +"functools.wraps": { +"name": "functools.wraps", +"module": "functools", +"kind": "function", +"signature": "(wrapped, assigned=('__module__', '__name__', '__qualname__', '__doc__', '__annotations__', '__type_params__'), updated=('__dict__',))", +"doc": "Decorator factory to apply update_wrapper() to a wrapper function" +}, +"operator.abs": { +"name": "operator.abs", +"module": "operator", +"kind": "function", +"signature": "(a, /)", +"doc": "Same as abs(a)." +}, +"operator.add": { +"name": "operator.add", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a + b." +}, +"operator.and_": { +"name": "operator.and_", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a & b." +}, +"operator.attrgetter": { +"name": "operator.attrgetter", +"module": "operator", +"kind": "class", +"signature": "(attr, /, *attrs)", +"doc": "Return a callable object that fetches the given attribute(s) from its operand." +}, +"operator.call": { +"name": "operator.call", +"module": "operator", +"kind": "function", +"signature": "(obj, /, *args, **kwargs)", +"doc": "Same as obj(*args, **kwargs)." +}, +"operator.concat": { +"name": "operator.concat", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a + b, for a and b sequences." +}, +"operator.contains": { +"name": "operator.contains", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as b in a (note reversed operands)." +}, +"operator.countOf": { +"name": "operator.countOf", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Return the number of items in a which are, or which equal, b." +}, +"operator.delitem": { +"name": "operator.delitem", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as del a[b]." +}, +"operator.eq": { +"name": "operator.eq", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a == b." +}, +"operator.floordiv": { +"name": "operator.floordiv", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a // b." +}, +"operator.ge": { +"name": "operator.ge", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a >= b." +}, +"operator.getitem": { +"name": "operator.getitem", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a[b]." +}, +"operator.gt": { +"name": "operator.gt", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a > b." +}, +"operator.iadd": { +"name": "operator.iadd", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a += b." +}, +"operator.iand": { +"name": "operator.iand", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a &= b." +}, +"operator.iconcat": { +"name": "operator.iconcat", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a += b, for a and b sequences." +}, +"operator.ifloordiv": { +"name": "operator.ifloordiv", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a //= b." +}, +"operator.ilshift": { +"name": "operator.ilshift", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a <<= b." +}, +"operator.imatmul": { +"name": "operator.imatmul", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a @= b." +}, +"operator.imod": { +"name": "operator.imod", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a %= b." +}, +"operator.imul": { +"name": "operator.imul", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a *= b." +}, +"operator.index": { +"name": "operator.index", +"module": "operator", +"kind": "function", +"signature": "(a, /)", +"doc": "Same as a.__index__()" +}, +"operator.indexOf": { +"name": "operator.indexOf", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Return the first index of b in a." +}, +"operator.inv": { +"name": "operator.inv", +"module": "operator", +"kind": "function", +"signature": "(a, /)", +"doc": "Same as ~a." +}, +"operator.invert": { +"name": "operator.invert", +"module": "operator", +"kind": "function", +"signature": "(a, /)", +"doc": "Same as ~a." +}, +"operator.ior": { +"name": "operator.ior", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a |= b." +}, +"operator.ipow": { +"name": "operator.ipow", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a **= b." +}, +"operator.irshift": { +"name": "operator.irshift", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a >>= b." +}, +"operator.is_": { +"name": "operator.is_", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a is b." +}, +"operator.is_not": { +"name": "operator.is_not", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a is not b." +}, +"operator.isub": { +"name": "operator.isub", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a -= b." +}, +"operator.itemgetter": { +"name": "operator.itemgetter", +"module": "operator", +"kind": "class", +"signature": "(item, /, *items)", +"doc": "Return a callable object that fetches the given item(s) from its operand." +}, +"operator.itruediv": { +"name": "operator.itruediv", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a /= b." +}, +"operator.ixor": { +"name": "operator.ixor", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a ^= b." +}, +"operator.le": { +"name": "operator.le", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a <= b." +}, +"operator.length_hint": { +"name": "operator.length_hint", +"module": "operator", +"kind": "function", +"signature": "(obj, default=0, /)", +"doc": "Return an estimate of the number of items in obj." +}, +"operator.lshift": { +"name": "operator.lshift", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a << b." +}, +"operator.lt": { +"name": "operator.lt", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a < b." +}, +"operator.matmul": { +"name": "operator.matmul", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a @ b." +}, +"operator.methodcaller": { +"name": "operator.methodcaller", +"module": "operator", +"kind": "class", +"signature": "(name, /, *args, **kwargs)", +"doc": "Return a callable object that calls the given method on its operand." +}, +"operator.mod": { +"name": "operator.mod", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a % b." +}, +"operator.mul": { +"name": "operator.mul", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a * b." +}, +"operator.ne": { +"name": "operator.ne", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a != b." +}, +"operator.neg": { +"name": "operator.neg", +"module": "operator", +"kind": "function", +"signature": "(a, /)", +"doc": "Same as -a." +}, +"operator.not_": { +"name": "operator.not_", +"module": "operator", +"kind": "function", +"signature": "(a, /)", +"doc": "Same as not a." +}, +"operator.or_": { +"name": "operator.or_", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a | b." +}, +"operator.pos": { +"name": "operator.pos", +"module": "operator", +"kind": "function", +"signature": "(a, /)", +"doc": "Same as +a." +}, +"operator.pow": { +"name": "operator.pow", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a ** b." +}, +"operator.rshift": { +"name": "operator.rshift", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a >> b." +}, +"operator.setitem": { +"name": "operator.setitem", +"module": "operator", +"kind": "function", +"signature": "(a, b, c, /)", +"doc": "Same as a[b] = c." +}, +"operator.sub": { +"name": "operator.sub", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a - b." +}, +"operator.truediv": { +"name": "operator.truediv", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a / b." +}, +"operator.truth": { +"name": "operator.truth", +"module": "operator", +"kind": "function", +"signature": "(a, /)", +"doc": "Return True if a is true, False otherwise." +}, +"operator.xor": { +"name": "operator.xor", +"module": "operator", +"kind": "function", +"signature": "(a, b, /)", +"doc": "Same as a ^ b." +}, +"pathlib.Path": { +"name": "pathlib.Path", +"module": "pathlib", +"kind": "class", +"signature": "(*args, **kwargs)", +"doc": "PurePath subclass that can make system calls." +}, +"pathlib.PosixPath": { +"name": "pathlib.PosixPath", +"module": "pathlib", +"kind": "class", +"signature": "(*args, **kwargs)", +"doc": "Path subclass for non-Windows systems." +}, +"pathlib.PurePath": { +"name": "pathlib.PurePath", +"module": "pathlib", +"kind": "class", +"signature": "(*args, **kwargs)", +"doc": "Base class for manipulating paths without I/O." +}, +"pathlib.PurePosixPath": { +"name": "pathlib.PurePosixPath", +"module": "pathlib", +"kind": "class", +"signature": "(*args, **kwargs)", +"doc": "PurePath subclass for non-Windows systems." +}, +"pathlib.PureWindowsPath": { +"name": "pathlib.PureWindowsPath", +"module": "pathlib", +"kind": "class", +"signature": "(*args, **kwargs)", +"doc": "PurePath subclass for Windows systems." +}, +"pathlib.WindowsPath": { +"name": "pathlib.WindowsPath", +"module": "pathlib", +"kind": "class", +"signature": "(*args, **kwargs)", +"doc": "Path subclass for Windows systems." +}, +"shutil.Error": { +"name": "shutil.Error", +"module": "shutil", +"kind": "class", +"signature": null, +"doc": "Base class for I/O related errors." +}, +"shutil.ExecError": { +"name": "shutil.ExecError", +"module": "shutil", +"kind": "class", +"signature": null, +"doc": "Raised when a command could not be executed" +}, +"shutil.ReadError": { +"name": "shutil.ReadError", +"module": "shutil", +"kind": "class", +"signature": null, +"doc": "Raised when an archive cannot be read" +}, +"shutil.RegistryError": { +"name": "shutil.RegistryError", +"module": "shutil", +"kind": "class", +"signature": null, +"doc": "Raised when a registry operation with the archiving" +}, +"shutil.SameFileError": { +"name": "shutil.SameFileError", +"module": "shutil", +"kind": "class", +"signature": null, +"doc": "Raised when source and destination are the same file." +}, +"shutil.SpecialFileError": { +"name": "shutil.SpecialFileError", +"module": "shutil", +"kind": "class", +"signature": null, +"doc": "Raised when trying to do a kind of operation (e.g. copying) which is" +}, +"shutil.chown": { +"name": "shutil.chown", +"module": "shutil", +"kind": "function", +"signature": "(path, user=None, group=None)", +"doc": "Change owner user and group of the given path." +}, +"shutil.copy": { +"name": "shutil.copy", +"module": "shutil", +"kind": "function", +"signature": "(src, dst, *, follow_symlinks=True)", +"doc": "Copy data and mode bits (\"cp src dst\"). Return the file's destination." +}, +"shutil.copy2": { +"name": "shutil.copy2", +"module": "shutil", +"kind": "function", +"signature": "(src, dst, *, follow_symlinks=True)", +"doc": "Copy data and metadata. Return the file's destination." +}, +"shutil.copyfile": { +"name": "shutil.copyfile", +"module": "shutil", +"kind": "function", +"signature": "(src, dst, *, follow_symlinks=True)", +"doc": "Copy data from src to dst in the most efficient way possible." +}, +"shutil.copyfileobj": { +"name": "shutil.copyfileobj", +"module": "shutil", +"kind": "function", +"signature": "(fsrc, fdst, length=0)", +"doc": "copy data from file-like object fsrc to file-like object fdst" +}, +"shutil.copymode": { +"name": "shutil.copymode", +"module": "shutil", +"kind": "function", +"signature": "(src, dst, *, follow_symlinks=True)", +"doc": "Copy mode bits from src to dst." +}, +"shutil.copystat": { +"name": "shutil.copystat", +"module": "shutil", +"kind": "function", +"signature": "(src, dst, *, follow_symlinks=True)", +"doc": "Copy file metadata" +}, +"shutil.copytree": { +"name": "shutil.copytree", +"module": "shutil", +"kind": "function", +"signature": "(src, dst, symlinks=False, ignore=None, copy_function=, ignore_dangling_symlinks=False, dirs_exist_ok=False)", +"doc": "Recursively copy a directory tree and return the destination directory." +}, +"shutil.disk_usage": { +"name": "shutil.disk_usage", +"module": "shutil", +"kind": "function", +"signature": "(path)", +"doc": "Return disk usage statistics about the given path." +}, +"shutil.get_archive_formats": { +"name": "shutil.get_archive_formats", +"module": "shutil", +"kind": "function", +"signature": "()", +"doc": "Returns a list of supported formats for archiving and unarchiving." +}, +"shutil.get_terminal_size": { +"name": "shutil.get_terminal_size", +"module": "shutil", +"kind": "function", +"signature": "(fallback=(80, 24))", +"doc": "Get the size of the terminal window." +}, +"shutil.get_unpack_formats": { +"name": "shutil.get_unpack_formats", +"module": "shutil", +"kind": "function", +"signature": "()", +"doc": "Returns a list of supported formats for unpacking." +}, +"shutil.ignore_patterns": { +"name": "shutil.ignore_patterns", +"module": "shutil", +"kind": "function", +"signature": "(*patterns)", +"doc": "Function that can be used as copytree() ignore parameter." +}, +"shutil.make_archive": { +"name": "shutil.make_archive", +"module": "shutil", +"kind": "function", +"signature": "(base_name, format, root_dir=None, base_dir=None, verbose=0, dry_run=0, owner=None, group=None, logger=None)", +"doc": "Create an archive file (eg. zip or tar)." +}, +"shutil.move": { +"name": "shutil.move", +"module": "shutil", +"kind": "function", +"signature": "(src, dst, copy_function=)", +"doc": "Recursively move a file or directory to another location. This is" +}, +"shutil.register_archive_format": { +"name": "shutil.register_archive_format", +"module": "shutil", +"kind": "function", +"signature": "(name, function, extra_args=None, description='')", +"doc": "Registers an archive format." +}, +"shutil.register_unpack_format": { +"name": "shutil.register_unpack_format", +"module": "shutil", +"kind": "function", +"signature": "(name, extensions, function, extra_args=None, description='')", +"doc": "Registers an unpack format." +}, +"shutil.rmtree": { +"name": "shutil.rmtree", +"module": "shutil", +"kind": "function", +"signature": "(path, ignore_errors=False, onerror=None, *, onexc=None, dir_fd=None)", +"doc": "Recursively delete a directory tree." +}, +"shutil.unpack_archive": { +"name": "shutil.unpack_archive", +"module": "shutil", +"kind": "function", +"signature": "(filename, extract_dir=None, format=None, *, filter=None)", +"doc": "Unpack an archive." +}, +"shutil.unregister_archive_format": { +"name": "shutil.unregister_archive_format", +"module": "shutil", +"kind": "function", +"signature": "(name)", +"doc": "" +}, +"shutil.unregister_unpack_format": { +"name": "shutil.unregister_unpack_format", +"module": "shutil", +"kind": "function", +"signature": "(name)", +"doc": "Removes the pack format from the registry." +}, +"shutil.which": { +"name": "shutil.which", +"module": "shutil", +"kind": "function", +"signature": "(cmd, mode=1, path=None)", +"doc": "Given a command, mode, and a PATH string, return the path which" +}, +"csv.Dialect": { +"name": "csv.Dialect", +"module": "csv", +"kind": "class", +"signature": "()", +"doc": "Describe a CSV dialect." +}, +"csv.DictReader": { +"name": "csv.DictReader", +"module": "csv", +"kind": "class", +"signature": "(f, fieldnames=None, restkey=None, restval=None, dialect='excel', *args, **kwds)", +"doc": "" +}, +"csv.DictWriter": { +"name": "csv.DictWriter", +"module": "csv", +"kind": "class", +"signature": "(f, fieldnames, restval='', extrasaction='raise', dialect='excel', *args, **kwds)", +"doc": "" +}, +"csv.Error": { +"name": "csv.Error", +"module": "csv", +"kind": "class", +"signature": null, +"doc": "Common base class for all non-exit exceptions." +}, +"csv.Sniffer": { +"name": "csv.Sniffer", +"module": "csv", +"kind": "class", +"signature": "()", +"doc": "\"Sniffs\" the format of a CSV file (i.e. delimiter, quotechar)" +}, +"csv.excel": { +"name": "csv.excel", +"module": "csv", +"kind": "class", +"signature": "()", +"doc": "Describe the usual properties of Excel-generated CSV files." +}, +"csv.excel_tab": { +"name": "csv.excel_tab", +"module": "csv", +"kind": "class", +"signature": "()", +"doc": "Describe the usual properties of Excel-generated TAB-delimited files." +}, +"csv.field_size_limit": { +"name": "csv.field_size_limit", +"module": "csv", +"kind": "function", +"signature": null, +"doc": "Sets an upper limit on parsed fields." +}, +"csv.get_dialect": { +"name": "csv.get_dialect", +"module": "csv", +"kind": "function", +"signature": "(name)", +"doc": "Return the dialect instance associated with name." +}, +"csv.list_dialects": { +"name": "csv.list_dialects", +"module": "csv", +"kind": "function", +"signature": "()", +"doc": "Return a list of all known dialect names." +}, +"csv.reader": { +"name": "csv.reader", +"module": "csv", +"kind": "function", +"signature": null, +"doc": "csv_reader = reader(iterable [, dialect='excel']" +}, +"csv.register_dialect": { +"name": "csv.register_dialect", +"module": "csv", +"kind": "function", +"signature": null, +"doc": "Create a mapping from a string name to a dialect class." +}, +"csv.unix_dialect": { +"name": "csv.unix_dialect", +"module": "csv", +"kind": "class", +"signature": "()", +"doc": "Describe the usual properties of Unix-generated CSV files." +}, +"csv.unregister_dialect": { +"name": "csv.unregister_dialect", +"module": "csv", +"kind": "function", +"signature": "(name)", +"doc": "Delete the name/dialect mapping associated with a string name." +}, +"csv.writer": { +"name": "csv.writer", +"module": "csv", +"kind": "function", +"signature": null, +"doc": "csv_writer = csv.writer(fileobj [, dialect='excel']" +}, +"hashlib.file_digest": { +"name": "hashlib.file_digest", +"module": "hashlib", +"kind": "function", +"signature": "(fileobj, digest, /, *, _bufsize=262144)", +"doc": "Hash the contents of a file-like object. Returns a digest object." +}, +"hashlib.md5": { +"name": "hashlib.md5", +"module": "hashlib", +"kind": "function", +"signature": "(string=b'', *, usedforsecurity=True)", +"doc": "Returns a md5 hash object; optionally initialized with a string" +}, +"hashlib.new": { +"name": "hashlib.new", +"module": "hashlib", +"kind": "function", +"signature": "(name, data=b'', **kwargs)", +"doc": "new(name, data=b'') - Return a new hashing object using the named algorithm;" +}, +"hashlib.pbkdf2_hmac": { +"name": "hashlib.pbkdf2_hmac", +"module": "hashlib", +"kind": "function", +"signature": "(hash_name, password, salt, iterations, dklen=None)", +"doc": "Password based key derivation function 2 (PKCS #5 v2.0) with HMAC as pseudorandom function." +}, +"hashlib.scrypt": { +"name": "hashlib.scrypt", +"module": "hashlib", +"kind": "function", +"signature": "(password, *, salt=None, n=None, r=None, p=None, maxmem=0, dklen=64)", +"doc": "scrypt password-based key derivation function." +}, +"hashlib.sha1": { +"name": "hashlib.sha1", +"module": "hashlib", +"kind": "function", +"signature": "(string=b'', *, usedforsecurity=True)", +"doc": "Returns a sha1 hash object; optionally initialized with a string" +}, +"hashlib.sha224": { +"name": "hashlib.sha224", +"module": "hashlib", +"kind": "function", +"signature": "(string=b'', *, usedforsecurity=True)", +"doc": "Returns a sha224 hash object; optionally initialized with a string" +}, +"hashlib.sha256": { +"name": "hashlib.sha256", +"module": "hashlib", +"kind": "function", +"signature": "(string=b'', *, usedforsecurity=True)", +"doc": "Returns a sha256 hash object; optionally initialized with a string" +}, +"hashlib.sha384": { +"name": "hashlib.sha384", +"module": "hashlib", +"kind": "function", +"signature": "(string=b'', *, usedforsecurity=True)", +"doc": "Returns a sha384 hash object; optionally initialized with a string" +}, +"hashlib.sha3_224": { +"name": "hashlib.sha3_224", +"module": "hashlib", +"kind": "function", +"signature": "(string=b'', *, usedforsecurity=True)", +"doc": "Returns a sha3-224 hash object; optionally initialized with a string" +}, +"hashlib.sha3_256": { +"name": "hashlib.sha3_256", +"module": "hashlib", +"kind": "function", +"signature": "(string=b'', *, usedforsecurity=True)", +"doc": "Returns a sha3-256 hash object; optionally initialized with a string" +}, +"hashlib.sha3_384": { +"name": "hashlib.sha3_384", +"module": "hashlib", +"kind": "function", +"signature": "(string=b'', *, usedforsecurity=True)", +"doc": "Returns a sha3-384 hash object; optionally initialized with a string" +}, +"hashlib.sha3_512": { +"name": "hashlib.sha3_512", +"module": "hashlib", +"kind": "function", +"signature": "(string=b'', *, usedforsecurity=True)", +"doc": "Returns a sha3-512 hash object; optionally initialized with a string" +}, +"hashlib.sha512": { +"name": "hashlib.sha512", +"module": "hashlib", +"kind": "function", +"signature": "(string=b'', *, usedforsecurity=True)", +"doc": "Returns a sha512 hash object; optionally initialized with a string" +}, +"hashlib.shake_128": { +"name": "hashlib.shake_128", +"module": "hashlib", +"kind": "function", +"signature": "(string=b'', *, usedforsecurity=True)", +"doc": "Returns a shake-128 variable hash object; optionally initialized with a string" +}, +"hashlib.shake_256": { +"name": "hashlib.shake_256", +"module": "hashlib", +"kind": "function", +"signature": "(string=b'', *, usedforsecurity=True)", +"doc": "Returns a shake-256 variable hash object; optionally initialized with a string" +}, +"base64.a85decode": { +"name": "base64.a85decode", +"module": "base64", +"kind": "function", +"signature": "(b, *, foldspaces=False, adobe=False, ignorechars=b' \\t\\n\\r\\x0b')", +"doc": "Decode the Ascii85 encoded bytes-like object or ASCII string b." +}, +"base64.a85encode": { +"name": "base64.a85encode", +"module": "base64", +"kind": "function", +"signature": "(b, *, foldspaces=False, wrapcol=0, pad=False, adobe=False)", +"doc": "Encode bytes-like object b using Ascii85 and return a bytes object." +}, +"base64.b16decode": { +"name": "base64.b16decode", +"module": "base64", +"kind": "function", +"signature": "(s, casefold=False)", +"doc": "Decode the Base16 encoded bytes-like object or ASCII string s." +}, +"base64.b16encode": { +"name": "base64.b16encode", +"module": "base64", +"kind": "function", +"signature": "(s)", +"doc": "Encode the bytes-like object s using Base16 and return a bytes object." +}, +"base64.b32decode": { +"name": "base64.b32decode", +"module": "base64", +"kind": "function", +"signature": "(s, casefold=False, map01=None)", +"doc": "Decode the base32 encoded bytes-like object or ASCII string s." +}, +"base64.b32encode": { +"name": "base64.b32encode", +"module": "base64", +"kind": "function", +"signature": "(s)", +"doc": "Encode the bytes-like objects using base32 and return a bytes object." +}, +"base64.b32hexdecode": { +"name": "base64.b32hexdecode", +"module": "base64", +"kind": "function", +"signature": "(s, casefold=False)", +"doc": "Decode the base32hex encoded bytes-like object or ASCII string s." +}, +"base64.b32hexencode": { +"name": "base64.b32hexencode", +"module": "base64", +"kind": "function", +"signature": "(s)", +"doc": "Encode the bytes-like objects using base32hex and return a bytes object." +}, +"base64.b64decode": { +"name": "base64.b64decode", +"module": "base64", +"kind": "function", +"signature": "(s, altchars=None, validate=False)", +"doc": "Decode the Base64 encoded bytes-like object or ASCII string s." +}, +"base64.b64encode": { +"name": "base64.b64encode", +"module": "base64", +"kind": "function", +"signature": "(s, altchars=None)", +"doc": "Encode the bytes-like object s using Base64 and return a bytes object." +}, +"base64.b85decode": { +"name": "base64.b85decode", +"module": "base64", +"kind": "function", +"signature": "(b)", +"doc": "Decode the base85-encoded bytes-like object or ASCII string b" +}, +"base64.b85encode": { +"name": "base64.b85encode", +"module": "base64", +"kind": "function", +"signature": "(b, pad=False)", +"doc": "Encode bytes-like object b in base85 format and return a bytes object." +}, +"base64.decode": { +"name": "base64.decode", +"module": "base64", +"kind": "function", +"signature": "(input, output)", +"doc": "Decode a file; input and output are binary files." +}, +"base64.decodebytes": { +"name": "base64.decodebytes", +"module": "base64", +"kind": "function", +"signature": "(s)", +"doc": "Decode a bytestring of base-64 data into a bytes object." +}, +"base64.encode": { +"name": "base64.encode", +"module": "base64", +"kind": "function", +"signature": "(input, output)", +"doc": "Encode a file; input and output are binary files." +}, +"base64.encodebytes": { +"name": "base64.encodebytes", +"module": "base64", +"kind": "function", +"signature": "(s)", +"doc": "Encode a bytestring into a bytes object containing multiple lines" +}, +"base64.main": { +"name": "base64.main", +"module": "base64", +"kind": "function", +"signature": "()", +"doc": "Small main program" +}, +"base64.standard_b64decode": { +"name": "base64.standard_b64decode", +"module": "base64", +"kind": "function", +"signature": "(s)", +"doc": "Decode bytes encoded with the standard Base64 alphabet." +}, +"base64.standard_b64encode": { +"name": "base64.standard_b64encode", +"module": "base64", +"kind": "function", +"signature": "(s)", +"doc": "Encode bytes-like object s using the standard Base64 alphabet." +}, +"base64.urlsafe_b64decode": { +"name": "base64.urlsafe_b64decode", +"module": "base64", +"kind": "function", +"signature": "(s)", +"doc": "Decode bytes using the URL- and filesystem-safe Base64 alphabet." +}, +"base64.urlsafe_b64encode": { +"name": "base64.urlsafe_b64encode", +"module": "base64", +"kind": "function", +"signature": "(s)", +"doc": "Encode bytes using the URL- and filesystem-safe Base64 alphabet." +}, +"textwrap.TextWrapper": { +"name": "textwrap.TextWrapper", +"module": "textwrap", +"kind": "class", +"signature": "(width=70, initial_indent='', subsequent_indent='', expand_tabs=True, replace_whitespace=True, fix_sentence_endings=False, break_long_words=True, drop_whitespace=True, break_on_hyphens=True, tabsize=8, *, max_lines=None, placeholder=' [...]')", +"doc": "Object for wrapping/filling text. The public interface consists of" +}, +"textwrap.dedent": { +"name": "textwrap.dedent", +"module": "textwrap", +"kind": "function", +"signature": "(text)", +"doc": "Remove any common leading whitespace from every line in `text`." +}, +"textwrap.fill": { +"name": "textwrap.fill", +"module": "textwrap", +"kind": "function", +"signature": "(text, width=70, **kwargs)", +"doc": "Fill a single paragraph of text, returning a new string." +}, +"textwrap.indent": { +"name": "textwrap.indent", +"module": "textwrap", +"kind": "function", +"signature": "(text, prefix, predicate=None)", +"doc": "Adds 'prefix' to the beginning of selected lines in 'text'." +}, +"textwrap.shorten": { +"name": "textwrap.shorten", +"module": "textwrap", +"kind": "function", +"signature": "(text, width, **kwargs)", +"doc": "Collapse and truncate the given text to fit in the given width." +}, +"textwrap.wrap": { +"name": "textwrap.wrap", +"module": "textwrap", +"kind": "function", +"signature": "(text, width=70, **kwargs)", +"doc": "Wrap a single paragraph of text, returning a list of wrapped lines." +}, +"fractions.Fraction": { +"name": "fractions.Fraction", +"module": "fractions", +"kind": "class", +"signature": "(numerator=0, denominator=None)", +"doc": "This class implements rational numbers." +}, +"decimal.Clamped": { +"name": "decimal.Clamped", +"module": "decimal", +"kind": "class", +"signature": null, +"doc": "Base class for arithmetic errors." +}, +"decimal.Context": { +"name": "decimal.Context", +"module": "decimal", +"kind": "class", +"signature": "(prec=None, rounding=None, Emin=None, Emax=None, capitals=None, clamp=None, flags=None, traps=None)", +"doc": "The context affects almost all operations and controls rounding," +}, +"decimal.ConversionSyntax": { +"name": "decimal.ConversionSyntax", +"module": "decimal", +"kind": "class", +"signature": null, +"doc": "Base class for arithmetic errors." +}, +"decimal.Decimal": { +"name": "decimal.Decimal", +"module": "decimal", +"kind": "class", +"signature": "(value='0', context=None)", +"doc": "Construct a new Decimal object. 'value' can be an integer, string, tuple," +}, +"decimal.DecimalException": { +"name": "decimal.DecimalException", +"module": "decimal", +"kind": "class", +"signature": null, +"doc": "Base class for arithmetic errors." +}, +"decimal.DecimalTuple": { +"name": "decimal.DecimalTuple", +"module": "decimal", +"kind": "class", +"signature": "(sign, digits, exponent)", +"doc": "DecimalTuple(sign, digits, exponent)" +}, +"decimal.DivisionByZero": { +"name": "decimal.DivisionByZero", +"module": "decimal", +"kind": "class", +"signature": null, +"doc": "Second argument to a division or modulo operation was zero." +}, +"decimal.DivisionImpossible": { +"name": "decimal.DivisionImpossible", +"module": "decimal", +"kind": "class", +"signature": null, +"doc": "Base class for arithmetic errors." +}, +"decimal.DivisionUndefined": { +"name": "decimal.DivisionUndefined", +"module": "decimal", +"kind": "class", +"signature": null, +"doc": "Second argument to a division or modulo operation was zero." +}, +"decimal.FloatOperation": { +"name": "decimal.FloatOperation", +"module": "decimal", +"kind": "class", +"signature": null, +"doc": "Base class for arithmetic errors." +}, +"decimal.Inexact": { +"name": "decimal.Inexact", +"module": "decimal", +"kind": "class", +"signature": null, +"doc": "Base class for arithmetic errors." +}, +"decimal.InvalidContext": { +"name": "decimal.InvalidContext", +"module": "decimal", +"kind": "class", +"signature": null, +"doc": "Base class for arithmetic errors." +}, +"decimal.InvalidOperation": { +"name": "decimal.InvalidOperation", +"module": "decimal", +"kind": "class", +"signature": null, +"doc": "Base class for arithmetic errors." +}, +"decimal.Overflow": { +"name": "decimal.Overflow", +"module": "decimal", +"kind": "class", +"signature": null, +"doc": "Base class for arithmetic errors." +}, +"decimal.Rounded": { +"name": "decimal.Rounded", +"module": "decimal", +"kind": "class", +"signature": null, +"doc": "Base class for arithmetic errors." +}, +"decimal.Subnormal": { +"name": "decimal.Subnormal", +"module": "decimal", +"kind": "class", +"signature": null, +"doc": "Base class for arithmetic errors." +}, +"decimal.Underflow": { +"name": "decimal.Underflow", +"module": "decimal", +"kind": "class", +"signature": null, +"doc": "Base class for arithmetic errors." +}, +"decimal.getcontext": { +"name": "decimal.getcontext", +"module": "decimal", +"kind": "function", +"signature": "()", +"doc": "Get the current default context." +}, +"decimal.localcontext": { +"name": "decimal.localcontext", +"module": "decimal", +"kind": "function", +"signature": "(ctx=None, **kwargs)", +"doc": "Return a context manager that will set the default context to a copy of ctx" +}, +"decimal.setcontext": { +"name": "decimal.setcontext", +"module": "decimal", +"kind": "function", +"signature": "(context, /)", +"doc": "Set a new default context." +}, +"heapq.heapify": { +"name": "heapq.heapify", +"module": "heapq", +"kind": "function", +"signature": "(heap, /)", +"doc": "Transform list into a heap, in-place, in O(len(heap)) time." +}, +"heapq.heappop": { +"name": "heapq.heappop", +"module": "heapq", +"kind": "function", +"signature": "(heap, /)", +"doc": "Pop the smallest item off the heap, maintaining the heap invariant." +}, +"heapq.heappush": { +"name": "heapq.heappush", +"module": "heapq", +"kind": "function", +"signature": "(heap, item, /)", +"doc": "Push item onto heap, maintaining the heap invariant." +}, +"heapq.heappushpop": { +"name": "heapq.heappushpop", +"module": "heapq", +"kind": "function", +"signature": "(heap, item, /)", +"doc": "Push item on the heap, then pop and return the smallest item from the heap." +}, +"heapq.heapreplace": { +"name": "heapq.heapreplace", +"module": "heapq", +"kind": "function", +"signature": "(heap, item, /)", +"doc": "Pop and return the current smallest value, and add the new item." +}, +"heapq.merge": { +"name": "heapq.merge", +"module": "heapq", +"kind": "function", +"signature": "(*iterables, key=None, reverse=False)", +"doc": "Merge multiple sorted inputs into a single sorted output." +}, +"heapq.nlargest": { +"name": "heapq.nlargest", +"module": "heapq", +"kind": "function", +"signature": "(n, iterable, key=None)", +"doc": "Find the n largest elements in a dataset." +}, +"heapq.nsmallest": { +"name": "heapq.nsmallest", +"module": "heapq", +"kind": "function", +"signature": "(n, iterable, key=None)", +"doc": "Find the n smallest elements in a dataset." +}, +"bisect.bisect": { +"name": "bisect.bisect", +"module": "bisect", +"kind": "function", +"signature": "(a, x, lo=0, hi=None, *, key=None)", +"doc": "Return the index where to insert item x in list a, assuming a is sorted." +}, +"bisect.bisect_left": { +"name": "bisect.bisect_left", +"module": "bisect", +"kind": "function", +"signature": "(a, x, lo=0, hi=None, *, key=None)", +"doc": "Return the index where to insert item x in list a, assuming a is sorted." +}, +"bisect.bisect_right": { +"name": "bisect.bisect_right", +"module": "bisect", +"kind": "function", +"signature": "(a, x, lo=0, hi=None, *, key=None)", +"doc": "Return the index where to insert item x in list a, assuming a is sorted." +}, +"bisect.insort": { +"name": "bisect.insort", +"module": "bisect", +"kind": "function", +"signature": "(a, x, lo=0, hi=None, *, key=None)", +"doc": "Insert item x in list a, and keep it sorted assuming a is sorted." +}, +"bisect.insort_left": { +"name": "bisect.insort_left", +"module": "bisect", +"kind": "function", +"signature": "(a, x, lo=0, hi=None, *, key=None)", +"doc": "Insert item x in list a, and keep it sorted assuming a is sorted." +}, +"bisect.insort_right": { +"name": "bisect.insort_right", +"module": "bisect", +"kind": "function", +"signature": "(a, x, lo=0, hi=None, *, key=None)", +"doc": "Insert item x in list a, and keep it sorted assuming a is sorted." +}, +"copy.Error": { +"name": "copy.Error", +"module": "copy", +"kind": "class", +"signature": null, +"doc": "Common base class for all non-exit exceptions." +}, +"copy.copy": { +"name": "copy.copy", +"module": "copy", +"kind": "function", +"signature": "(x)", +"doc": "Shallow copy operation on arbitrary Python objects." +}, +"copy.deepcopy": { +"name": "copy.deepcopy", +"module": "copy", +"kind": "function", +"signature": "(x, memo=None, _nil=[])", +"doc": "Deep copy operation on arbitrary Python objects." +}, +"copy.error": { +"name": "copy.error", +"module": "copy", +"kind": "class", +"signature": null, +"doc": "Common base class for all non-exit exceptions." +}, +"glob.escape": { +"name": "glob.escape", +"module": "glob", +"kind": "function", +"signature": "(pathname)", +"doc": "Escape all special characters." +}, +"glob.glob": { +"name": "glob.glob", +"module": "glob", +"kind": "function", +"signature": "(pathname, *, root_dir=None, dir_fd=None, recursive=False, include_hidden=False)", +"doc": "Return a list of paths matching a pathname pattern." +}, +"glob.glob0": { +"name": "glob.glob0", +"module": "glob", +"kind": "function", +"signature": "(dirname, pattern)", +"doc": "" +}, +"glob.glob1": { +"name": "glob.glob1", +"module": "glob", +"kind": "function", +"signature": "(dirname, pattern)", +"doc": "" +}, +"glob.has_magic": { +"name": "glob.has_magic", +"module": "glob", +"kind": "function", +"signature": "(s)", +"doc": "" +}, +"glob.iglob": { +"name": "glob.iglob", +"module": "glob", +"kind": "function", +"signature": "(pathname, *, root_dir=None, dir_fd=None, recursive=False, include_hidden=False)", +"doc": "Return an iterator which yields the paths matching a pathname pattern." +}, +"uuid.SafeUUID": { +"name": "uuid.SafeUUID", +"module": "uuid", +"kind": "class", +"signature": "(*values)", +"doc": "An enumeration." +}, +"uuid.UUID": { +"name": "uuid.UUID", +"module": "uuid", +"kind": "class", +"signature": "(hex=None, bytes=None, bytes_le=None, fields=None, int=None, version=None, *, is_safe=)", +"doc": "Instances of the UUID class represent UUIDs as specified in RFC 4122." +}, +"uuid.getnode": { +"name": "uuid.getnode", +"module": "uuid", +"kind": "function", +"signature": "()", +"doc": "Get the hardware address as a 48-bit positive integer." +}, +"uuid.main": { +"name": "uuid.main", +"module": "uuid", +"kind": "function", +"signature": "()", +"doc": "Run the uuid command line interface." +}, +"uuid.uuid1": { +"name": "uuid.uuid1", +"module": "uuid", +"kind": "function", +"signature": "(node=None, clock_seq=None)", +"doc": "Generate a UUID from a host ID, sequence number, and the current time." +}, +"uuid.uuid3": { +"name": "uuid.uuid3", +"module": "uuid", +"kind": "function", +"signature": "(namespace, name)", +"doc": "Generate a UUID from the MD5 hash of a namespace UUID and a name." +}, +"uuid.uuid4": { +"name": "uuid.uuid4", +"module": "uuid", +"kind": "function", +"signature": "()", +"doc": "Generate a random UUID." +}, +"uuid.uuid5": { +"name": "uuid.uuid5", +"module": "uuid", +"kind": "function", +"signature": "(namespace, name)", +"doc": "Generate a UUID from the SHA-1 hash of a namespace UUID and a name." +}, +"urllib.parse.DefragResult": { +"name": "urllib.parse.DefragResult", +"module": "urllib.parse", +"kind": "class", +"signature": "(url, fragment)", +"doc": "DefragResult(url, fragment)" +}, +"urllib.parse.DefragResultBytes": { +"name": "urllib.parse.DefragResultBytes", +"module": "urllib.parse", +"kind": "class", +"signature": "(url, fragment)", +"doc": "DefragResult(url, fragment)" +}, +"urllib.parse.ParseResult": { +"name": "urllib.parse.ParseResult", +"module": "urllib.parse", +"kind": "class", +"signature": "(scheme, netloc, path, params, query, fragment)", +"doc": "ParseResult(scheme, netloc, path, params, query, fragment)" +}, +"urllib.parse.ParseResultBytes": { +"name": "urllib.parse.ParseResultBytes", +"module": "urllib.parse", +"kind": "class", +"signature": "(scheme, netloc, path, params, query, fragment)", +"doc": "ParseResult(scheme, netloc, path, params, query, fragment)" +}, +"urllib.parse.ResultBase": { +"name": "urllib.parse.ResultBase", +"module": "urllib.parse", +"kind": "class", +"signature": "()", +"doc": "Shared methods for the parsed result objects containing a netloc element" +}, +"urllib.parse.SplitResult": { +"name": "urllib.parse.SplitResult", +"module": "urllib.parse", +"kind": "class", +"signature": "(scheme, netloc, path, query, fragment)", +"doc": "SplitResult(scheme, netloc, path, query, fragment)" +}, +"urllib.parse.SplitResultBytes": { +"name": "urllib.parse.SplitResultBytes", +"module": "urllib.parse", +"kind": "class", +"signature": "(scheme, netloc, path, query, fragment)", +"doc": "SplitResult(scheme, netloc, path, query, fragment)" +}, +"urllib.parse.clear_cache": { +"name": "urllib.parse.clear_cache", +"module": "urllib.parse", +"kind": "function", +"signature": "()", +"doc": "Clear internal performance caches. Undocumented; some tests want it." +}, +"urllib.parse.parse_qs": { +"name": "urllib.parse.parse_qs", +"module": "urllib.parse", +"kind": "function", +"signature": "(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None, separator='&')", +"doc": "Parse a query given as a string argument." +}, +"urllib.parse.parse_qsl": { +"name": "urllib.parse.parse_qsl", +"module": "urllib.parse", +"kind": "function", +"signature": "(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None, separator='&')", +"doc": "Parse a query given as a string argument." +}, +"urllib.parse.quote": { +"name": "urllib.parse.quote", +"module": "urllib.parse", +"kind": "function", +"signature": "(string, safe='/', encoding=None, errors=None)", +"doc": "quote('abc def') -> 'abc%20def'" +}, +"urllib.parse.quote_from_bytes": { +"name": "urllib.parse.quote_from_bytes", +"module": "urllib.parse", +"kind": "function", +"signature": "(bs, safe='/')", +"doc": "Like quote(), but accepts a bytes object rather than a str, and does" +}, +"urllib.parse.quote_plus": { +"name": "urllib.parse.quote_plus", +"module": "urllib.parse", +"kind": "function", +"signature": "(string, safe='', encoding=None, errors=None)", +"doc": "Like quote(), but also replace ' ' with '+', as required for quoting" +}, +"urllib.parse.splitattr": { +"name": "urllib.parse.splitattr", +"module": "urllib.parse", +"kind": "function", +"signature": "(url)", +"doc": "" +}, +"urllib.parse.splithost": { +"name": "urllib.parse.splithost", +"module": "urllib.parse", +"kind": "function", +"signature": "(url)", +"doc": "" +}, +"urllib.parse.splitnport": { +"name": "urllib.parse.splitnport", +"module": "urllib.parse", +"kind": "function", +"signature": "(host, defport=-1)", +"doc": "" +}, +"urllib.parse.splitpasswd": { +"name": "urllib.parse.splitpasswd", +"module": "urllib.parse", +"kind": "function", +"signature": "(user)", +"doc": "" +}, +"urllib.parse.splitport": { +"name": "urllib.parse.splitport", +"module": "urllib.parse", +"kind": "function", +"signature": "(host)", +"doc": "" +}, +"urllib.parse.splitquery": { +"name": "urllib.parse.splitquery", +"module": "urllib.parse", +"kind": "function", +"signature": "(url)", +"doc": "" +}, +"urllib.parse.splittag": { +"name": "urllib.parse.splittag", +"module": "urllib.parse", +"kind": "function", +"signature": "(url)", +"doc": "" +}, +"urllib.parse.splittype": { +"name": "urllib.parse.splittype", +"module": "urllib.parse", +"kind": "function", +"signature": "(url)", +"doc": "" +}, +"urllib.parse.splituser": { +"name": "urllib.parse.splituser", +"module": "urllib.parse", +"kind": "function", +"signature": "(host)", +"doc": "" +}, +"urllib.parse.splitvalue": { +"name": "urllib.parse.splitvalue", +"module": "urllib.parse", +"kind": "function", +"signature": "(attr)", +"doc": "" +}, +"urllib.parse.to_bytes": { +"name": "urllib.parse.to_bytes", +"module": "urllib.parse", +"kind": "function", +"signature": "(url)", +"doc": "" +}, +"urllib.parse.unquote": { +"name": "urllib.parse.unquote", +"module": "urllib.parse", +"kind": "function", +"signature": "(string, encoding='utf-8', errors='replace')", +"doc": "Replace %xx escapes by their single-character equivalent. The optional" +}, +"urllib.parse.unquote_plus": { +"name": "urllib.parse.unquote_plus", +"module": "urllib.parse", +"kind": "function", +"signature": "(string, encoding='utf-8', errors='replace')", +"doc": "Like unquote(), but also replace plus signs by spaces, as required for" +}, +"urllib.parse.unquote_to_bytes": { +"name": "urllib.parse.unquote_to_bytes", +"module": "urllib.parse", +"kind": "function", +"signature": "(string)", +"doc": "unquote_to_bytes('abc%20def') -> b'abc def'." +}, +"urllib.parse.unwrap": { +"name": "urllib.parse.unwrap", +"module": "urllib.parse", +"kind": "function", +"signature": "(url)", +"doc": "Transform a string like '' into 'scheme://host/path'." +}, +"urllib.parse.urldefrag": { +"name": "urllib.parse.urldefrag", +"module": "urllib.parse", +"kind": "function", +"signature": "(url)", +"doc": "Removes any existing fragment from URL." +}, +"urllib.parse.urlencode": { +"name": "urllib.parse.urlencode", +"module": "urllib.parse", +"kind": "function", +"signature": "(query, doseq=False, safe='', encoding=None, errors=None, quote_via=)", +"doc": "Encode a dict or sequence of two-element tuples into a URL query string." +}, +"urllib.parse.urljoin": { +"name": "urllib.parse.urljoin", +"module": "urllib.parse", +"kind": "function", +"signature": "(base, url, allow_fragments=True)", +"doc": "Join a base URL and a possibly relative URL to form an absolute" +}, +"urllib.parse.urlparse": { +"name": "urllib.parse.urlparse", +"module": "urllib.parse", +"kind": "function", +"signature": "(url, scheme='', allow_fragments=True)", +"doc": "Parse a URL into 6 components:" +}, +"urllib.parse.urlsplit": { +"name": "urllib.parse.urlsplit", +"module": "urllib.parse", +"kind": "function", +"signature": "(url, scheme='', allow_fragments=True)", +"doc": "Parse a URL into 5 components:" +}, +"urllib.parse.urlunparse": { +"name": "urllib.parse.urlunparse", +"module": "urllib.parse", +"kind": "function", +"signature": "(components)", +"doc": "Put a parsed URL back together again. This may result in a" +}, +"urllib.parse.urlunsplit": { +"name": "urllib.parse.urlunsplit", +"module": "urllib.parse", +"kind": "function", +"signature": "(components)", +"doc": "Combine the elements of a tuple as returned by urlsplit() into a" +}, +"zlib.adler32": { +"name": "zlib.adler32", +"module": "zlib", +"kind": "function", +"signature": "(data, value=1, /)", +"doc": "Compute an Adler-32 checksum of data." +}, +"zlib.compress": { +"name": "zlib.compress", +"module": "zlib", +"kind": "function", +"signature": "(data, /, level=-1, wbits=15)", +"doc": "Returns a bytes object containing compressed data." +}, +"zlib.compressobj": { +"name": "zlib.compressobj", +"module": "zlib", +"kind": "function", +"signature": "(level=-1, method=8, wbits=15, memLevel=8, strategy=0, zdict=None)", +"doc": "Return a compressor object." +}, +"zlib.crc32": { +"name": "zlib.crc32", +"module": "zlib", +"kind": "function", +"signature": "(data, value=0, /)", +"doc": "Compute a CRC-32 checksum of data." +}, +"zlib.decompress": { +"name": "zlib.decompress", +"module": "zlib", +"kind": "function", +"signature": "(data, /, wbits=15, bufsize=16384)", +"doc": "Returns a bytes object containing the uncompressed data." +}, +"zlib.decompressobj": { +"name": "zlib.decompressobj", +"module": "zlib", +"kind": "function", +"signature": "(wbits=15, zdict=b'')", +"doc": "Return a decompressor object." +}, +"zlib.error": { +"name": "zlib.error", +"module": "zlib", +"kind": "class", +"signature": null, +"doc": "Common base class for all non-exit exceptions." +}, +"gzip.BadGzipFile": { +"name": "gzip.BadGzipFile", +"module": "gzip", +"kind": "class", +"signature": null, +"doc": "Exception raised in some cases for invalid gzip files." +}, +"gzip.GzipFile": { +"name": "gzip.GzipFile", +"module": "gzip", +"kind": "class", +"signature": "(filename=None, mode=None, compresslevel=9, fileobj=None, mtime=None)", +"doc": "The GzipFile class simulates most of the methods of a file object with" +}, +"gzip.compress": { +"name": "gzip.compress", +"module": "gzip", +"kind": "function", +"signature": "(data, compresslevel=9, *, mtime=None)", +"doc": "Compress data in one shot and return the compressed string." +}, +"gzip.decompress": { +"name": "gzip.decompress", +"module": "gzip", +"kind": "function", +"signature": "(data)", +"doc": "Decompress a gzip compressed string in one shot." +}, +"gzip.main": { +"name": "gzip.main", +"module": "gzip", +"kind": "function", +"signature": "()", +"doc": "" +}, +"gzip.open": { +"name": "gzip.open", +"module": "gzip", +"kind": "function", +"signature": "(filename, mode='rb', compresslevel=9, encoding=None, errors=None, newline=None)", +"doc": "Open a gzip-compressed file in binary or text mode." +}, +"gzip.write32u": { +"name": "gzip.write32u", +"module": "gzip", +"kind": "function", +"signature": "(output, value)", +"doc": "" +}, +"sqlite3.Blob": { +"name": "sqlite3.Blob", +"module": "sqlite3", +"kind": "class", +"signature": "()", +"doc": "" +}, +"sqlite3.Connection": { +"name": "sqlite3.Connection", +"module": "sqlite3", +"kind": "class", +"signature": null, +"doc": "SQLite database connection object." +}, +"sqlite3.Cursor": { +"name": "sqlite3.Cursor", +"module": "sqlite3", +"kind": "class", +"signature": null, +"doc": "SQLite database cursor class." +}, +"sqlite3.DataError": { +"name": "sqlite3.DataError", +"module": "sqlite3", +"kind": "class", +"signature": null, +"doc": "Common base class for all non-exit exceptions." +}, +"sqlite3.DatabaseError": { +"name": "sqlite3.DatabaseError", +"module": "sqlite3", +"kind": "class", +"signature": null, +"doc": "Common base class for all non-exit exceptions." +}, +"sqlite3.DateFromTicks": { +"name": "sqlite3.DateFromTicks", +"module": "sqlite3", +"kind": "function", +"signature": "(ticks)", +"doc": "" +}, +"sqlite3.Error": { +"name": "sqlite3.Error", +"module": "sqlite3", +"kind": "class", +"signature": null, +"doc": "Common base class for all non-exit exceptions." +}, +"sqlite3.IntegrityError": { +"name": "sqlite3.IntegrityError", +"module": "sqlite3", +"kind": "class", +"signature": null, +"doc": "Common base class for all non-exit exceptions." +}, +"sqlite3.InterfaceError": { +"name": "sqlite3.InterfaceError", +"module": "sqlite3", +"kind": "class", +"signature": null, +"doc": "Common base class for all non-exit exceptions." +}, +"sqlite3.InternalError": { +"name": "sqlite3.InternalError", +"module": "sqlite3", +"kind": "class", +"signature": null, +"doc": "Common base class for all non-exit exceptions." +}, +"sqlite3.NotSupportedError": { +"name": "sqlite3.NotSupportedError", +"module": "sqlite3", +"kind": "class", +"signature": null, +"doc": "Common base class for all non-exit exceptions." +}, +"sqlite3.OperationalError": { +"name": "sqlite3.OperationalError", +"module": "sqlite3", +"kind": "class", +"signature": null, +"doc": "Common base class for all non-exit exceptions." +}, +"sqlite3.PrepareProtocol": { +"name": "sqlite3.PrepareProtocol", +"module": "sqlite3", +"kind": "class", +"signature": null, +"doc": "PEP 246 style object adaption protocol type." +}, +"sqlite3.ProgrammingError": { +"name": "sqlite3.ProgrammingError", +"module": "sqlite3", +"kind": "class", +"signature": null, +"doc": "Common base class for all non-exit exceptions." +}, +"sqlite3.Row": { +"name": "sqlite3.Row", +"module": "sqlite3", +"kind": "class", +"signature": null, +"doc": "" +}, +"sqlite3.TimeFromTicks": { +"name": "sqlite3.TimeFromTicks", +"module": "sqlite3", +"kind": "function", +"signature": "(ticks)", +"doc": "" +}, +"sqlite3.TimestampFromTicks": { +"name": "sqlite3.TimestampFromTicks", +"module": "sqlite3", +"kind": "function", +"signature": "(ticks)", +"doc": "" +}, +"sqlite3.Warning": { +"name": "sqlite3.Warning", +"module": "sqlite3", +"kind": "class", +"signature": null, +"doc": "Common base class for all non-exit exceptions." +}, +"sqlite3.adapt": { +"name": "sqlite3.adapt", +"module": "sqlite3", +"kind": "function", +"signature": null, +"doc": "Adapt given object to given protocol." +}, +"sqlite3.complete_statement": { +"name": "sqlite3.complete_statement", +"module": "sqlite3", +"kind": "function", +"signature": "(statement)", +"doc": "Checks if a string contains a complete SQL statement." +}, +"sqlite3.connect": { +"name": "sqlite3.connect", +"module": "sqlite3", +"kind": "function", +"signature": null, +"doc": "Opens a connection to the SQLite database file database." +}, +"sqlite3.enable_callback_tracebacks": { +"name": "sqlite3.enable_callback_tracebacks", +"module": "sqlite3", +"kind": "function", +"signature": "(enable, /)", +"doc": "Enable or disable callback functions throwing errors to stderr." +}, +"sqlite3.register_adapter": { +"name": "sqlite3.register_adapter", +"module": "sqlite3", +"kind": "function", +"signature": "(type, adapter, /)", +"doc": "Register a function to adapt Python objects to SQLite values." +}, +"sqlite3.register_converter": { +"name": "sqlite3.register_converter", +"module": "sqlite3", +"kind": "function", +"signature": "(typename, converter, /)", +"doc": "Register a function to convert SQLite values to Python objects." +}, +"str.capitalize": { +"name": "str.capitalize", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return a capitalized version of the string." +}, +"str.casefold": { +"name": "str.casefold", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return a version of the string suitable for caseless comparisons." +}, +"str.center": { +"name": "str.center", +"module": "builtins", +"kind": "function", +"signature": "(self, width, fillchar=' ', /)", +"doc": "Return a centered string of length width." +}, +"str.count": { +"name": "str.count", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "S.count(sub[, start[, end]]) -> int" +}, +"str.encode": { +"name": "str.encode", +"module": "builtins", +"kind": "function", +"signature": "(self, /, encoding='utf-8', errors='strict')", +"doc": "Encode the string using the codec registered for encoding." +}, +"str.endswith": { +"name": "str.endswith", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "S.endswith(suffix[, start[, end]]) -> bool" +}, +"str.expandtabs": { +"name": "str.expandtabs", +"module": "builtins", +"kind": "function", +"signature": "(self, /, tabsize=8)", +"doc": "Return a copy where all tab characters are expanded using spaces." +}, +"str.find": { +"name": "str.find", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "S.find(sub[, start[, end]]) -> int" +}, +"str.format": { +"name": "str.format", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "S.format(*args, **kwargs) -> str" +}, +"str.format_map": { +"name": "str.format_map", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "S.format_map(mapping) -> str" +}, +"str.index": { +"name": "str.index", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "S.index(sub[, start[, end]]) -> int" +}, +"str.isalnum": { +"name": "str.isalnum", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return True if the string is an alpha-numeric string, False otherwise." +}, +"str.isalpha": { +"name": "str.isalpha", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return True if the string is an alphabetic string, False otherwise." +}, +"str.isascii": { +"name": "str.isascii", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return True if all characters in the string are ASCII, False otherwise." +}, +"str.isdecimal": { +"name": "str.isdecimal", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return True if the string is a decimal string, False otherwise." +}, +"str.isdigit": { +"name": "str.isdigit", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return True if the string is a digit string, False otherwise." +}, +"str.isidentifier": { +"name": "str.isidentifier", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return True if the string is a valid Python identifier, False otherwise." +}, +"str.islower": { +"name": "str.islower", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return True if the string is a lowercase string, False otherwise." +}, +"str.isnumeric": { +"name": "str.isnumeric", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return True if the string is a numeric string, False otherwise." +}, +"str.isprintable": { +"name": "str.isprintable", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return True if the string is printable, False otherwise." +}, +"str.isspace": { +"name": "str.isspace", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return True if the string is a whitespace string, False otherwise." +}, +"str.istitle": { +"name": "str.istitle", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return True if the string is a title-cased string, False otherwise." +}, +"str.isupper": { +"name": "str.isupper", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return True if the string is an uppercase string, False otherwise." +}, +"str.join": { +"name": "str.join", +"module": "builtins", +"kind": "function", +"signature": "(self, iterable, /)", +"doc": "Concatenate any number of strings." +}, +"str.ljust": { +"name": "str.ljust", +"module": "builtins", +"kind": "function", +"signature": "(self, width, fillchar=' ', /)", +"doc": "Return a left-justified string of length width." +}, +"str.lower": { +"name": "str.lower", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return a copy of the string converted to lowercase." +}, +"str.lstrip": { +"name": "str.lstrip", +"module": "builtins", +"kind": "function", +"signature": "(self, chars=None, /)", +"doc": "Return a copy of the string with leading whitespace removed." +}, +"str.maketrans": { +"name": "str.maketrans", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Return a translation table usable for str.translate()." +}, +"str.partition": { +"name": "str.partition", +"module": "builtins", +"kind": "function", +"signature": "(self, sep, /)", +"doc": "Partition the string into three parts using the given separator." +}, +"str.removeprefix": { +"name": "str.removeprefix", +"module": "builtins", +"kind": "function", +"signature": "(self, prefix, /)", +"doc": "Return a str with the given prefix string removed if present." +}, +"str.removesuffix": { +"name": "str.removesuffix", +"module": "builtins", +"kind": "function", +"signature": "(self, suffix, /)", +"doc": "Return a str with the given suffix string removed if present." +}, +"str.replace": { +"name": "str.replace", +"module": "builtins", +"kind": "function", +"signature": "(self, old, new, count=-1, /)", +"doc": "Return a copy with all occurrences of substring old replaced by new." +}, +"str.rfind": { +"name": "str.rfind", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "S.rfind(sub[, start[, end]]) -> int" +}, +"str.rindex": { +"name": "str.rindex", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "S.rindex(sub[, start[, end]]) -> int" +}, +"str.rjust": { +"name": "str.rjust", +"module": "builtins", +"kind": "function", +"signature": "(self, width, fillchar=' ', /)", +"doc": "Return a right-justified string of length width." +}, +"str.rpartition": { +"name": "str.rpartition", +"module": "builtins", +"kind": "function", +"signature": "(self, sep, /)", +"doc": "Partition the string into three parts using the given separator." +}, +"str.rsplit": { +"name": "str.rsplit", +"module": "builtins", +"kind": "function", +"signature": "(self, /, sep=None, maxsplit=-1)", +"doc": "Return a list of the substrings in the string, using sep as the separator string." +}, +"str.rstrip": { +"name": "str.rstrip", +"module": "builtins", +"kind": "function", +"signature": "(self, chars=None, /)", +"doc": "Return a copy of the string with trailing whitespace removed." +}, +"str.split": { +"name": "str.split", +"module": "builtins", +"kind": "function", +"signature": "(self, /, sep=None, maxsplit=-1)", +"doc": "Return a list of the substrings in the string, using sep as the separator string." +}, +"str.splitlines": { +"name": "str.splitlines", +"module": "builtins", +"kind": "function", +"signature": "(self, /, keepends=False)", +"doc": "Return a list of the lines in the string, breaking at line boundaries." +}, +"str.startswith": { +"name": "str.startswith", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "S.startswith(prefix[, start[, end]]) -> bool" +}, +"str.strip": { +"name": "str.strip", +"module": "builtins", +"kind": "function", +"signature": "(self, chars=None, /)", +"doc": "Return a copy of the string with leading and trailing whitespace removed." +}, +"str.swapcase": { +"name": "str.swapcase", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Convert uppercase characters to lowercase and lowercase characters to uppercase." +}, +"str.title": { +"name": "str.title", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return a version of the string where each word is titlecased." +}, +"str.translate": { +"name": "str.translate", +"module": "builtins", +"kind": "function", +"signature": "(self, table, /)", +"doc": "Replace each character in the string using the given translation table." +}, +"str.upper": { +"name": "str.upper", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return a copy of the string converted to uppercase." +}, +"str.zfill": { +"name": "str.zfill", +"module": "builtins", +"kind": "function", +"signature": "(self, width, /)", +"doc": "Pad a numeric string with zeros on the left, to fill a field of the given width." +}, +"list.append": { +"name": "list.append", +"module": "builtins", +"kind": "function", +"signature": "(self, object, /)", +"doc": "Append object to the end of the list." +}, +"list.clear": { +"name": "list.clear", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Remove all items from list." +}, +"list.copy": { +"name": "list.copy", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return a shallow copy of the list." +}, +"list.count": { +"name": "list.count", +"module": "builtins", +"kind": "function", +"signature": "(self, value, /)", +"doc": "Return number of occurrences of value." +}, +"list.extend": { +"name": "list.extend", +"module": "builtins", +"kind": "function", +"signature": "(self, iterable, /)", +"doc": "Extend list by appending elements from the iterable." +}, +"list.index": { +"name": "list.index", +"module": "builtins", +"kind": "function", +"signature": "(self, value, start=0, stop=9223372036854775807, /)", +"doc": "Return first index of value." +}, +"list.insert": { +"name": "list.insert", +"module": "builtins", +"kind": "function", +"signature": "(self, index, object, /)", +"doc": "Insert object before index." +}, +"list.pop": { +"name": "list.pop", +"module": "builtins", +"kind": "function", +"signature": "(self, index=-1, /)", +"doc": "Remove and return item at index (default last)." +}, +"list.remove": { +"name": "list.remove", +"module": "builtins", +"kind": "function", +"signature": "(self, value, /)", +"doc": "Remove first occurrence of value." +}, +"list.reverse": { +"name": "list.reverse", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Reverse *IN PLACE*." +}, +"list.sort": { +"name": "list.sort", +"module": "builtins", +"kind": "function", +"signature": "(self, /, *, key=None, reverse=False)", +"doc": "Sort the list in ascending order and return None." +}, +"dict.clear": { +"name": "dict.clear", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "D.clear() -> None. Remove all items from D." +}, +"dict.copy": { +"name": "dict.copy", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "D.copy() -> a shallow copy of D" +}, +"dict.fromkeys": { +"name": "dict.fromkeys", +"module": "builtins", +"kind": "function", +"signature": "(iterable, value=None, /)", +"doc": "Create a new dictionary with keys from iterable and values set to value." +}, +"dict.get": { +"name": "dict.get", +"module": "builtins", +"kind": "function", +"signature": "(self, key, default=None, /)", +"doc": "Return the value for key if key is in the dictionary, else default." +}, +"dict.items": { +"name": "dict.items", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "D.items() -> a set-like object providing a view on D's items" +}, +"dict.keys": { +"name": "dict.keys", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "D.keys() -> a set-like object providing a view on D's keys" +}, +"dict.pop": { +"name": "dict.pop", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "D.pop(k[,d]) -> v, remove specified key and return the corresponding value." +}, +"dict.popitem": { +"name": "dict.popitem", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Remove and return a (key, value) pair as a 2-tuple." +}, +"dict.setdefault": { +"name": "dict.setdefault", +"module": "builtins", +"kind": "function", +"signature": "(self, key, default=None, /)", +"doc": "Insert key with a value of default if key is not in the dictionary." +}, +"dict.update": { +"name": "dict.update", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "D.update([E, ]**F) -> None. Update D from dict/iterable E and F." +}, +"dict.values": { +"name": "dict.values", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "D.values() -> an object providing a view on D's values" +}, +"set.add": { +"name": "set.add", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Add an element to a set." +}, +"set.clear": { +"name": "set.clear", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Remove all elements from this set." +}, +"set.copy": { +"name": "set.copy", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Return a shallow copy of a set." +}, +"set.difference": { +"name": "set.difference", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Return the difference of two or more sets as a new set." +}, +"set.difference_update": { +"name": "set.difference_update", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Remove all elements of another set from this set." +}, +"set.discard": { +"name": "set.discard", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Remove an element from a set if it is a member." +}, +"set.intersection": { +"name": "set.intersection", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Return the intersection of two sets as a new set." +}, +"set.intersection_update": { +"name": "set.intersection_update", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Update a set with the intersection of itself and another." +}, +"set.isdisjoint": { +"name": "set.isdisjoint", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Return True if two sets have a null intersection." +}, +"set.issubset": { +"name": "set.issubset", +"module": "builtins", +"kind": "function", +"signature": "(self, other, /)", +"doc": "Test whether every element in the set is in other." +}, +"set.issuperset": { +"name": "set.issuperset", +"module": "builtins", +"kind": "function", +"signature": "(self, other, /)", +"doc": "Test whether every element in other is in the set." +}, +"set.pop": { +"name": "set.pop", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Remove and return an arbitrary set element." +}, +"set.remove": { +"name": "set.remove", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Remove an element from a set; it must be a member." +}, +"set.symmetric_difference": { +"name": "set.symmetric_difference", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Return the symmetric difference of two sets as a new set." +}, +"set.symmetric_difference_update": { +"name": "set.symmetric_difference_update", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Update a set with the symmetric difference of itself and another." +}, +"set.union": { +"name": "set.union", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Return the union of sets as a new set." +}, +"set.update": { +"name": "set.update", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Update a set with the union of itself and others." +}, +"tuple.count": { +"name": "tuple.count", +"module": "builtins", +"kind": "function", +"signature": "(self, value, /)", +"doc": "Return number of occurrences of value." +}, +"tuple.index": { +"name": "tuple.index", +"module": "builtins", +"kind": "function", +"signature": "(self, value, start=0, stop=9223372036854775807, /)", +"doc": "Return first index of value." +}, +"int.as_integer_ratio": { +"name": "int.as_integer_ratio", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return a pair of integers, whose ratio is equal to the original int." +}, +"int.bit_count": { +"name": "int.bit_count", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Number of ones in the binary representation of the absolute value of self." +}, +"int.bit_length": { +"name": "int.bit_length", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Number of bits necessary to represent self in binary." +}, +"int.conjugate": { +"name": "int.conjugate", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Returns self, the complex conjugate of any int." +}, +"int.from_bytes": { +"name": "int.from_bytes", +"module": "builtins", +"kind": "function", +"signature": "(bytes, byteorder='big', *, signed=False)", +"doc": "Return the integer represented by the given array of bytes." +}, +"int.is_integer": { +"name": "int.is_integer", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Returns True. Exists for duck type compatibility with float.is_integer." +}, +"int.to_bytes": { +"name": "int.to_bytes", +"module": "builtins", +"kind": "function", +"signature": "(self, /, length=1, byteorder='big', *, signed=False)", +"doc": "Return an array of bytes representing an integer." +}, +"float.as_integer_ratio": { +"name": "float.as_integer_ratio", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return a pair of integers, whose ratio is exactly equal to the original float." +}, +"float.conjugate": { +"name": "float.conjugate", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return self, the complex conjugate of any float." +}, +"float.fromhex": { +"name": "float.fromhex", +"module": "builtins", +"kind": "function", +"signature": "(string, /)", +"doc": "Create a floating-point number from a hexadecimal string." +}, +"float.hex": { +"name": "float.hex", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return a hexadecimal representation of a floating-point number." +}, +"float.is_integer": { +"name": "float.is_integer", +"module": "builtins", +"kind": "function", +"signature": "(self, /)", +"doc": "Return True if the float is an integer." +}, +"bytes.capitalize": { +"name": "bytes.capitalize", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "B.capitalize() -> copy of B" +}, +"bytes.center": { +"name": "bytes.center", +"module": "builtins", +"kind": "function", +"signature": "(self, width, fillchar=b' ', /)", +"doc": "Return a centered string of length width." +}, +"bytes.count": { +"name": "bytes.count", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "B.count(sub[, start[, end]]) -> int" +}, +"bytes.decode": { +"name": "bytes.decode", +"module": "builtins", +"kind": "function", +"signature": "(self, /, encoding='utf-8', errors='strict')", +"doc": "Decode the bytes using the codec registered for encoding." +}, +"bytes.endswith": { +"name": "bytes.endswith", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "B.endswith(suffix[, start[, end]]) -> bool" +}, +"bytes.expandtabs": { +"name": "bytes.expandtabs", +"module": "builtins", +"kind": "function", +"signature": "(self, /, tabsize=8)", +"doc": "Return a copy where all tab characters are expanded using spaces." +}, +"bytes.find": { +"name": "bytes.find", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "B.find(sub[, start[, end]]) -> int" +}, +"bytes.fromhex": { +"name": "bytes.fromhex", +"module": "builtins", +"kind": "function", +"signature": "(string, /)", +"doc": "Create a bytes object from a string of hexadecimal numbers." +}, +"bytes.hex": { +"name": "bytes.hex", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "Create a string of hexadecimal numbers from a bytes object." +}, +"bytes.index": { +"name": "bytes.index", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "B.index(sub[, start[, end]]) -> int" +}, +"bytes.isalnum": { +"name": "bytes.isalnum", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "B.isalnum() -> bool" +}, +"bytes.isalpha": { +"name": "bytes.isalpha", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "B.isalpha() -> bool" +}, +"bytes.isascii": { +"name": "bytes.isascii", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "B.isascii() -> bool" +}, +"bytes.isdigit": { +"name": "bytes.isdigit", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "B.isdigit() -> bool" +}, +"bytes.islower": { +"name": "bytes.islower", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "B.islower() -> bool" +}, +"bytes.isspace": { +"name": "bytes.isspace", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "B.isspace() -> bool" +}, +"bytes.istitle": { +"name": "bytes.istitle", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "B.istitle() -> bool" +}, +"bytes.isupper": { +"name": "bytes.isupper", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "B.isupper() -> bool" +}, +"bytes.join": { +"name": "bytes.join", +"module": "builtins", +"kind": "function", +"signature": "(self, iterable_of_bytes, /)", +"doc": "Concatenate any number of bytes objects." +}, +"bytes.ljust": { +"name": "bytes.ljust", +"module": "builtins", +"kind": "function", +"signature": "(self, width, fillchar=b' ', /)", +"doc": "Return a left-justified string of length width." +}, +"bytes.lower": { +"name": "bytes.lower", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "B.lower() -> copy of B" +}, +"bytes.lstrip": { +"name": "bytes.lstrip", +"module": "builtins", +"kind": "function", +"signature": "(self, bytes=None, /)", +"doc": "Strip leading bytes contained in the argument." +}, +"bytes.maketrans": { +"name": "bytes.maketrans", +"module": "builtins", +"kind": "function", +"signature": "(frm, to, /)", +"doc": "Return a translation table useable for the bytes or bytearray translate method." +}, +"bytes.partition": { +"name": "bytes.partition", +"module": "builtins", +"kind": "function", +"signature": "(self, sep, /)", +"doc": "Partition the bytes into three parts using the given separator." +}, +"bytes.removeprefix": { +"name": "bytes.removeprefix", +"module": "builtins", +"kind": "function", +"signature": "(self, prefix, /)", +"doc": "Return a bytes object with the given prefix string removed if present." +}, +"bytes.removesuffix": { +"name": "bytes.removesuffix", +"module": "builtins", +"kind": "function", +"signature": "(self, suffix, /)", +"doc": "Return a bytes object with the given suffix string removed if present." +}, +"bytes.replace": { +"name": "bytes.replace", +"module": "builtins", +"kind": "function", +"signature": "(self, old, new, count=-1, /)", +"doc": "Return a copy with all occurrences of substring old replaced by new." +}, +"bytes.rfind": { +"name": "bytes.rfind", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "B.rfind(sub[, start[, end]]) -> int" +}, +"bytes.rindex": { +"name": "bytes.rindex", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "B.rindex(sub[, start[, end]]) -> int" +}, +"bytes.rjust": { +"name": "bytes.rjust", +"module": "builtins", +"kind": "function", +"signature": "(self, width, fillchar=b' ', /)", +"doc": "Return a right-justified string of length width." +}, +"bytes.rpartition": { +"name": "bytes.rpartition", +"module": "builtins", +"kind": "function", +"signature": "(self, sep, /)", +"doc": "Partition the bytes into three parts using the given separator." +}, +"bytes.rsplit": { +"name": "bytes.rsplit", +"module": "builtins", +"kind": "function", +"signature": "(self, /, sep=None, maxsplit=-1)", +"doc": "Return a list of the sections in the bytes, using sep as the delimiter." +}, +"bytes.rstrip": { +"name": "bytes.rstrip", +"module": "builtins", +"kind": "function", +"signature": "(self, bytes=None, /)", +"doc": "Strip trailing bytes contained in the argument." +}, +"bytes.split": { +"name": "bytes.split", +"module": "builtins", +"kind": "function", +"signature": "(self, /, sep=None, maxsplit=-1)", +"doc": "Return a list of the sections in the bytes, using sep as the delimiter." +}, +"bytes.splitlines": { +"name": "bytes.splitlines", +"module": "builtins", +"kind": "function", +"signature": "(self, /, keepends=False)", +"doc": "Return a list of the lines in the bytes, breaking at line boundaries." +}, +"bytes.startswith": { +"name": "bytes.startswith", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "B.startswith(prefix[, start[, end]]) -> bool" +}, +"bytes.strip": { +"name": "bytes.strip", +"module": "builtins", +"kind": "function", +"signature": "(self, bytes=None, /)", +"doc": "Strip leading and trailing bytes contained in the argument." +}, +"bytes.swapcase": { +"name": "bytes.swapcase", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "B.swapcase() -> copy of B" +}, +"bytes.title": { +"name": "bytes.title", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "B.title() -> copy of B" +}, +"bytes.translate": { +"name": "bytes.translate", +"module": "builtins", +"kind": "function", +"signature": "(self, table, /, delete=b'')", +"doc": "Return a copy with each character mapped by the given translation table." +}, +"bytes.upper": { +"name": "bytes.upper", +"module": "builtins", +"kind": "function", +"signature": null, +"doc": "B.upper() -> copy of B" +}, +"bytes.zfill": { +"name": "bytes.zfill", +"module": "builtins", +"kind": "function", +"signature": "(self, width, /)", +"doc": "Pad a numeric string with zeros on the left, to fill a field of the given width." +} +} +} \ No newline at end of file diff --git a/root/specialists/python/verdict_dev.json b/root/specialists/python/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..c0e5754d667056ed2cc2386fcc457cf948239c0b --- /dev/null +++ b/root/specialists/python/verdict_dev.json @@ -0,0 +1,110 @@ +{ + "id": "python", + "name": "Oracle7 Python Reference", + "tier": "A", + "split": "dev", + "head": "oracle_release_runtime_w363", + "time": "2026-09-29T01:05:45Z", + "domain": { + "head": { + "correct": 5, + "false_yes": 0, + "n": 198, + "p50_ms": 150.81, + "fails": [ + [ + "signature", + "What are the parameters of random.shuffle in Python?", + "factoid:withheld|vessel:receipt", + "I have no admitted record that answers that about \"Python\", so I will not guess. The reply" + ], + [ + "doc", + "What does the Python function gzip.GzipFile do?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "doc", + "What does the Python function str.casefold do?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "doc", + "What does the Python function pow do?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "doc", + "What does the Python function str.lower do?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "signature", + "What are the parameters of statistics.fmean in Python?", + "factoid:withheld|vessel:receipt", + "I have no admitted record that answers that about \"Python\", so I will not guess. The reply" + ], + [ + "doc", + "What does the Python function UnboundLocalError do?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "signature", + "What are the parameters of itertools.count in Python?", + "factoid:withheld|vessel:receipt", + "I have no admitted record that answers that about \"Python\", so I will not guess. The reply" + ] + ] + }, + "spec": { + "correct": 198, + "false_yes": 0, + "n": 198, + "p50_ms": 0.01, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.15, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/python/verdict_heldout.json b/root/specialists/python/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..dc7bde8cad5efb17c46da5cd66860e2f99031883 --- /dev/null +++ b/root/specialists/python/verdict_heldout.json @@ -0,0 +1,159 @@ +{ + "id": "python", + "name": "Oracle7 Python Reference", + "tier": "A", + "split": "heldout", + "head": "oracle_release_runtime_w363", + "time": "2026-09-29T01:14:55Z", + "domain": { + "head": { + "correct": 0, + "false_yes": 5, + "n": 224, + "p50_ms": 428.91, + "fails": [ + [ + "signature", + "What arguments does Python's bytes.partition take?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "signature", + "What arguments does Python's random.vonmisesvariate take?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "doc", + "Explain what bytes.replace does in Python.", + "organ:converse>request", + "Here's what my sources say about bytes: The byte is a unit of digital information that mos" + ], + [ + "signature", + "What arguments does Python's functools.lru_cache take?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "signature", + "What arguments does Python's heapq.merge take?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "doc", + "Explain what ImportWarning does in Python.", + "organ:converse>request", + "Here's what my sources say about python: Python is the name given to a genus of constricti" + ], + [ + "signature", + "What arguments does Python's sys.set_coroutine_origin_tracking_depth t", + "arb:timeline->capability:timeline|vessel", + "A timeline needs at least two dated statements; the admitted material on arguments contain" + ], + [ + "module", + "What module provides set_asyncgen_hooks in Python?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 186, + "false_yes": 0, + "n": 224, + "p50_ms": 0.02, + "fails": [ + [ + "doc", + "Explain what ImportWarning does in Python.", + "organ:converse>request", + "Here's what my sources say about python: Python is the name given to a genus of constricti" + ], + [ + "signature", + "What arguments does Python's format take?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "doc", + "Explain what NotADirectoryError does in Python.", + "organ:converse>request", + "Here's what my sources say about python: Python is the name given to a genus of constricti" + ], + [ + "doc", + "Explain what super does in Python.", + "organ:converse>request", + "Here's what my sources say about python: Python is the name given to a genus of constricti" + ], + [ + "doc", + "Explain what ModuleNotFoundError does in Python.", + "organ:converse>request", + "Here's what my sources say about python: Python is the name given to a genus of constricti" + ], + [ + "doc", + "Explain what hasattr does in Python.", + "organ:converse>request", + "Here's what my sources say about python: Python is the name given to a genus of constricti" + ], + [ + "doc", + "Explain what isinstance does in Python.", + "organ:converse>request", + "Here's what my sources say about python: Python is the name given to a genus of constricti" + ], + [ + "doc", + "Explain what PermissionError does in Python.", + "organ:converse>request", + "Here's what my sources say about python: Python is the name given to a genus of constricti" + ] + ] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.15, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-airlines/manifest.json b/root/specialists/rel-airlines/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..e4bfe7e6bd8488ac37d5f1b034fa46f77ade0804 --- /dev/null +++ b/root/specialists/rel-airlines/manifest.json @@ -0,0 +1,72 @@ +{ + "id": "rel-airlines", + "name": "Oracle7 Relations: Airlines", + "number": 160, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-airlines/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-airlines", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "airlines", + "kind": "airlines" + } + }, + "accept": { + "kinds": [ + "airlines" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-airlines/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [ + 46970 + ], + "occupations": [] + }, + "readers": [ + "112", + "159", + "571", + "17" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-airlines/organ_relation_v2.py b/root/specialists/rel-airlines/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-airlines/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-airlines/readers.json b/root/specialists/rel-airlines/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..f70be5483071025b0ccf25143fe5d427f920f869 --- /dev/null +++ b/root/specialists/rel-airlines/readers.json @@ -0,0 +1,9 @@ +{ + "keys": [ + "112", + "159", + "571", + "17" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-airlines/relation_panel_v2.json b/root/specialists/rel-airlines/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..8c7ca0734a95b2034522787fe5f3b9d680bc09a8 --- /dev/null +++ b/root/specialists/rel-airlines/relation_panel_v2.json @@ -0,0 +1,848 @@ +[ + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Who founded Kingfisher Airlines?", + "expect": "Vijay Mallya", + "relation": "fwd P112", + "entity": "Q744935" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Who founded JetBlue Airways?", + "expect": "David Neeleman", + "relation": "fwd P112", + "entity": "Q161086" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Who founded Air Transat?", + "expect": "Fran\u00e7ois Legault", + "relation": "fwd P112", + "entity": "Q407869" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Who founded UTair Aviation?", + "expect": "Andrei Martirosov", + "relation": "fwd P112", + "entity": "Q1065835" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Who founded Wider\u00f8e?", + "expect": "Viggo Wider\u00f8e", + "relation": "fwd P112", + "entity": "Q28344" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Who founded Ural Airlines?", + "expect": "Sergey Skuratov", + "relation": "fwd P112", + "entity": "Q581161" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Who founded Meridiana?", + "expect": "Aga Khan IV", + "relation": "fwd P112", + "entity": "Q1156345" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Who founded Braniff International Airways?", + "expect": "Paul Revere Braniff", + "relation": "fwd P112", + "entity": "Q898522" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Who founded Wind Jet?", + "expect": "Antonino Pulvirenti", + "relation": "fwd P112", + "entity": "Q672326" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Who founded EVA Air?", + "expect": "Chang Yung-fa", + "relation": "fwd P112", + "entity": "Q715113" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Who founded Alaska Airlines?", + "expect": "Linious McGee", + "relation": "fwd P112", + "entity": "Q822614" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Who founded VietJet Air?", + "expect": "Nguyen Thi Phuong Thao", + "relation": "fwd P112", + "entity": "Q853878" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Who was the founder of Martinair?", + "expect": "Martin Schr\u00f6der", + "relation": "fwd P112", + "entity": "Q426851" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Who was the founder of SkyWest Airlines?", + "expect": "Ralph Atkin", + "relation": "fwd P112", + "entity": "Q773662" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Who was the founder of Virgin Express?", + "expect": "Richard Branson", + "relation": "fwd P112", + "entity": "Q1191086" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Who was the founder of Simplifly Deccan?", + "expect": "G. R. Gopinath", + "relation": "fwd P112", + "entity": "Q1426357" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Who was the founder of DELAG?", + "expect": "Ferdinand von Zeppelin", + "relation": "fwd P112", + "entity": "Q682863" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Who was the founder of Poste Air Cargo?", + "expect": "Bud Spencer", + "relation": "fwd P112", + "entity": "Q1939338" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Who was the founder of Akasa Air?", + "expect": "Aditya Ghosh", + "relation": "fwd P112", + "entity": "Q109536115" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Who was the founder of Air Creebec?", + "expect": "Billy Diamond", + "relation": "fwd P112", + "entity": "Q407055" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Who was the founder of Niki?", + "expect": "Niki Lauda", + "relation": "fwd P112", + "entity": "Q865858" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Who was the founder of Cebu Pacific?", + "expect": "John Gokongwei", + "relation": "fwd P112", + "entity": "Q995151" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Who was the founder of Braathens?", + "expect": "Ludvig G. Braathen", + "relation": "fwd P112", + "entity": "Q1334889" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Who was the founder of Transavia?", + "expect": "John Nicolaas Block", + "relation": "fwd P112", + "entity": "Q246952" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Where is EgyptAir Express headquartered?", + "expect": "Cairo", + "relation": "fwd P159", + "entity": "Q1199780" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Where is Mauritania Airlines headquartered?", + "expect": "Nouakchott", + "relation": "fwd P159", + "entity": "Q3852483" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Where is Air Alg\u00e9rie headquartered?", + "expect": "Algiers", + "relation": "fwd P159", + "entity": "Q406764" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Where is Dobrolet Airlines headquartered?", + "expect": "Moscow", + "relation": "fwd P159", + "entity": "Q16644952" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Where is Tailwind Airlines headquartered?", + "expect": "Istanbul", + "relation": "fwd P159", + "entity": "Q660062" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Where is National Airlines headquartered?", + "expect": "Orlando", + "relation": "fwd P159", + "entity": "Q899774" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Where is Lufthansa CityLine headquartered?", + "expect": "Munich Airport", + "relation": "fwd P159", + "entity": "Q162189" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Where is Air Sinai headquartered?", + "expect": "Cairo", + "relation": "fwd P159", + "entity": "Q1340479" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Where is Avion Express headquartered?", + "expect": "Vilnius", + "relation": "fwd P159", + "entity": "Q791093" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Where is Eritrean Airlines headquartered?", + "expect": "Asmara", + "relation": "fwd P159", + "entity": "Q685418" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Where is China Postal Airlines headquartered?", + "expect": "Beijing", + "relation": "fwd P159", + "entity": "Q1073481" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "Where is Airnorth headquartered?", + "expect": "Darwin", + "relation": "fwd P159", + "entity": "Q408864" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Where are the headquarters of Smartwings?", + "expect": "Prague", + "relation": "fwd P159", + "entity": "Q1853488" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Where are the headquarters of Air Canada Express?", + "expect": "Montreal", + "relation": "fwd P159", + "entity": "Q666821" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Where are the headquarters of Pobeda?", + "expect": "Moscow", + "relation": "fwd P159", + "entity": "Q18398469" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Where are the headquarters of Ibex Airlines?", + "expect": "Tokyo", + "relation": "fwd P159", + "entity": "Q1340730" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Where are the headquarters of Nippon Cargo Airlines?", + "expect": "Narita International Airport", + "relation": "fwd P159", + "entity": "Q1364998" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Where are the headquarters of Level?", + "expect": "Viladecans", + "relation": "fwd P159", + "entity": "Q28955954" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Where are the headquarters of Nok Air?", + "expect": "Sathon", + "relation": "fwd P159", + "entity": "Q1065088" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Where are the headquarters of Tiger Airways?", + "expect": "Singapore", + "relation": "fwd P159", + "entity": "Q483281" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Where are the headquarters of Star Per\u00fa?", + "expect": "Lima", + "relation": "fwd P159", + "entity": "Q1798128" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Where are the headquarters of ASL Airlines France?", + "expect": "Paris", + "relation": "fwd P159", + "entity": "Q1376268" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Where are the headquarters of Vladivostok Air?", + "expect": "Vladivostok", + "relation": "fwd P159", + "entity": "Q1068446" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Where are the headquarters of Bangkok Airways?", + "expect": "Bangkok", + "relation": "fwd P159", + "entity": "Q806487" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "When was Clickair founded?", + "expect": "2006", + "relation": "fwd P571", + "entity": "Q1100995" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "When was Daallo Airlines founded?", + "expect": "1991", + "relation": "fwd P571", + "entity": "Q1094344" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "When was Meridiana founded?", + "expect": "3 May 1991", + "relation": "fwd P571", + "entity": "Q1156345" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "When was Maya Island Air founded?", + "expect": "1962", + "relation": "fwd P571", + "entity": "Q1370452" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "When was Go First founded?", + "expect": "4 November 2005", + "relation": "fwd P571", + "entity": "Q1350144" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "When was Allegiant Air founded?", + "expect": "1997", + "relation": "fwd P571", + "entity": "Q1319601" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "When was KrasAir founded?", + "expect": "1934", + "relation": "fwd P571", + "entity": "Q142227" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "When was American Eagle founded?", + "expect": "1984", + "relation": "fwd P571", + "entity": "Q15670994" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "When was Nordic Regional Airlines founded?", + "expect": "2011", + "relation": "fwd P571", + "entity": "Q1434560" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "When was TAME founded?", + "expect": "17 December 1962", + "relation": "fwd P571", + "entity": "Q1530726" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "When was Hong Kong Airlines founded?", + "expect": "28 March 2001", + "relation": "fwd P571", + "entity": "Q1035195" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "When was Libyan Airlines founded?", + "expect": "1965", + "relation": "fwd P571", + "entity": "Q1056939" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "In what year was Titan Airways established?", + "expect": "1988", + "relation": "fwd P571", + "entity": "Q153733" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "In what year was Virgin Express established?", + "expect": "1996", + "relation": "fwd P571", + "entity": "Q1191086" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "In what year was Alitalia established?", + "expect": "1946", + "relation": "fwd P571", + "entity": "Q153975" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "In what year was Grand China Air established?", + "expect": "2007", + "relation": "fwd P571", + "entity": "Q1542571" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "In what year was China Cargo Airlines established?", + "expect": "1998", + "relation": "fwd P571", + "entity": "Q1073234" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "In what year was Palestinian Airlines established?", + "expect": "1995", + "relation": "fwd P571", + "entity": "Q1355503" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "In what year was Orient Thai Airlines established?", + "expect": "1995", + "relation": "fwd P571", + "entity": "Q1068909" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "In what year was China Express Airlines established?", + "expect": "2004", + "relation": "fwd P571", + "entity": "Q1073273" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "In what year was Pacific Airlines established?", + "expect": "1991", + "relation": "fwd P571", + "entity": "Q1156874" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "In what year was Mandala Airlines established?", + "expect": "1969", + "relation": "fwd P571", + "entity": "Q1198815" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "In what year was Dana Air established?", + "expect": "2008", + "relation": "fwd P571", + "entity": "Q1159205" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "In what year was Surinam Airways established?", + "expect": "1955", + "relation": "fwd P571", + "entity": "Q1059033" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "In which country is Canadian Airlines International?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q627115" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "In which country is WestJet?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q1059770" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "In which country is Air Canada Rouge?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q2828184" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "In which country is First Air?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q1419271" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "In which country is Japan Air Commuter?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1191485" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "In which country is Japan Transocean Air?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q574659" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "In which country is J-Air?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1188326" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "In which country is Japan Airlines?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q213140" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "In which country is Vanilla Air?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q15149613" + }, + { + "split": "dev", + "kind": "airlines", + "valid": true, + "q": "In which country is Air Transat?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q407869" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Which country is Hokkaido Air System in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1188206" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Which country is Peach in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1376634" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Which country is Jetstar Japan in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q117433" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Which country is Air Inuit in?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q407371" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Which country is Porter Airlines in?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q1811473" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Which country is Buffalo Airways in?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q622029" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Which country is JALways in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1319224" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Which country is AirAsia Japan in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1376644" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Which country is Air North in?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q407673" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Which country is Sunwing Airlines in?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q1198402" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Which country is Cargojet in?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q376186" + }, + { + "split": "heldout", + "kind": "airlines", + "valid": true, + "q": "Which country is Air Creebec in?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q407055" + } +] \ No newline at end of file diff --git a/root/specialists/rel-airlines/relspec_scorer.py b/root/specialists/rel-airlines/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-airlines/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-airlines/verdict_dev.json b/root/specialists/rel-airlines/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..0dbdbfc27ebf4d33ac0e6a77a9332d15d8004dd1 --- /dev/null +++ b/root/specialists/rel-airlines/verdict_dev.json @@ -0,0 +1,145 @@ +{ + "id": "rel-airlines", + "name": "Oracle7 Relations: Airlines", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:12:07Z", + "domain": { + "head": { + "correct": 21, + "false_yes": 0, + "wrong": 4, + "n": 46, + "p50_ms": 436.57, + "fails": [ + [ + "airlines", + "Who founded JetBlue Airways?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "airlines", + "Who founded Air Transat?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "airlines", + "Who founded UTair Aviation?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "airlines", + "Who founded Wider\u00f8e?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "airlines", + "Who founded Meridiana?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "airlines", + "Who founded Wind Jet?", + "precision_guard:G3_evidence_misses_quest", + "I can't verify an answer to that exact question, so I won't guess." + ], + [ + "airlines", + "Who founded VietJet Air?", + "unverified:factoid:page", + "I found a passage that may be related, but I can't verify it answers your question: \"Found" + ], + [ + "airlines", + "Where is Air Alg\u00e9rie headquartered?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 41, + "false_yes": 0, + "wrong": 0, + "n": 46, + "p50_ms": 3.68, + "fails": [ + [ + "airlines", + "Where is National Airlines headquartered?", + "specialist:rel-airlines>unverified", + "I can't verify the seat of National Airlines from my records, so I won't guess." + ], + [ + "airlines", + "In which country is Air Canada Rouge?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "airlines", + "In which country is Japan Air Commuter?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "airlines", + "In which country is Japan Transocean Air?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "airlines", + "In which country is Japan Airlines?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-airlines/verdict_heldout.json b/root/specialists/rel-airlines/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..daaea90c3e785870c3d99ab9a12218d05411dbd4 --- /dev/null +++ b/root/specialists/rel-airlines/verdict_heldout.json @@ -0,0 +1,145 @@ +{ + "id": "rel-airlines", + "name": "Oracle7 Relations: Airlines", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:12:48Z", + "domain": { + "head": { + "correct": 17, + "false_yes": 0, + "wrong": 14, + "n": 48, + "p50_ms": 449.58, + "fails": [ + [ + "airlines", + "Who was the founder of Martinair?", + "unverified:factoid:fts", + "I found a passage that may be related, but I can't verify it answers your question: \"He wa" + ], + [ + "airlines", + "Who was the founder of SkyWest Airlines?", + "arb:explain_simply->capability:explain_s", + "[ev:unknown] In simple terms: The dictionary sense: One who founds or establishes (a compa" + ], + [ + "airlines", + "Who was the founder of Virgin Express?", + "arb:explain_simply->capability:explain_s", + "[ev:unknown] In simple terms: The dictionary sense: One who founds or establishes (a compa" + ], + [ + "airlines", + "Who was the founder of Simplifly Deccan?", + "arb:explain_simply->capability:explain_s", + "[ev:unknown] In simple terms: The dictionary sense: One who founds or establishes (a compa" + ], + [ + "airlines", + "Who was the founder of DELAG?", + "arb:explain_simply->capability:explain_s", + "[ev:unknown] In simple terms: The dictionary sense: One who founds or establishes (a compa" + ], + [ + "airlines", + "Who was the founder of Poste Air Cargo?", + "arb:explain_simply->capability:explain_s", + "[ev:unknown] In simple terms: The dictionary sense: One who founds or establishes (a compa" + ], + [ + "airlines", + "Who was the founder of Akasa Air?", + "arb:explain_simply->capability:explain_s", + "[ev:unknown] In simple terms: The dictionary sense: One who founds or establishes (a compa" + ], + [ + "airlines", + "Who was the founder of Air Creebec?", + "arb:explain_simply->capability:explain_s", + "[ev:unknown] In simple terms: The dictionary sense: One who founds or establishes (a compa" + ] + ] + }, + "spec": { + "correct": 43, + "false_yes": 0, + "wrong": 0, + "n": 48, + "p50_ms": 2.64, + "fails": [ + [ + "airlines", + "Who was the founder of SkyWest Airlines?", + "specialist:rel-airlines>unverified", + "I can't verify the starter of SkyWest Airlines from my records, so I won't guess." + ], + [ + "airlines", + "Where are the headquarters of Level?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "airlines", + "Which country is Peach in?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "airlines", + "Which country is Jetstar Japan in?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "airlines", + "Which country is AirAsia Japan in?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-albums/manifest.json b/root/specialists/rel-albums/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..e64d56250e2799fd702cd94ebb57d3d6419f6aeb --- /dev/null +++ b/root/specialists/rel-albums/manifest.json @@ -0,0 +1,71 @@ +{ + "id": "rel-albums", + "name": "Oracle7 Relations: Albums", + "number": 127, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-albums/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-albums", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "albums", + "kind": "albums" + } + }, + "accept": { + "kinds": [ + "albums" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-albums/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [ + 482994 + ], + "occupations": [] + }, + "readers": [ + "175", + "577", + "264" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-albums/organ_relation_v2.py b/root/specialists/rel-albums/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-albums/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-albums/patterns.json b/root/specialists/rel-albums/patterns.json new file mode 100644 index 0000000000000000000000000000000000000000..55751e153cd77db8af52d053737674d792ffd80d --- /dev/null +++ b/root/specialists/rel-albums/patterns.json @@ -0,0 +1,32 @@ +{ + "fwd|which|band": [ + 175, + 1.0, + 0.955, + 40 + ], + "fwd|which|entitled": [ + 175, + 1.0, + 1.0, + 26 + ], + "fwd|which|released": [ + 175, + 0.929, + 1.0, + 65 + ], + "fwd|which|rock": [ + 175, + 1.0, + 1.0, + 10 + ], + "fwd|who|released": [ + 175, + 1.0, + 1.0, + 29 + ] +} \ No newline at end of file diff --git a/root/specialists/rel-albums/readers.json b/root/specialists/rel-albums/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..a1a61760a8f6910cff082d66ba020af966e6dc51 --- /dev/null +++ b/root/specialists/rel-albums/readers.json @@ -0,0 +1,8 @@ +{ + "keys": [ + "175", + "577", + "264" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-albums/relation_panel_v2.json b/root/specialists/rel-albums/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..b85bbe58b5235ee6e8ffca0a19fbb3ea873a1830 --- /dev/null +++ b/root/specialists/rel-albums/relation_panel_v2.json @@ -0,0 +1,650 @@ +[ + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Who performed Journeyman?", + "expect": "Eric Clapton", + "relation": "fwd P175", + "entity": "Q596201" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Who performed Know Your Enemy?", + "expect": "Manic Street Preachers", + "relation": "fwd P175", + "entity": "Q1768342" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Who performed Dig Out Your Soul?", + "expect": "Oasis", + "relation": "fwd P175", + "entity": "Q1129617" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Who performed Empty Sky?", + "expect": "Elton John", + "relation": "fwd P175", + "entity": "Q1753065" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Who performed Toward the Within?", + "expect": "Dead Can Dance", + "relation": "fwd P175", + "entity": "Q1934269" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Who performed Blood Fire Death?", + "expect": "Bathory", + "relation": "fwd P175", + "entity": "Q804532" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Who performed Big Thing?", + "expect": "Duran Duran", + "relation": "fwd P175", + "entity": "Q2314929" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Who performed The Complete Studio Recordings?", + "expect": "Led Zeppelin", + "relation": "fwd P175", + "entity": "Q747917" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Who performed Extraordinary Machine?", + "expect": "Fiona Apple", + "relation": "fwd P175", + "entity": "Q1617282" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Who performed Glory?", + "expect": "Britney Spears", + "relation": "fwd P175", + "entity": "Q26213106" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Who performed The Visitors?", + "expect": "ABBA", + "relation": "fwd P175", + "entity": "Q338553" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Who performed Strictly 4 My N.I.G.G.A.Z.\u2026?", + "expect": "Tupac Shakur", + "relation": "fwd P175", + "entity": "Q262226" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "Which artist recorded Horizontal?", + "expect": "Bee Gees", + "relation": "fwd P175", + "entity": "Q924970" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "Which artist recorded Video Greatest Hits \u2013 HIStory?", + "expect": "Michael Jackson", + "relation": "fwd P175", + "entity": "Q941927" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "Which artist recorded Infinite?", + "expect": "Stratovarius", + "relation": "fwd P175", + "entity": "Q845178" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "Which artist recorded Score?", + "expect": "Dream Theater", + "relation": "fwd P175", + "entity": "Q626571" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "Which artist recorded Maiden England?", + "expect": "Iron Maiden", + "relation": "fwd P175", + "entity": "Q2264768" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "Which artist recorded Blondie?", + "expect": "Blondie", + "relation": "fwd P175", + "entity": "Q804530" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "Which artist recorded Nightlife?", + "expect": "Pet Shop Boys", + "relation": "fwd P175", + "entity": "Q1049789" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "Which artist recorded Nation?", + "expect": "Sepultura", + "relation": "fwd P175", + "entity": "Q1768180" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "Which artist recorded Dirty Mind?", + "expect": "Prince", + "relation": "fwd P175", + "entity": "Q1228240" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "Which artist recorded Blue Blood?", + "expect": "X Japan", + "relation": "fwd P175", + "entity": "Q1195366" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "Which artist recorded Take a Look in the Mirror?", + "expect": "Korn", + "relation": "fwd P175", + "entity": "Q594590" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "Which artist recorded J to tha L\u2013O! The Remixes?", + "expect": "Jennifer Lopez", + "relation": "fwd P175", + "entity": "Q432002" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "When was Whole Lotta Red released?", + "expect": "25 December 2020", + "relation": "fwd P577", + "entity": "Q104461032" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "When was Studio Tan released?", + "expect": "15 September 1978", + "relation": "fwd P577", + "entity": "Q1086672" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "When was The Who by Numbers released?", + "expect": "3 October 1975", + "relation": "fwd P577", + "entity": "Q1543160" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "When was 1,039/Smoothed Out Slappy Hours released?", + "expect": "1 July 1990", + "relation": "fwd P577", + "entity": "Q1123314" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "When was Greatest Hits released?", + "expect": "31 October 2005", + "relation": "fwd P577", + "entity": "Q1028050" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "When was Positions released?", + "expect": "30 October 2020", + "relation": "fwd P577", + "entity": "Q100351980" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "When was Jumping All Over the World released?", + "expect": "30 November 2007", + "relation": "fwd P577", + "entity": "Q1071839" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "When was In a Reverie released?", + "expect": "1999", + "relation": "fwd P577", + "entity": "Q129704" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "When was The Electric Light Orchestra released?", + "expect": "1 December 1971", + "relation": "fwd P577", + "entity": "Q1202623" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "When was Metal Heart released?", + "expect": "4 March 1985", + "relation": "fwd P577", + "entity": "Q1051596" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "When was Karmacode released?", + "expect": "31 March 2006", + "relation": "fwd P577", + "entity": "Q1422385" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "When was Good Girl Gone Bad: The Remixes released?", + "expect": "27 January 2009", + "relation": "fwd P577", + "entity": "Q1537502" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "In what year was Phobia released?", + "expect": "2006", + "relation": "fwd P577", + "entity": "Q1088109" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "In what year was Slowly We Rot released?", + "expect": "1989", + "relation": "fwd P577", + "entity": "Q1463856" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "In what year was Harry Potter and the Order of the Phoenix released?", + "expect": "2007", + "relation": "fwd P577", + "entity": "Q1148993" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "In what year was Death Magnetic released?", + "expect": "2008", + "relation": "fwd P577", + "entity": "Q151657" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "In what year was Mercury Falling released?", + "expect": "1996", + "relation": "fwd P577", + "entity": "Q1091258" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "In what year was Yeezus released?", + "expect": "2013", + "relation": "fwd P577", + "entity": "Q13378144" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "In what year was F.A.M.E. released?", + "expect": "2011", + "relation": "fwd P577", + "entity": "Q1386269" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "In what year was Predator released?", + "expect": "1996", + "relation": "fwd P577", + "entity": "Q1088494" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "In what year was Diabolus in Musica released?", + "expect": "1998", + "relation": "fwd P577", + "entity": "Q135720" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "In what year was Messy Little Raindrops released?", + "expect": "2010", + "relation": "fwd P577", + "entity": "Q1176181" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "In what year was With the Lights Out released?", + "expect": "2004", + "relation": "fwd P577", + "entity": "Q1140480" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "In what year was Mirror Ball released?", + "expect": "1995", + "relation": "fwd P577", + "entity": "Q1170703" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Which label released Reality Killed the Video Star?", + "expect": "Virgin Records", + "relation": "fwd P264", + "entity": "Q420871" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Which label released One Day in Your Life?", + "expect": "Motown", + "relation": "fwd P264", + "entity": "Q625491" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Which label released Original Soundtracks 1?", + "expect": "Island Records", + "relation": "fwd P264", + "entity": "Q1078102" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Which label released Emergency on Planet Earth?", + "expect": "Columbia Records", + "relation": "fwd P264", + "entity": "Q549484" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Which label released Channel Orange?", + "expect": "Def Jam Recordings", + "relation": "fwd P264", + "entity": "Q402035" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Which label released Placebo?", + "expect": "Virgin Records", + "relation": "fwd P264", + "entity": "Q901155" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Which label released Father of All Motherfuckers?", + "expect": "Reprise Records", + "relation": "fwd P264", + "entity": "Q67384982" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Which label released Dear Heather?", + "expect": "Columbia Records", + "relation": "fwd P264", + "entity": "Q1930251" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Which label released Tomb of the Mutilated?", + "expect": "Metal Blade Records", + "relation": "fwd P264", + "entity": "Q848347" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Which label released Hail to the Thief?", + "expect": "Parlophone", + "relation": "fwd P264", + "entity": "Q274963" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Which label released Alien Love Secrets?", + "expect": "Relativity Records", + "relation": "fwd P264", + "entity": "Q613349" + }, + { + "split": "dev", + "kind": "albums", + "valid": true, + "q": "Which label released Rosenrot?", + "expect": "Universal Music Group", + "relation": "fwd P264", + "entity": "Q213591" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "On which record label was Get Yer Ya-Ya's Out! The Rolling Stones in Concert released?", + "expect": "Decca", + "relation": "fwd P264", + "entity": "Q839836" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "On which record label was Shadow Zone released?", + "expect": "Warner Bros. Records", + "relation": "fwd P264", + "entity": "Q1460922" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "On which record label was Love. Angel. Music. Baby. released?", + "expect": "Interscope Records", + "relation": "fwd P264", + "entity": "Q750087" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "On which record label was Speaking in Tongues released?", + "expect": "Sire", + "relation": "fwd P264", + "entity": "Q236304" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "On which record label was Unknown Pleasures released?", + "expect": "Factory Records", + "relation": "fwd P264", + "entity": "Q735573" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "On which record label was E.S.P. released?", + "expect": "Warner Music Group", + "relation": "fwd P264", + "entity": "Q971427" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "On which record label was Larks' Tongues in Aspic released?", + "expect": "Island Records", + "relation": "fwd P264", + "entity": "Q725114" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "On which record label was Never Say Never released?", + "expect": "Atlantic Records", + "relation": "fwd P264", + "entity": "Q583084" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "On which record label was Score released?", + "expect": "Rhino Entertainment Company", + "relation": "fwd P264", + "entity": "Q626571" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "On which record label was Land of the Free released?", + "expect": "Noise Records", + "relation": "fwd P264", + "entity": "Q1931178" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "On which record label was Spleen and Ideal released?", + "expect": "4AD", + "relation": "fwd P264", + "entity": "Q1755639" + }, + { + "split": "heldout", + "kind": "albums", + "valid": true, + "q": "On which record label was Murder Ballads released?", + "expect": "Mute Records", + "relation": "fwd P264", + "entity": "Q965613" + } +] \ No newline at end of file diff --git a/root/specialists/rel-albums/relspec_scorer.py b/root/specialists/rel-albums/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-albums/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-albums/verdict_dev.json b/root/specialists/rel-albums/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..fb1b48ac9442a5f81d36e3e75253f99fefcc57c4 --- /dev/null +++ b/root/specialists/rel-albums/verdict_dev.json @@ -0,0 +1,139 @@ +{ + "id": "rel-albums", + "name": "Oracle7 Relations: Albums", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w524", + "time": "2026-10-08T23:53:09Z", + "domain": { + "head": { + "correct": 6, + "false_yes": 0, + "wrong": 3, + "n": 36, + "p50_ms": 516.82, + "fails": [ + [ + "albums", + "Who performed Journeyman?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "albums", + "Who performed Know Your Enemy?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "albums", + "Who performed Dig Out Your Soul?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "albums", + "Who performed Toward the Within?", + "precision_guard:G3_evidence_misses_quest", + "I can't verify an answer to that exact question, so I won't guess." + ], + [ + "albums", + "Who performed Blood Fire Death?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "albums", + "Who performed Big Thing?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "albums", + "Who performed The Complete Studio Recordings?", + "unverified:compose:bridge", + "I found a passage that may be related, but I can't verify it answers your question: \"Throu" + ], + [ + "albums", + "Who performed Glory?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 32, + "false_yes": 0, + "wrong": 0, + "n": 36, + "p50_ms": 4.51, + "fails": [ + [ + "albums", + "Who performed The Complete Studio Recordings?", + "specialist:rel-albums>unverified", + "I can't verify the sung by of The Complete Studio Recordings from my records, so I won't g" + ], + [ + "albums", + "Who performed Glory?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "albums", + "When was Greatest Hits released?", + "precision_guard:G3_evidence_misses_quest", + "I can't verify an answer to that exact question, so I won't guess." + ], + [ + "albums", + "Which label released Placebo?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + } + }, + "core": { + "head": { + "correct": 149, + "false_yes": 0 + }, + "spec": { + "correct": 149, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-albums/verdict_heldout.json b/root/specialists/rel-albums/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..57cc598bd5582f9d5ee51aa0c11671b9502529c1 --- /dev/null +++ b/root/specialists/rel-albums/verdict_heldout.json @@ -0,0 +1,163 @@ +{ + "id": "rel-albums", + "name": "Oracle7 Relations: Albums", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w524", + "time": "2026-10-08T23:53:56Z", + "domain": { + "head": { + "correct": 13, + "false_yes": 0, + "wrong": 1, + "n": 36, + "p50_ms": 488.68, + "fails": [ + [ + "albums", + "Which artist recorded Horizontal?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "albums", + "Which artist recorded Infinite?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "albums", + "Which artist recorded Score?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "albums", + "Which artist recorded Maiden England?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "albums", + "Which artist recorded Blondie?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "albums", + "Which artist recorded Nightlife?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "albums", + "Which artist recorded Nation?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "albums", + "Which artist recorded Blue Blood?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 24, + "false_yes": 0, + "wrong": 1, + "n": 36, + "p50_ms": 5.07, + "fails": [ + [ + "albums", + "Which artist recorded Infinite?", + "specialist:rel-albums>albums", + "Eminem. From the Wikidata relation store: Infinite (Q676125) - sung by (P175) - Eminem." + ], + [ + "albums", + "Which artist recorded Score?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "albums", + "Which artist recorded Blondie?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "albums", + "Which artist recorded Nightlife?", + "specialist:rel-albums>unverified", + "I can't verify the sung by of Nightlife from my records, so I won't guess." + ], + [ + "albums", + "Which artist recorded Nation?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "albums", + "In what year was Phobia released?", + "specialist:rel-albums>unverified", + "I can't verify the year of publication of Phobia from my records, so I won't guess." + ], + [ + "albums", + "In what year was Harry Potter and the Order of the Phoenix released?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "albums", + "In what year was F.A.M.E. released?", + "specialist:rel-albums>unverified", + "I can't verify the year of publication of F.A.M.E. from my records, so I won't guess." + ] + ] + } + }, + "core": { + "head": { + "correct": 149, + "false_yes": 0 + }, + "spec": { + "correct": 149, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-animators/manifest.json b/root/specialists/rel-animators/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..0b1cdf1a3ee03b1096f69b39402ac3d0611ca5c4 --- /dev/null +++ b/root/specialists/rel-animators/manifest.json @@ -0,0 +1,76 @@ +{ + "id": "rel-animators", + "name": "Oracle7 Relations: Animators", + "number": 280, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-animators/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-animators", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "animators", + "kind": "animators" + } + }, + "accept": { + "kinds": [ + "animators" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-animators/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [], + "occupations": [ + 266569 + ] + }, + "readers": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-animators/organ_relation_v2.py b/root/specialists/rel-animators/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-animators/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-animators/readers.json b/root/specialists/rel-animators/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..c13089e7f6ebfd5218117298dde068a3062d6c8b --- /dev/null +++ b/root/specialists/rel-animators/readers.json @@ -0,0 +1,13 @@ +{ + "keys": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-animators/relation_panel_v2.json b/root/specialists/rel-animators/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..88d0662859afbdb06cef2a43b3cc423d9cb1d9cf --- /dev/null +++ b/root/specialists/rel-animators/relation_panel_v2.json @@ -0,0 +1,1262 @@ +[ + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where was David Silverman born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q919608" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where was Georges M\u00e9li\u00e8s born?", + "expect": "Paris", + "relation": "fwd P19", + "entity": "Q152272" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where was Milt Kahl born?", + "expect": "San Francisco", + "relation": "fwd P19", + "entity": "Q2711171" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where was Dave Fleischer born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q1173200" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where was Iwao Takamoto born?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q445100" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where was Bobby Hutcherson born?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q888571" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where was Chris Miller born?", + "expect": "Washington, D.C.", + "relation": "fwd P19", + "entity": "Q283700" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where was Kirk Wise born?", + "expect": "San Francisco", + "relation": "fwd P19", + "entity": "Q1073959" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where was Loren Bouchard born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q356375" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where was Joe Grant born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q205002" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where was Jack Kirby born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q311607" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where was Ray Harryhausen born?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q313341" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "What is the birthplace of Neil Cicierega?", + "expect": "Boston", + "relation": "fwd P19", + "entity": "Q971949" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "What is the birthplace of Vicky Jenson?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q4011210" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "What is the birthplace of Danny Antonucci?", + "expect": "Toronto", + "relation": "fwd P19", + "entity": "Q280875" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "What is the birthplace of Antonio Margheriti?", + "expect": "Rome", + "relation": "fwd P19", + "entity": "Q603216" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "What is the birthplace of Matthew J. Munn?", + "expect": "United States", + "relation": "fwd P19", + "entity": "Q4168041" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "What is the birthplace of Richard Williams?", + "expect": "Toronto", + "relation": "fwd P19", + "entity": "Q1999598" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "What is the birthplace of Lauren MacMullan?", + "expect": "Boston", + "relation": "fwd P19", + "entity": "Q3181202" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "What is the birthplace of Roy E. Disney?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q374229" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "What is the birthplace of John R. Dilworth?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q2734593" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "What is the birthplace of Steven Lisberger?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q1378661" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "What is the birthplace of Tony Leondis?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q913976" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where did Erich Ohser die?", + "expect": "Berlin", + "relation": "fwd P20", + "entity": "Q67009" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where did Kay Rasmus Nielsen die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q3107486" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where did Pat Sullivan die?", + "expect": "New York City", + "relation": "fwd P20", + "entity": "Q2407511" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where did Tamara Press die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q232249" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where did Tamara Nosova die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q4327602" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where did Lev Atamanov die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q2395785" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where did Fyodor Khitruk die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q732039" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where did Miki Muster die?", + "expect": "Ljubljana", + "relation": "fwd P20", + "entity": "Q6960645" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where did Ivan Ivanov-Vano die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q1066055" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where did Mikheil Chiaureli die?", + "expect": "Tbilisi", + "relation": "fwd P20", + "entity": "Q969083" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where did B\u0159etislav Pojar die?", + "expect": "Prague", + "relation": "fwd P20", + "entity": "Q2930228" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Where did Walter Ruttmann die?", + "expect": "Berlin", + "relation": "fwd P20", + "entity": "Q77365" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In which city did Adolf Born die?", + "expect": "Prague", + "relation": "fwd P20", + "entity": "Q361032" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In which city did Edmund Purdom die?", + "expect": "Rome", + "relation": "fwd P20", + "entity": "Q1286750" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In which city did Boris Yefimov die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q355672" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In which city did Petar Gligorovski die?", + "expect": "Skopje", + "relation": "fwd P20", + "entity": "Q982443" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In which city did Ji\u0159\u00ed Trnka die?", + "expect": "Prague", + "relation": "fwd P20", + "entity": "Q362319" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In which city did Willis H. O'Brien die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q1386416" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In which city did Roman Kachanov die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q719142" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In which city did Norman McLaren die?", + "expect": "Montreal", + "relation": "fwd P20", + "entity": "Q716552" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In which city did Friz Freleng die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q457864" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In which city did Leonid Shvartsman die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q4521684" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In which city did Fr\u00e9d\u00e9ric Back die?", + "expect": "Montreal", + "relation": "fwd P20", + "entity": "Q69218" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In which city did Osvaldo Cavandoli die?", + "expect": "Milan", + "relation": "fwd P20", + "entity": "Q248079" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "When was Kirk Wise born?", + "expect": "24 August 1963", + "relation": "fwd P569", + "entity": "Q1073959" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "When was Ivan Ivanov-Vano born?", + "expect": "8 February 1900", + "relation": "fwd P569", + "entity": "Q1066055" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In what year was Brad Peyton born?", + "expect": "1978", + "relation": "fwd P569", + "entity": "Q1114465" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In what year was Robert McKimson born?", + "expect": "1910", + "relation": "fwd P569", + "entity": "Q1063493" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In what year was Chris Williams born?", + "expect": "1968", + "relation": "fwd P569", + "entity": "Q1077862" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In what year was Yasuhiro Takemoto born?", + "expect": "1972", + "relation": "fwd P569", + "entity": "Q1038856" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In what year was Jean-Marie Poir\u00e9 born?", + "expect": "1945", + "relation": "fwd P569", + "entity": "Q1042021" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In what year was Byron Howard born?", + "expect": "1968", + "relation": "fwd P569", + "entity": "Q1018606" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In what year was Tetsur\u014d Araki born?", + "expect": "1976", + "relation": "fwd P569", + "entity": "Q1101038" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "When did Davyd Cherkaskyi die?", + "expect": "30 October 2018", + "relation": "fwd P570", + "entity": "Q1174863" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "When did Vilgot Sj\u00f6man die?", + "expect": "9 April 2006", + "relation": "fwd P570", + "entity": "Q116760" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "When did Dave Fleischer die?", + "expect": "25 June 1979", + "relation": "fwd P570", + "entity": "Q1173200" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "When did Osamu Dezaki die?", + "expect": "17 April 2011", + "relation": "fwd P570", + "entity": "Q1315839" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "When did Ivan Ivanov-Vano die?", + "expect": "25 March 1987", + "relation": "fwd P570", + "entity": "Q1066055" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In what year did Paul Grimault die?", + "expect": "1994", + "relation": "fwd P570", + "entity": "Q1351064" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In what year did Du\u0161an Vukoti\u0107 die?", + "expect": "1998", + "relation": "fwd P570", + "entity": "Q1268232" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In what year did Yasuhiro Takemoto die?", + "expect": "2019", + "relation": "fwd P570", + "entity": "Q1038856" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In what year did Edmund Purdom die?", + "expect": "2009", + "relation": "fwd P570", + "entity": "Q1286750" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In what year did Carl Barks die?", + "expect": "2000", + "relation": "fwd P570", + "entity": "Q11941" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "In what year did Bobby Sands die?", + "expect": "1981", + "relation": "fwd P570", + "entity": "Q121615" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "What nationality was Naoko Yamada?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q550018" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "What nationality was Hiromasa Yonebayashi?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q2630715" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "What nationality was Mamoru Hosoda?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q720771" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "What nationality was Domee Shi?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q55070915" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "What nationality was Hiroyuki Imaishi?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q3023829" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "What nationality was Masaaki Yuasa?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1385540" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "What nationality was Mamoru Oshii?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q285084" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "What nationality was Tatsuya Ishihara?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q534114" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "What nationality was Dean DeBlois?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q1181049" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "What nationality was Yoshiyuki Sadamoto?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q282121" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "What nationality was Makoto Shinkai?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q335080" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "What nationality was Yoshitaka Amano?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q355030" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Which country was Chris Williams a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q1077862" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Which country was John Kricfalusi a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q955144" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Which country was Rumiko Takahashi a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q219948" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Which country was Go Nagai a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q551359" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Which country was Kon Ichikawa a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q55397" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Which country was Akiyuki Shinbo a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q50036" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Which country was Osamu Akimoto a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1321466" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Which country was Yoshiaki Kawajiri a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q2593083" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Which country was Ivo Caprino a citizen of?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q2712084" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Which country was Yoshiyuki Tomino a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1325374" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Which country was Brad Peyton a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q1114465" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Which country was Yumi Hotta a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q263303" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Erich Ohser married to?", + "expect": "Marigard Bantzer", + "relation": "fwd P26", + "entity": "Q67009" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Fernando Trueba married to?", + "expect": "Cristina Huete", + "relation": "fwd P26", + "entity": "Q381934" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Georges M\u00e9li\u00e8s married to?", + "expect": "Jehanne d'Alcy", + "relation": "fwd P26", + "entity": "Q152272" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Elizabeth Avell\u00e1n Ochoa married to?", + "expect": "Robert Rodriguez", + "relation": "fwd P26", + "entity": "Q465517" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Yuri Norstein married to?", + "expect": "Francheska Yarbusova", + "relation": "fwd P26", + "entity": "Q371337" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Jack Mercer married to?", + "expect": "Margie Hines", + "relation": "fwd P26", + "entity": "Q2570344" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Makoto Shinkai married to?", + "expect": "Chieko Misaka", + "relation": "fwd P26", + "entity": "Q335080" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Craig McCracken married to?", + "expect": "Lauren Faust", + "relation": "fwd P26", + "entity": "Q655250" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Hideaki Anno married to?", + "expect": "Moyoco Anno", + "relation": "fwd P26", + "entity": "Q23261" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Tamara Nosova married to?", + "expect": "Vitali Gubarev", + "relation": "fwd P26", + "entity": "Q4327602" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Rebecca Sugar married to?", + "expect": "Ian Jones-Quartey", + "relation": "fwd P26", + "entity": "Q12569944" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Lotte Reiniger married to?", + "expect": "Carl Koch", + "relation": "fwd P26", + "entity": "Q444011" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who is the spouse of Gosho Aoyama?", + "expect": "Minami Takayama", + "relation": "fwd P26", + "entity": "Q313945" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who is the spouse of Roy E. Disney?", + "expect": "Patricia Disney", + "relation": "fwd P26", + "entity": "Q374229" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who is the spouse of Lauren Faust?", + "expect": "Craig McCracken", + "relation": "fwd P26", + "entity": "Q262510" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who is the spouse of Tamara Makarova?", + "expect": "Sergei Gerasimov", + "relation": "fwd P26", + "entity": "Q845854" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who is the spouse of Stina Wirs\u00e9n?", + "expect": "Pompe Hedengren", + "relation": "fwd P26", + "entity": "Q532720" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who is the spouse of Arne Mattsson?", + "expect": "Elsa Prawitz", + "relation": "fwd P26", + "entity": "Q692645" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who is the spouse of Kon Ichikawa?", + "expect": "Natto Wada", + "relation": "fwd P26", + "entity": "Q55397" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who is the spouse of Walerian Borowczyk?", + "expect": "Ligia Branice", + "relation": "fwd P26", + "entity": "Q708727" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who is the spouse of Herm\u00edna T\u00fdrlov\u00e1?", + "expect": "Karel Dodal", + "relation": "fwd P26", + "entity": "Q273185" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who is the spouse of Bobby Cannavale?", + "expect": "Jenny Lumet", + "relation": "fwd P26", + "entity": "Q428819" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who is the spouse of Jennifer Lee?", + "expect": "Alfred Molina", + "relation": "fwd P26", + "entity": "Q5929198" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who is the spouse of Leiji Matsumoto?", + "expect": "Miyako Maki", + "relation": "fwd P26", + "entity": "Q431443" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was William Kentridge's father?", + "expect": "Sydney Kentridge", + "relation": "fwd P22", + "entity": "Q666092" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Kay Rasmus Nielsen's father?", + "expect": "Martinius Nielsen", + "relation": "fwd P22", + "entity": "Q3107486" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Jan Pinkava's father?", + "expect": "Jan K\u0159esadlo", + "relation": "fwd P22", + "entity": "Q1455793" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Cory Edwards's father?", + "expect": "James L. Edwards", + "relation": "fwd P22", + "entity": "Q3694918" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Travis Knight's father?", + "expect": "Phil Knight", + "relation": "fwd P22", + "entity": "Q7836302" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Vasily Livanov's father?", + "expect": "Boris Livanov", + "relation": "fwd P22", + "entity": "Q362133" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Bobby Deol's father?", + "expect": "Dharmendra", + "relation": "fwd P22", + "entity": "Q48619" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who was the father of Edmund Purdom?", + "expect": "Charles Purdom", + "relation": "fwd P22", + "entity": "Q1286750" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who was the father of Glen Keane?", + "expect": "Bil Keane", + "relation": "fwd P22", + "entity": "Q1382544" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who was the father of Roy E. Disney?", + "expect": "Roy O. Disney", + "relation": "fwd P22", + "entity": "Q374229" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who was the father of Osamu Tezuka?", + "expect": "Yutaka Tezuka", + "relation": "fwd P22", + "entity": "Q193300" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who was the father of Jean-Marie Poir\u00e9?", + "expect": "Alain Poir\u00e9", + "relation": "fwd P22", + "entity": "Q1042021" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Pendleton Ward's mother?", + "expect": "Bettie Ward", + "relation": "fwd P25", + "entity": "Q3246742" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was William Kentridge's mother?", + "expect": "Felicia Kentridge", + "relation": "fwd P25", + "entity": "Q666092" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Vasily Livanov's mother?", + "expect": "Evgenia Prawdzic-Filipowicz", + "relation": "fwd P25", + "entity": "Q362133" + }, + { + "split": "dev", + "kind": "animators", + "valid": true, + "q": "Who was Kay Rasmus Nielsen's mother?", + "expect": "Oda Nielsen", + "relation": "fwd P25", + "entity": "Q3107486" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who was the mother of Ivo Caprino?", + "expect": "Ingeborg Gude", + "relation": "fwd P25", + "entity": "Q2712084" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who was the mother of Glen Keane?", + "expect": "Thelma Keane", + "relation": "fwd P25", + "entity": "Q1382544" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who was the mother of Stina Wirs\u00e9n?", + "expect": "Carin Wirs\u00e9n", + "relation": "fwd P25", + "entity": "Q532720" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who was the mother of Du\u0161an Vukoti\u0107?", + "expect": "Darinka Vu\u010dini\u0107", + "relation": "fwd P25", + "entity": "Q1268232" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who was the mother of Roy E. Disney?", + "expect": "Edna Disney", + "relation": "fwd P25", + "entity": "Q374229" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who was the mother of Segundo de Chom\u00f3n?", + "expect": "Luisa Ruiz Valero", + "relation": "fwd P25", + "entity": "Q965654" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who was the mother of James Rallison?", + "expect": "Janette Rallison", + "relation": "fwd P25", + "entity": "Q29586868" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who was the mother of Charles Addams?", + "expect": "Grace Spear", + "relation": "fwd P25", + "entity": "Q361106" + }, + { + "split": "heldout", + "kind": "animators", + "valid": true, + "q": "Who was the mother of Pierre Coffin?", + "expect": "Nh. Dini", + "relation": "fwd P25", + "entity": "Q3384479" + } +] \ No newline at end of file diff --git a/root/specialists/rel-animators/relspec_scorer.py b/root/specialists/rel-animators/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-animators/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-animators/verdict_dev.json b/root/specialists/rel-animators/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..c091854544ad5560d7916ab134dc62d72339916c --- /dev/null +++ b/root/specialists/rel-animators/verdict_dev.json @@ -0,0 +1,114 @@ +{ + "id": "rel-animators", + "name": "Oracle7 Relations: Animators", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w406", + "time": "2026-10-13T02:15:28Z", + "domain": { + "head": { + "correct": 57, + "false_yes": 0, + "wrong": 2, + "n": 66, + "p50_ms": 597.41, + "fails": [ + [ + "animators", + "Where was Bobby Hutcherson born?", + "deliberation:where", + "[ev:direct] In spite of the numerous post-bop, and free jazz recordings made during this p" + ], + [ + "animators", + "Where was Chris Miller born?", + "specialist_call>specialist:rel-actors>un", + "I can't verify the POB of Chris Miller from my records, so I won't guess. [rel-actors]" + ], + [ + "animators", + "Where was Kirk Wise born?", + "specialist_call>specialist:rel-actors>un", + "I can't verify the POB of Kirk Wise from my records, so I won't guess. [rel-actors]" + ], + [ + "animators", + "Where was Loren Bouchard born?", + "specialist_call>specialist:rel-actors>un", + "I can't verify the POB of Loren Bouchard from my records, so I won't guess. [rel-actors]" + ], + [ + "animators", + "When was Kirk Wise born?", + "capability:when_did", + "[ev:direct] According to Kirk Wise, Kirk Wise (born August 24, 1963) is an American animat" + ], + [ + "animators", + "Who was Travis Knight's father?", + "specialist_call>specialist:rel-basketbal", + "I can't verify the son of of Travis Knight from my records, so I won't guess. [rel-basketb" + ], + [ + "animators", + "Who was Pendleton Ward's mother?", + "specialist_call>specialist:rel-actors>un", + "I can't verify the son of of Pendleton Ward from my records, so I won't guess. [rel-actors" + ], + [ + "animators", + "Who was William Kentridge's mother?", + "specialist_call>specialist:rel-actors>un", + "I can't verify the son of of William Kentridge from my records, so I won't guess. [rel-act" + ] + ] + }, + "spec": { + "correct": 66, + "false_yes": 0, + "wrong": 0, + "n": 66, + "p50_ms": 0.1, + "fails": [] + } + }, + "core": { + "head": { + "correct": 132, + "false_yes": 0 + }, + "spec": { + "correct": 132, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-animators/verdict_heldout.json b/root/specialists/rel-animators/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..f69df36966fb98baac4bc6b19c452ad25dabc943 --- /dev/null +++ b/root/specialists/rel-animators/verdict_heldout.json @@ -0,0 +1,102 @@ +{ + "id": "rel-animators", + "name": "Oracle7 Relations: Animators", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w406", + "time": "2026-10-13T02:16:16Z", + "domain": { + "head": { + "correct": 68, + "false_yes": 0, + "wrong": 2, + "n": 74, + "p50_ms": 639.45, + "fails": [ + [ + "animators", + "What is the birthplace of Richard Williams?", + "specialist_call>specialist:rel-actors>ac", + "Stamford. From the Wikidata relation store: Treat Williams (Q352730) - POB (P19) - Stamfor" + ], + [ + "animators", + "In which city did Willis H. O'Brien die?", + "organ:relation>READ>FRAME>LINK>RELATE:fw", + "[ev:direct] Oakland. O'Brien was born in Oakland, California. [enwiki_c8a7c307e13a00a9dd4b" + ], + [ + "animators", + "In which city did Roman Kachanov die?", + "specialist_call>specialist:rel-actors>un", + "I can't verify the POD of Roman Kachanov from my records, so I won't guess. [rel-actors]" + ], + [ + "animators", + "Which country was Chris Williams a citizen of?", + "specialist_call>specialist:rel-actors>un", + "I can't verify the subject of (country) of Chris Williams from my records, so I won't gues" + ], + [ + "animators", + "Who is the spouse of Stina Wirs\u00e9n?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "animators", + "Who was the mother of Stina Wirs\u00e9n?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 74, + "false_yes": 0, + "wrong": 0, + "n": 74, + "p50_ms": 0.11, + "fails": [] + } + }, + "core": { + "head": { + "correct": 132, + "false_yes": 0 + }, + "spec": { + "correct": 132, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-ballets/manifest.json b/root/specialists/rel-ballets/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..2794f966edccaca7e1db4fc3ca22751126aa5b87 --- /dev/null +++ b/root/specialists/rel-ballets/manifest.json @@ -0,0 +1,70 @@ +{ + "id": "rel-ballets", + "name": "Oracle7 Relations: Ballets", + "number": 129, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-ballets/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-ballets", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "ballets", + "kind": "ballets" + } + }, + "accept": { + "kinds": [ + "ballets" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-ballets/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [ + 15079786, + 58483088 + ], + "occupations": [] + }, + "readers": [ + "86" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-ballets/organ_relation_v2.py b/root/specialists/rel-ballets/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-ballets/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-ballets/readers.json b/root/specialists/rel-ballets/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..a2640f1bc11354c7562460837fb01e81a109fdb4 --- /dev/null +++ b/root/specialists/rel-ballets/readers.json @@ -0,0 +1,6 @@ +{ + "keys": [ + "86" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-ballets/relation_panel_v2.json b/root/specialists/rel-ballets/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..8f0eb68d9539b41b5ab53279fb4bf7e88b33a088 --- /dev/null +++ b/root/specialists/rel-ballets/relation_panel_v2.json @@ -0,0 +1,191 @@ +[ + { + "split": "dev", + "kind": "ballets", + "valid": true, + "q": "Who composed La Bayad\u00e8re?", + "expect": "Ludwig Minkus", + "relation": "fwd P86", + "entity": "Q674967" + }, + { + "split": "dev", + "kind": "ballets", + "valid": true, + "q": "Who composed Sylvia?", + "expect": "L\u00e9o Delibes", + "relation": "fwd P86", + "entity": "Q1277308" + }, + { + "split": "dev", + "kind": "ballets", + "valid": true, + "q": "Who composed Raymonda?", + "expect": "Alexander Glazounov", + "relation": "fwd P86", + "entity": "Q1627638" + }, + { + "split": "dev", + "kind": "ballets", + "valid": true, + "q": "Who composed Zolu\u0161ka?", + "expect": "Sergei Prokofiev", + "relation": "fwd P86", + "entity": "Q144545" + }, + { + "split": "dev", + "kind": "ballets", + "valid": true, + "q": "Who composed Spartacus?", + "expect": "Aram Khachaturian", + "relation": "fwd P86", + "entity": "Q2016644" + }, + { + "split": "dev", + "kind": "ballets", + "valid": true, + "q": "Who composed Don Quixote?", + "expect": "Ludwig Minkus", + "relation": "fwd P86", + "entity": "Q1239463" + }, + { + "split": "dev", + "kind": "ballets", + "valid": true, + "q": "Who composed Maiden Tower?", + "expect": "Afrasiab Badalbeyli", + "relation": "fwd P86", + "entity": "Q1532695" + }, + { + "split": "dev", + "kind": "ballets", + "valid": true, + "q": "Who composed Romeo and Juliet?", + "expect": "Sergei Prokofiev", + "relation": "fwd P86", + "entity": "Q911487" + }, + { + "split": "dev", + "kind": "ballets", + "valid": true, + "q": "Who composed La Sylphide?", + "expect": "Jean Schneitzhoeffer", + "relation": "fwd P86", + "entity": "Q1053812" + }, + { + "split": "dev", + "kind": "ballets", + "valid": true, + "q": "Who composed El amor brujo?", + "expect": "Manuel de Falla", + "relation": "fwd P86", + "entity": "Q2609739" + }, + { + "split": "heldout", + "kind": "ballets", + "valid": true, + "q": "Who wrote the music for Histoire du soldat?", + "expect": "Igor Stravinsky", + "relation": "fwd P86", + "entity": "Q1620751" + }, + { + "split": "heldout", + "kind": "ballets", + "valid": true, + "q": "Who wrote the music for Plat\u00e9e?", + "expect": "Jean-Philippe Rameau", + "relation": "fwd P86", + "entity": "Q1376222" + }, + { + "split": "heldout", + "kind": "ballets", + "valid": true, + "q": "Who wrote the music for Les Indes galantes?", + "expect": "Jean-Philippe Rameau", + "relation": "fwd P86", + "entity": "Q583297" + }, + { + "split": "heldout", + "kind": "ballets", + "valid": true, + "q": "Who wrote the music for Le Villi?", + "expect": "Giacomo Puccini", + "relation": "fwd P86", + "entity": "Q845606" + }, + { + "split": "heldout", + "kind": "ballets", + "valid": true, + "q": "Who wrote the music for Les noces?", + "expect": "Igor Stravinsky", + "relation": "fwd P86", + "entity": "Q2521679" + }, + { + "split": "heldout", + "kind": "ballets", + "valid": true, + "q": "Who wrote the music for Le Spectre de la Rose?", + "expect": "Carl Maria von Weber", + "relation": "fwd P86", + "entity": "Q1529152" + }, + { + "split": "heldout", + "kind": "ballets", + "valid": true, + "q": "Who wrote the music for Pulcinella?", + "expect": "Igor Stravinsky", + "relation": "fwd P86", + "entity": "Q2630833" + }, + { + "split": "heldout", + "kind": "ballets", + "valid": true, + "q": "Who wrote the music for Afternoon of a Faun?", + "expect": "Claude Debussy", + "relation": "fwd P86", + "entity": "Q1637772" + }, + { + "split": "heldout", + "kind": "ballets", + "valid": true, + "q": "Who wrote the music for Bol\u00e9ro?", + "expect": "Maurice Ravel", + "relation": "fwd P86", + "entity": "Q327331" + }, + { + "split": "heldout", + "kind": "ballets", + "valid": true, + "q": "Who wrote the music for Les Sylphides?", + "expect": "Fr\u00e9d\u00e9ric Chopin", + "relation": "fwd P86", + "entity": "Q1630831" + }, + { + "split": "heldout", + "kind": "ballets", + "valid": true, + "q": "Who wrote the music for Gayane (ballet)?", + "expect": "Aram Khachaturian", + "relation": "fwd P86", + "entity": "Q539437" + } +] \ No newline at end of file diff --git a/root/specialists/rel-ballets/relspec_scorer.py b/root/specialists/rel-ballets/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-ballets/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-ballets/verdict_dev.json b/root/specialists/rel-ballets/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..538393ac63e1748b7890eb31aee09b6bcc3510d7 --- /dev/null +++ b/root/specialists/rel-ballets/verdict_dev.json @@ -0,0 +1,139 @@ +{ + "id": "rel-ballets", + "name": "Oracle7 Relations: Ballets", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w524", + "time": "2026-10-08T23:54:35Z", + "domain": { + "head": { + "correct": 2, + "false_yes": 0, + "wrong": 0, + "n": 10, + "p50_ms": 516.77, + "fails": [ + [ + "ballets", + "Who composed La Bayad\u00e8re?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "ballets", + "Who composed Sylvia?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "ballets", + "Who composed Raymonda?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "ballets", + "Who composed Zolu\u0161ka?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "ballets", + "Who composed Spartacus?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "ballets", + "Who composed Don Quixote?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "ballets", + "Who composed Maiden Tower?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "ballets", + "Who composed Romeo and Juliet?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 6, + "false_yes": 0, + "wrong": 0, + "n": 10, + "p50_ms": 29.45, + "fails": [ + [ + "ballets", + "Who composed Sylvia?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "ballets", + "Who composed Spartacus?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "ballets", + "Who composed Don Quixote?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "ballets", + "Who composed Romeo and Juliet?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + } + }, + "core": { + "head": { + "correct": 149, + "false_yes": 0 + }, + "spec": { + "correct": 149, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-ballets/verdict_heldout.json b/root/specialists/rel-ballets/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..2990dfbf54baef8c30988b2b0a08cef695b8776c --- /dev/null +++ b/root/specialists/rel-ballets/verdict_heldout.json @@ -0,0 +1,108 @@ +{ + "id": "rel-ballets", + "name": "Oracle7 Relations: Ballets", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w524", + "time": "2026-10-08T23:55:08Z", + "domain": { + "head": { + "correct": 4, + "false_yes": 0, + "wrong": 1, + "n": 11, + "p50_ms": 2618.13, + "fails": [ + [ + "ballets", + "Who wrote the music for Histoire du soldat?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "ballets", + "Who wrote the music for Plat\u00e9e?", + "cube:read>frame>link>expand>bind>check>v", + "[ev:direct] Voltaire. Voltaire however, who was in the audience in Versailles, wrote to hi" + ], + [ + "ballets", + "Who wrote the music for Les Indes galantes?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "ballets", + "Who wrote the music for Le Spectre de la Rose?", + "unverified:compose:bridge", + "I found a passage that may be related, but I can't verify it answers your question: \"He wr" + ], + [ + "ballets", + "Who wrote the music for Pulcinella?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "ballets", + "Who wrote the music for Afternoon of a Faun?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "ballets", + "Who wrote the music for Bol\u00e9ro?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 11, + "false_yes": 0, + "wrong": 0, + "n": 11, + "p50_ms": 2.96, + "fails": [] + } + }, + "core": { + "head": { + "correct": 149, + "false_yes": 0 + }, + "spec": { + "correct": 149, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-basketball/manifest.json b/root/specialists/rel-basketball/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..b30c1111ca225597ce6aadd7c8688b66e88e67c4 --- /dev/null +++ b/root/specialists/rel-basketball/manifest.json @@ -0,0 +1,77 @@ +{ + "id": "rel-basketball", + "name": "Oracle7 Relations: Basketball players", + "number": 239, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-basketball/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-basketball", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "basketball", + "kind": "basketball" + } + }, + "accept": { + "kinds": [ + "basketball" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-basketball/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [], + "occupations": [ + 3665646 + ] + }, + "readers": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25", + "413" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-basketball/organ_relation_v2.py b/root/specialists/rel-basketball/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-basketball/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-basketball/readers.json b/root/specialists/rel-basketball/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..7f60d58ad52ae70485f831b6f769da6ffcbf3061 --- /dev/null +++ b/root/specialists/rel-basketball/readers.json @@ -0,0 +1,14 @@ +{ + "keys": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25", + "413" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-basketball/relation_panel_v2.json b/root/specialists/rel-basketball/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..7d526d76b0c43ef422a96171b340db7fe62e2800 --- /dev/null +++ b/root/specialists/rel-basketball/relation_panel_v2.json @@ -0,0 +1,1937 @@ +[ + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where was Walter Berry born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q2568192" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where was Jacque Vaughn born?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q1377226" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where was Rimantas Kauk\u0117nas born?", + "expect": "Vilnius", + "relation": "fwd P19", + "entity": "Q211376" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where was Maurice Harkless born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q29336" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where was Medina Dixon born?", + "expect": "Boston", + "relation": "fwd P19", + "entity": "Q2472656" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where was Damiris Dantas born?", + "expect": "S\u00e3o Paulo", + "relation": "fwd P19", + "entity": "Q2065779" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where was Dorell Wright born?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q609300" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where was OG Anunoby born?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q28054144" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where was Allen Crabbe born?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q4731604" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where was Maodo L\u00f4 born?", + "expect": "Berlin", + "relation": "fwd P19", + "entity": "Q18920164" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where was Tina Thompson born?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q434518" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where was Dominique Wilkins born?", + "expect": "Paris", + "relation": "fwd P19", + "entity": "Q311533" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What is the birthplace of Gail Goodrich?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q1393162" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What is the birthplace of Roy Tarpley?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q2528518" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What is the birthplace of Kelly Olynyk?", + "expect": "Toronto", + "relation": "fwd P19", + "entity": "Q3194911" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What is the birthplace of Brendan Haywood?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q908715" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What is the birthplace of Nickeil Alexander-Walker?", + "expect": "Toronto", + "relation": "fwd P19", + "entity": "Q56513207" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What is the birthplace of Bira Maciel?", + "expect": "S\u00e3o Paulo", + "relation": "fwd P19", + "entity": "Q1676647" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What is the birthplace of Michael Cooper?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q971538" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What is the birthplace of Elden Campbell?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q524908" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What is the birthplace of Quinn Cook?", + "expect": "Washington, D.C.", + "relation": "fwd P19", + "entity": "Q7272263" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What is the birthplace of Kane Kosugi?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q4235795" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What is the birthplace of RJ Barrett?", + "expect": "Toronto", + "relation": "fwd P19", + "entity": "Q32786169" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What is the birthplace of Charlie Scott?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q923569" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where did Bubba Smith die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q318938" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where did Chuck Connors die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q705738" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where did Krasimira Gyurova die?", + "expect": "Sofia", + "relation": "fwd P20", + "entity": "Q2491130" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where did Viktor Zubkov die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q607930" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where did Sam Balter die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q375858" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where did Viktor Vlasov die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q2538800" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where did Trajko Rajkovi\u0107 die?", + "expect": "Ljubljana", + "relation": "fwd P20", + "entity": "Q1282809" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where did Cesare Rubini die?", + "expect": "Milan", + "relation": "fwd P20", + "entity": "Q704922" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where did Brandon Clarke die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q56809232" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where did Jerry West die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q311195" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where did Wlamir Marques die?", + "expect": "S\u00e3o Paulo", + "relation": "fwd P20", + "entity": "Q937619" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Where did Jerry Buss die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q1509908" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In which city did Guram Minashvili die?", + "expect": "Tbilisi", + "relation": "fwd P20", + "entity": "Q3120940" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In which city did Ademola Okulaja die?", + "expect": "Berlin", + "relation": "fwd P20", + "entity": "Q77165" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In which city did Jason Collins die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q2317740" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In which city did Marcus Hurley die?", + "expect": "New York City", + "relation": "fwd P20", + "entity": "Q940285" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In which city did Zurab Sakandelidze die?", + "expect": "Tbilisi", + "relation": "fwd P20", + "entity": "Q2538085" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In which city did Maria Kwa\u015bniewska die?", + "expect": "Warsaw", + "relation": "fwd P20", + "entity": "Q434539" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In which city did Andr\u00e9 Buffi\u00e8re die?", + "expect": "Lyon", + "relation": "fwd P20", + "entity": "Q2540314" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In which city did Vladimer Ugrekhelidze die?", + "expect": "Tbilisi", + "relation": "fwd P20", + "entity": "Q540765" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In which city did Petar Skansi die?", + "expect": "Ljubljana", + "relation": "fwd P20", + "entity": "Q2552767" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In which city did Blagoja Georgievski die?", + "expect": "Skopje", + "relation": "fwd P20", + "entity": "Q2409352" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In which city did Sergei Belov die?", + "expect": "Perm", + "relation": "fwd P20", + "entity": "Q435891" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In which city did Jim Walsh die?", + "expect": "San Francisco", + "relation": "fwd P20", + "entity": "Q1469046" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When was Jaden Ivey born?", + "expect": "13 February 2002", + "relation": "fwd P569", + "entity": "Q106818050" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When was Angel Reese born?", + "expect": "6 May 2002", + "relation": "fwd P569", + "entity": "Q111698612" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When was Julian Champagnie born?", + "expect": "29 June 2001", + "relation": "fwd P569", + "entity": "Q100768908" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When was Jade Cargill born?", + "expect": "3 June 1992", + "relation": "fwd P569", + "entity": "Q101506175" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When was Christian Braun born?", + "expect": "17 April 2001", + "relation": "fwd P569", + "entity": "Q100759022" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When was John Jenkins born?", + "expect": "6 March 1991", + "relation": "fwd P569", + "entity": "Q1000791" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When was Sasu Salin born?", + "expect": "11 June 1991", + "relation": "fwd P569", + "entity": "Q1114754" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When was Matt Lojeski born?", + "expect": "24 July 1985", + "relation": "fwd P569", + "entity": "Q1033050" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When was Peyton Watson born?", + "expect": "11 September 2002", + "relation": "fwd P569", + "entity": "Q106641631" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When was Lucious Jackson born?", + "expect": "31 October 1941", + "relation": "fwd P569", + "entity": "Q1115784" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When was Cindy Noble born?", + "expect": "14 November 1958", + "relation": "fwd P569", + "entity": "Q1119311" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When was Dennis Schr\u00f6der born?", + "expect": "15 September 1993", + "relation": "fwd P569", + "entity": "Q10862660" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year was Connie Hawkins born?", + "expect": "1942", + "relation": "fwd P569", + "entity": "Q1126347" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year was Agnis \u010cavars born?", + "expect": "1986", + "relation": "fwd P569", + "entity": "Q107429256" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year was Shahnez Boushaki born?", + "expect": "1985", + "relation": "fwd P569", + "entity": "Q106522361" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year was Jalen Duren born?", + "expect": "2003", + "relation": "fwd P569", + "entity": "Q104698929" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year was K\u0101rlis Lasmanis born?", + "expect": "1994", + "relation": "fwd P569", + "entity": "Q107639299" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year was Caitlin Clark born?", + "expect": "2002", + "relation": "fwd P569", + "entity": "Q106298476" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year was Jalen Williams born?", + "expect": "2001", + "relation": "fwd P569", + "entity": "Q100957464" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year was Keisei Tominaga born?", + "expect": "2001", + "relation": "fwd P569", + "entity": "Q107172388" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year was Matt Ryan born?", + "expect": "1997", + "relation": "fwd P569", + "entity": "Q100919123" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year was Dyson Daniels born?", + "expect": "2003", + "relation": "fwd P569", + "entity": "Q107308380" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year was Zaccharie Risacher born?", + "expect": "2005", + "relation": "fwd P569", + "entity": "Q109669843" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year was Keegan Murray born?", + "expect": "2000", + "relation": "fwd P569", + "entity": "Q106818294" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When did Ken Howard die?", + "expect": "23 March 2016", + "relation": "fwd P570", + "entity": "Q1320640" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When did Alphonso Ford die?", + "expect": "4 September 2004", + "relation": "fwd P570", + "entity": "Q1266392" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When did Lucious Jackson die?", + "expect": "12 October 2022", + "relation": "fwd P570", + "entity": "Q1115784" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When did Stacey King die?", + "expect": "7 June 2026", + "relation": "fwd P570", + "entity": "Q112449" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When did Dragan Labovi\u0107 die?", + "expect": "9 May 2025", + "relation": "fwd P570", + "entity": "Q1254600" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When did Tony Gwynn die?", + "expect": "16 June 2014", + "relation": "fwd P570", + "entity": "Q1145222" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When did Earl Lloyd die?", + "expect": "26 February 2015", + "relation": "fwd P570", + "entity": "Q1277115" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When did Bob Gibson die?", + "expect": "2 October 2020", + "relation": "fwd P570", + "entity": "Q1131535" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When did Clifford Robinson die?", + "expect": "29 August 2020", + "relation": "fwd P570", + "entity": "Q1101335" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When did Dick Garmaker die?", + "expect": "13 June 2020", + "relation": "fwd P570", + "entity": "Q1209671" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When did Trajko Rajkovi\u0107 die?", + "expect": "27 May 1970", + "relation": "fwd P570", + "entity": "Q1282809" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "When did Joann L\u00f5ssov die?", + "expect": "3 August 2000", + "relation": "fwd P570", + "entity": "Q1337832" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year did Kenny Rollins die?", + "expect": "2012", + "relation": "fwd P570", + "entity": "Q129408" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year did Dick Van Arsdale die?", + "expect": "2024", + "relation": "fwd P570", + "entity": "Q1027929" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year did Chet Walker die?", + "expect": "2024", + "relation": "fwd P570", + "entity": "Q1070836" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year did Du\u0161ko Vujo\u0161evi\u0107 die?", + "expect": "2026", + "relation": "fwd P570", + "entity": "Q1288374" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year did Adam W\u00f3jcik die?", + "expect": "2017", + "relation": "fwd P570", + "entity": "Q1141637" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year did Al Attles die?", + "expect": "2024", + "relation": "fwd P570", + "entity": "Q1347527" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year did Connie Hawkins die?", + "expect": "2017", + "relation": "fwd P570", + "entity": "Q1126347" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year did Joe Bryant die?", + "expect": "2024", + "relation": "fwd P570", + "entity": "Q1332856" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year did J\u0101nis Timma die?", + "expect": "2024", + "relation": "fwd P570", + "entity": "Q10831393" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year did Aleksandar Nikoli\u0107 die?", + "expect": "2000", + "relation": "fwd P570", + "entity": "Q1282797" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "In what year did Don Barksdale die?", + "expect": "1993", + "relation": "fwd P570", + "entity": "Q1238917" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What nationality was Naho Miyoshi?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q11354864" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What nationality was Joshua Primo?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q106819078" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What nationality was Yuki Kawamura?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q84554649" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What nationality was Maki Takada?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q11672184" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What nationality was Joel Anthony?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q521950" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What nationality was Cory Joseph?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q2407571" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What nationality was Rick Fox?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q380802" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What nationality was Ian Allison?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q2532606" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What nationality was Rui Machida?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q11578328" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What nationality was Bill Wennington?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q2607807" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What nationality was Tyler Ennis?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q16227014" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What nationality was Mai Yamamoto?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q84546398" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Which country was Yuta Tabuse a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q952047" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Which country was Luguentz Dort a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q59209443" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Which country was Keisei Tominaga a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q107172388" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Which country was Olivier Hanlan a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q16227268" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Which country was Gordon Aitchison a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q2532579" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Which country was Yuki Miyazawa a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q11455074" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Which country was Jay Triano a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q2454488" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Which country was Andrew Wiggins a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q4758911" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Which country was Sim Bhullar a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q7517251" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Which country was Jamal Murray a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q20711111" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Which country was Kelly Olynyk a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q3194911" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Which country was Jamaal Magloire a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q716093" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Spencer Haywood married to?", + "expect": "Iman", + "relation": "fwd P26", + "entity": "Q1238103" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Nemanja Dangubi\u0107 married to?", + "expect": "Katarina Lazovi\u0107", + "relation": "fwd P26", + "entity": "Q6990938" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Jade Cargill married to?", + "expect": "Brandon Phillips", + "relation": "fwd P26", + "entity": "Q101506175" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Babe Didrikson Zaharias married to?", + "expect": "George Zaharias", + "relation": "fwd P26", + "entity": "Q231983" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Gianmarco Pozzecco married to?", + "expect": "Francesca Piccinini", + "relation": "fwd P26", + "entity": "Q2380314" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Earl Watson married to?", + "expect": "Jennifer Freeman", + "relation": "fwd P26", + "entity": "Q922434" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Norm Nixon married to?", + "expect": "Debbie Allen", + "relation": "fwd P26", + "entity": "Q2663482" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Kenny Smith married to?", + "expect": "Gwendolyn Osborne", + "relation": "fwd P26", + "entity": "Q1168929" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Cenk Akyol married to?", + "expect": "Naz Aydemir Akyol", + "relation": "fwd P26", + "entity": "Q933804" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Sergio Scariolo married to?", + "expect": "Blanca Ares", + "relation": "fwd P26", + "entity": "Q718825" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Olga Fikotov\u00e1 married to?", + "expect": "Hal Connolly", + "relation": "fwd P26", + "entity": "Q47085" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Tony Gonzalez married to?", + "expect": "Lauren S\u00e1nchez", + "relation": "fwd P26", + "entity": "Q729462" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who is the spouse of Ang\u00e9la N\u00e9meth?", + "expect": "Mikl\u00f3s N\u00e9meth", + "relation": "fwd P26", + "entity": "Q256179" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who is the spouse of Dell Curry?", + "expect": "Sonya Curry", + "relation": "fwd P26", + "entity": "Q1184381" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who is the spouse of \u0160ar\u016bnas Jasikevi\u010dius?", + "expect": "Linor Abargil", + "relation": "fwd P26", + "entity": "Q316252" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who is the spouse of Grant Hill?", + "expect": "Tamia", + "relation": "fwd P26", + "entity": "Q311895" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who is the spouse of Birkan Sokullu?", + "expect": "Asl\u0131 Enver", + "relation": "fwd P26", + "entity": "Q17045542" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who is the spouse of Sonja Vasi\u0107?", + "expect": "Milo\u0161 Vasi\u0107", + "relation": "fwd P26", + "entity": "Q1158152" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who is the spouse of Jordan Theodore?", + "expect": "Tu\u011fba Ta\u015f\u00e7\u0131", + "relation": "fwd P26", + "entity": "Q23664818" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who is the spouse of Daniel Gibson?", + "expect": "Keyshia Cole", + "relation": "fwd P26", + "entity": "Q443665" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who is the spouse of Sam Dekker?", + "expect": "Olivia Harlan", + "relation": "fwd P26", + "entity": "Q16226929" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who is the spouse of Kelsey Plum?", + "expect": "Darren Waller", + "relation": "fwd P26", + "entity": "Q20657581" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who is the spouse of Al Horford?", + "expect": "Amelia Vega", + "relation": "fwd P26", + "entity": "Q521931" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who is the spouse of \u017dana Lelas?", + "expect": "Vjekoslav Lokica", + "relation": "fwd P26", + "entity": "Q3509139" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was J. B. Bickerstaff's father?", + "expect": "Bernie Bickerstaff", + "relation": "fwd P22", + "entity": "Q18921436" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Nic Claxton's father?", + "expect": "Charles Claxton", + "relation": "fwd P22", + "entity": "Q64010219" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Doug McDermott's father?", + "expect": "Greg McDermott", + "relation": "fwd P22", + "entity": "Q732350" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Ben Simmons's father?", + "expect": "Dave Simmons", + "relation": "fwd P22", + "entity": "Q18638003" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Luke Kornet's father?", + "expect": "Frank Kornet", + "relation": "fwd P22", + "entity": "Q28967738" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Kevin Knox II's father?", + "expect": "Kevin Knox", + "relation": "fwd P22", + "entity": "Q27919944" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Mike Conley Jr.'s father?", + "expect": "Mike Conley Sr.", + "relation": "fwd P22", + "entity": "Q921340" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Ron Wyden's father?", + "expect": "Peter H. Wyden", + "relation": "fwd P22", + "entity": "Q529344" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Deni Avdija's father?", + "expect": "Zufer Avdija", + "relation": "fwd P22", + "entity": "Q42302125" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Jalen Rose's father?", + "expect": "Jimmy Walker", + "relation": "fwd P22", + "entity": "Q984367" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Axel Toupane's father?", + "expect": "Jean-Aim\u00e9 Toupane", + "relation": "fwd P22", + "entity": "Q2874765" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Evan Mobley's father?", + "expect": "Eric Mobley", + "relation": "fwd P22", + "entity": "Q64009534" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the father of Domantas Sabonis?", + "expect": "Arvydas Sabonis", + "relation": "fwd P22", + "entity": "Q5289916" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the father of Nikola Vu\u010devi\u0107?", + "expect": "Borislav Vu\u010devi\u0107", + "relation": "fwd P22", + "entity": "Q659886" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the father of Luol Deng?", + "expect": "Aldo Deng", + "relation": "fwd P22", + "entity": "Q275183" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the father of Preguinho?", + "expect": "Coelho Neto", + "relation": "fwd P22", + "entity": "Q456600" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the father of Alessandro Gentile?", + "expect": "Ferdinando Gentile", + "relation": "fwd P22", + "entity": "Q510074" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the father of Elfrid Payton?", + "expect": "Elfrid Payton", + "relation": "fwd P22", + "entity": "Q16847519" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the father of Santi Aldama?", + "expect": "Santiago Aldama", + "relation": "fwd P22", + "entity": "Q69308603" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the father of \u00c1lex Abrines?", + "expect": "Gabriel Abrines i Mart\u00ed", + "relation": "fwd P22", + "entity": "Q250534" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the father of Andrew Wiggins?", + "expect": "Mitchell Wiggins", + "relation": "fwd P22", + "entity": "Q4758911" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the father of Paul Robeson?", + "expect": "William Drew Robeson I", + "relation": "fwd P22", + "entity": "Q273233" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the father of Pat Conroy?", + "expect": "Donald Conroy", + "relation": "fwd P22", + "entity": "Q2451348" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the father of Tamika Catchings?", + "expect": "Harvey Catchings", + "relation": "fwd P22", + "entity": "Q255518" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Kiki VanDeWeghe's mother?", + "expect": "Colleen Kay Hutchins", + "relation": "fwd P25", + "entity": "Q1343292" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Rick Fox's mother?", + "expect": "Dianne Gerace", + "relation": "fwd P25", + "entity": "Q380802" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Yuta Watanabe's mother?", + "expect": "Kumi Kubota", + "relation": "fwd P25", + "entity": "Q17492383" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Boris Diaw's mother?", + "expect": "\u00c9lisabeth Riffiod", + "relation": "fwd P25", + "entity": "Q317527" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Edi Rama's mother?", + "expect": "Aneta Rama", + "relation": "fwd P25", + "entity": "Q316901" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Jaden Ivey's mother?", + "expect": "Niele Ivey", + "relation": "fwd P25", + "entity": "Q106818050" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Brent Barry's mother?", + "expect": "Pam Hale", + "relation": "fwd P25", + "entity": "Q472790" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Darren Randolph's mother?", + "expect": "Anne Randolph", + "relation": "fwd P25", + "entity": "Q3016542" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Bronny James's mother?", + "expect": "Savannah Brinson", + "relation": "fwd P25", + "entity": "Q22302425" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Kon Knueppel's mother?", + "expect": "Chari Nordgaard-Knueppel", + "relation": "fwd P25", + "entity": "Q123666661" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Terance Mann's mother?", + "expect": "Daynia La-Force", + "relation": "fwd P25", + "entity": "Q62764548" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "Who was Seth Curry's mother?", + "expect": "Sonya Curry", + "relation": "fwd P25", + "entity": "Q7456454" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the mother of Gary Harris?", + "expect": "Joy Holmes", + "relation": "fwd P25", + "entity": "Q5525214" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the mother of Emma Meesseman?", + "expect": "Sonja Tankrey", + "relation": "fwd P25", + "entity": "Q3052471" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the mother of Thabo Sefolosha?", + "expect": "Christine Sefolosha", + "relation": "fwd P25", + "entity": "Q377721" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the mother of Paolo Banchero?", + "expect": "Rhonda Banchero", + "relation": "fwd P25", + "entity": "Q92198887" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the mother of Jaxson Hayes?", + "expect": "Kristi Kinne Hayes", + "relation": "fwd P25", + "entity": "Q60963199" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the mother of Thanasis Antetokounmpo?", + "expect": "Veronica Antetokounmpo", + "relation": "fwd P25", + "entity": "Q8991893" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the mother of Domantas Sabonis?", + "expect": "Ingrida Mikelionyt", + "relation": "fwd P25", + "entity": "Q5289916" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the mother of Micheal Ray Richardson?", + "expect": "Ludie Hicks", + "relation": "fwd P25", + "entity": "Q969401" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the mother of Slaven Rimac?", + "expect": "Ru\u017eica Meglaj-Rimac", + "relation": "fwd P25", + "entity": "Q2560852" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the mother of Lauri Markkanen?", + "expect": "Riikka Ellonen", + "relation": "fwd P25", + "entity": "Q19706820" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the mother of J\u00fcri Ratas?", + "expect": "Urve Ratas", + "relation": "fwd P25", + "entity": "Q2621730" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "Who was the mother of Han Xu?", + "expect": "Chen Zhiping", + "relation": "fwd P25", + "entity": "Q59828188" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What position does Anatoli Krikun play?", + "expect": "shooting guard", + "relation": "fwd P413", + "entity": "Q487846" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What position does Eugene Jeter play?", + "expect": "point guard", + "relation": "fwd P413", + "entity": "Q2720428" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What position does Gabriel Diego Fern\u00e1ndez play?", + "expect": "center", + "relation": "fwd P413", + "entity": "Q2632483" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What position does Jason Richardson play?", + "expect": "shooting guard", + "relation": "fwd P413", + "entity": "Q1685" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What position does \u017dydr\u016bnas Ilgauskas play?", + "expect": "center", + "relation": "fwd P413", + "entity": "Q72353" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What position does Ralph Bishop play?", + "expect": "center", + "relation": "fwd P413", + "entity": "Q2530658" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What position does Carsen Edwards play?", + "expect": "point guard", + "relation": "fwd P413", + "entity": "Q32076468" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What position does Rui Machida play?", + "expect": "point guard", + "relation": "fwd P413", + "entity": "Q11578328" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What position does Donald Piper play?", + "expect": "shooting guard", + "relation": "fwd P413", + "entity": "Q580686" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What position does Damiris Dantas play?", + "expect": "center", + "relation": "fwd P413", + "entity": "Q2065779" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What position does J. J. Barea play?", + "expect": "point guard", + "relation": "fwd P413", + "entity": "Q371193" + }, + { + "split": "dev", + "kind": "basketball", + "valid": true, + "q": "What position does Silvia Dom\u00ednguez play?", + "expect": "point guard", + "relation": "fwd P413", + "entity": "Q2753305" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What position did Kentavious Caldwell-Pope play?", + "expect": "shooting guard", + "relation": "fwd P413", + "entity": "Q13562909" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What position did R. J. Hunter play?", + "expect": "shooting guard", + "relation": "fwd P413", + "entity": "Q16935026" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What position did Paige Bueckers play?", + "expect": "point guard", + "relation": "fwd P413", + "entity": "Q67202319" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What position did Aaron Holiday play?", + "expect": "point guard", + "relation": "fwd P413", + "entity": "Q18921278" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What position did Sara Krnji\u0107 play?", + "expect": "center", + "relation": "fwd P413", + "entity": "Q2160560" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What position did Ivica Zubac play?", + "expect": "center", + "relation": "fwd P413", + "entity": "Q23761524" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What position did Roberto Chiacig play?", + "expect": "center", + "relation": "fwd P413", + "entity": "Q2739325" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What position did Tacko Fall play?", + "expect": "center", + "relation": "fwd P413", + "entity": "Q18921708" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What position did Elmedin Kikanovi\u0107 play?", + "expect": "center", + "relation": "fwd P413", + "entity": "Q2474737" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What position did Mike Dunleavy, Sr. play?", + "expect": "point guard", + "relation": "fwd P413", + "entity": "Q1665679" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What position did Gary Neal play?", + "expect": "shooting guard", + "relation": "fwd P413", + "entity": "Q736815" + }, + { + "split": "heldout", + "kind": "basketball", + "valid": true, + "q": "What position did Massimo Bulleri play?", + "expect": "point guard", + "relation": "fwd P413", + "entity": "Q1378436" + } +] \ No newline at end of file diff --git a/root/specialists/rel-basketball/relspec_scorer.py b/root/specialists/rel-basketball/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-basketball/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-basketball/verdict_dev.json b/root/specialists/rel-basketball/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..36a795de3f66ffd2a8ce0febd74a3fa822401b09 --- /dev/null +++ b/root/specialists/rel-basketball/verdict_dev.json @@ -0,0 +1,127 @@ +{ + "id": "rel-basketball", + "name": "Oracle7 Relations: Basketball players", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T01:01:48Z", + "domain": { + "head": { + "correct": 10, + "false_yes": 0, + "wrong": 25, + "n": 108, + "p50_ms": 490.72, + "fails": [ + [ + "basketball", + "Where was Walter Berry born?", + "factoid:withheld|vessel:receipt", + "I have no admitted record that answers that about \"Walter Berry\", so I will not guess. The" + ], + [ + "basketball", + "Where was Jacque Vaughn born?", + "deliberation:where", + "[ev:direct] Vaughn played in the National Basketball Association (NBA) for the Utah Jazz, " + ], + [ + "basketball", + "Where was Rimantas Kauk\u0117nas born?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "basketball", + "Where was Maurice Harkless born?", + "deliberation:where", + "[ev:direct] On July 6, 2019, Harkless was traded to the Los Angeles Clippers along with a " + ], + [ + "basketball", + "Where was Damiris Dantas born?", + "deliberation:where", + "[ev:direct] Together with the junior Brazilian team, she won the bronze medal at the Under" + ], + [ + "basketball", + "Where was Dorell Wright born?", + "deliberation:where", + "[ev:direct] A small forward, he was drafted in the 2004 NBA draft by the Miami Heat direct" + ], + [ + "basketball", + "Where was OG Anunoby born?", + "deliberation:where", + "[ev:direct] He played college basketball for the Indiana Hoosiers and was selected by the " + ], + [ + "basketball", + "Where was Allen Crabbe born?", + "unverified:factoid:page", + "I found a passage that may be related, but I can't verify it answers your question: \"Allen" + ] + ] + }, + "spec": { + "correct": 106, + "false_yes": 0, + "wrong": 0, + "n": 108, + "p50_ms": 4.17, + "fails": [ + [ + "basketball", + "Who was Earl Watson married to?", + "specialist:rel-basketball>unverified", + "I can't verify the wives of Earl Watson from my records, so I won't guess." + ], + [ + "basketball", + "Who was Kevin Knox II's father?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-basketball/verdict_heldout.json b/root/specialists/rel-basketball/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..d328b3d2144bd8f4719fa9afbfef2c576302630c --- /dev/null +++ b/root/specialists/rel-basketball/verdict_heldout.json @@ -0,0 +1,127 @@ +{ + "id": "rel-basketball", + "name": "Oracle7 Relations: Basketball players", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T01:02:43Z", + "domain": { + "head": { + "correct": 29, + "false_yes": 0, + "wrong": 1, + "n": 107, + "p50_ms": 509.15, + "fails": [ + [ + "basketball", + "What is the birthplace of Gail Goodrich?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "basketball", + "What is the birthplace of Roy Tarpley?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "basketball", + "What is the birthplace of Kelly Olynyk?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "basketball", + "What is the birthplace of Brendan Haywood?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "basketball", + "What is the birthplace of Nickeil Alexander-Walker?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "basketball", + "What is the birthplace of Bira Maciel?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "basketball", + "What is the birthplace of Michael Cooper?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "basketball", + "What is the birthplace of Elden Campbell?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ] + ] + }, + "spec": { + "correct": 105, + "false_yes": 0, + "wrong": 0, + "n": 107, + "p50_ms": 3.84, + "fails": [ + [ + "basketball", + "In what year was Matt Ryan born?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "basketball", + "Who was the father of Elfrid Payton?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-bloggers/manifest.json b/root/specialists/rel-bloggers/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..4d65510779896369b124f75dfc9db08204c35be1 --- /dev/null +++ b/root/specialists/rel-bloggers/manifest.json @@ -0,0 +1,76 @@ +{ + "id": "rel-bloggers", + "name": "Oracle7 Relations: Bloggers", + "number": 301, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-bloggers/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-bloggers", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "bloggers", + "kind": "bloggers" + } + }, + "accept": { + "kinds": [ + "bloggers" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-bloggers/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [], + "occupations": [ + 8246794 + ] + }, + "readers": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-bloggers/organ_relation_v2.py b/root/specialists/rel-bloggers/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-bloggers/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-bloggers/readers.json b/root/specialists/rel-bloggers/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..c13089e7f6ebfd5218117298dde068a3062d6c8b --- /dev/null +++ b/root/specialists/rel-bloggers/readers.json @@ -0,0 +1,13 @@ +{ + "keys": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-bloggers/relation_panel_v2.json b/root/specialists/rel-bloggers/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..363d62337197d165a27ed8e3f16347cabd20cac5 --- /dev/null +++ b/root/specialists/rel-bloggers/relation_panel_v2.json @@ -0,0 +1,1379 @@ +[ + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Where was Cory Doctorow born?", + "expect": "Toronto", + "relation": "fwd P19", + "entity": "Q110436" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Where was Jerry Brown born?", + "expect": "San Francisco", + "relation": "fwd P19", + "entity": "Q152451" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Where was Bram Cohen born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q318489" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Where was KSI born?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q16235544" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Where was John Amaechi born?", + "expect": "Boston", + "relation": "fwd P19", + "entity": "Q706052" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Where was Thomas Dolby born?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q553790" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Where was Abby Stein born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q24263778" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Where was Sally Amaki born?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q42877957" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Where was Rebecca Yarros born?", + "expect": "Washington, D.C.", + "relation": "fwd P19", + "entity": "Q121091992" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Where was Ory Okolloh born?", + "expect": "Kenya", + "relation": "fwd P19", + "entity": "Q49275" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Where was Susie Amy born?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q7649001" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Where was Kai Trump born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q23000822" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "What is the birthplace of Alfie Deyes?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q16235323" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "What is the birthplace of Katherine Schwarzenegger?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q4521676" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "What is the birthplace of Josh Friedman?", + "expect": "United States", + "relation": "fwd P19", + "entity": "Q6288874" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "What is the birthplace of Michelle Phan?", + "expect": "Boston", + "relation": "fwd P19", + "entity": "Q384960" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "What is the birthplace of Jessie Cave?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q233439" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "What is the birthplace of Neil Cicierega?", + "expect": "Boston", + "relation": "fwd P19", + "entity": "Q971949" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "What is the birthplace of Robert F. Kennedy Jr.?", + "expect": "Washington, D.C.", + "relation": "fwd P19", + "entity": "Q1352872" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "What is the birthplace of Mari\u00e9 Digby?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q236762" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "What is the birthplace of Poppy?", + "expect": "Boston", + "relation": "fwd P19", + "entity": "Q24852571" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "What is the birthplace of Karl Jacobs?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q105070859" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "What is the birthplace of David Frum?", + "expect": "Toronto", + "relation": "fwd P19", + "entity": "Q1174481" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "What is the birthplace of Richard Posner?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q533583" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Where did Vladlen Tatarsky die?", + "expect": "Saint Petersburg", + "relation": "fwd P20", + "entity": "Q111433188" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Where did Vasily Utkin die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q4478881" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Where did John Perry Barlow die?", + "expect": "San Francisco", + "relation": "fwd P20", + "entity": "Q534428" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Where did Michela Murgia die?", + "expect": "Rome", + "relation": "fwd P20", + "entity": "Q3827096" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Where did Theo van Gogh die?", + "expect": "Amsterdam", + "relation": "fwd P20", + "entity": "Q205456" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "In which city did Giulietto Chiesa die?", + "expect": "Rome", + "relation": "fwd P20", + "entity": "Q921722" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "In which city did Alice Wong die?", + "expect": "San Francisco", + "relation": "fwd P20", + "entity": "Q23409829" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "In which city did Mikhail Zadornov die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q2622688" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "When was Vladlen Tatarsky born?", + "expect": "25 April 1982", + "relation": "fwd P569", + "entity": "Q111433188" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "When was Technoblade born?", + "expect": "1 June 1999", + "relation": "fwd P569", + "entity": "Q105396829" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "When was Yasmin Finney born?", + "expect": "30 August 2003", + "relation": "fwd P569", + "entity": "Q106629302" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "When was Salem Ilese born?", + "expect": "19 August 1999", + "relation": "fwd P569", + "entity": "Q101028862" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "When was Bella Poarch born?", + "expect": "9 February 1997", + "relation": "fwd P569", + "entity": "Q104064843" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "When was Cory Doctorow born?", + "expect": "17 July 1971", + "relation": "fwd P569", + "entity": "Q110436" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "When was Mellstroy born?", + "expect": "15 December 1998", + "relation": "fwd P569", + "entity": "Q102036394" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "When was Matt Harding born?", + "expect": "27 September 1976", + "relation": "fwd P569", + "entity": "Q1071655" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "When was TommyInnit born?", + "expect": "9 April 2004", + "relation": "fwd P569", + "entity": "Q104589982" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "When was Mikaela Loach born?", + "expect": "1998", + "relation": "fwd P569", + "entity": "Q105812482" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "When was Claudia Sulewski born?", + "expect": "19 February 1996", + "relation": "fwd P569", + "entity": "Q107620509" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "When was Tom Fletcher born?", + "expect": "17 July 1985", + "relation": "fwd P569", + "entity": "Q1051540" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "In what year was Kane Parsons born?", + "expect": "2005", + "relation": "fwd P569", + "entity": "Q111653356" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "In what year was Karl Jacobs born?", + "expect": "1998", + "relation": "fwd P569", + "entity": "Q105070859" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "In what year was Bonnie Wright born?", + "expect": "1991", + "relation": "fwd P569", + "entity": "Q105466" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "In what year was Jacob Appelbaum born?", + "expect": "1983", + "relation": "fwd P569", + "entity": "Q10070" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "In what year was Maria Pevchikh born?", + "expect": "1987", + "relation": "fwd P569", + "entity": "Q107104509" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "In what year was Abdulrahman Akkad born?", + "expect": "1998", + "relation": "fwd P569", + "entity": "Q106936955" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "In what year was Emma Laird born?", + "expect": "1996", + "relation": "fwd P569", + "entity": "Q108883717" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "In what year was Nikocado Avocado born?", + "expect": "1992", + "relation": "fwd P569", + "entity": "Q105593316" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "In what year was Ai Shinozaki born?", + "expect": "1992", + "relation": "fwd P569", + "entity": "Q1101166" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "In what year was Khaby Lame born?", + "expect": "2000", + "relation": "fwd P569", + "entity": "Q106839925" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "When did Vladlen Tatarsky die?", + "expect": "2 April 2023", + "relation": "fwd P570", + "entity": "Q111433188" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "When did Technoblade die?", + "expect": "1 June 2022", + "relation": "fwd P570", + "entity": "Q105396829" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "In what year did Saleh al-Jafarawi die?", + "expect": "2025", + "relation": "fwd P570", + "entity": "Q123738450" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "What nationality was Maki Goto?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q234099" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "What nationality was Kimiko Date?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q229104" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "What nationality was Risa Niigaki?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q233349" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "What nationality was Erik Mongrain?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q13132" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "What nationality was Mieko Kawakami?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q455930" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "What nationality was Gigi Gorgeous?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q1545337" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "What nationality was Melissa Auf der Maur?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q254510" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "What nationality was Kaela Kimura?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1342823" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "What nationality was Haruna Kojima?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q399637" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "What nationality was James Gosling?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q92622" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "What nationality was Y\u016bko Ogura?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q253715" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "What nationality was Rino Sashihara?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q181881" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Which country was Jon Lajoie a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q164869" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Which country was Mao Kobayashi a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q6753594" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Which country was Stefan Molyneux a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q937697" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Which country was Koji Uehara a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1194501" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Which country was Lauren Southern a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q24078962" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Which country was Jurina Matsui a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q399524" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Which country was Geoff Keighley a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q5534188" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Which country was Yuki Kashiwagi a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1207378" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Which country was Andr\u00e9 Boisclair a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q470957" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Which country was Linus Sebastian a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q22810736" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Which country was Jordan Peterson a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q6276882" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Which country was Rina Ikoma a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q5926327" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Cory Doctorow married to?", + "expect": "Alice Taylor", + "relation": "fwd P26", + "entity": "Q110436" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Ashley Tisdale married to?", + "expect": "Christopher French", + "relation": "fwd P26", + "entity": "Q127471" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Bruce Sterling married to?", + "expect": "Jasmina Te\u0161anovi\u0107", + "relation": "fwd P26", + "entity": "Q312995" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Candace Owens married to?", + "expect": "George Thomas Stahel Farmer", + "relation": "fwd P26", + "entity": "Q43302090" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Ezra Klein married to?", + "expect": "Annie Lowrey", + "relation": "fwd P26", + "entity": "Q605" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Tomoko Kaneda married to?", + "expect": "Wataru Mori", + "relation": "fwd P26", + "entity": "Q1192080" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Bassel Khartabil married to?", + "expect": "Noura Ghazi", + "relation": "fwd P26", + "entity": "Q982696" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Colleen Ballinger married to?", + "expect": "Erik Stocklin", + "relation": "fwd P26", + "entity": "Q18204660" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Kaela Kimura married to?", + "expect": "Eita Nagayama", + "relation": "fwd P26", + "entity": "Q1342823" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Paul Dini married to?", + "expect": "Misty Lee", + "relation": "fwd P26", + "entity": "Q636303" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Johnny Sins married to?", + "expect": "Kissa Sins", + "relation": "fwd P26", + "entity": "Q18749736" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Hans Rosling married to?", + "expect": "Agneta Rosling", + "relation": "fwd P26", + "entity": "Q588259" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who is the spouse of Teri Hatcher?", + "expect": "Jon Tenney", + "relation": "fwd P26", + "entity": "Q181490" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who is the spouse of David Frum?", + "expect": "Danielle Crittenden", + "relation": "fwd P26", + "entity": "Q1174481" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who is the spouse of Anatoly Shariy?", + "expect": "Olha Shariy", + "relation": "fwd P26", + "entity": "Q4520514" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who is the spouse of \u00c5sa Westlund?", + "expect": "Anders Lindberg", + "relation": "fwd P26", + "entity": "Q269859" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who is the spouse of John Green?", + "expect": "Sarah Urist Green", + "relation": "fwd P26", + "entity": "Q630446" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who is the spouse of Maxim Galkin?", + "expect": "Alla Pugacheva", + "relation": "fwd P26", + "entity": "Q559485" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who is the spouse of Neil Cicierega?", + "expect": "Ming Doyle", + "relation": "fwd P26", + "entity": "Q971949" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who is the spouse of Gretchen?", + "expect": "Chrystian", + "relation": "fwd P26", + "entity": "Q1791104" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who is the spouse of Mao Kobayashi?", + "expect": "Ichikawa Danj\u016br\u014d XIII", + "relation": "fwd P26", + "entity": "Q6753594" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who is the spouse of Kimberly Loaiza?", + "expect": "Juan de Dios Pantoja", + "relation": "fwd P26", + "entity": "Q63565821" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who is the spouse of Paul Krugman?", + "expect": "Robin Wells", + "relation": "fwd P26", + "entity": "Q131112" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who is the spouse of Alexander Nevzorov?", + "expect": "Aleksandra Yakovleva", + "relation": "fwd P26", + "entity": "Q1978790" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was David D. Friedman's father?", + "expect": "Milton Friedman", + "relation": "fwd P22", + "entity": "Q353915" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Dmytro Kuleba's father?", + "expect": "Ivan Kuleba", + "relation": "fwd P22", + "entity": "Q24025631" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Shoko Nakagawa's father?", + "expect": "Katsuhiko Nakagawa", + "relation": "fwd P22", + "entity": "Q685028" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Avijit Roy's father?", + "expect": "Ajoy Roy", + "relation": "fwd P22", + "entity": "Q19361202" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Hikaru Utada's father?", + "expect": "Teruzane Utada", + "relation": "fwd P22", + "entity": "Q234598" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Kelly Piquet's father?", + "expect": "Nelson Piquet", + "relation": "fwd P22", + "entity": "Q21290333" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Yoshitoshi ABe's father?", + "expect": "Yoshiteru Abe", + "relation": "fwd P22", + "entity": "Q707507" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Francis Fukuyama's father?", + "expect": "Yoshio Fukuyama", + "relation": "fwd P22", + "entity": "Q186123" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Dylan O'Brien's father?", + "expect": "Patrick O'Brien", + "relation": "fwd P22", + "entity": "Q714458" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Nikita Mikhalkov's father?", + "expect": "Sergey Mikhalkov", + "relation": "fwd P22", + "entity": "Q55207" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Johan Norberg's father?", + "expect": "Erik Norberg", + "relation": "fwd P22", + "entity": "Q618025" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Alaa Abd El-Fatah's father?", + "expect": "Ahmed Seif El-Islam", + "relation": "fwd P22", + "entity": "Q149941" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the father of Mike Leavitt?", + "expect": "Dixie L. Leavitt", + "relation": "fwd P22", + "entity": "Q879432" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the father of Soleil Moon Frye?", + "expect": "Virgil Frye", + "relation": "fwd P22", + "entity": "Q287805" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the father of Matti Vanhanen?", + "expect": "Tatu Vanhanen", + "relation": "fwd P22", + "entity": "Q182043" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the father of Mikhail Zadornov?", + "expect": "Nikolay Zadornov", + "relation": "fwd P22", + "entity": "Q2622688" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the father of Hazel Brugger?", + "expect": "Peter Brugger", + "relation": "fwd P22", + "entity": "Q21583218" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the father of Erkki Tuomioja?", + "expect": "Sakari Tuomioja", + "relation": "fwd P22", + "entity": "Q58121" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the father of Mace?", + "expect": "Brent Williams", + "relation": "fwd P22", + "entity": "Q14917342" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the father of Magnus Uggla?", + "expect": "Cla\u00ebs Uggla", + "relation": "fwd P22", + "entity": "Q946885" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the father of Ananya Birla?", + "expect": "Kumar Mangalam Birla", + "relation": "fwd P22", + "entity": "Q28529974" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the father of Robert F. Kennedy Jr.?", + "expect": "Robert F. Kennedy", + "relation": "fwd P22", + "entity": "Q1352872" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the father of Astrid Thors?", + "expect": "Carl-Eric Thors", + "relation": "fwd P22", + "entity": "Q2868553" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the father of Nora Ephron?", + "expect": "Henry Ephron", + "relation": "fwd P22", + "entity": "Q214677" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Alaa Abd El-Fatah's mother?", + "expect": "Laila Soueif", + "relation": "fwd P25", + "entity": "Q149941" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Simone Giertz's mother?", + "expect": "Caroline Giertz", + "relation": "fwd P25", + "entity": "Q23304510" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Artemy Lebedev's mother?", + "expect": "Tatyana Tolstaya", + "relation": "fwd P25", + "entity": "Q2273039" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Jerry Brown's mother?", + "expect": "Bernice Layne Brown", + "relation": "fwd P25", + "entity": "Q152451" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Kai Trump's mother?", + "expect": "Vanessa Trump", + "relation": "fwd P25", + "entity": "Q23000822" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Chiara Ferragni's mother?", + "expect": "Marina Di Guardo", + "relation": "fwd P25", + "entity": "Q8933801" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Hasan Piker's mother?", + "expect": "Ulker Piker", + "relation": "fwd P25", + "entity": "Q72219322" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Shoko Nakagawa's mother?", + "expect": "Keiko Nakagawa", + "relation": "fwd P25", + "entity": "Q685028" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Anton Nosik's mother?", + "expect": "Victoria Mochalova", + "relation": "fwd P25", + "entity": "Q3888799" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Hikaru Utada's mother?", + "expect": "Keiko Fuji", + "relation": "fwd P25", + "entity": "Q234598" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Kathleen Kinmont's mother?", + "expect": "Abby Dalton", + "relation": "fwd P25", + "entity": "Q457562" + }, + { + "split": "dev", + "kind": "bloggers", + "valid": true, + "q": "Who was Carl Bildt's mother?", + "expect": "Rut Kerstin Maria Andersson-Alw\u00e5", + "relation": "fwd P25", + "entity": "Q52922" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the mother of Dixie D'Amelio?", + "expect": "Heidi D'Amelio", + "relation": "fwd P25", + "entity": "Q83708517" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the mother of Jordan Peterson?", + "expect": "Beverley Peterson", + "relation": "fwd P25", + "entity": "Q6276882" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the mother of James Rallison?", + "expect": "Janette Rallison", + "relation": "fwd P25", + "entity": "Q29586868" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the mother of Bonnie Wright?", + "expect": "Sheila Teague", + "relation": "fwd P25", + "entity": "Q105466" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the mother of Katherine Schwarzenegger?", + "expect": "Maria Shriver", + "relation": "fwd P25", + "entity": "Q4521676" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the mother of Magnus Uggla?", + "expect": "Madeleine Uggla", + "relation": "fwd P25", + "entity": "Q946885" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the mother of iJustine?", + "expect": "Michelle Ezarik", + "relation": "fwd P25", + "entity": "Q2372674" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the mother of Grimes?", + "expect": "Sandy Garossino", + "relation": "fwd P25", + "entity": "Q117970" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the mother of Nora Ephron?", + "expect": "Phoebe Ephron", + "relation": "fwd P25", + "entity": "Q214677" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the mother of JoJo Siwa?", + "expect": "Jessalynn Siwa", + "relation": "fwd P25", + "entity": "Q24174947" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the mother of Maxim Galkin?", + "expect": "Natalya Grigoryevna Galkina", + "relation": "fwd P25", + "entity": "Q559485" + }, + { + "split": "heldout", + "kind": "bloggers", + "valid": true, + "q": "Who was the mother of Robert F. Kennedy Jr.?", + "expect": "Ethel Kennedy", + "relation": "fwd P25", + "entity": "Q1352872" + } +] \ No newline at end of file diff --git a/root/specialists/rel-bloggers/relspec_scorer.py b/root/specialists/rel-bloggers/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-bloggers/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-bloggers/verdict_dev.json b/root/specialists/rel-bloggers/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..2c09c157d96f564a2d8fb5bb57b9ded2cd663cba --- /dev/null +++ b/root/specialists/rel-bloggers/verdict_dev.json @@ -0,0 +1,114 @@ +{ + "id": "rel-bloggers", + "name": "Oracle7 Relations: Bloggers", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w406", + "time": "2026-10-13T02:19:54Z", + "domain": { + "head": { + "correct": 57, + "false_yes": 0, + "wrong": 10, + "n": 79, + "p50_ms": 596.47, + "fails": [ + [ + "bloggers", + "Where was Bram Cohen born?", + "specialist_call>specialist:rel-business>", + "I can't verify the POB of Bram Cohen from my records, so I won't guess. [rel-business]" + ], + [ + "bloggers", + "Where was Thomas Dolby born?", + "deliberation:where", + "[ev:direct] He married actress Kathleen Beller in 1988. [simplewiki_515572a3fbc6fd57f93951" + ], + [ + "bloggers", + "Where was Sally Amaki born?", + "deliberation:where", + "[ev:direct] She is a member of the voice acting idol group 22/7, which debuted in 2017, an" + ], + [ + "bloggers", + "Where was Rebecca Yarros born?", + "deliberation:where", + "[ev:direct] The first book in the Empyrean series, Fourth Wing, was published in April 202" + ], + [ + "bloggers", + "Where was Susie Amy born?", + "deliberation:where", + "[ev:direct] She is best known for her role as Chardonnay Lane-Pascoe in the ITV series Foo" + ], + [ + "bloggers", + "When was Technoblade born?", + "capability:when_did|vessel:receipt", + "The admitted record for Technoblade contains no dated statement about when it born. It may" + ], + [ + "bloggers", + "When was Bella Poarch born?", + "capability:when_did", + "[ev:direct] According to Bella Poarch, Denarie Bautista Taylor Poarch (born February 8, 19" + ], + [ + "bloggers", + "When was Cory Doctorow born?", + "capability:when_did", + "[ev:direct] According to Cory Doctorow, Cory Efram Doctorow (/\u02c8k\u0252ri \u02c8d\u0252kt\u0259ro\u028a/; born July " + ] + ] + }, + "spec": { + "correct": 79, + "false_yes": 0, + "wrong": 0, + "n": 79, + "p50_ms": 0.1, + "fails": [] + } + }, + "core": { + "head": { + "correct": 132, + "false_yes": 0 + }, + "spec": { + "correct": 132, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-bloggers/verdict_heldout.json b/root/specialists/rel-bloggers/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..537a2f93abe0c6dd33dc47d98d2c6eecc1c5b874 --- /dev/null +++ b/root/specialists/rel-bloggers/verdict_heldout.json @@ -0,0 +1,127 @@ +{ + "id": "rel-bloggers", + "name": "Oracle7 Relations: Bloggers", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w406", + "time": "2026-10-13T02:20:48Z", + "domain": { + "head": { + "correct": 66, + "false_yes": 0, + "wrong": 0, + "n": 74, + "p50_ms": 635.28, + "fails": [ + [ + "bloggers", + "What is the birthplace of Katherine Schwarzenegger?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "bloggers", + "In which city did Alice Wong die?", + "specialist_call>specialist:rel-business>", + "I can't verify the POD of Alice Wong from my records, so I won't guess. [rel-business]" + ], + [ + "bloggers", + "In what year was Abdulrahman Akkad born?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "bloggers", + "Which country was Jurina Matsui a citizen of?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "bloggers", + "Who is the spouse of Mao Kobayashi?", + "specialist_call>specialist:rel-actors>un", + "I can't verify the wives of Mao Kobayashi from my records, so I won't guess. [rel-actors]" + ], + [ + "bloggers", + "Who was the father of Mikhail Zadornov?", + "specialist_call>specialist:rel-business>", + "I can't verify the son of of Mikhail Zadornov from my records, so I won't guess. [rel-busi" + ], + [ + "bloggers", + "Who was the father of Mace?", + "unverified:factoid:fts", + "I found a passage that may be related, but I can't verify it answers your question: \"In 19" + ], + [ + "bloggers", + "Who was the father of Robert F. Kennedy Jr.?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 72, + "false_yes": 0, + "wrong": 0, + "n": 74, + "p50_ms": 0.05, + "fails": [ + [ + "bloggers", + "Who was the father of Mace?", + "unverified:factoid:fts", + "I found a passage that may be related, but I can't verify it answers your question: \"In 19" + ], + [ + "bloggers", + "Who was the father of Robert F. Kennedy Jr.?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + } + }, + "core": { + "head": { + "correct": 132, + "false_yes": 0 + }, + "spec": { + "correct": 132, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-brands/manifest.json b/root/specialists/rel-brands/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..55c618cbe07a435b5506f1173bc760b84dccb69e --- /dev/null +++ b/root/specialists/rel-brands/manifest.json @@ -0,0 +1,72 @@ +{ + "id": "rel-brands", + "name": "Oracle7 Relations: Brands", + "number": 257, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-brands/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-brands", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "brands", + "kind": "brands" + } + }, + "accept": { + "kinds": [ + "brands" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-brands/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [ + 431289 + ], + "occupations": [] + }, + "readers": [ + "749", + "17", + "571", + "112" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-brands/organ_relation_v2.py b/root/specialists/rel-brands/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-brands/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-brands/readers.json b/root/specialists/rel-brands/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..e5c965e1755df6c763cb2fc589a8c8268263770f --- /dev/null +++ b/root/specialists/rel-brands/readers.json @@ -0,0 +1,9 @@ +{ + "keys": [ + "749", + "17", + "571", + "112" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-brands/relation_panel_v2.json b/root/specialists/rel-brands/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..c4e511c8e9b922c2fad97c3e7a8b5c312e7b7d70 --- /dev/null +++ b/root/specialists/rel-brands/relation_panel_v2.json @@ -0,0 +1,866 @@ +[ + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Which company owns Ultra Records?", + "expect": "Sony Music", + "relation": "fwd P749", + "entity": "Q2573393" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Which company owns Warner Records Inc.?", + "expect": "Warner Music Group", + "relation": "fwd P749", + "entity": "Q67030918" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Which company owns Dr. Martens?", + "expect": "Permira", + "relation": "fwd P749", + "entity": "Q1126126" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Which company owns Dodge?", + "expect": "Stellantis North America", + "relation": "fwd P749", + "entity": "Q27564" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Which company owns Roc-A-Fella Records?", + "expect": "Universal Music Group", + "relation": "fwd P749", + "entity": "Q1153032" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Which company owns XL Recordings?", + "expect": "Beggars Group", + "relation": "fwd P749", + "entity": "Q1123947" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Which company owns Nonesuch Records?", + "expect": "Warner Music Group", + "relation": "fwd P749", + "entity": "Q1849138" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Which company owns McCaf\u00e9?", + "expect": "McDonald's", + "relation": "fwd P749", + "entity": "Q3114287" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Which company owns ESPN+?", + "expect": "ESPN, LLC", + "relation": "fwd P749", + "entity": "Q46996011" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Which company owns Geffen Records?", + "expect": "Universal Music Group", + "relation": "fwd P749", + "entity": "Q212699" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Which company owns RCA Records?", + "expect": "Sony Music", + "relation": "fwd P749", + "entity": "Q202585" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Which company owns Arri?", + "expect": "Riedel Communications", + "relation": "fwd P749", + "entity": "Q11207" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "What is the parent company of Jetour?", + "expect": "Chery", + "relation": "fwd P749", + "entity": "Q98145436" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "What is the parent company of Neoplan?", + "expect": "MAN Truck & Bus", + "relation": "fwd P749", + "entity": "Q326013" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "What is the parent company of Cash Money Records?", + "expect": "Universal Music Group", + "relation": "fwd P749", + "entity": "Q1047366" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "What is the parent company of Tetra Pak?", + "expect": "Tetra Laval", + "relation": "fwd P749", + "entity": "Q659200" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "What is the parent company of Jeep?", + "expect": "Stellantis North America", + "relation": "fwd P749", + "entity": "Q30113" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "What is the parent company of Avex Trax?", + "expect": "Avex Group", + "relation": "fwd P749", + "entity": "Q1988428" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "What is the parent company of Asylum Records?", + "expect": "Warner Music Group", + "relation": "fwd P749", + "entity": "Q1998195" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "What is the parent company of Alpine?", + "expect": "Renault", + "relation": "fwd P749", + "entity": "Q26944" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "What is the parent company of BMG Rights Management?", + "expect": "Bertelsmann", + "relation": "fwd P749", + "entity": "Q796316" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "What is the parent company of Stone Music Entertainment?", + "expect": "CJ ENM Entertainment Division", + "relation": "fwd P749", + "entity": "Q483971" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "What is the parent company of Grand Hustle Records?", + "expect": "Warner Music Group", + "relation": "fwd P749", + "entity": "Q1153338" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "What is the parent company of A&M Records?", + "expect": "Universal Music Group", + "relation": "fwd P749", + "entity": "Q277626" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "In which country is Tokuma Shoten?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1372258" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "In which country is NBCUniversal Entertainment Japan LLC?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1205595" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "In which country is Mazda?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q35996" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "In which country is EMI Music Japan?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1365614" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "In which country is Key?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1143528" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "In which country is Nakamichi?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1963952" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "In which country is Aeon?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q271413" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "In which country is PlayStation?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1323662" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "In which country is Toshiba?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q49125" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "In which country is Cerv\u00e9lo?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q1056567" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "In which country is Nikkor?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q2468852" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "In which country is Tama Drums?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1536520" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Which country is Kenwood Corporation in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q17180" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Which country is Trinitron in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q337538" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Which country is Daihatsu in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q27511" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Which country is Pony Canyon in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q513712" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Which country is Avex Trax in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1988428" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Which country is Marvelous in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q2546713" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Which country is Air Canada Express in?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q666821" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Which country is Technics in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1426394" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Which country is Suntory in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1345267" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Which country is Smile-Up in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q11728013" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Which country is Scion in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q503487" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Which country is Air Japan in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1189087" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "When was Prime founded?", + "expect": "2022", + "relation": "fwd P571", + "entity": "Q115113002" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "When was Roc Nation founded?", + "expect": "2008", + "relation": "fwd P571", + "entity": "Q1194456" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "When was Fueled by Ramen founded?", + "expect": "1996", + "relation": "fwd P571", + "entity": "Q1046066" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "When was Moncler founded?", + "expect": "1952", + "relation": "fwd P571", + "entity": "Q1548951" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "When was Jugoton founded?", + "expect": "10 July 1947", + "relation": "fwd P571", + "entity": "Q1094430" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "When was Vox founded?", + "expect": "1947", + "relation": "fwd P571", + "entity": "Q1122899" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "When was Roc-A-Fella Records founded?", + "expect": "1203", + "relation": "fwd P571", + "entity": "Q1153032" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "When was Elf Aquitaine founded?", + "expect": "1966", + "relation": "fwd P571", + "entity": "Q1505649" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "When was Ruff Ryders Entertainment founded?", + "expect": "1988", + "relation": "fwd P571", + "entity": "Q1193843" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "When was Spinefarm Records founded?", + "expect": "1990", + "relation": "fwd P571", + "entity": "Q1124153" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "When was Octopus card founded?", + "expect": "1 September 1997", + "relation": "fwd P571", + "entity": "Q1063167" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "When was Plymouth founded?", + "expect": "7 July 1928", + "relation": "fwd P571", + "entity": "Q1124857" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "In what year was Ninja Tune established?", + "expect": "1990", + "relation": "fwd P571", + "entity": "Q1358555" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "In what year was Soylent established?", + "expect": "2013", + "relation": "fwd P571", + "entity": "Q13384640" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "In what year was Lanc\u00f4me established?", + "expect": "1935", + "relation": "fwd P571", + "entity": "Q1541268" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "In what year was Harvest established?", + "expect": "1969", + "relation": "fwd P571", + "entity": "Q1324712" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "In what year was Creation Records established?", + "expect": "1983", + "relation": "fwd P571", + "entity": "Q1139341" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "In what year was FSO Warszawa established?", + "expect": "1951", + "relation": "fwd P571", + "entity": "Q1462357" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "In what year was Charisma established?", + "expect": "1969", + "relation": "fwd P571", + "entity": "Q1063242" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "In what year was Cannondale Bicycle Corporation established?", + "expect": "1971", + "relation": "fwd P571", + "entity": "Q1033502" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "In what year was J Records established?", + "expect": "2000", + "relation": "fwd P571", + "entity": "Q121698" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "In what year was Matador Records established?", + "expect": "1989", + "relation": "fwd P571", + "entity": "Q1327994" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "In what year was GOOD Music established?", + "expect": "2004", + "relation": "fwd P571", + "entity": "Q1142456" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "In what year was Grand Hustle Records established?", + "expect": "2003", + "relation": "fwd P571", + "entity": "Q1153338" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Who founded Syco Music?", + "expect": "Simon Cowell", + "relation": "fwd P112", + "entity": "Q7659636" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Who founded Rolling Stones Records?", + "expect": "The Rolling Stones", + "relation": "fwd P112", + "entity": "Q594126" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Who founded Braun?", + "expect": "Max Braun", + "relation": "fwd P112", + "entity": "Q631220" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Who founded AFM Records?", + "expect": "Andreas Allend\u00f6rfer", + "relation": "fwd P112", + "entity": "Q292128" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Who founded Hybe?", + "expect": "Bang Si-hyuk", + "relation": "fwd P112", + "entity": "Q16161254" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Who founded Mazda?", + "expect": "Jujiro Matsuda", + "relation": "fwd P112", + "entity": "Q35996" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Who founded Giant Bicycles?", + "expect": "King Liu", + "relation": "fwd P112", + "entity": "Q703557" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Who founded Roc Nation?", + "expect": "Jay-Z", + "relation": "fwd P112", + "entity": "Q1194456" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Who founded Arista Records?", + "expect": "Clive Davis", + "relation": "fwd P112", + "entity": "Q664167" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Who founded Oldsmobile?", + "expect": "Ransom E. Olds", + "relation": "fwd P112", + "entity": "Q204327" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Who founded Vox?", + "expect": "Thomas Walter Jennings", + "relation": "fwd P112", + "entity": "Q1122899" + }, + { + "split": "dev", + "kind": "brands", + "valid": true, + "q": "Who founded Fenty Beauty?", + "expect": "Rihanna", + "relation": "fwd P112", + "entity": "Q51135597" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Who was the founder of Hollywood Records?", + "expect": "Michael Eisner", + "relation": "fwd P112", + "entity": "Q387539" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Who was the founder of Alipay?", + "expect": "Jack Ma", + "relation": "fwd P112", + "entity": "Q493556" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Who was the founder of Avex Trax?", + "expect": "Max Matsuura", + "relation": "fwd P112", + "entity": "Q1988428" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Who was the founder of Sunbeam?", + "expect": "John Marston", + "relation": "fwd P112", + "entity": "Q2165627" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Who was the founder of American Recordings?", + "expect": "Rick Rubin", + "relation": "fwd P112", + "entity": "Q466649" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Who was the founder of Lux?", + "expect": "Lever Brothers", + "relation": "fwd P112", + "entity": "Q665425" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Who was the founder of Virgin Trains?", + "expect": "Richard Branson", + "relation": "fwd P112", + "entity": "Q843431" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Who was the founder of Lava Records?", + "expect": "Jason Flom", + "relation": "fwd P112", + "entity": "Q2002177" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Who was the founder of Philips Records?", + "expect": "N.V. Philips Phonografische Industrie", + "relation": "fwd P112", + "entity": "Q1536003" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Who was the founder of Prestige?", + "expect": "Bob Weinstock", + "relation": "fwd P112", + "entity": "Q1811175" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Who was the founder of Cupra?", + "expect": "SEAT", + "relation": "fwd P112", + "entity": "Q8352675" + }, + { + "split": "heldout", + "kind": "brands", + "valid": true, + "q": "Who was the founder of GMC?", + "expect": "William Crapo Durant", + "relation": "fwd P112", + "entity": "Q28993" + } +] \ No newline at end of file diff --git a/root/specialists/rel-brands/relspec_scorer.py b/root/specialists/rel-brands/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-brands/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-brands/verdict_dev.json b/root/specialists/rel-brands/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..e18acd56579e42fb9c58296b749cb812e71e3cdc --- /dev/null +++ b/root/specialists/rel-brands/verdict_dev.json @@ -0,0 +1,163 @@ +{ + "id": "rel-brands", + "name": "Oracle7 Relations: Brands", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w406", + "time": "2026-10-13T02:21:21Z", + "domain": { + "head": { + "correct": 30, + "false_yes": 0, + "wrong": 2, + "n": 48, + "p50_ms": 274.45, + "fails": [ + [ + "brands", + "Which company owns Ultra Records?", + "precision_guard:G2_time_not_asked|arb:ti", + "I can't verify an answer to that exact question, so I won't guess." + ], + [ + "brands", + "Which company owns Roc-A-Fella Records?", + "precision_guard:G2_time_not_asked|arb:ti", + "I can't verify an answer to that exact question, so I won't guess." + ], + [ + "brands", + "Which company owns XL Recordings?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "brands", + "Which company owns Nonesuch Records?", + "precision_guard:G2_time_not_asked|arb:ti", + "I can't verify an answer to that exact question, so I won't guess." + ], + [ + "brands", + "Which company owns McCaf\u00e9?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "brands", + "Which company owns ESPN+?", + "specialist_call>specialist:rel-companies", + "I can't verify the superior organization unit of ESPN+ from my records, so I won't guess. " + ], + [ + "brands", + "Which company owns Geffen Records?", + "precision_guard:G2_time_not_asked|arb:ti", + "I can't verify an answer to that exact question, so I won't guess." + ], + [ + "brands", + "In which country is NBCUniversal Entertainment Japan LLC?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 40, + "false_yes": 0, + "wrong": 0, + "n": 48, + "p50_ms": 2.88, + "fails": [ + [ + "brands", + "In which country is NBCUniversal Entertainment Japan LLC?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "brands", + "In which country is EMI Music Japan?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "brands", + "In which country is Key?", + "unverified:factoid:fts", + "I found a passage that may be related, but I can't verify it answers your question: \"Hamin" + ], + [ + "brands", + "When was Prime founded?", + "capability:when_did|vessel:reinforced", + "The admitted record for Prime contains no dated statement about when it found. It may also" + ], + [ + "brands", + "When was Vox founded?", + "capability:when_did|vessel:reinforced", + "The admitted record for Vox contains no dated statement about when it found. It may also b" + ], + [ + "brands", + "When was Plymouth founded?", + "capability:when_did|vessel:reinforced", + "The admitted record for Plymouth contains no dated statement about when it found. It may a" + ], + [ + "brands", + "Who founded Rolling Stones Records?", + "unverified:compose:bridge", + "I found a passage that may be related, but I can't verify it answers your question: \"Marsh" + ], + [ + "brands", + "Who founded Vox?", + "specialist_call>specialist:rel-organisat", + "I can't verify the starter of Vox from my records, so I won't guess. [rel-organisations]" + ] + ] + } + }, + "core": { + "head": { + "correct": 132, + "false_yes": 0 + }, + "spec": { + "correct": 132, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-brands/verdict_heldout.json b/root/specialists/rel-brands/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..dbdd10e08c8714c47b1ff9668c70e87893e30360 --- /dev/null +++ b/root/specialists/rel-brands/verdict_heldout.json @@ -0,0 +1,139 @@ +{ + "id": "rel-brands", + "name": "Oracle7 Relations: Brands", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w406", + "time": "2026-10-13T02:22:08Z", + "domain": { + "head": { + "correct": 27, + "false_yes": 0, + "wrong": 6, + "n": 48, + "p50_ms": 495.84, + "fails": [ + [ + "brands", + "What is the parent company of Cash Money Records?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "brands", + "What is the parent company of Tetra Pak?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "brands", + "What is the parent company of Avex Trax?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "brands", + "What is the parent company of Asylum Records?", + "unverified:corpus_query:property_of", + "I found a passage that may be related, but I can't verify it answers your question: \"They " + ], + [ + "brands", + "What is the parent company of Alpine?", + "corpus_query:property_of|vessel:reinforc", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nYou have asked \"Wha" + ], + [ + "brands", + "What is the parent company of Grand Hustle Records?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "brands", + "What is the parent company of A&M Records?", + "unverified:corpus_query:property_of", + "I found a passage that may be related, but I can't verify it answers your question: \"Withi" + ], + [ + "brands", + "Which country is Trinitron in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 44, + "false_yes": 0, + "wrong": 0, + "n": 48, + "p50_ms": 0.94, + "fails": [ + [ + "brands", + "What is the parent company of Alpine?", + "corpus_query:property_of|vessel:reinforc", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nYou have asked \"Wha" + ], + [ + "brands", + "Which country is Air Canada Express in?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "brands", + "Which country is Air Japan in?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "brands", + "Who was the founder of Lux?", + "specialist_call>specialist:rel-organisat", + "I can't verify the starter of Lux from my records, so I won't guess. [rel-organisations]" + ] + ] + } + }, + "core": { + "head": { + "correct": 132, + "false_yes": 0 + }, + "spec": { + "correct": 132, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-bridges/manifest.json b/root/specialists/rel-bridges/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..c92561a7201d3a51780164e896851f130ae4146e --- /dev/null +++ b/root/specialists/rel-bridges/manifest.json @@ -0,0 +1,72 @@ +{ + "id": "rel-bridges", + "name": "Oracle7 Relations: Bridges", + "number": 150, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-bridges/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-bridges", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "bridges", + "kind": "bridges" + } + }, + "accept": { + "kinds": [ + "bridges" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-bridges/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [ + 12280 + ], + "occupations": [] + }, + "readers": [ + "177", + "84", + "1619", + "17" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-bridges/organ_relation_v2.py b/root/specialists/rel-bridges/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-bridges/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-bridges/readers.json b/root/specialists/rel-bridges/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..d158b4adf90ca75b6db955f435bf5d50a9b34139 --- /dev/null +++ b/root/specialists/rel-bridges/readers.json @@ -0,0 +1,9 @@ +{ + "keys": [ + "177", + "84", + "1619", + "17" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-bridges/relation_panel_v2.json b/root/specialists/rel-bridges/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..45b6754b84a176a097f1065702ec64b90650b7e7 --- /dev/null +++ b/root/specialists/rel-bridges/relation_panel_v2.json @@ -0,0 +1,767 @@ +[ + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Which river does Pont Rouelle cross?", + "expect": "Seine", + "relation": "fwd P177", + "entity": "Q2307584" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Which river does Allenby Bridge cross?", + "expect": "Jordan River", + "relation": "fwd P177", + "entity": "Q712133" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Which river does George Washington Bridge cross?", + "expect": "Hudson River", + "relation": "fwd P177", + "entity": "Q125821" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Which river does Wandsworth Bridge cross?", + "expect": "River Thames", + "relation": "fwd P177", + "entity": "Q1502874" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Which river does Bridge of the Americas cross?", + "expect": "Panama Canal", + "relation": "fwd P177", + "entity": "Q216061" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Which river does Brusio spiral viaduct cross?", + "expect": "Bernina railway line", + "relation": "fwd P177", + "entity": "Q850305" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Which river does Seven Mile Bridge cross?", + "expect": "Moser Channel", + "relation": "fwd P177", + "entity": "Q2164354" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Which river does Admiral's bridge cross?", + "expect": "Oreto River", + "relation": "fwd P177", + "entity": "Q1262976" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Which river does Quebec Bridge cross?", + "expect": "St. Lawrence River", + "relation": "fwd P177", + "entity": "Q1427489" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Which river does Jamuna Bridge cross?", + "expect": "Brahmaputra River", + "relation": "fwd P177", + "entity": "Q10729282" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Which river does Roman Bridge cross?", + "expect": "Moselle", + "relation": "fwd P177", + "entity": "Q284125" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Which river does Puente Nuevo cross?", + "expect": "Guadalev\u00edn", + "relation": "fwd P177", + "entity": "Q2004707" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "What body of water does Lambeth Bridge span?", + "expect": "River Thames", + "relation": "fwd P177", + "entity": "Q1130666" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "What body of water does Stone Bridge span?", + "expect": "Danube", + "relation": "fwd P177", + "entity": "Q695095" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "What body of water does Dragon River Bridge span?", + "expect": "Han River", + "relation": "fwd P177", + "entity": "Q5305270" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "What body of water does 6th October Bridge span?", + "expect": "Nile", + "relation": "fwd P177", + "entity": "Q996111" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "What body of water does Galata Bridge span?", + "expect": "Golden Horn", + "relation": "fwd P177", + "entity": "Q81523" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "What body of water does Zeeland Bridge span?", + "expect": "Oosterschelde", + "relation": "fwd P177", + "entity": "Q184390" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "What body of water does Pont des Invalides span?", + "expect": "Seine", + "relation": "fwd P177", + "entity": "Q1073098" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "What body of water does Adolphe Bridge span?", + "expect": "P\u00e9trusse", + "relation": "fwd P177", + "entity": "Q365643" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "What body of water does \u00c1rp\u00e1d Bridge span?", + "expect": "Danube", + "relation": "fwd P177", + "entity": "Q252452" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "What body of water does Chesapeake Bay Bridge span?", + "expect": "Chesapeake Bay", + "relation": "fwd P177", + "entity": "Q1319988" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "What body of water does Bolsheokhtinsky Bridge span?", + "expect": "Neva", + "relation": "fwd P177", + "entity": "Q891580" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "What body of water does Dragon Bridge span?", + "expect": "Ljubljanica", + "relation": "fwd P177", + "entity": "Q660029" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Who was the architect of Quebec Bridge?", + "expect": "Theodore Cooper", + "relation": "fwd P84", + "entity": "Q1427489" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Who was the architect of Sz\u00e9chenyi Chain Bridge?", + "expect": "William Tierney Clark", + "relation": "fwd P84", + "entity": "Q465534" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Who was the architect of ponte della Costituzione?", + "expect": "Santiago Calatrava", + "relation": "fwd P84", + "entity": "Q52501" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Who was the architect of Pont de Normandie?", + "expect": "Michel Virlogeux", + "relation": "fwd P84", + "entity": "Q504710" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Who was the architect of Ponte de D. Maria Pia?", + "expect": "Gustave Eiffel", + "relation": "fwd P84", + "entity": "Q1550899" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Who was the architect of Zubizuri?", + "expect": "Santiago Calatrava", + "relation": "fwd P84", + "entity": "Q227583" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Who was the architect of Solkan Bridge?", + "expect": "Rudolf Jaussner", + "relation": "fwd P84", + "entity": "Q12363" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Who was the architect of Bronx\u2013Whitestone Bridge?", + "expect": "Othmar Hermann Ammann", + "relation": "fwd P84", + "entity": "Q125543" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Who was the architect of passerelle L\u00e9opold-S\u00e9dar-Senghor?", + "expect": "Marc Mimram", + "relation": "fwd P84", + "entity": "Q605912" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Who was the architect of Kyiv Metro Bridge?", + "expect": "Heorhij Fuks", + "relation": "fwd P84", + "entity": "Q2475012" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Who was the architect of Puente de la Mujer?", + "expect": "Santiago Calatrava", + "relation": "fwd P84", + "entity": "Q2336867" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "Who was the architect of Great Bridge of Hrazdan?", + "expect": "Grigor Aghababyan", + "relation": "fwd P84", + "entity": "Q3114751" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "Who designed Eiffel Bridge, Ungheni?", + "expect": "Nikolai Belelyubsky", + "relation": "fwd P84", + "entity": "Q13529390" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "Who designed Liberty Bridge?", + "expect": "J\u00e1nos Feketeh\u00e1zy", + "relation": "fwd P84", + "entity": "Q915195" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "Who designed Mehmed Pa\u0161a Sokolovi\u0107 Bridge?", + "expect": "Mimar Sinan", + "relation": "fwd P84", + "entity": "Q210055" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "Who designed The Iron Bridge?", + "expect": "Thomas Farnolls Pritchard", + "relation": "fwd P84", + "entity": "Q99200" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "Who designed Zhivopisny Bridge?", + "expect": "Nikolay Shumakov", + "relation": "fwd P84", + "entity": "Q834287" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "Who designed Str\u00f6msund Bridge?", + "expect": "Franz Dischinger", + "relation": "fwd P84", + "entity": "Q1574275" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "Who designed Vizcaya Bridge?", + "expect": "Alberto Palacio", + "relation": "fwd P84", + "entity": "Q331996" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "Who designed Benjamin Franklin Bridge?", + "expect": "Paul Philippe Cret", + "relation": "fwd P84", + "entity": "Q817485" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "Who designed Haghtanak bridge?", + "expect": "Artashes Mamijanyan", + "relation": "fwd P84", + "entity": "Q2471370" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "Who designed Samuel Beckett Bridge?", + "expect": "Santiago Calatrava", + "relation": "fwd P84", + "entity": "Q1193916" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "Who designed Ponte Sant'Angelo?", + "expect": "Decriannus", + "relation": "fwd P84", + "entity": "Q870476" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "Who designed \u00c1rp\u00e1d Bridge?", + "expect": "K\u00e1roly Sz\u00e9chy", + "relation": "fwd P84", + "entity": "Q252452" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "When did viaduc d'Austerlitz open?", + "expect": "1904", + "relation": "fwd P1619", + "entity": "Q2271703" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "When did Seven Mile Bridge open?", + "expect": "24 May 1982", + "relation": "fwd P1619", + "entity": "Q2164354" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "When did Kyrkbron open?", + "expect": "26 September 1975", + "relation": "fwd P1619", + "entity": "Q3603778" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "When did Anichkov Bridge open?", + "expect": "1716", + "relation": "fwd P1619", + "entity": "Q550953" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "When did Grosvenor Bridge open?", + "expect": "1860", + "relation": "fwd P1619", + "entity": "Q693731" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "When did King Fahd Causeway open?", + "expect": "12 November 1986", + "relation": "fwd P1619", + "entity": "Q827735" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "When did Ask\u00f8y Bridge open?", + "expect": "12 December 1992", + "relation": "fwd P1619", + "entity": "Q2374688" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "When did Jiangyin Yangtze River Bridge open?", + "expect": "1999", + "relation": "fwd P1619", + "entity": "Q2625335" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "When did Fatih Sultan Mehmet Bridge open?", + "expect": "3 July 1988", + "relation": "fwd P1619", + "entity": "Q369967" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "When did Conwy Suspension Bridge open?", + "expect": "1826", + "relation": "fwd P1619", + "entity": "Q2091681" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "When did Bhumibol Bridge open?", + "expect": "24 November 2010", + "relation": "fwd P1619", + "entity": "Q855090" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "When did \u00d6land Bridge open?", + "expect": "30 September 1972", + "relation": "fwd P1619", + "entity": "Q296799" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "In what year did Samuel Beckett Bridge open?", + "expect": "2009", + "relation": "fwd P1619", + "entity": "Q1193916" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "In what year did Three Countries Bridge open?", + "expect": "2007", + "relation": "fwd P1619", + "entity": "Q205682" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "In what year did Korea\u2013Russia Friendship Bridge open?", + "expect": "1959", + "relation": "fwd P1619", + "entity": "Q30901234" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "In what year did Zhivopisny Bridge open?", + "expect": "2007", + "relation": "fwd P1619", + "entity": "Q834287" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "In what year did Cannon Street Railway Bridge open?", + "expect": "1866", + "relation": "fwd P1619", + "entity": "Q278314" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "In what year did Silver Bridge open?", + "expect": "1928", + "relation": "fwd P1619", + "entity": "Q177865" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "In what year did Hammersmith Bridge open?", + "expect": "1827", + "relation": "fwd P1619", + "entity": "Q1573860" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "In what year did Centennial Bridge, Panama open?", + "expect": "2004", + "relation": "fwd P1619", + "entity": "Q747908" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "In what year did Vasco da Gama Bridge open?", + "expect": "1998", + "relation": "fwd P1619", + "entity": "Q233737" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "In what year did Queen Louise Bridge open?", + "expect": "1907", + "relation": "fwd P1619", + "entity": "Q530858" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "In what year did Yavuz Sultan Selim Bridge open?", + "expect": "2016", + "relation": "fwd P1619", + "entity": "Q7784788" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "In what year did Bridge of the Slovak National Uprising open?", + "expect": "1972", + "relation": "fwd P1619", + "entity": "Q837291" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "In which country is Sanj\u014d \u014chashi Bridge?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q3087620" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "In which country is Yokohama Bay Bridge?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1138655" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "In which country is Confederation Bridge?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q865076" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "In which country is Aioi Bridge?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q23476" + }, + { + "split": "dev", + "kind": "bridges", + "valid": true, + "q": "In which country is Quebec Bridge?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q1427489" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "Which country is Lions Gate Bridge in?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q124352" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "Which country is Kintai Bridge in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1196460" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "Which country is Rainbow Bridge in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1046736" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "Which country is Eshima Ohashi Bridge in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q11550847" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "Which country is Akashi Kaiky\u014d Bridge in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q184213" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "Which country is Kanmon Bridge in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1196470" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "Which country is Tatara Bridge in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1539750" + }, + { + "split": "heldout", + "kind": "bridges", + "valid": true, + "q": "Which country is Capilano Suspension Bridge in?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q862283" + } +] \ No newline at end of file diff --git a/root/specialists/rel-bridges/relspec_scorer.py b/root/specialists/rel-bridges/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-bridges/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-bridges/verdict_dev.json b/root/specialists/rel-bridges/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..4232d4a507959b5b43c2c2fe93f014b83e1b5e5d --- /dev/null +++ b/root/specialists/rel-bridges/verdict_dev.json @@ -0,0 +1,139 @@ +{ + "id": "rel-bridges", + "name": "Oracle7 Relations: Bridges", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:07:28Z", + "domain": { + "head": { + "correct": 6, + "false_yes": 0, + "wrong": 2, + "n": 41, + "p50_ms": 550.27, + "fails": [ + [ + "bridges", + "Which river does Pont Rouelle cross?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "bridges", + "Which river does George Washington Bridge cross?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "bridges", + "Which river does Wandsworth Bridge cross?", + "unverified:factoid:page", + "I found a passage that may be related, but I can't verify it answers your question: \"The f" + ], + [ + "bridges", + "Which river does Bridge of the Americas cross?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "bridges", + "Which river does Brusio spiral viaduct cross?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "bridges", + "Which river does Seven Mile Bridge cross?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "bridges", + "Which river does Admiral's bridge cross?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "bridges", + "Which river does Quebec Bridge cross?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 37, + "false_yes": 0, + "wrong": 0, + "n": 41, + "p50_ms": 4.21, + "fails": [ + [ + "bridges", + "Which river does Bridge of the Americas cross?", + "specialist:rel-bridges>unverified", + "I can't verify the under of Bridge of the Americas from my records, so I won't guess." + ], + [ + "bridges", + "Which river does Roman Bridge cross?", + "specialist:rel-bridges>unverified", + "I can't verify the under of Roman Bridge from my records, so I won't guess." + ], + [ + "bridges", + "Which river does Puente Nuevo cross?", + "specialist:rel-bridges>unverified", + "I can't verify the under of Puente Nuevo from my records, so I won't guess." + ], + [ + "bridges", + "When did Grosvenor Bridge open?", + "specialist:rel-bridges>unverified", + "I can't verify the opening date of Grosvenor Bridge from my records, so I won't guess." + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-bridges/verdict_heldout.json b/root/specialists/rel-bridges/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..462c4464941a8ea070bc981857b4aa850d142913 --- /dev/null +++ b/root/specialists/rel-bridges/verdict_heldout.json @@ -0,0 +1,145 @@ +{ + "id": "rel-bridges", + "name": "Oracle7 Relations: Bridges", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:08:12Z", + "domain": { + "head": { + "correct": 9, + "false_yes": 0, + "wrong": 2, + "n": 44, + "p50_ms": 582.8, + "fails": [ + [ + "bridges", + "What body of water does Lambeth Bridge span?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "bridges", + "What body of water does Stone Bridge span?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "bridges", + "What body of water does Dragon River Bridge span?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "bridges", + "What body of water does 6th October Bridge span?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "bridges", + "What body of water does Galata Bridge span?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "bridges", + "What body of water does Zeeland Bridge span?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "bridges", + "What body of water does Pont des Invalides span?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "bridges", + "What body of water does Adolphe Bridge span?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 39, + "false_yes": 0, + "wrong": 0, + "n": 44, + "p50_ms": 3.88, + "fails": [ + [ + "bridges", + "What body of water does Stone Bridge span?", + "specialist:rel-bridges>unverified", + "I can't verify the under of Stone Bridge from my records, so I won't guess." + ], + [ + "bridges", + "What body of water does Chesapeake Bay Bridge span?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "bridges", + "What body of water does Dragon Bridge span?", + "specialist:rel-bridges>unverified", + "I can't verify the under of Dragon Bridge from my records, so I won't guess." + ], + [ + "bridges", + "Who designed Liberty Bridge?", + "specialist:rel-bridges>unverified", + "I can't verify the architecture firm of Liberty Bridge from my records, so I won't guess." + ], + [ + "bridges", + "Which country is Rainbow Bridge in?", + "specialist:rel-bridges>unverified", + "I can't verify the state of Rainbow Bridge from my records, so I won't guess." + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-castles/manifest.json b/root/specialists/rel-castles/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..9fba19d20c8a23f91b3e6712c43798bfa808959b --- /dev/null +++ b/root/specialists/rel-castles/manifest.json @@ -0,0 +1,71 @@ +{ + "id": "rel-castles", + "name": "Oracle7 Relations: Castles and palaces", + "number": 152, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-castles/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-castles", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "castles", + "kind": "castles" + } + }, + "accept": { + "kinds": [ + "castles" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-castles/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [ + 23413, + 16560 + ], + "occupations": [] + }, + "readers": [ + "17", + "571" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-castles/organ_relation_v2.py b/root/specialists/rel-castles/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-castles/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-castles/readers.json b/root/specialists/rel-castles/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..a966aae3ff6829f397d84839343a0145941e6ab3 --- /dev/null +++ b/root/specialists/rel-castles/readers.json @@ -0,0 +1,7 @@ +{ + "keys": [ + "17", + "571" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-castles/relation_panel_v2.json b/root/specialists/rel-castles/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..982a431825f1eaa8370aa5fb29739c21d395cf8b --- /dev/null +++ b/root/specialists/rel-castles/relation_panel_v2.json @@ -0,0 +1,434 @@ +[ + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "In which country is Nakijin Castle?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q508866" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "In which country is Matsue Castle?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q151776" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "In which country is Osaka Castle?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q321242" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "In which country is Maruoka Castle?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1143892" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "In which country is Okazaki Castle?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1013445" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "In which country is Himeji Castle?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q188754" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "In which country is Hagi Castle?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1064830" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "In which country is Katsuren Castle?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q2471589" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "In which country is Aizuwakamatsu Castle?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1365061" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "In which country is Hikone Castle?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1012374" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "In which country is Kumamoto Castle?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q613355" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "In which country is Hara Castle?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q2498312" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "Which country is Kokura Castle in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q581644" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "Which country is Hiroshima Castle in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q41977" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "Which country is Fushimi Castle in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1196273" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "Which country is Kiyosu Castle in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1357421" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "Which country is Nij\u014d Castle in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1013399" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "Which country is Iwamura Castle in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1196356" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "Which country is Hirosaki Castle in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q328582" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "Which country is Sendai Castle in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q598621" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "Which country is Okayama Castle in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1013448" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "Which country is Tokyo Imperial Palace in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q500681" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "Which country is Kanazawa Castle in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q511412" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "Which country is Inuyama Castle in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1155484" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "When was Castle of Mey founded?", + "expect": "1566", + "relation": "fwd P571", + "entity": "Q1049589" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "When was Swallow's Nest founded?", + "expect": "1912", + "relation": "fwd P571", + "entity": "Q1353643" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "When was Kidwelly Castle founded?", + "expect": "1106", + "relation": "fwd P571", + "entity": "Q1585849" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "When was Shimabara Castle founded?", + "expect": "1618", + "relation": "fwd P571", + "entity": "Q1322463" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "When was Grand Ducal Palace founded?", + "expect": "1574", + "relation": "fwd P571", + "entity": "Q1205254" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "When was Casa de Pilatos founded?", + "expect": "1483", + "relation": "fwd P571", + "entity": "Q1046529" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "When was Huis ten Bosch founded?", + "expect": "2 September 1645", + "relation": "fwd P571", + "entity": "Q1072284" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "When was Castel Sant'Elmo founded?", + "expect": "1537", + "relation": "fwd P571", + "entity": "Q1048627" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "When was Zvolen Castle founded?", + "expect": "1400", + "relation": "fwd P571", + "entity": "Q1315015" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "When was Ch\u00e2teau de Foix founded?", + "expect": "1101", + "relation": "fwd P571", + "entity": "Q1011806" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "When was Deal Castle founded?", + "expect": "1539", + "relation": "fwd P571", + "entity": "Q1180981" + }, + { + "split": "dev", + "kind": "castles", + "valid": true, + "q": "When was Castle of the Moors founded?", + "expect": "700", + "relation": "fwd P571", + "entity": "Q1049008" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "In what year was Ruzhany Palace established?", + "expect": "1786", + "relation": "fwd P571", + "entity": "Q1591054" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "In what year was Euxinograd established?", + "expect": "1885", + "relation": "fwd P571", + "entity": "Q1370513" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "In what year was Royal Palace of La Granja de San Ildefonso established?", + "expect": "1721", + "relation": "fwd P571", + "entity": "Q1540732" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "In what year was Swedish House of Nobility established?", + "expect": "1678", + "relation": "fwd P571", + "entity": "Q1547268" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "In what year was \u0160pilberk Castle established?", + "expect": "1300", + "relation": "fwd P571", + "entity": "Q118256" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "In what year was Osu Castle established?", + "expect": "1659", + "relation": "fwd P571", + "entity": "Q1082964" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "In what year was Dunvegan Castle established?", + "expect": "1220", + "relation": "fwd P571", + "entity": "Q1266330" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "In what year was Louvre Palace established?", + "expect": "1190", + "relation": "fwd P571", + "entity": "Q1075988" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "In what year was Castello Ursino established?", + "expect": "1239", + "relation": "fwd P571", + "entity": "Q1048850" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "In what year was Ch\u00e2teau de Monts\u00e9gur established?", + "expect": "1204", + "relation": "fwd P571", + "entity": "Q1013191" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "In what year was Imabari Castle established?", + "expect": "1602", + "relation": "fwd P571", + "entity": "Q1071856" + }, + { + "split": "heldout", + "kind": "castles", + "valid": true, + "q": "In what year was Montr\u00e9al Castle established?", + "expect": "1115", + "relation": "fwd P571", + "entity": "Q1362749" + } +] \ No newline at end of file diff --git a/root/specialists/rel-castles/relspec_scorer.py b/root/specialists/rel-castles/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-castles/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-castles/verdict_dev.json b/root/specialists/rel-castles/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..77e5701e7b6b3fb4e89ed99297b3bcc4754c5168 --- /dev/null +++ b/root/specialists/rel-castles/verdict_dev.json @@ -0,0 +1,114 @@ +{ + "id": "rel-castles", + "name": "Oracle7 Relations: Castles and palaces", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:09:00Z", + "domain": { + "head": { + "correct": 9, + "false_yes": 0, + "wrong": 0, + "n": 24, + "p50_ms": 493.46, + "fails": [ + [ + "castles", + "In which country is Nakijin Castle?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "castles", + "In which country is Okazaki Castle?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "castles", + "In which country is Hagi Castle?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "castles", + "In which country is Katsuren Castle?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "castles", + "In which country is Hikone Castle?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "castles", + "In which country is Kumamoto Castle?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "castles", + "When was Castle of Mey founded?", + "precision_guard:R13_year_from_list_line|", + "I can't verify an answer to that exact question, so I won't guess." + ], + [ + "castles", + "When was Shimabara Castle founded?", + "capability:when_did|vessel:reinforced", + "The admitted record for Shimabara Castle contains no dated statement about when it found. " + ] + ] + }, + "spec": { + "correct": 24, + "false_yes": 0, + "wrong": 0, + "n": 24, + "p50_ms": 4.19, + "fails": [] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-castles/verdict_heldout.json b/root/specialists/rel-castles/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..7750f2d4c004d0cd3f76542f46bb2934b0442434 --- /dev/null +++ b/root/specialists/rel-castles/verdict_heldout.json @@ -0,0 +1,114 @@ +{ + "id": "rel-castles", + "name": "Oracle7 Relations: Castles and palaces", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:09:22Z", + "domain": { + "head": { + "correct": 7, + "false_yes": 0, + "wrong": 1, + "n": 24, + "p50_ms": 514.45, + "fails": [ + [ + "castles", + "Which country is Kokura Castle in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "castles", + "Which country is Fushimi Castle in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "castles", + "Which country is Kiyosu Castle in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "castles", + "Which country is Nij\u014d Castle in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "castles", + "Which country is Kanazawa Castle in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "castles", + "Which country is Inuyama Castle in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "castles", + "In what year was Ruzhany Palace established?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "castles", + "In what year was Euxinograd established?", + "verified:cube>YEAR|factoid:page", + "1891. The palace's winery was established in 1891 to meet the requirements of the Bulgaria" + ] + ] + }, + "spec": { + "correct": 24, + "false_yes": 0, + "wrong": 0, + "n": 24, + "p50_ms": 3.88, + "fails": [] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-characters/manifest.json b/root/specialists/rel-characters/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..f4849c566c99bc95cc0fc7e9e70149aa74c0ead0 --- /dev/null +++ b/root/specialists/rel-characters/manifest.json @@ -0,0 +1,74 @@ +{ + "id": "rel-characters", + "name": "Oracle7 Relations: Fictional characters", + "number": 135, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-characters/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-characters", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "characters", + "kind": "characters" + } + }, + "accept": { + "kinds": [ + "characters" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-characters/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [ + 95074, + 15632617, + 15711870, + 15773317, + 1114461 + ], + "occupations": [] + }, + "readers": [ + "170", + "1080" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-characters/organ_relation_v2.py b/root/specialists/rel-characters/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-characters/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-characters/readers.json b/root/specialists/rel-characters/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..b93a4b77ee5cb2a8f1457d7f88bff5fafe13891e --- /dev/null +++ b/root/specialists/rel-characters/readers.json @@ -0,0 +1,7 @@ +{ + "keys": [ + "170", + "1080" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-characters/relation_panel_v2.json b/root/specialists/rel-characters/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..871295e90b6f50178fc5e6dd5980c88d41c6bbfb --- /dev/null +++ b/root/specialists/rel-characters/relation_panel_v2.json @@ -0,0 +1,434 @@ +[ + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Who created Venom?", + "expect": "David Michelinie", + "relation": "fwd P170", + "entity": "Q1621261" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Who created Filius Flitwick?", + "expect": "J. K. Rowling", + "relation": "fwd P170", + "entity": "Q1256952" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Who created Beta Ray Bill?", + "expect": "Walt Simonson", + "relation": "fwd P170", + "entity": "Q1987662" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Who created Ars\u00e8ne Lupin?", + "expect": "Maurice Leblanc", + "relation": "fwd P170", + "entity": "Q461606" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Who created Justin Finch-Fletchley?", + "expect": "J. K. Rowling", + "relation": "fwd P170", + "entity": "Q5956830" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Who created Amycus Carrow?", + "expect": "J. K. Rowling", + "relation": "fwd P170", + "entity": "Q2292217" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Who created Christine Chapel?", + "expect": "Gene Roddenberry", + "relation": "fwd P170", + "entity": "Q2737692" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Who created Sidney Prescott?", + "expect": "Kevin Williamson", + "relation": "fwd P170", + "entity": "Q303741" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Who created Lucius Malfoy?", + "expect": "J. K. Rowling", + "relation": "fwd P170", + "entity": "Q842178" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Who created Tifa Lockhart?", + "expect": "Tetsuya Nomura", + "relation": "fwd P170", + "entity": "Q1199059" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Who created William Riker?", + "expect": "Gene Roddenberry", + "relation": "fwd P170", + "entity": "Q752877" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Who created Eric Foreman?", + "expect": "David Shore", + "relation": "fwd P170", + "entity": "Q1058591" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Who is the creator of Nemesis?", + "expect": "Shinji Mikami", + "relation": "fwd P170", + "entity": "Q2320050" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Who is the creator of Willow Rosenberg?", + "expect": "Joss Whedon", + "relation": "fwd P170", + "entity": "Q1042244" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Who is the creator of Cormac McLaggen?", + "expect": "J. K. Rowling", + "relation": "fwd P170", + "entity": "Q3221658" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Who is the creator of Jessica Rabbit?", + "expect": "Gary K. Wolf", + "relation": "fwd P170", + "entity": "Q1631670" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Who is the creator of Rose Granger-Weasley?", + "expect": "J. K. Rowling", + "relation": "fwd P170", + "entity": "Q3744404" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Who is the creator of Krillin?", + "expect": "Akira Toriyama", + "relation": "fwd P170", + "entity": "Q757141" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Who is the creator of Scorpius Malfoy?", + "expect": "J. K. Rowling", + "relation": "fwd P170", + "entity": "Q2838011" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Who is the creator of \u00c9ponine?", + "expect": "Victor Hugo", + "relation": "fwd P170", + "entity": "Q2748568" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Who is the creator of Romilda Vane?", + "expect": "J. K. Rowling", + "relation": "fwd P170", + "entity": "Q1560696" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Who is the creator of Disco Stu?", + "expect": "Matt Groening", + "relation": "fwd P170", + "entity": "Q2294047" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Who is the creator of Din Djarin?", + "expect": "Jon Favreau", + "relation": "fwd P170", + "entity": "Q79325377" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Who is the creator of Happy Hogan?", + "expect": "Stan Lee", + "relation": "fwd P170", + "entity": "Q1319498" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Which universe is Bender from?", + "expect": "Futuramaverse", + "relation": "fwd P1080", + "entity": "Q750023" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Which universe is Optimus Prime from?", + "expect": "Transformers multiverse", + "relation": "fwd P1080", + "entity": "Q151583" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Which universe is Mr. Garrison from?", + "expect": "South Park universe", + "relation": "fwd P1080", + "entity": "Q47622" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Which universe is Max Goof from?", + "expect": "Mickey Mouse universe", + "relation": "fwd P1080", + "entity": "Q1141437" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Which universe is Charlie Weasley from?", + "expect": "Harry Potter universe", + "relation": "fwd P1080", + "entity": "Q3430858" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Which universe is Miles \"Tails\" Prower from?", + "expect": "Sonic the Hedgehog universe", + "relation": "fwd P1080", + "entity": "Q194135" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Which universe is Ariana Dumbledore from?", + "expect": "Harry Potter universe", + "relation": "fwd P1080", + "entity": "Q1875912" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Which universe is Dobby from?", + "expect": "Harry Potter universe", + "relation": "fwd P1080", + "entity": "Q1254953" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Which universe is Ezri Dax from?", + "expect": "Star Trek universe", + "relation": "fwd P1080", + "entity": "Q2171485" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Which universe is Clara Oswald from?", + "expect": "Whoniverse", + "relation": "fwd P1080", + "entity": "Q1765307" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Which universe is General Grievous from?", + "expect": "Star Wars universe", + "relation": "fwd P1080", + "entity": "Q51792" + }, + { + "split": "dev", + "kind": "characters", + "valid": true, + "q": "Which universe is Scooby-Doo from?", + "expect": "Scooby Doo universe", + "relation": "fwd P1080", + "entity": "Q901323" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Which franchise is Perry White from?", + "expect": "DC Universe", + "relation": "fwd P1080", + "entity": "Q2342943" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Which franchise is Nymphadora Tonks from?", + "expect": "Harry Potter universe", + "relation": "fwd P1080", + "entity": "Q715312" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Which franchise is Bors from?", + "expect": "Arthurian universe", + "relation": "fwd P1080", + "entity": "Q894176" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Which franchise is Hela from?", + "expect": "Earth-616", + "relation": "fwd P1080", + "entity": "Q3043221" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Which franchise is Iceman from?", + "expect": "Earth-616", + "relation": "fwd P1080", + "entity": "Q838088" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Which franchise is Brainiac from?", + "expect": "DC Universe", + "relation": "fwd P1080", + "entity": "Q592909" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Which franchise is Bard the Bowman from?", + "expect": "Tolkien's legendarium", + "relation": "fwd P1080", + "entity": "Q2470173" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Which franchise is Drizzt Do'Urden from?", + "expect": "Forgotten Realms", + "relation": "fwd P1080", + "entity": "Q114455" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Which franchise is Phil Coulson from?", + "expect": "Marvel Cinematic Universe", + "relation": "fwd P1080", + "entity": "Q1369292" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Which franchise is Echo from?", + "expect": "Earth-616", + "relation": "fwd P1080", + "entity": "Q2519959" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Which franchise is Nute Gunray from?", + "expect": "Star Wars universe", + "relation": "fwd P1080", + "entity": "Q51791" + }, + { + "split": "heldout", + "kind": "characters", + "valid": true, + "q": "Which franchise is Duncan Idaho from?", + "expect": "Dune universe", + "relation": "fwd P1080", + "entity": "Q911563" + } +] \ No newline at end of file diff --git a/root/specialists/rel-characters/relspec_scorer.py b/root/specialists/rel-characters/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-characters/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-characters/verdict_dev.json b/root/specialists/rel-characters/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..03a566b00ce141323da78974d9785d4cba5c41f9 --- /dev/null +++ b/root/specialists/rel-characters/verdict_dev.json @@ -0,0 +1,121 @@ +{ + "id": "rel-characters", + "name": "Oracle7 Relations: Fictional characters", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w525", + "time": "2026-10-08T23:56:49Z", + "domain": { + "head": { + "correct": 1, + "false_yes": 0, + "wrong": 0, + "n": 24, + "p50_ms": 519.19, + "fails": [ + [ + "characters", + "Who created Venom?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "characters", + "Who created Filius Flitwick?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "characters", + "Who created Beta Ray Bill?", + "unverified:compose:bridge", + "I found a passage that may be related, but I can't verify it answers your question: \"Novem" + ], + [ + "characters", + "Who created Justin Finch-Fletchley?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "characters", + "Who created Amycus Carrow?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "characters", + "Who created Christine Chapel?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "characters", + "Who created Sidney Prescott?", + "precision_guard:G3_evidence_misses_quest", + "I can't verify an answer to that exact question, so I won't guess." + ], + [ + "characters", + "Who created Lucius Malfoy?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 23, + "false_yes": 0, + "wrong": 0, + "n": 24, + "p50_ms": 6.22, + "fails": [ + [ + "characters", + "Which universe is Scooby-Doo from?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 14 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-characters/verdict_heldout.json b/root/specialists/rel-characters/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..c0a2955c9fe48e343631ff8be1b8d6144033373c --- /dev/null +++ b/root/specialists/rel-characters/verdict_heldout.json @@ -0,0 +1,145 @@ +{ + "id": "rel-characters", + "name": "Oracle7 Relations: Fictional characters", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:03:16Z", + "domain": { + "head": { + "correct": 1, + "false_yes": 0, + "wrong": 1, + "n": 24, + "p50_ms": 536.27, + "fails": [ + [ + "characters", + "Who is the creator of Nemesis?", + "unverified:factoid:fts", + "I found a passage that may be related, but I can't verify it answers your question: \"Milla" + ], + [ + "characters", + "Who is the creator of Willow Rosenberg?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "characters", + "Who is the creator of Cormac McLaggen?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "characters", + "Who is the creator of Jessica Rabbit?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "characters", + "Who is the creator of Rose Granger-Weasley?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "characters", + "Who is the creator of Krillin?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "characters", + "Who is the creator of Scorpius Malfoy?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "characters", + "Who is the creator of \u00c9ponine?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 19, + "false_yes": 0, + "wrong": 0, + "n": 24, + "p50_ms": 10.6, + "fails": [ + [ + "characters", + "Who is the creator of Nemesis?", + "unverified:factoid:fts", + "I found a passage that may be related, but I can't verify it answers your question: \"Milla" + ], + [ + "characters", + "Which franchise is Bors from?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "characters", + "Which franchise is Hela from?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "characters", + "Which franchise is Iceman from?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "characters", + "Which franchise is Echo from?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-chefs/manifest.json b/root/specialists/rel-chefs/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..ec5303eb834ca269c8dae7dbaf793b544580ff0d --- /dev/null +++ b/root/specialists/rel-chefs/manifest.json @@ -0,0 +1,76 @@ +{ + "id": "rel-chefs", + "name": "Oracle7 Relations: Chefs", + "number": 208, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-chefs/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-chefs", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "chefs", + "kind": "chefs" + } + }, + "accept": { + "kinds": [ + "chefs" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-chefs/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [], + "occupations": [ + 3499072 + ] + }, + "readers": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-chefs/organ_relation_v2.py b/root/specialists/rel-chefs/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-chefs/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-chefs/readers.json b/root/specialists/rel-chefs/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..c13089e7f6ebfd5218117298dde068a3062d6c8b --- /dev/null +++ b/root/specialists/rel-chefs/readers.json @@ -0,0 +1,13 @@ +{ + "keys": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-chefs/relation_panel_v2.json b/root/specialists/rel-chefs/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..b31cad9416941cd0ba5e5d98cba8a7ab430be66f --- /dev/null +++ b/root/specialists/rel-chefs/relation_panel_v2.json @@ -0,0 +1,299 @@ +[ + { + "split": "dev", + "kind": "chefs", + "valid": true, + "q": "Where was Kelis born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q294979" + }, + { + "split": "dev", + "kind": "chefs", + "valid": true, + "q": "Where was Heston Blumenthal born?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q1616078" + }, + { + "split": "dev", + "kind": "chefs", + "valid": true, + "q": "Where was Fannie Farmer born?", + "expect": "Boston", + "relation": "fwd P19", + "entity": "Q547167" + }, + { + "split": "dev", + "kind": "chefs", + "valid": true, + "q": "Where was Ayesha Curry born?", + "expect": "Toronto", + "relation": "fwd P19", + "entity": "Q24207190" + }, + { + "split": "heldout", + "kind": "chefs", + "valid": true, + "q": "What is the birthplace of Marie-Antoine Car\u00eame?", + "expect": "Paris", + "relation": "fwd P19", + "entity": "Q355751" + }, + { + "split": "dev", + "kind": "chefs", + "valid": true, + "q": "Where did Fannie Farmer die?", + "expect": "Boston", + "relation": "fwd P20", + "entity": "Q547167" + }, + { + "split": "dev", + "kind": "chefs", + "valid": true, + "q": "Where did Albert Roux die?", + "expect": "London", + "relation": "fwd P20", + "entity": "Q2895081" + }, + { + "split": "dev", + "kind": "chefs", + "valid": true, + "q": "Where did Richard Deacon die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q1289785" + }, + { + "split": "dev", + "kind": "chefs", + "valid": true, + "q": "Where did Jo\u00ebl Robuchon die?", + "expect": "Geneva", + "relation": "fwd P20", + "entity": "Q1367752" + }, + { + "split": "dev", + "kind": "chefs", + "valid": true, + "q": "Where did Danny Kaye die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q213425" + }, + { + "split": "heldout", + "kind": "chefs", + "valid": true, + "q": "In which city did Bartolomeo Scappi die?", + "expect": "Rome", + "relation": "fwd P20", + "entity": "Q683189" + }, + { + "split": "heldout", + "kind": "chefs", + "valid": true, + "q": "In which city did James Beard die?", + "expect": "New York City", + "relation": "fwd P20", + "entity": "Q1399476" + }, + { + "split": "heldout", + "kind": "chefs", + "valid": true, + "q": "In which city did Elizabeth David die?", + "expect": "London", + "relation": "fwd P20", + "entity": "Q4944293" + }, + { + "split": "dev", + "kind": "chefs", + "valid": true, + "q": "When did Richard Deacon die?", + "expect": "8 August 1984", + "relation": "fwd P570", + "entity": "Q1289785" + }, + { + "split": "dev", + "kind": "chefs", + "valid": true, + "q": "When did Fran\u00e7ois Pierre La Varenne die?", + "expect": "1678", + "relation": "fwd P570", + "entity": "Q127085" + }, + { + "split": "dev", + "kind": "chefs", + "valid": true, + "q": "When did Robert Berdella die?", + "expect": "8 October 1992", + "relation": "fwd P570", + "entity": "Q1329737" + }, + { + "split": "heldout", + "kind": "chefs", + "valid": true, + "q": "In what year did David Emge die?", + "expect": "2024", + "relation": "fwd P570", + "entity": "Q1174345" + }, + { + "split": "dev", + "kind": "chefs", + "valid": true, + "q": "Who was Danny Kaye married to?", + "expect": "Sylvia Fine", + "relation": "fwd P26", + "entity": "Q213425" + }, + { + "split": "dev", + "kind": "chefs", + "valid": true, + "q": "Who was Kelis married to?", + "expect": "Nas", + "relation": "fwd P26", + "entity": "Q294979" + }, + { + "split": "dev", + "kind": "chefs", + "valid": true, + "q": "Who was Seth Rollins married to?", + "expect": "Becky Lynch", + "relation": "fwd P26", + "entity": "Q715014" + }, + { + "split": "dev", + "kind": "chefs", + "valid": true, + "q": "Who was Ayesha Curry married to?", + "expect": "Stephen Curry", + "relation": "fwd P26", + "entity": "Q24207190" + }, + { + "split": "dev", + "kind": "chefs", + "valid": true, + "q": "Who was David Burtka married to?", + "expect": "Neil Patrick Harris", + "relation": "fwd P26", + "entity": "Q984397" + }, + { + "split": "dev", + "kind": "chefs", + "valid": true, + "q": "Who was Dominique Crenn married to?", + "expect": "Maria Bello", + "relation": "fwd P26", + "entity": "Q27959694" + }, + { + "split": "heldout", + "kind": "chefs", + "valid": true, + "q": "Who is the spouse of Judy Ann Santos?", + "expect": "Ryan Agoncillo", + "relation": "fwd P26", + "entity": "Q1928501" + }, + { + "split": "heldout", + "kind": "chefs", + "valid": true, + "q": "Who is the spouse of Bernard Loiseau?", + "expect": "Dominique Loiseau", + "relation": "fwd P26", + "entity": "Q822576" + }, + { + "split": "heldout", + "kind": "chefs", + "valid": true, + "q": "Who is the spouse of Nicholas Tse?", + "expect": "Cecilia Cheung", + "relation": "fwd P26", + "entity": "Q380579" + }, + { + "split": "heldout", + "kind": "chefs", + "valid": true, + "q": "Who is the spouse of Tamra Davis?", + "expect": "Mike D", + "relation": "fwd P26", + "entity": "Q2624537" + }, + { + "split": "heldout", + "kind": "chefs", + "valid": true, + "q": "Who is the spouse of Anne-Sophie Pic?", + "expect": "David Sinapian", + "relation": "fwd P26", + "entity": "Q446097" + }, + { + "split": "heldout", + "kind": "chefs", + "valid": true, + "q": "Who was the father of Nicholas Tse?", + "expect": "Patrick Tse", + "relation": "fwd P22", + "entity": "Q380579" + }, + { + "split": "heldout", + "kind": "chefs", + "valid": true, + "q": "Who was the father of Elizabeth David?", + "expect": "Rupert Gwynne", + "relation": "fwd P22", + "entity": "Q4944293" + }, + { + "split": "heldout", + "kind": "chefs", + "valid": true, + "q": "Who was the father of Anne-Sophie Pic?", + "expect": "Jacques Pic", + "relation": "fwd P22", + "entity": "Q446097" + }, + { + "split": "heldout", + "kind": "chefs", + "valid": true, + "q": "Who was the mother of Nicholas Tse?", + "expect": "Deborah Lee", + "relation": "fwd P25", + "entity": "Q380579" + }, + { + "split": "heldout", + "kind": "chefs", + "valid": true, + "q": "Who was the mother of Elizabeth David?", + "expect": "Stella Ridley", + "relation": "fwd P25", + "entity": "Q4944293" + } +] \ No newline at end of file diff --git a/root/specialists/rel-chefs/relspec_scorer.py b/root/specialists/rel-chefs/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-chefs/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-chefs/verdict_dev.json b/root/specialists/rel-chefs/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..edc7a36dfc2389368edae943296ac1c034eecf5a --- /dev/null +++ b/root/specialists/rel-chefs/verdict_dev.json @@ -0,0 +1,114 @@ +{ + "id": "rel-chefs", + "name": "Oracle7 Relations: Chefs", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:32:33Z", + "domain": { + "head": { + "correct": 9, + "false_yes": 0, + "wrong": 5, + "n": 18, + "p50_ms": 442.68, + "fails": [ + [ + "chefs", + "Where was Kelis born?", + "deliberation:where", + "[ev:direct] Kelis current age is 46 Kelis was born and raised in Harlem, Manhattan. [simpl" + ], + [ + "chefs", + "Where was Heston Blumenthal born?", + "deliberation:where", + "[ev:direct] His restaurants include the Fat Duck in Bray, Berkshire, a three-Michelin-star" + ], + [ + "chefs", + "Where was Ayesha Curry born?", + "deliberation:where", + "[ev:direct] In 2014, she founded Little Lights of Mine, a company selling extra virgin oli" + ], + [ + "chefs", + "Where did Albert Roux die?", + "deliberation:where", + "[ev:direct] He and his brother Michel ran Le Gavroche, the first restaurant in the UK to g" + ], + [ + "chefs", + "Where did Richard Deacon die?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "chefs", + "When did Richard Deacon die?", + "capability:when_did|vessel:reinforced", + "The admitted record for Richard Deacon contains no dated statement about when it die. It m" + ], + [ + "chefs", + "When did Fran\u00e7ois Pierre La Varenne die?", + "capability:when_did|vessel:reinforced", + "The admitted record for Fran\u00e7ois Pierre La Varenne contains no dated statement about when " + ], + [ + "chefs", + "When did Robert Berdella die?", + "verified:weak>YEAR|factoid:page", + "1949. [ev:direct] Robert Berdella was born on January 31, 1949, in Cuyahoga Falls, Ohio, t" + ] + ] + }, + "spec": { + "correct": 18, + "false_yes": 0, + "wrong": 0, + "n": 18, + "p50_ms": 4.17, + "fails": [] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-chefs/verdict_heldout.json b/root/specialists/rel-chefs/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..cc5ba1031827261634af3f12907e3308ae82b0a6 --- /dev/null +++ b/root/specialists/rel-chefs/verdict_heldout.json @@ -0,0 +1,114 @@ +{ + "id": "rel-chefs", + "name": "Oracle7 Relations: Chefs", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:32:47Z", + "domain": { + "head": { + "correct": 6, + "false_yes": 0, + "wrong": 0, + "n": 15, + "p50_ms": 529.95, + "fails": [ + [ + "chefs", + "What is the birthplace of Marie-Antoine Car\u00eame?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "chefs", + "In which city did Bartolomeo Scappi die?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "chefs", + "In which city did James Beard die?", + "unverified:compose:bridge", + "I found a passage that may be related, but I can't verify it answers your question: \"Nativ" + ], + [ + "chefs", + "In which city did Elizabeth David die?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "chefs", + "Who is the spouse of Judy Ann Santos?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "chefs", + "Who is the spouse of Bernard Loiseau?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "chefs", + "Who is the spouse of Anne-Sophie Pic?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "chefs", + "Who was the mother of Nicholas Tse?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 15, + "false_yes": 0, + "wrong": 0, + "n": 15, + "p50_ms": 5.4, + "fails": [] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-engineers/manifest.json b/root/specialists/rel-engineers/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..84fab0238a940bceaa2b79496ae0db41f77c6648 --- /dev/null +++ b/root/specialists/rel-engineers/manifest.json @@ -0,0 +1,77 @@ +{ + "id": "rel-engineers", + "name": "Oracle7 Relations: Engineers and inventors", + "number": 222, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-engineers/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-engineers", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "engineers", + "kind": "engineers" + } + }, + "accept": { + "kinds": [ + "engineers" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-engineers/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [], + "occupations": [ + 81096, + 205375 + ] + }, + "readers": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-engineers/organ_relation_v2.py b/root/specialists/rel-engineers/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-engineers/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-engineers/readers.json b/root/specialists/rel-engineers/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..c13089e7f6ebfd5218117298dde068a3062d6c8b --- /dev/null +++ b/root/specialists/rel-engineers/readers.json @@ -0,0 +1,13 @@ +{ + "keys": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-engineers/relation_panel_v2.json b/root/specialists/rel-engineers/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..e0c55ec3354812ad6e2a5287c5127f9c3433db1e --- /dev/null +++ b/root/specialists/rel-engineers/relation_panel_v2.json @@ -0,0 +1,1730 @@ +[ + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where was Max de Terra born?", + "expect": "Zurich", + "relation": "fwd P19", + "entity": "Q115677" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where was Geir Ivars\u00f8y born?", + "expect": "Norway", + "relation": "fwd P19", + "entity": "Q382148" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where was James Glaisher born?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q1229851" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where was Jos\u00e9 Serra born?", + "expect": "S\u00e3o Paulo", + "relation": "fwd P19", + "entity": "Q379563" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where was Jean-Michel Sama Lukonde Kyenge born?", + "expect": "Paris", + "relation": "fwd P19", + "entity": "Q105523479" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where was Teoberto Maler born?", + "expect": "Rome", + "relation": "fwd P19", + "entity": "Q67064" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where was John Barnard born?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q173549" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where was Louis Carrogis Carmontelle born?", + "expect": "Paris", + "relation": "fwd P19", + "entity": "Q982053" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where was Coraline Ada Ehmke born?", + "expect": "United States", + "relation": "fwd P19", + "entity": "Q24192535" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where was Loren Bouchard born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q356375" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where was Rob Pike born?", + "expect": "Canada", + "relation": "fwd P19", + "entity": "Q517764" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where was Bob Kahn born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q62843" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "What is the birthplace of Ellen Ochoa?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q49269" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "What is the birthplace of Chris Metzen?", + "expect": "United States", + "relation": "fwd P19", + "entity": "Q1077554" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "What is the birthplace of Otis Barton?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q540947" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "What is the birthplace of Paul Winchell?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q731316" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "What is the birthplace of Curt von Bardeleben?", + "expect": "Berlin", + "relation": "fwd P19", + "entity": "Q60779" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "What is the birthplace of Lisa Nowak?", + "expect": "Washington, D.C.", + "relation": "fwd P19", + "entity": "Q49264" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "What is the birthplace of Arthur Owen?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q173562" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "What is the birthplace of Gordon Moore?", + "expect": "San Francisco", + "relation": "fwd P19", + "entity": "Q243969" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "What is the birthplace of Hippolyte Fizeau?", + "expect": "Paris", + "relation": "fwd P19", + "entity": "Q216814" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "What is the birthplace of Erik M\u00f6ller?", + "expect": "Germany", + "relation": "fwd P19", + "entity": "Q577729" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "What is the birthplace of Cyril Abiteboul?", + "expect": "Paris", + "relation": "fwd P19", + "entity": "Q4054762" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "What is the birthplace of Steve Coast?", + "expect": "United Kingdom", + "relation": "fwd P19", + "entity": "Q56200" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where did Tony Shelly die?", + "expect": "New Zealand", + "relation": "fwd P20", + "entity": "Q173592" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where did Joseph Henry die?", + "expect": "Washington, D.C.", + "relation": "fwd P20", + "entity": "Q157043" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where did Stephen Schneider die?", + "expect": "London", + "relation": "fwd P20", + "entity": "Q982493" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where did Guy Tunmer die?", + "expect": "South Africa", + "relation": "fwd P20", + "entity": "Q172307" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where did Grigory Romanov die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q68463" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where did Florestano Di Fausto die?", + "expect": "Rome", + "relation": "fwd P20", + "entity": "Q472250" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where did Gunnar Nilsson die?", + "expect": "London", + "relation": "fwd P20", + "entity": "Q171445" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where did Bernard Forest de B\u00e9lidor die?", + "expect": "Paris", + "relation": "fwd P20", + "entity": "Q767329" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where did Ibn al-Haytham die?", + "expect": "Cairo", + "relation": "fwd P20", + "entity": "Q11104" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where did Jean Le Rond d'Alembert die?", + "expect": "Paris", + "relation": "fwd P20", + "entity": "Q153232" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where did Constantin-Fran\u00e7ois Chasseb\u0153uf die?", + "expect": "Paris", + "relation": "fwd P20", + "entity": "Q466093" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Where did Henri-Louis Duhamel du Monceau die?", + "expect": "Paris", + "relation": "fwd P20", + "entity": "Q525949" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In which city did Dmitry Dmitrievich Maksutov die?", + "expect": "Saint Petersburg", + "relation": "fwd P20", + "entity": "Q1232475" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In which city did Felix Hoffmann die?", + "expect": "Lausanne", + "relation": "fwd P20", + "entity": "Q61232" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In which city did Maurice Wilkes die?", + "expect": "Cambridge", + "relation": "fwd P20", + "entity": "Q62857" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In which city did \u00c9lie Metchnikoff die?", + "expect": "Paris", + "relation": "fwd P20", + "entity": "Q172254" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In which city did William Kent die?", + "expect": "London", + "relation": "fwd P20", + "entity": "Q445433" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In which city did Arthur Young die?", + "expect": "London", + "relation": "fwd P20", + "entity": "Q561670" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In which city did Apollodorus of Damascus die?", + "expect": "Rome", + "relation": "fwd P20", + "entity": "Q189375" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In which city did Ascanio Sobrero die?", + "expect": "Turin", + "relation": "fwd P20", + "entity": "Q351377" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In which city did Tony Hoare die?", + "expect": "Cambridge", + "relation": "fwd P20", + "entity": "Q92602" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In which city did Patricia Bath die?", + "expect": "San Francisco", + "relation": "fwd P20", + "entity": "Q7145460" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In which city did Carl Wilhelm Siemens die?", + "expect": "London", + "relation": "fwd P20", + "entity": "Q62377" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In which city did Nicolas Louis Fran\u00e7ois de Neufch\u00e2teau die?", + "expect": "Paris", + "relation": "fwd P20", + "entity": "Q1397972" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When was Alan MacDiarmid born?", + "expect": "14 April 1927", + "relation": "fwd P569", + "entity": "Q110942" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When was Kevin Systrom born?", + "expect": "30 December 1983", + "relation": "fwd P569", + "entity": "Q10314243" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When was Harry K\u00e4llstr\u00f6m born?", + "expect": "30 June 1939", + "relation": "fwd P569", + "entity": "Q1034133" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When was Jacobus Henricus van 't Hoff born?", + "expect": "30 August 1852", + "relation": "fwd P569", + "entity": "Q102822" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When was Vilfredo Pareto born?", + "expect": "15 July 1848", + "relation": "fwd P569", + "entity": "Q11031" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When was Alan J. Heeger born?", + "expect": "22 January 1936", + "relation": "fwd P569", + "entity": "Q106751" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When was Charles Francis Jenkins born?", + "expect": "22 August 1867", + "relation": "fwd P569", + "entity": "Q1064424" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When was Baruch Samuel Blumberg born?", + "expect": "28 July 1925", + "relation": "fwd P569", + "entity": "Q105830" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When was Robert Moses born?", + "expect": "18 December 1888", + "relation": "fwd P569", + "entity": "Q1111386" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When was Koichi Tanaka born?", + "expect": "3 August 1959", + "relation": "fwd P569", + "entity": "Q110963" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When was Caspar David Friedrich born?", + "expect": "5 September 1774", + "relation": "fwd P569", + "entity": "Q104884" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When was Hannah Schmitz born?", + "expect": "1 May 1985", + "relation": "fwd P569", + "entity": "Q111576763" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year was Gus Grissom born?", + "expect": "1926", + "relation": "fwd P569", + "entity": "Q110879" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year was Luciano De Crescenzo born?", + "expect": "1928", + "relation": "fwd P569", + "entity": "Q1006152" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year was Ken Thompson born?", + "expect": "1943", + "relation": "fwd P569", + "entity": "Q1107006" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year was Charles Joseph Minard born?", + "expect": "1781", + "relation": "fwd P569", + "entity": "Q1065131" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year was Sarra Zaafrani born?", + "expect": "1963", + "relation": "fwd P569", + "entity": "Q108892374" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year was Alexander Rosenberg born?", + "expect": "1967", + "relation": "fwd P569", + "entity": "Q110644463" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year was Carl Akeley born?", + "expect": "1864", + "relation": "fwd P569", + "entity": "Q1037711" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year was Michel Houellebecq born?", + "expect": "1956", + "relation": "fwd P569", + "entity": "Q103114" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year was Butades born?", + "expect": "700 BC", + "relation": "fwd P569", + "entity": "Q1017839" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year was Charles Francis Brush born?", + "expect": "1849", + "relation": "fwd P569", + "entity": "Q1064423" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year was Mohamed Atta born?", + "expect": "1968", + "relation": "fwd P569", + "entity": "Q110067" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year was Hans Ledwinka born?", + "expect": "1878", + "relation": "fwd P569", + "entity": "Q111964" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When did Jim Marshall die?", + "expect": "5 April 2012", + "relation": "fwd P570", + "entity": "Q121668" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When did Annie Easley die?", + "expect": "25 June 2011", + "relation": "fwd P570", + "entity": "Q11586" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When did Ibn Wahshiyya die?", + "expect": "930", + "relation": "fwd P570", + "entity": "Q1246493" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When did Simon van der Meer die?", + "expect": "4 March 2011", + "relation": "fwd P570", + "entity": "Q104779" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When did Nitobe Inaz\u014d die?", + "expect": "15 October 1933", + "relation": "fwd P570", + "entity": "Q12696" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When did Laurens Hammond die?", + "expect": "3 July 1973", + "relation": "fwd P570", + "entity": "Q123678" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When did Mikhail Simonov die?", + "expect": "4 March 2011", + "relation": "fwd P570", + "entity": "Q1073792" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When did Claude Antoine, comte Prieur-Duvernois die?", + "expect": "11 August 1832", + "relation": "fwd P570", + "entity": "Q1096321" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When did William Giauque die?", + "expect": "28 March 1982", + "relation": "fwd P570", + "entity": "Q110073" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When did Raymond Scott die?", + "expect": "8 February 1994", + "relation": "fwd P570", + "entity": "Q1334617" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When did Jacobus Henricus van 't Hoff die?", + "expect": "1 March 1911", + "relation": "fwd P570", + "entity": "Q102822" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "When did Julian Fa\u0142at die?", + "expect": "9 July 1929", + "relation": "fwd P570", + "entity": "Q1349858" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year did Vince Zampella die?", + "expect": "2025", + "relation": "fwd P570", + "entity": "Q113996148" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year did David Vinckboons die?", + "expect": "1629", + "relation": "fwd P570", + "entity": "Q1176989" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year did Kathleen Booth die?", + "expect": "2022", + "relation": "fwd P570", + "entity": "Q11481" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year did Imhotep die?", + "expect": "2700 BC", + "relation": "fwd P570", + "entity": "Q131171" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year did Hermann Neubacher die?", + "expect": "1960", + "relation": "fwd P570", + "entity": "Q112462" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year did Gus Grissom die?", + "expect": "1967", + "relation": "fwd P570", + "entity": "Q110879" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year did Ferdinand Mannlicher die?", + "expect": "1904", + "relation": "fwd P570", + "entity": "Q113057" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year did Sergei Gavrilovich Simonov die?", + "expect": "1986", + "relation": "fwd P570", + "entity": "Q1333962" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year did Fleeming Jenkin die?", + "expect": "1885", + "relation": "fwd P570", + "entity": "Q1329361" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year did Alexandre Darracq die?", + "expect": "1931", + "relation": "fwd P570", + "entity": "Q1343185" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year did Pietro Arduino die?", + "expect": "1805", + "relation": "fwd P570", + "entity": "Q1244985" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "In what year did John Garand die?", + "expect": "1974", + "relation": "fwd P570", + "entity": "Q1317174" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "What nationality was Takuya \u014cnishi?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q5975593" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "What nationality was Peter Broeker?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q172828" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "What nationality was Minh Le?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q1208777" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "What nationality was Koichi Wakata?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q375566" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "What nationality was Yoshiro Nakamatsu?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q522246" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "What nationality was Nitobe Inaz\u014d?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q12696" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "What nationality was Michael Brook?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q1349166" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "What nationality was Tetsuya Nomura?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q355062" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "What nationality was Yoko Taro?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q11542446" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "What nationality was Masami Kuwashima?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q714580" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "What nationality was Sigurd Wongraven?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q2067783" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "What nationality was Y\u016bko Miyamura?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q2279779" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Which country was Satoru Iwata a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q316013" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Which country was Jade Raymond a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q235734" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Which country was Mikimoto K\u014dkichi a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q956283" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Which country was Yukihiro Matsumoto a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q92748" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Which country was Takashi Tezuka a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q509121" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Which country was Frits Thaulow a citizen of?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q445891" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Which country was Hiroshi Amano a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q11443689" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Which country was Hirokazu Tanaka a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q2521353" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Which country was Torakusu Yamaha a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q958364" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Which country was Naoki Hattori a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q516012" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Which country was Hideo Kojima a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q315577" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Which country was Hitoshi Sakimoto a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1196596" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Sudha Murthy married to?", + "expect": "N. R. Narayana Murthy", + "relation": "fwd P26", + "entity": "Q3520225" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Susana Higuchi married to?", + "expect": "Alberto Fujimori", + "relation": "fwd P26", + "entity": "Q265813" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Frauke Petry married to?", + "expect": "Marcus Pretzell", + "relation": "fwd P26", + "entity": "Q7477615" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Jorge Serrano El\u00edas married to?", + "expect": "Magda Bianchi L\u00e1zzari", + "relation": "fwd P26", + "entity": "Q880037" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Louis Fieser married to?", + "expect": "Mary Peters Fieser", + "relation": "fwd P26", + "entity": "Q384156" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Luis Alejandro Berthier married to?", + "expect": "Duchess Maria Elisabeth in Bavaria", + "relation": "fwd P26", + "entity": "Q155734" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was George Maxwell Richards married to?", + "expect": "Jean Ramjohn-Richards", + "relation": "fwd P26", + "entity": "Q57532" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was John C. Fr\u00e9mont married to?", + "expect": "Jessie Benton Fr\u00e9mont", + "relation": "fwd P26", + "entity": "Q169011" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Charlotta Fr\u00f6lich married to?", + "expect": "Johan Funck", + "relation": "fwd P26", + "entity": "Q13565189" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Le\u00f3 Szil\u00e1rd married to?", + "expect": "Gertrud Weiss Szilard", + "relation": "fwd P26", + "entity": "Q153238" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was John Bardeen married to?", + "expect": "Jane Maxwell", + "relation": "fwd P26", + "entity": "Q949" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Andr\u00e9-Marie Amp\u00e8re married to?", + "expect": "Julie Carron", + "relation": "fwd P26", + "entity": "Q675" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who is the spouse of Davies Gilbert?", + "expect": "Mary Ann Gilbert", + "relation": "fwd P26", + "entity": "Q5241730" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who is the spouse of Naomi Novik?", + "expect": "Richard Aleas", + "relation": "fwd P26", + "entity": "Q242643" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who is the spouse of Charles Combes?", + "expect": "Louise Pauline Bousquet", + "relation": "fwd P26", + "entity": "Q526023" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who is the spouse of Zhuge Liang?", + "expect": "Huang Yueying", + "relation": "fwd P26", + "entity": "Q198211" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who is the spouse of Emil Rathenau?", + "expect": "Mathilde Rathenau", + "relation": "fwd P26", + "entity": "Q215586" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who is the spouse of Gene Amdahl?", + "expect": "Marian Quissell", + "relation": "fwd P26", + "entity": "Q62890" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who is the spouse of Emily Warren Roebling?", + "expect": "Washington Roebling", + "relation": "fwd P26", + "entity": "Q49902" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who is the spouse of Mirek Topol\u00e1nek?", + "expect": "Lucie Talmanov\u00e1", + "relation": "fwd P26", + "entity": "Q155880" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who is the spouse of Raymond Aubrac?", + "expect": "Lucie Aubrac", + "relation": "fwd P26", + "entity": "Q567529" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who is the spouse of Andris B\u0113rzi\u0146\u0161?", + "expect": "Dace Seisuma", + "relation": "fwd P26", + "entity": "Q57506" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who is the spouse of Kleber Mendon\u00e7a Filho?", + "expect": "Emilie Lesclaux", + "relation": "fwd P26", + "entity": "Q14940022" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who is the spouse of Lars Magnus Ericsson?", + "expect": "Hilda Carolina Ericsson", + "relation": "fwd P26", + "entity": "Q711309" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Leonard Darwin's father?", + "expect": "Charles Darwin", + "relation": "fwd P22", + "entity": "Q354352" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Zhu Rongji's father?", + "expect": "Zhu Kuanshu", + "relation": "fwd P22", + "entity": "Q18285" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Knut \u00c5ngstr\u00f6m's father?", + "expect": "Anders Jonas \u00c5ngstr\u00f6m", + "relation": "fwd P22", + "entity": "Q722373" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Alexandre Brongniart's father?", + "expect": "Alexandre-Th\u00e9odore Brongniart", + "relation": "fwd P22", + "entity": "Q442937" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Herbert Macaulay's father?", + "expect": "Thomas Babington Macaulay", + "relation": "fwd P22", + "entity": "Q734986" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Mansour Ojjeh's father?", + "expect": "Akram Ojjeh", + "relation": "fwd P22", + "entity": "Q173646" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Alexander Cunningham's father?", + "expect": "Allan Cunningham", + "relation": "fwd P22", + "entity": "Q455430" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Sh\u014dichir\u014d Toyoda's father?", + "expect": "Kiichir\u014d Toyoda", + "relation": "fwd P22", + "entity": "Q478765" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Sergei Khrushchev's father?", + "expect": "Nikita Khrushchev", + "relation": "fwd P22", + "entity": "Q1374180" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Rowland Hill's father?", + "expect": "Thomas Wright Hill", + "relation": "fwd P22", + "entity": "Q370241" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Ferdinand Pi\u00ebch's father?", + "expect": "Anton Pi\u00ebch", + "relation": "fwd P22", + "entity": "Q78713" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Richard William Howard Vyse's father?", + "expect": "Richard Vyse", + "relation": "fwd P22", + "entity": "Q128554" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the father of Jerzy Buzek?", + "expect": "Pawe\u0142 Buzek", + "relation": "fwd P22", + "entity": "Q55910" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the father of Albert Auguste Perdonnet?", + "expect": "Vincent Perdonnet", + "relation": "fwd P22", + "entity": "Q580852" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the father of Roland Penrose?", + "expect": "James Doyle Penrose", + "relation": "fwd P22", + "entity": "Q982677" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the father of Colin Davis?", + "expect": "S. C. H. \"Sammy\" Davis", + "relation": "fwd P22", + "entity": "Q172819" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the father of Holger Thiele?", + "expect": "Thorvald N. Thiele", + "relation": "fwd P22", + "entity": "Q562164" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the father of Ada Lovelace?", + "expect": "Lord Byron", + "relation": "fwd P22", + "entity": "Q7259" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the father of Luis Walter Alvarez?", + "expect": "Walter C. Alvarez", + "relation": "fwd P22", + "entity": "Q178344" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the father of Alberto Santos-Dumont?", + "expect": "Henrique Dumont", + "relation": "fwd P22", + "entity": "Q313211" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the father of Aleksandr Vishnevsky?", + "expect": "Alexander Vasilyevich Vishnevsky", + "relation": "fwd P22", + "entity": "Q4112717" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the father of Elsa Beata Bunge?", + "expect": "Fabian Wrede", + "relation": "fwd P22", + "entity": "Q3359192" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the father of Jos\u00e9 Figueres Ferrer?", + "expect": "Mari\u00e0 Figueres i Forges", + "relation": "fwd P22", + "entity": "Q311126" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the father of Franz Grashof?", + "expect": "Karl F. H. Grashof", + "relation": "fwd P22", + "entity": "Q66543" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Doris Duke's mother?", + "expect": "Nanaline Duke", + "relation": "fwd P25", + "entity": "Q273889" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was John Lombe's mother?", + "expect": "Willmott (?)", + "relation": "fwd P25", + "entity": "Q465997" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Charles Willson Peale's mother?", + "expect": "Margaret Triggs Peale", + "relation": "fwd P25", + "entity": "Q454945" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was John Bennet Lawes's mother?", + "expect": "Marianne Sherman", + "relation": "fwd P25", + "entity": "Q901532" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Ernest Dunlop Swinton's mother?", + "expect": "Elizabeth Dorothy Rundall", + "relation": "fwd P25", + "entity": "Q3847508" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Eduard Buchner's mother?", + "expect": "Friederike Buchner", + "relation": "fwd P25", + "entity": "Q43917" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Humphry Marshall's mother?", + "expect": "Mary Hunt", + "relation": "fwd P25", + "entity": "Q1397162" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Andr\u00e9-Marie Amp\u00e8re's mother?", + "expect": "Jeanne Antoinette Desarcey", + "relation": "fwd P25", + "entity": "Q675" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Sergei Shoigu's mother?", + "expect": "Alexandra Shoigu", + "relation": "fwd P25", + "entity": "Q32024" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Richard William Howard Vyse's mother?", + "expect": "Ann Howard", + "relation": "fwd P25", + "entity": "Q128554" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Klaus Schwab's mother?", + "expect": "Emma Gisela Schwab", + "relation": "fwd P25", + "entity": "Q76793" + }, + { + "split": "dev", + "kind": "engineers", + "valid": true, + "q": "Who was Naina Yeltsina's mother?", + "expect": "Maria Girina", + "relation": "fwd P25", + "entity": "Q2498810" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the mother of Andr\u00e9 Citro\u00ebn?", + "expect": "Amelia Kleinmann", + "relation": "fwd P25", + "entity": "Q219842" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the mother of Karl Wittgenstein?", + "expect": "Fanny Wittgenstein", + "relation": "fwd P25", + "entity": "Q563305" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the mother of Kazimierz Pr\u00f3szy\u0144ski?", + "expect": "Cecylia Puciata", + "relation": "fwd P25", + "entity": "Q2616002" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the mother of Percy Hobart?", + "expect": "Janetta Stanley", + "relation": "fwd P25", + "entity": "Q966007" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the mother of Menno van Coehoorn?", + "expect": "Aletta van Hinckema", + "relation": "fwd P25", + "entity": "Q560731" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the mother of Mike Beuttler?", + "expect": "Pamela Rosemary Blake", + "relation": "fwd P25", + "entity": "Q171734" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the mother of Samuel Baker?", + "expect": "Mary Dobson", + "relation": "fwd P25", + "entity": "Q376087" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the mother of John Bartram?", + "expect": "Elizabeth Hunt", + "relation": "fwd P25", + "entity": "Q528476" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the mother of L. L. Zamenhof?", + "expect": "Rozalia Zamenhof", + "relation": "fwd P25", + "entity": "Q11758" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the mother of Robert Nobel?", + "expect": "Karolina Andriette Ahlsell", + "relation": "fwd P25", + "entity": "Q1398286" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the mother of Artem Mikoyan?", + "expect": "Tamara Mikoyan", + "relation": "fwd P25", + "entity": "Q314043" + }, + { + "split": "heldout", + "kind": "engineers", + "valid": true, + "q": "Who was the mother of Henry Shrapnel?", + "expect": "Lydia Needham", + "relation": "fwd P25", + "entity": "Q941215" + } +] \ No newline at end of file diff --git a/root/specialists/rel-engineers/relspec_scorer.py b/root/specialists/rel-engineers/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-engineers/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-engineers/verdict_dev.json b/root/specialists/rel-engineers/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..4f8dea2b0c9307eb9f9967d598d3a2008f61aed6 --- /dev/null +++ b/root/specialists/rel-engineers/verdict_dev.json @@ -0,0 +1,133 @@ +{ + "id": "rel-engineers", + "name": "Oracle7 Relations: Engineers and inventors", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:47:29Z", + "domain": { + "head": { + "correct": 9, + "false_yes": 0, + "wrong": 18, + "n": 96, + "p50_ms": 497.92, + "fails": [ + [ + "engineers", + "Where was Max de Terra born?", + "deliberation:where", + "[ev:direct] He participated in two Formula One World Championship Grands Prix, debuting on" + ], + [ + "engineers", + "Where was Geir Ivars\u00f8y born?", + "deliberation:where", + "[ev:direct] Telenor stopped them from working on the program, but in 1995, Ivars\u00f8y and Ste" + ], + [ + "engineers", + "Where was Jos\u00e9 Serra born?", + "deliberation:where", + "[ev:direct] Serra was the Minister of Foreign Affairs in the Michel Temer administration f" + ], + [ + "engineers", + "Where was Jean-Michel Sama Lukonde Kyenge born?", + "verified:cube>PLACE|factoid:page", + "Congo. Jean-Michel Sama Lukonde Kyenge (born 4 August 1977) is a Congolese politician from" + ], + [ + "engineers", + "Where was John Barnard born?", + "deliberation:where", + "[ev:direct] Barnard is credited with the introduction of two new designs into Formula One:" + ], + [ + "engineers", + "Where was Coraline Ada Ehmke born?", + "deliberation:where", + "[ev:direct] Coraline Ada Ehmke is a software developer, and some say that she is an open s" + ], + [ + "engineers", + "Where was Loren Bouchard born?", + "unverified:factoid:page", + "I found a passage that may be related, but I can't verify it answers your question: \"Loren" + ], + [ + "engineers", + "Where was Rob Pike born?", + "deliberation:where", + "[ev:direct] Pike wrote the first window system for Unix in 1981. [enwiki_93f677d0ce4013626" + ] + ] + }, + "spec": { + "correct": 93, + "false_yes": 0, + "wrong": 0, + "n": 96, + "p50_ms": 3.03, + "fails": [ + [ + "engineers", + "Where was John Barnard born?", + "specialist:rel-engineers>unverified", + "I can't verify the POB of John Barnard from my records, so I won't guess." + ], + [ + "engineers", + "When was Charles Francis Jenkins born?", + "specialist:rel-engineers>unverified", + "I can't verify the year of birth of Charles Francis Jenkins from my records, so I won't gu" + ], + [ + "engineers", + "Who was Richard William Howard Vyse's father?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-engineers/verdict_heldout.json b/root/specialists/rel-engineers/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..755df2c9ddba2f5cf53d9ebf31825a872b741dc9 --- /dev/null +++ b/root/specialists/rel-engineers/verdict_heldout.json @@ -0,0 +1,121 @@ +{ + "id": "rel-engineers", + "name": "Oracle7 Relations: Engineers and inventors", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:48:36Z", + "domain": { + "head": { + "correct": 12, + "false_yes": 0, + "wrong": 3, + "n": 96, + "p50_ms": 512.75, + "fails": [ + [ + "engineers", + "What is the birthplace of Ellen Ochoa?", + "corpus_query:property_of|vessel:reinforc", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nYou have asked \"Wha" + ], + [ + "engineers", + "What is the birthplace of Chris Metzen?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "engineers", + "What is the birthplace of Otis Barton?", + "corpus_query:property_of|vessel:reinforc", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nYou have asked \"Wha" + ], + [ + "engineers", + "What is the birthplace of Paul Winchell?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "engineers", + "What is the birthplace of Curt von Bardeleben?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "engineers", + "What is the birthplace of Lisa Nowak?", + "corpus_query:property_of|vessel:reinforc", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nYou have asked \"Wha" + ], + [ + "engineers", + "What is the birthplace of Arthur Owen?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "engineers", + "What is the birthplace of Gordon Moore?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ] + ] + }, + "spec": { + "correct": 95, + "false_yes": 0, + "wrong": 0, + "n": 96, + "p50_ms": 2.58, + "fails": [ + [ + "engineers", + "Who was the father of Colin Davis?", + "specialist:rel-engineers>unverified", + "I can't verify the son of of Colin Davis from my records, so I won't guess." + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-fieldhockey/manifest.json b/root/specialists/rel-fieldhockey/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..47ebe1c7801d868e5292cc62f693db2f77801738 --- /dev/null +++ b/root/specialists/rel-fieldhockey/manifest.json @@ -0,0 +1,77 @@ +{ + "id": "rel-fieldhockey", + "name": "Oracle7 Relations: Field hockey players", + "number": 288, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-fieldhockey/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-fieldhockey", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "fieldhockey", + "kind": "fieldhockey" + } + }, + "accept": { + "kinds": [ + "fieldhockey" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-fieldhockey/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [], + "occupations": [ + 10843263 + ] + }, + "readers": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25", + "1532" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-fieldhockey/organ_relation_v2.py b/root/specialists/rel-fieldhockey/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-fieldhockey/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-fieldhockey/readers.json b/root/specialists/rel-fieldhockey/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..e1ec7e417d53f7c52dc4f3c5787b30ff51cef723 --- /dev/null +++ b/root/specialists/rel-fieldhockey/readers.json @@ -0,0 +1,14 @@ +{ + "keys": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25", + "1532" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-fieldhockey/relation_panel_v2.json b/root/specialists/rel-fieldhockey/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..053f58fda996b4e6976cab563b1664250be925a4 --- /dev/null +++ b/root/specialists/rel-fieldhockey/relation_panel_v2.json @@ -0,0 +1,506 @@ +[ + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Where was Natascha Keller born?", + "expect": "Berlin", + "relation": "fwd P19", + "entity": "Q453208" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "What is the birthplace of Martin H\u00e4ner?", + "expect": "Berlin", + "relation": "fwd P19", + "entity": "Q67685" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Where did Mohinder Lal die?", + "expect": "Spain", + "relation": "fwd P20", + "entity": "Q4352330" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Where did Andr\u00e9 Waterkeyn die?", + "expect": "Brussels", + "relation": "fwd P20", + "entity": "Q523346" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Where did Werner Delmes die?", + "expect": "Cologne", + "relation": "fwd P20", + "entity": "Q2561023" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "In which city did Vsevolod Bobrov die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q433391" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "In which city did Leo Pinto die?", + "expect": "Mumbai", + "relation": "fwd P20", + "entity": "Q1818726" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "In which city did Ken Dryden die?", + "expect": "Toronto", + "relation": "fwd P20", + "entity": "Q739820" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "In which city did Berta Hrub\u00e1 die?", + "expect": "Prague", + "relation": "fwd P20", + "entity": "Q4895412" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "In which city did Raghbir Singh Bhola die?", + "expect": "New Delhi", + "relation": "fwd P20", + "entity": "Q7282962" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "In which city did Hugo Budinger die?", + "expect": "Cologne", + "relation": "fwd P20", + "entity": "Q548288" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "In which city did Richard Carr die?", + "expect": "Australia", + "relation": "fwd P20", + "entity": "Q1810075" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "In which city did Anatoly Tarasov die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q264127" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "In which city did Reggie Pridmore die?", + "expect": "Venice", + "relation": "fwd P20", + "entity": "Q3089044" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "When was Matthew Wells born?", + "expect": "2 May 1978", + "relation": "fwd P569", + "entity": "Q11156528" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "In what year was Abhishek Nain born?", + "expect": "1999", + "relation": "fwd P569", + "entity": "Q112427208" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "In what year did Ranganathan Francis die?", + "expect": "1975", + "relation": "fwd P570", + "entity": "Q1338391" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "Which country was Ken Dryden a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q739820" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Who was Eva de Goede married to?", + "expect": "Timothy Drummond", + "relation": "fwd P26", + "entity": "Q555153" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Who was Nova Peris married to?", + "expect": "Daniel Batman", + "relation": "fwd P26", + "entity": "Q3566032" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Who was Ji\u0159ina \u010cerm\u00e1kov\u00e1 married to?", + "expect": "Petr \u010cerm\u00e1k", + "relation": "fwd P26", + "entity": "Q6203600" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Who was Princess Muna Al-Hussein married to?", + "expect": "Hussein I of Jordan", + "relation": "fwd P26", + "entity": "Q269898" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Who was Georgie Twigg married to?", + "expect": "Iain Lewers", + "relation": "fwd P26", + "entity": "Q40009" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Who was Kate Richardson-Walsh married to?", + "expect": "Helen Richardson", + "relation": "fwd P26", + "entity": "Q40011" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "Who is the spouse of Helen Richardson?", + "expect": "Kate Richardson-Walsh", + "relation": "fwd P26", + "entity": "Q40382" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "Who is the spouse of Minke Smeets?", + "expect": "Tjerk Smeets", + "relation": "fwd P26", + "entity": "Q2522378" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Who was Andreas Keller's father?", + "expect": "Carsten Keller", + "relation": "fwd P22", + "entity": "Q90551" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Who was Princess Muna Al-Hussein's father?", + "expect": "Walter Percy Gardiner", + "relation": "fwd P22", + "entity": "Q269898" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Who was Natascha Keller's father?", + "expect": "Carsten Keller", + "relation": "fwd P22", + "entity": "Q453208" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "Who was the father of Hanke Bruins Slot?", + "expect": "Harm Bruins Slot", + "relation": "fwd P22", + "entity": "Q5165280" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "Who was the father of Ken Dryden?", + "expect": "Murray Dryden", + "relation": "fwd P22", + "entity": "Q739820" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Who was Princess Muna Al-Hussein's mother?", + "expect": "Doris Elizabeth Sutton", + "relation": "fwd P25", + "entity": "Q269898" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Which country does Marloes Keetels represent?", + "expect": "Netherlands", + "relation": "fwd P1532", + "entity": "Q17351376" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Which country does Ram\u00f3n Alegre represent?", + "expect": "Spain", + "relation": "fwd P1532", + "entity": "Q3304060" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Which country does Maria Verschoor represent?", + "expect": "Netherlands", + "relation": "fwd P1532", + "entity": "Q14852998" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Which country does Pedro Mur\u00faa represent?", + "expect": "Spain", + "relation": "fwd P1532", + "entity": "Q7159813" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Which country does Xan de Waard represent?", + "expect": "Netherlands", + "relation": "fwd P1532", + "entity": "Q17351539" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Which country does Jules Ancion represent?", + "expect": "Netherlands", + "relation": "fwd P1532", + "entity": "Q2614742" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Which country does Laurien Leurink represent?", + "expect": "Netherlands", + "relation": "fwd P1532", + "entity": "Q26418020" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Which country does Carlien Dirkse van den Heuvel represent?", + "expect": "Netherlands", + "relation": "fwd P1532", + "entity": "Q461396" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Which country does Raoul Daufresne de la Chevalerie represent?", + "expect": "Belgium", + "relation": "fwd P1532", + "entity": "Q2069404" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Which country does Simon Gougnard represent?", + "expect": "Belgium", + "relation": "fwd P1532", + "entity": "Q7518861" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Which country does Lidewij Welten represent?", + "expect": "Netherlands", + "relation": "fwd P1532", + "entity": "Q554799" + }, + { + "split": "dev", + "kind": "fieldhockey", + "valid": true, + "q": "Which country does Jos\u00e9 Colomer represent?", + "expect": "Spain", + "relation": "fwd P1532", + "entity": "Q3819108" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "Which country did Fernand de Montigny play for?", + "expect": "Belgium", + "relation": "fwd P1532", + "entity": "Q2602555" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "Which country did Crista Cullen play for?", + "expect": "England", + "relation": "fwd P1532", + "entity": "Q40016" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "Which country did Hannah Macleod play for?", + "expect": "United Kingdom", + "relation": "fwd P1532", + "entity": "Q40385" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "Which country did Maartje Paumen play for?", + "expect": "Netherlands", + "relation": "fwd P1532", + "entity": "Q288429" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "Which country did Caia van Maasakker play for?", + "expect": "Netherlands", + "relation": "fwd P1532", + "entity": "Q554659" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "Which country did Nagore Gabellanes play for?", + "expect": "Spain", + "relation": "fwd P1532", + "entity": "Q3752079" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "Which country did Mink van der Weerden play for?", + "expect": "Netherlands", + "relation": "fwd P1532", + "entity": "Q554355" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "Which country did Margot van Geffen play for?", + "expect": "Netherlands", + "relation": "fwd P1532", + "entity": "Q554165" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "Which country did Mar\u00eda Carmen Barea play for?", + "expect": "Spain", + "relation": "fwd P1532", + "entity": "Q3819179" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "Which country did Pol Amat play for?", + "expect": "Spain", + "relation": "fwd P1532", + "entity": "Q3773149" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "Which country did Juan Amat play for?", + "expect": "Spain", + "relation": "fwd P1532", + "entity": "Q3819133" + }, + { + "split": "heldout", + "kind": "fieldhockey", + "valid": true, + "q": "Which country did Willemijn Bos play for?", + "expect": "Netherlands", + "relation": "fwd P1532", + "entity": "Q4489496" + } +] \ No newline at end of file diff --git a/root/specialists/rel-fieldhockey/relspec_scorer.py b/root/specialists/rel-fieldhockey/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-fieldhockey/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-fieldhockey/verdict_dev.json b/root/specialists/rel-fieldhockey/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..83de1e8357f1d8563f5f7820407d71088f06a728 --- /dev/null +++ b/root/specialists/rel-fieldhockey/verdict_dev.json @@ -0,0 +1,122 @@ +{ + "id": "rel-fieldhockey", + "name": "Oracle7 Relations: Field hockey players", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w406", + "time": "2026-10-13T02:30:44Z", + "domain": { + "head": { + "correct": 8, + "false_yes": 0, + "wrong": 3, + "n": 27, + "p50_ms": 647.92, + "fails": [ + [ + "fieldhockey", + "Where did Mohinder Lal die?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fieldhockey", + "When was Matthew Wells born?", + "specialist_call>specialist:rel-footballe", + "22 September 1988. From the Wikidata relation store: Matt Wells (Q111893455) - year of bir" + ], + [ + "fieldhockey", + "Who was Ji\u0159ina \u010cerm\u00e1kov\u00e1 married to?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fieldhockey", + "Who was Georgie Twigg married to?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fieldhockey", + "Who was Andreas Keller's father?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fieldhockey", + "Who was Princess Muna Al-Hussein's father?", + "compose:bridge", + "[ev:derived] He became king on 7 February 1999 after the death of his father King Hussein." + ], + [ + "fieldhockey", + "Who was Natascha Keller's father?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fieldhockey", + "Who was Princess Muna Al-Hussein's mother?", + "compose:bridge", + "[ev:derived] Princess Muna Al Hussein (born Toni Avril Gardiner, 25 April 1941) is the mot" + ] + ] + }, + "spec": { + "correct": 27, + "false_yes": 0, + "wrong": 0, + "n": 27, + "p50_ms": 2.54, + "fails": [] + } + }, + "core": { + "head": { + "correct": 132, + "false_yes": 0 + }, + "spec": { + "correct": 132, + "false_yes": 0 + }, + "n": 401, + "swept_in": 1, + "taken_by_specialist": [ + { + "family": "open_relation", + "q": "In which city did Dylan Thomas die?", + "path": "specialist:rel-fieldhockey>unverified", + "head_correct": 0, + "spec_correct": 0 + } + ], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-fieldhockey/verdict_heldout.json b/root/specialists/rel-fieldhockey/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..bed584b009d22a2c0e981873493acd08f8919768 --- /dev/null +++ b/root/specialists/rel-fieldhockey/verdict_heldout.json @@ -0,0 +1,122 @@ +{ + "id": "rel-fieldhockey", + "name": "Oracle7 Relations: Field hockey players", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w406", + "time": "2026-10-13T02:31:34Z", + "domain": { + "head": { + "correct": 10, + "false_yes": 0, + "wrong": 3, + "n": 29, + "p50_ms": 643.91, + "fails": [ + [ + "fieldhockey", + "What is the birthplace of Martin H\u00e4ner?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "fieldhockey", + "In which city did Leo Pinto die?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fieldhockey", + "In which city did Ken Dryden die?", + "organ:relation>READ>FRAME>LINK>RELATE:fw", + "[ev:direct] Hamilton. Born in Hamilton, Ontario, on August, 8 1947, Dryden was originally " + ], + [ + "fieldhockey", + "In which city did Berta Hrub\u00e1 die?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fieldhockey", + "In which city did Raghbir Singh Bhola die?", + "organ:relation>READ>FRAME>LINK>RELATE:fw", + "[ev:direct] Multan. He was born in Multan, Pakistan. [simplewiki_2578dd426b71e8fa8f37af4d]" + ], + [ + "fieldhockey", + "In which city did Hugo Budinger die?", + "organ:relation>READ>FRAME>LINK>RELATE:fw", + "[ev:direct] D\u00fcsseldorf. He was born in D\u00fcsseldorf and died in K\u00f6ln. [enwiki_c882c917c149b2" + ], + [ + "fieldhockey", + "In what year did Ranganathan Francis die?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "fieldhockey", + "Who is the spouse of Helen Richardson?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 29, + "false_yes": 0, + "wrong": 0, + "n": 29, + "p50_ms": 2.9, + "fails": [] + } + }, + "core": { + "head": { + "correct": 132, + "false_yes": 0 + }, + "spec": { + "correct": 132, + "false_yes": 0 + }, + "n": 401, + "swept_in": 1, + "taken_by_specialist": [ + { + "family": "open_relation", + "q": "In which city did Dylan Thomas die?", + "path": "specialist:rel-fieldhockey>unverified", + "head_correct": 0, + "spec_correct": 0 + } + ], + "head_cache_hits": 401 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-graphicartists/manifest.json b/root/specialists/rel-graphicartists/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..e6028ca2b0596d2c02216fc01e9810fd261b801b --- /dev/null +++ b/root/specialists/rel-graphicartists/manifest.json @@ -0,0 +1,76 @@ +{ + "id": "rel-graphicartists", + "name": "Oracle7 Relations: Graphic artists", + "number": 296, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-graphicartists/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-graphicartists", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "graphicartists", + "kind": "graphicartists" + } + }, + "accept": { + "kinds": [ + "graphicartists" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-graphicartists/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [], + "occupations": [ + 1925963 + ] + }, + "readers": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-graphicartists/organ_relation_v2.py b/root/specialists/rel-graphicartists/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-graphicartists/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-graphicartists/readers.json b/root/specialists/rel-graphicartists/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..c13089e7f6ebfd5218117298dde068a3062d6c8b --- /dev/null +++ b/root/specialists/rel-graphicartists/readers.json @@ -0,0 +1,13 @@ +{ + "keys": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-graphicartists/relation_panel_v2.json b/root/specialists/rel-graphicartists/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..c23811c8b09615721a370e933fb0587444ada386 --- /dev/null +++ b/root/specialists/rel-graphicartists/relation_panel_v2.json @@ -0,0 +1,1730 @@ +[ + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where was George Dawe born?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q1507231" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where was Rodolphe T\u00f6pffer born?", + "expect": "Geneva", + "relation": "fwd P19", + "entity": "Q4247" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where was Megumi Igarashi born?", + "expect": "Japan", + "relation": "fwd P19", + "entity": "Q11281593" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where was Henry Holiday born?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q1763678" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where was Jean-Baptiste Debret born?", + "expect": "Paris", + "relation": "fwd P19", + "entity": "Q281998" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where was Charles de La Fosse born?", + "expect": "Paris", + "relation": "fwd P19", + "entity": "Q1066580" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where was Lalla Ward born?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q439404" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where was Dave Fleischer born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q1173200" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where was Matthew Barney born?", + "expect": "San Francisco", + "relation": "fwd P19", + "entity": "Q451185" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where was Clarence Day born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q1095394" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where was Joe Grant born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q205002" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where was Napoleon III born?", + "expect": "Paris", + "relation": "fwd P19", + "entity": "Q7721" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "What is the birthplace of Maximilien Luce?", + "expect": "Paris", + "relation": "fwd P19", + "entity": "Q545293" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "What is the birthplace of Edith Durham?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q287994" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "What is the birthplace of K\u014dsuke Fujishima?", + "expect": "Chiba", + "relation": "fwd P19", + "entity": "Q551551" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "What is the birthplace of Anna Waser?", + "expect": "Zurich", + "relation": "fwd P19", + "entity": "Q119788" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "What is the birthplace of Sarah Churchill?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q2405785" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "What is the birthplace of Elizabeth Catlett?", + "expect": "Washington, D.C.", + "relation": "fwd P19", + "entity": "Q290331" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "What is the birthplace of Danny Antonucci?", + "expect": "Toronto", + "relation": "fwd P19", + "entity": "Q280875" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "What is the birthplace of Matthew J. Munn?", + "expect": "United States", + "relation": "fwd P19", + "entity": "Q4168041" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "What is the birthplace of Marie-Genevi\u00e8ve-Charlotte Thiroux d'Arconville?", + "expect": "Paris", + "relation": "fwd P19", + "entity": "Q3291849" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "What is the birthplace of Maurice de Vlaminck?", + "expect": "Paris", + "relation": "fwd P19", + "entity": "Q241098" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "What is the birthplace of Jacob Burckhardt?", + "expect": "Basel", + "relation": "fwd P19", + "entity": "Q59945" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "What is the birthplace of Max Miedinger?", + "expect": "Zurich", + "relation": "fwd P19", + "entity": "Q118270" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where did Th\u00e9r\u00e8se Schwartze die?", + "expect": "Amsterdam", + "relation": "fwd P20", + "entity": "Q457001" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where did Harvey Kurtzman die?", + "expect": "New York City", + "relation": "fwd P20", + "entity": "Q732474" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where did Ben Shahn die?", + "expect": "New York City", + "relation": "fwd P20", + "entity": "Q695239" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where did Jean-Antoine Houdon die?", + "expect": "Paris", + "relation": "fwd P20", + "entity": "Q318741" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where did Cornelis Cort die?", + "expect": "Rome", + "relation": "fwd P20", + "entity": "Q167220" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where did Joan Blaeu die?", + "expect": "Amsterdam", + "relation": "fwd P20", + "entity": "Q379677" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where did Joseph-Siffred Duplessis die?", + "expect": "Versailles", + "relation": "fwd P20", + "entity": "Q2286906" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where did Arman die?", + "expect": "New York City", + "relation": "fwd P20", + "entity": "Q367973" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where did Karl Schmid die?", + "expect": "Zurich", + "relation": "fwd P20", + "entity": "Q27229298" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where did Vladimir Favorsky die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q898175" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where did \u00c9tienne-Louis Boull\u00e9e die?", + "expect": "Paris", + "relation": "fwd P20", + "entity": "Q289220" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Where did Francis Picabia die?", + "expect": "Paris", + "relation": "fwd P20", + "entity": "Q157321" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In which city did Betty Parsons die?", + "expect": "New York City", + "relation": "fwd P20", + "entity": "Q435791" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In which city did Matthias de l'Obel die?", + "expect": "London", + "relation": "fwd P20", + "entity": "Q1860320" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In which city did Nicolaes Pieterszoon Berchem die?", + "expect": "Amsterdam", + "relation": "fwd P20", + "entity": "Q711737" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In which city did Walt Kelly die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q933892" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In which city did Friz Freleng die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q457864" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In which city did Tom Wesselmann die?", + "expect": "New York City", + "relation": "fwd P20", + "entity": "Q703660" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In which city did Wojciech Gerson die?", + "expect": "Warsaw", + "relation": "fwd P20", + "entity": "Q1364258" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In which city did Antonio de La Gandara die?", + "expect": "Paris", + "relation": "fwd P20", + "entity": "Q606115" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In which city did Jacob van Campen die?", + "expect": "Amersfoort", + "relation": "fwd P20", + "entity": "Q536951" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In which city did Fernando Botero die?", + "expect": "Monaco", + "relation": "fwd P20", + "entity": "Q272877" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In which city did Fr\u00e9d\u00e9ric Back die?", + "expect": "Montreal", + "relation": "fwd P20", + "entity": "Q69218" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In which city did Johannes Itten die?", + "expect": "Zurich", + "relation": "fwd P20", + "entity": "Q123138" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When was Alan Lee born?", + "expect": "20 August 1947", + "relation": "fwd P569", + "entity": "Q102108" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When was Clarence Day born?", + "expect": "18 November 1874", + "relation": "fwd P569", + "entity": "Q1095394" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When was Charles de La Fosse born?", + "expect": "15 June 1636", + "relation": "fwd P569", + "entity": "Q1066580" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When was J\u00f3zef Pankiewicz born?", + "expect": "29 November 1866", + "relation": "fwd P569", + "entity": "Q1038450" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When was Claes Janszoon Visscher II born?", + "expect": "1586", + "relation": "fwd P569", + "entity": "Q1094674" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When was Pavao Ritter Vitezovi\u0107 born?", + "expect": "12 January 1652", + "relation": "fwd P569", + "entity": "Q1081211" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When was Andrzej Wajda born?", + "expect": "6 March 1926", + "relation": "fwd P569", + "entity": "Q106685" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When was Kirk Wise born?", + "expect": "24 August 1963", + "relation": "fwd P569", + "entity": "Q1073959" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When was Berthe Morisot born?", + "expect": "14 January 1841", + "relation": "fwd P569", + "entity": "Q105320" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When was Gerhard Munthe born?", + "expect": "19 July 1849", + "relation": "fwd P569", + "entity": "Q1009816" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When was Charles Allan Gilbert born?", + "expect": "3 September 1873", + "relation": "fwd P569", + "entity": "Q1063544" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When was James Barry born?", + "expect": "11 October 1741", + "relation": "fwd P569", + "entity": "Q1042892" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year was Chris Williams born?", + "expect": "1968", + "relation": "fwd P569", + "entity": "Q1077862" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year was Johan Nieuhof born?", + "expect": "1618", + "relation": "fwd P569", + "entity": "Q1123800" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year was Charles Joseph Minard born?", + "expect": "1781", + "relation": "fwd P569", + "entity": "Q1065131" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year was Cesare Maccari born?", + "expect": "1840", + "relation": "fwd P569", + "entity": "Q1056862" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year was Carmine Infantino born?", + "expect": "1925", + "relation": "fwd P569", + "entity": "Q1043824" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year was Tove Jansson born?", + "expect": "1914", + "relation": "fwd P569", + "entity": "Q102071" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year was Hans Alfredson born?", + "expect": "1931", + "relation": "fwd P569", + "entity": "Q1033656" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year was Chris Ofili born?", + "expect": "1968", + "relation": "fwd P569", + "entity": "Q1077608" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year was Yasuhiro Takemoto born?", + "expect": "1972", + "relation": "fwd P569", + "entity": "Q1038856" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year was Tetsur\u014d Araki born?", + "expect": "1976", + "relation": "fwd P569", + "entity": "Q1101038" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year was Byron Howard born?", + "expect": "1968", + "relation": "fwd P569", + "entity": "Q1018606" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year was Paul Gavarni born?", + "expect": "1804", + "relation": "fwd P569", + "entity": "Q1074290" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When did Berthe Morisot die?", + "expect": "2 March 1895", + "relation": "fwd P570", + "entity": "Q105320" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When did Charles Allan Gilbert die?", + "expect": "20 April 1929", + "relation": "fwd P570", + "entity": "Q1063544" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When did Francis Davis Millet die?", + "expect": "15 April 1912", + "relation": "fwd P570", + "entity": "Q1345302" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When did Charles de La Fosse die?", + "expect": "13 December 1716", + "relation": "fwd P570", + "entity": "Q1066580" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When did Nicolas Toussaint Charlet die?", + "expect": "30 December 1845", + "relation": "fwd P570", + "entity": "Q1347175" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When did James Robertson die?", + "expect": "18 April 1888", + "relation": "fwd P570", + "entity": "Q1348650" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When did David Cox die?", + "expect": "7 June 1859", + "relation": "fwd P570", + "entity": "Q1174087" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When did Simon Ushakov die?", + "expect": "25 June 1686", + "relation": "fwd P570", + "entity": "Q1188303" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When did Salomon Koninck die?", + "expect": "8 August 1656", + "relation": "fwd P570", + "entity": "Q1344948" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When did John Henry Twachtman die?", + "expect": "8 August 1902", + "relation": "fwd P570", + "entity": "Q1342683" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When did Wanda G\u00e1g die?", + "expect": "27 June 1946", + "relation": "fwd P570", + "entity": "Q1012900" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "When did Johann Jakob Scheuchzer die?", + "expect": "23 June 1733", + "relation": "fwd P570", + "entity": "Q123900" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year did Paul Grimault die?", + "expect": "1994", + "relation": "fwd P570", + "entity": "Q1351064" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year did Charles Jacque die?", + "expect": "1894", + "relation": "fwd P570", + "entity": "Q125409" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year did Wally Herbert die?", + "expect": "2007", + "relation": "fwd P570", + "entity": "Q1347150" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year did Charles Joshua Chaplin die?", + "expect": "1891", + "relation": "fwd P570", + "entity": "Q1063936" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year did Simon de Vlieger die?", + "expect": "1653", + "relation": "fwd P570", + "entity": "Q1093129" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year did Louis Daguerre die?", + "expect": "1851", + "relation": "fwd P570", + "entity": "Q131405" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year did Max Miedinger die?", + "expect": "1980", + "relation": "fwd P570", + "entity": "Q118270" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year did Walter De Maria die?", + "expect": "2013", + "relation": "fwd P570", + "entity": "Q126506" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year did Kazimir Malevich die?", + "expect": "1935", + "relation": "fwd P570", + "entity": "Q130777" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year did Guillaume Henri Dufour die?", + "expect": "1875", + "relation": "fwd P570", + "entity": "Q123238" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year did Hugo Claus die?", + "expect": "2008", + "relation": "fwd P570", + "entity": "Q117783" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "In what year did Bobby Sands die?", + "expect": "1981", + "relation": "fwd P570", + "entity": "Q121615" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "What nationality was Hitoshi Iwaaki?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1191638" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "What nationality was Yoshihiro Togashi?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q550311" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "What nationality was Hishikawa Moronobu?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q746217" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "What nationality was Naoko Takeuchi?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q229724" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "What nationality was Y\u014dichi Takahashi?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q958269" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "What nationality was Tsutomu Nihei?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q504482" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "What nationality was Bisco Hatori?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q238087" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "What nationality was Tatsuya End\u014d?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q3981526" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "What nationality was Keiko Takemiya?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q268789" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "What nationality was Suzuki Harunobu?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q360978" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "What nationality was Toshio Suzuki?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q713511" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "What nationality was Utagawa Kuniyoshi?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q317736" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Which country was Jeff Wall a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q550428" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Which country was Rupi Kaur a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q19662918" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Which country was Adolph Tidemand a citizen of?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q365544" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Which country was Masami Kurumada a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q725387" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Which country was Seishi Kishimoto a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q360610" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Which country was Al Pease a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q172469" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Which country was Alex Colville a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q2832922" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Which country was Katsura Hoshino a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q464351" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Which country was Tetsuya Chiba a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q2339941" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Which country was Masamune Shirow a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q442602" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Which country was Bryan Lee O'Malley a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q712562" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Which country was Yumi Hotta a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q263303" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Lorna Simpson married to?", + "expect": "James Casebere", + "relation": "fwd P26", + "entity": "Q6681389" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Hieronymus Cock married to?", + "expect": "Volcxken Diericx", + "relation": "fwd P26", + "entity": "Q640361" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Guillaume Apollinaire married to?", + "expect": "Jacqueline Apollonaire", + "relation": "fwd P26", + "entity": "Q133855" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Ken Akamatsu married to?", + "expect": "Kanon Akamatsu", + "relation": "fwd P26", + "entity": "Q311589" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Hans Hartung married to?", + "expect": "Anna-Eva Bergman", + "relation": "fwd P26", + "entity": "Q657402" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Philipp Otto Runge married to?", + "expect": "Pauline Runge", + "relation": "fwd P26", + "entity": "Q166585" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Bea Uusma married to?", + "expect": "Henrik Schyffert", + "relation": "fwd P26", + "entity": "Q4977696" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Krzysztof Kamil Baczy\u0144ski married to?", + "expect": "Barbara Drapczy\u0144ska", + "relation": "fwd P26", + "entity": "Q558722" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Mikhail Vrubel married to?", + "expect": "Nadezhda Zabela-Vrubel", + "relation": "fwd P26", + "entity": "Q215100" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Karl Bryullov married to?", + "expect": "Emilie Timm", + "relation": "fwd P26", + "entity": "Q4768" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Jessie M. King married to?", + "expect": "E. A. Taylor", + "relation": "fwd P26", + "entity": "Q2078865" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Josef Skupa married to?", + "expect": "Ji\u0159ina Skupov\u00e1", + "relation": "fwd P26", + "entity": "Q820418" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who is the spouse of Thomas Hart Benton?", + "expect": "Rita Piacenza Benton", + "relation": "fwd P26", + "entity": "Q471764" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who is the spouse of Kenyon Cox?", + "expect": "Louise Cox", + "relation": "fwd P26", + "entity": "Q933739" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who is the spouse of Marc Quinn?", + "expect": "Georgia Byng", + "relation": "fwd P26", + "entity": "Q355811" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who is the spouse of J\u00f3zef Mehoffer?", + "expect": "Jadwiga Mehoffer", + "relation": "fwd P26", + "entity": "Q1354695" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who is the spouse of Ivo Caprino?", + "expect": "Liv Bredal", + "relation": "fwd P26", + "entity": "Q2712084" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who is the spouse of Maria Sibylla Merian?", + "expect": "Johann Andreas Graff", + "relation": "fwd P26", + "entity": "Q62530" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who is the spouse of Don Rosa?", + "expect": "Ann Payne", + "relation": "fwd P26", + "entity": "Q24184" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who is the spouse of Louise \u00c9lisabeth of France?", + "expect": "Filippo I, Duke of Parma", + "relation": "fwd P26", + "entity": "Q230868" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who is the spouse of Constantijn Huygens?", + "expect": "Suzanna van Baerle", + "relation": "fwd P26", + "entity": "Q560746" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who is the spouse of Maria Louisa Catherine Cecilia Cosway?", + "expect": "Richard Cosway", + "relation": "fwd P26", + "entity": "Q3847222" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who is the spouse of Sina Mesdag-van Houten?", + "expect": "Hendrik Willem Mesdag", + "relation": "fwd P26", + "entity": "Q1837114" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who is the spouse of Gerald Scarfe?", + "expect": "Jane Asher", + "relation": "fwd P26", + "entity": "Q463132" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Prince Luigi Amedeo, Duke of the Abruzzi's father?", + "expect": "Amadeo I of Spain", + "relation": "fwd P22", + "entity": "Q320618" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Pieter Jansz. Saenredam's father?", + "expect": "Jan Saenredam", + "relation": "fwd P22", + "entity": "Q433804" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Napoleon II's father?", + "expect": "Napoleon", + "relation": "fwd P22", + "entity": "Q7723" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was An\u0161lavs Egl\u012btis's father?", + "expect": "Viktors Egl\u012btis", + "relation": "fwd P22", + "entity": "Q615419" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Cory Edwards's father?", + "expect": "James L. Edwards", + "relation": "fwd P22", + "entity": "Q3694918" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Lambert Sigisbert Adam's father?", + "expect": "Jacob Sigisbert Adam", + "relation": "fwd P22", + "entity": "Q1564497" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Balthus's father?", + "expect": "Erich Klossowski", + "relation": "fwd P22", + "entity": "Q325925" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Titus van Rijn's father?", + "expect": "Rembrandt", + "relation": "fwd P22", + "entity": "Q200817" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Ambrosius Holbein's father?", + "expect": "Hans Holbein the Elder", + "relation": "fwd P22", + "entity": "Q123732" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Konstantin Somov's father?", + "expect": "Andrey Somov", + "relation": "fwd P22", + "entity": "Q433067" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Gerald of Wales's father?", + "expect": "William de Barri", + "relation": "fwd P22", + "entity": "Q357824" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Fran\u00e7ois Bourgeon's father?", + "expect": "Martial Bourgeon", + "relation": "fwd P22", + "entity": "Q983343" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the father of Hermann Hesse?", + "expect": "Johannes Hesse", + "relation": "fwd P22", + "entity": "Q25973" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the father of Edmund Purdom?", + "expect": "Charles Purdom", + "relation": "fwd P22", + "entity": "Q1286750" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the father of Bernard Picart?", + "expect": "\u00c9tienne Picart", + "relation": "fwd P22", + "entity": "Q559929" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the father of Pierre Cuypers?", + "expect": "Johannes Hubertus Cuypers", + "relation": "fwd P22", + "entity": "Q540431" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the father of Carl Friedrich Philipp von Martius?", + "expect": "Ernst Wilhelm Martius", + "relation": "fwd P22", + "entity": "Q77131" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the father of Henricus Hondius II?", + "expect": "Jodocus Hondius I", + "relation": "fwd P22", + "entity": "Q983261" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the father of Adriaan Metius?", + "expect": "Adriaen Anthonisz", + "relation": "fwd P22", + "entity": "Q367638" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the father of Kara Walker?", + "expect": "Larry Walker", + "relation": "fwd P22", + "entity": "Q444277" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the father of Fran\u00e7ois G\u00e9rard?", + "expect": "Jean Simon G\u00e9rard", + "relation": "fwd P22", + "entity": "Q163543" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the father of Glen Keane?", + "expect": "Bil Keane", + "relation": "fwd P22", + "entity": "Q1382544" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the father of Cornelis Saftleven?", + "expect": "Herman Saftleven I", + "relation": "fwd P22", + "entity": "Q130039" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the father of Charles de Foucauld?", + "expect": "\u00c9douard de Foucauld de Pontbriand", + "relation": "fwd P22", + "entity": "Q51880" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Emil von Sydow's mother?", + "expect": "Wilhelmine von Sydow", + "relation": "fwd P25", + "entity": "Q70286" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Izabela Czartoryska's mother?", + "expect": "Antonina Czartoryska", + "relation": "fwd P25", + "entity": "Q455182" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Erik Gustaf Geijer's mother?", + "expect": "Ulrica Magdalena Geisler", + "relation": "fwd P25", + "entity": "Q380937" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Julius Schnorr von Carolsfeld's mother?", + "expect": "Christina Juliana Hempel", + "relation": "fwd P25", + "entity": "Q703458" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Sibylle Riquetti de Mirabeau's mother?", + "expect": "Marie Le Harivel de Gonneville", + "relation": "fwd P25", + "entity": "Q199228" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Vasily Livanov's mother?", + "expect": "Evgenia Prawdzic-Filipowicz", + "relation": "fwd P25", + "entity": "Q362133" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Princess Henriette of Belgium's mother?", + "expect": "Princess Marie of Hohenzollern-Sigmaringen", + "relation": "fwd P25", + "entity": "Q449622" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Willem Piso's mother?", + "expect": "Cornelia van Liesvelt", + "relation": "fwd P25", + "entity": "Q1385325" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Valentin Serov's mother?", + "expect": "Valentina Serova", + "relation": "fwd P25", + "entity": "Q217128" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Giovanni Battista Tiepolo's mother?", + "expect": "Orsetta Tiepolo", + "relation": "fwd P25", + "entity": "Q186202" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Peter Johann Nepomuk Geiger's mother?", + "expect": "Antonia Geiger", + "relation": "fwd P25", + "entity": "Q751264" + }, + { + "split": "dev", + "kind": "graphicartists", + "valid": true, + "q": "Who was Joann Sfar's mother?", + "expect": "Liliane Haftel", + "relation": "fwd P25", + "entity": "Q239897" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the mother of Luke Fildes?", + "expect": "Mary Fildes", + "relation": "fwd P25", + "entity": "Q1855648" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the mother of Max Beerbohm?", + "expect": "Eliza Draper", + "relation": "fwd P25", + "entity": "Q472071" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the mother of Eric XIV of Sweden?", + "expect": "Catherine of Saxe-Lauenburg", + "relation": "fwd P25", + "entity": "Q52945" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the mother of Giovanni Domenico Tiepolo?", + "expect": "Maria Cecilia Guardi", + "relation": "fwd P25", + "entity": "Q435316" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the mother of Princess Cl\u00e9mentine, Princess of Koh\u00e1ry?", + "expect": "Maria Amalia of Naples and Sicily", + "relation": "fwd P25", + "entity": "Q237129" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the mother of Jacob Burckhardt?", + "expect": "Susanna Maria Burckhardt-Schorndorff", + "relation": "fwd P25", + "entity": "Q59945" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the mother of Stina Wirs\u00e9n?", + "expect": "Carin Wirs\u00e9n", + "relation": "fwd P25", + "entity": "Q532720" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the mother of Sarah Churchill?", + "expect": "Clementine Churchill", + "relation": "fwd P25", + "entity": "Q2405785" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the mother of Wilhelm Leibl?", + "expect": "Gertrud Leibl", + "relation": "fwd P25", + "entity": "Q704661" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the mother of Mariano Fortuny?", + "expect": "Cecilia de Madrazo", + "relation": "fwd P25", + "entity": "Q1113061" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the mother of Charles Le Brun?", + "expect": "Jeanne Le Brun", + "relation": "fwd P25", + "entity": "Q271676" + }, + { + "split": "heldout", + "kind": "graphicartists", + "valid": true, + "q": "Who was the mother of James Kr\u00fcss?", + "expect": "Margareta Kr\u00fcss", + "relation": "fwd P25", + "entity": "Q28147" + } +] \ No newline at end of file diff --git a/root/specialists/rel-graphicartists/relspec_scorer.py b/root/specialists/rel-graphicartists/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-graphicartists/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-graphicartists/verdict_dev.json b/root/specialists/rel-graphicartists/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..0d1fd68a800c985022ef6957e76d01d7ca9a537a --- /dev/null +++ b/root/specialists/rel-graphicartists/verdict_dev.json @@ -0,0 +1,170 @@ +{ + "id": "rel-graphicartists", + "name": "Oracle7 Relations: Graphic artists", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w406", + "time": "2026-10-13T02:33:21Z", + "domain": { + "head": { + "correct": 81, + "false_yes": 0, + "wrong": 7, + "n": 96, + "p50_ms": 613.95, + "fails": [ + [ + "graphicartists", + "Where was Rodolphe T\u00f6pffer born?", + "specialist_call>specialist:rel-novelists", + "I can't verify the POB of Rodolphe T\u00f6pffer from my records, so I won't guess. [rel-novelis" + ], + [ + "graphicartists", + "Where was Lalla Ward born?", + "deliberation:where", + "[ev:direct] Sarah Jill \"Lalla\" Ward (born 28 June 1951 ) is an English actress, voice arti" + ], + [ + "graphicartists", + "Where was Matthew Barney born?", + "deliberation:where", + "[ev:direct] Matthew Barney (born March 25, 1967) is an American contemporary artist and fi" + ], + [ + "graphicartists", + "Where did Joan Blaeu die?", + "deliberation:where", + "[ev:direct] Blaeu is most notable for his map published in 1648, which was the first map t" + ], + [ + "graphicartists", + "When was Alan Lee born?", + "capability:when_did|vessel:reinforced", + "The admitted record for Alan Lee contains no dated statement about when it born. It may al" + ], + [ + "graphicartists", + "When was Kirk Wise born?", + "capability:when_did", + "[ev:direct] According to Kirk Wise, Kirk Wise (born August 24, 1963) is an American animat" + ], + [ + "graphicartists", + "When was Gerhard Munthe born?", + "specialist_call>specialist:rel-historian", + "4 January 1795. From the Wikidata relation store: Gerhard Munthe (Q5997261) - year of birt" + ], + [ + "graphicartists", + "When was James Barry born?", + "verified:weak>YEAR|compose:bridge", + "2012. [ev:derived] The rights to run the domain were applied for in June 2012 by Dot-Irish" + ] + ] + }, + "spec": { + "correct": 94, + "false_yes": 0, + "wrong": 0, + "n": 96, + "p50_ms": 0.05, + "fails": [ + [ + "graphicartists", + "When was Gerhard Munthe born?", + "specialist:rel-graphicartists>unverified", + "I can't verify the year of birth of Gerhard Munthe from my records, so I won't guess." + ], + [ + "graphicartists", + "Who was Napoleon II's father?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + } + }, + "core": { + "head": { + "correct": 132, + "false_yes": 0 + }, + "spec": { + "correct": 132, + "false_yes": 0 + }, + "n": 406, + "swept_in": 6, + "taken_by_specialist": [ + { + "family": "open_conversation_convq", + "q": "Who was Fitzgerald's wife?", + "path": "specialist:rel-graphicartists>graphicartists", + "head_correct": 0, + "spec_correct": 0 + }, + { + "family": "open_conversation_convq", + "q": "Who was Fitzgerald married to?", + "path": "specialist:rel-graphicartists>graphicartists", + "head_correct": 0, + "spec_correct": 0 + }, + { + "family": "open_conversation_convq", + "q": "Who was Fitzgerald married to?", + "path": "specialist:rel-graphicartists>graphicartists", + "head_correct": 0, + "spec_correct": 0 + }, + { + "family": "open_conversation_convq", + "q": "Who was Fitzgerald married to?", + "path": "specialist:rel-graphicartists>graphicartists", + "head_correct": 0, + "spec_correct": 0 + }, + { + "family": "open_conversation_convq", + "q": "Who was Fitzgerald married to?", + "path": "specialist:rel-graphicartists>graphicartists", + "head_correct": 0, + "spec_correct": 0 + }, + { + "family": "open_conversation_convq", + "q": "Who was Fitzgerald married to?", + "path": "specialist:rel-graphicartists>graphicartists", + "head_correct": 0, + "spec_correct": 0 + } + ], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-graphicartists/verdict_heldout.json b/root/specialists/rel-graphicartists/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..c32065e35f546e058de7cee26b43cce49ba385aa --- /dev/null +++ b/root/specialists/rel-graphicartists/verdict_heldout.json @@ -0,0 +1,164 @@ +{ + "id": "rel-graphicartists", + "name": "Oracle7 Relations: Graphic artists", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w406", + "time": "2026-10-13T02:35:20Z", + "domain": { + "head": { + "correct": 85, + "false_yes": 0, + "wrong": 3, + "n": 96, + "p50_ms": 639.67, + "fails": [ + [ + "graphicartists", + "What is the birthplace of Sarah Churchill?", + "specialist_call>specialist:rel-monarchs>", + "I can't verify the POB of Sarah Churchill, Duchess of Marlborough from my records, so I wo" + ], + [ + "graphicartists", + "What is the birthplace of Max Miedinger?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "graphicartists", + "In which city did Tom Wesselmann die?", + "organ:relation>READ>FRAME>LINK>RELATE:fw", + "[ev:direct] Cincinnati. From 1949 to 1951 he attended college in Ohio; first at Hiram Coll" + ], + [ + "graphicartists", + "In which city did Jacob van Campen die?", + "organ:relation>READ>FRAME>LINK>RELATE:fw", + "[ev:direct] Haarlem. He was born into a wealthy family at Haarlem and spent his youth in h" + ], + [ + "graphicartists", + "In which city did Fernando Botero die?", + "organ:relation>READ>FRAME>LINK>RELATE:fw", + "[ev:direct] Medell\u00edn. In 1948, Botero at the age of 16 had his first illustrations publish" + ], + [ + "graphicartists", + "In what year did Max Miedinger die?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "graphicartists", + "Who is the spouse of Thomas Hart Benton?", + "specialist_call>specialist:rel-lawyers>u", + "I can't verify the wives of Thomas Hart Benton from my records, so I won't guess. [rel-law" + ], + [ + "graphicartists", + "Who is the spouse of Louise \u00c9lisabeth of France?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 95, + "false_yes": 0, + "wrong": 0, + "n": 96, + "p50_ms": 0.05, + "fails": [ + [ + "graphicartists", + "Who was the mother of Mariano Fortuny?", + "specialist:rel-graphicartists>unverified", + "I can't verify the son of of Mariano Fortuny Marsal from my records, so I won't guess." + ] + ] + } + }, + "core": { + "head": { + "correct": 132, + "false_yes": 0 + }, + "spec": { + "correct": 132, + "false_yes": 0 + }, + "n": 406, + "swept_in": 6, + "taken_by_specialist": [ + { + "family": "open_conversation_convq", + "q": "Who was Fitzgerald's wife?", + "path": "specialist:rel-graphicartists>graphicartists", + "head_correct": 0, + "spec_correct": 0 + }, + { + "family": "open_conversation_convq", + "q": "Who was Fitzgerald married to?", + "path": "specialist:rel-graphicartists>graphicartists", + "head_correct": 0, + "spec_correct": 0 + }, + { + "family": "open_conversation_convq", + "q": "Who was Fitzgerald married to?", + "path": "specialist:rel-graphicartists>graphicartists", + "head_correct": 0, + "spec_correct": 0 + }, + { + "family": "open_conversation_convq", + "q": "Who was Fitzgerald married to?", + "path": "specialist:rel-graphicartists>graphicartists", + "head_correct": 0, + "spec_correct": 0 + }, + { + "family": "open_conversation_convq", + "q": "Who was Fitzgerald married to?", + "path": "specialist:rel-graphicartists>graphicartists", + "head_correct": 0, + "spec_correct": 0 + }, + { + "family": "open_conversation_convq", + "q": "Who was Fitzgerald married to?", + "path": "specialist:rel-graphicartists>graphicartists", + "head_correct": 0, + "spec_correct": 0 + } + ], + "head_cache_hits": 406 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-languages/manifest.json b/root/specialists/rel-languages/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..9833a32829c99fc1b7e0a3174b9b859734d23b75 --- /dev/null +++ b/root/specialists/rel-languages/manifest.json @@ -0,0 +1,70 @@ +{ + "id": "rel-languages", + "name": "Oracle7 Relations: Languages", + "number": 182, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-languages/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-languages", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "languages", + "kind": "languages" + } + }, + "accept": { + "kinds": [ + "languages" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-languages/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [ + 34770, + 1288568 + ], + "occupations": [] + }, + "readers": [ + "282" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-languages/organ_relation_v2.py b/root/specialists/rel-languages/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-languages/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-languages/readers.json b/root/specialists/rel-languages/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..3da521b1791e15895884cbab29a621ff3c669bc0 --- /dev/null +++ b/root/specialists/rel-languages/readers.json @@ -0,0 +1,6 @@ +{ + "keys": [ + "282" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-languages/relation_panel_v2.json b/root/specialists/rel-languages/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..502c548945665e7124407e4d69e81c396ef0f0a8 --- /dev/null +++ b/root/specialists/rel-languages/relation_panel_v2.json @@ -0,0 +1,218 @@ +[ + { + "split": "dev", + "kind": "languages", + "valid": true, + "q": "Which script is Skolt Sami written in?", + "expect": "Latin script", + "relation": "fwd P282", + "entity": "Q13271" + }, + { + "split": "dev", + "kind": "languages", + "valid": true, + "q": "Which script is Namibian Black German written in?", + "expect": "Latin script", + "relation": "fwd P282", + "entity": "Q35759" + }, + { + "split": "dev", + "kind": "languages", + "valid": true, + "q": "Which script is Kaw\u00e9sqar written in?", + "expect": "Latin script", + "relation": "fwd P282", + "entity": "Q56544" + }, + { + "split": "dev", + "kind": "languages", + "valid": true, + "q": "Which script is Ch\u2019orti\u2019 written in?", + "expect": "Latin script", + "relation": "fwd P282", + "entity": "Q35177" + }, + { + "split": "dev", + "kind": "languages", + "valid": true, + "q": "Which script is Kadazandusun written in?", + "expect": "Latin script", + "relation": "fwd P282", + "entity": "Q5317225" + }, + { + "split": "dev", + "kind": "languages", + "valid": true, + "q": "Which script is Palenquero written in?", + "expect": "Latin script", + "relation": "fwd P282", + "entity": "Q36665" + }, + { + "split": "dev", + "kind": "languages", + "valid": true, + "q": "Which script is Car written in?", + "expect": "Latin script", + "relation": "fwd P282", + "entity": "Q35156" + }, + { + "split": "dev", + "kind": "languages", + "valid": true, + "q": "Which script is Ido written in?", + "expect": "Latin script", + "relation": "fwd P282", + "entity": "Q35224" + }, + { + "split": "dev", + "kind": "languages", + "valid": true, + "q": "Which script is Guianan Creole written in?", + "expect": "Latin script", + "relation": "fwd P282", + "entity": "Q1363072" + }, + { + "split": "dev", + "kind": "languages", + "valid": true, + "q": "Which script is Paiwan written in?", + "expect": "Latin script", + "relation": "fwd P282", + "entity": "Q715755" + }, + { + "split": "dev", + "kind": "languages", + "valid": true, + "q": "Which script is Tofa written in?", + "expect": "Cyrillic script", + "relation": "fwd P282", + "entity": "Q36848" + }, + { + "split": "dev", + "kind": "languages", + "valid": true, + "q": "Which script is Plautdietsch written in?", + "expect": "Latin script", + "relation": "fwd P282", + "entity": "Q1751432" + }, + { + "split": "heldout", + "kind": "languages", + "valid": true, + "q": "What alphabet is Kimbundu written in?", + "expect": "Latin script", + "relation": "fwd P282", + "entity": "Q35891" + }, + { + "split": "heldout", + "kind": "languages", + "valid": true, + "q": "What alphabet is Klamath-Modoc written in?", + "expect": "Latin script", + "relation": "fwd P282", + "entity": "Q2669248" + }, + { + "split": "heldout", + "kind": "languages", + "valid": true, + "q": "What alphabet is Poqomchi' written in?", + "expect": "Latin script", + "relation": "fwd P282", + "entity": "Q36414" + }, + { + "split": "heldout", + "kind": "languages", + "valid": true, + "q": "What alphabet is Bodo written in?", + "expect": "Devanagari", + "relation": "fwd P282", + "entity": "Q33223" + }, + { + "split": "heldout", + "kind": "languages", + "valid": true, + "q": "What alphabet is Ripuarian written in?", + "expect": "Latin script", + "relation": "fwd P282", + "entity": "Q32145" + }, + { + "split": "heldout", + "kind": "languages", + "valid": true, + "q": "What alphabet is Tocharian written in?", + "expect": "Tocharian alphabet", + "relation": "fwd P282", + "entity": "Q37029" + }, + { + "split": "heldout", + "kind": "languages", + "valid": true, + "q": "What alphabet is Puquina written in?", + "expect": "Latin script", + "relation": "fwd P282", + "entity": "Q1207739" + }, + { + "split": "heldout", + "kind": "languages", + "valid": true, + "q": "What alphabet is Ulch written in?", + "expect": "Cyrillic script", + "relation": "fwd P282", + "entity": "Q13239" + }, + { + "split": "heldout", + "kind": "languages", + "valid": true, + "q": "What alphabet is Argobba written in?", + "expect": "Ge\u02bdez script", + "relation": "fwd P282", + "entity": "Q29292" + }, + { + "split": "heldout", + "kind": "languages", + "valid": true, + "q": "What alphabet is Bouyei written in?", + "expect": "Latin script", + "relation": "fwd P282", + "entity": "Q35100" + }, + { + "split": "heldout", + "kind": "languages", + "valid": true, + "q": "What alphabet is Hoby\u00f3t written in?", + "expect": "unwritten language", + "relation": "fwd P282", + "entity": "Q33299" + }, + { + "split": "heldout", + "kind": "languages", + "valid": true, + "q": "What alphabet is Reunionese Creole written in?", + "expect": "Latin script", + "relation": "fwd P282", + "entity": "Q13198" + } +] \ No newline at end of file diff --git a/root/specialists/rel-languages/relspec_scorer.py b/root/specialists/rel-languages/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-languages/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-languages/verdict_dev.json b/root/specialists/rel-languages/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..ccb0c2b98690cc05a30c5472fdf6eaf224c04e7f --- /dev/null +++ b/root/specialists/rel-languages/verdict_dev.json @@ -0,0 +1,121 @@ +{ + "id": "rel-languages", + "name": "Oracle7 Relations: Languages", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:19:25Z", + "domain": { + "head": { + "correct": 0, + "false_yes": 0, + "wrong": 0, + "n": 12, + "p50_ms": 528.56, + "fails": [ + [ + "languages", + "Which script is Skolt Sami written in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "languages", + "Which script is Namibian Black German written in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "languages", + "Which script is Kaw\u00e9sqar written in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "languages", + "Which script is Ch\u2019orti\u2019 written in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "languages", + "Which script is Kadazandusun written in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "languages", + "Which script is Palenquero written in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "languages", + "Which script is Car written in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "languages", + "Which script is Ido written in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 11, + "false_yes": 0, + "wrong": 0, + "n": 12, + "p50_ms": 3.38, + "fails": [ + [ + "languages", + "Which script is Car written in?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-languages/verdict_heldout.json b/root/specialists/rel-languages/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..4143c8932676a327942b04bcd368f1e34559cfa8 --- /dev/null +++ b/root/specialists/rel-languages/verdict_heldout.json @@ -0,0 +1,121 @@ +{ + "id": "rel-languages", + "name": "Oracle7 Relations: Languages", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:19:39Z", + "domain": { + "head": { + "correct": 0, + "false_yes": 0, + "wrong": 0, + "n": 12, + "p50_ms": 525.99, + "fails": [ + [ + "languages", + "What alphabet is Kimbundu written in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "languages", + "What alphabet is Klamath-Modoc written in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "languages", + "What alphabet is Poqomchi' written in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "languages", + "What alphabet is Bodo written in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "languages", + "What alphabet is Ripuarian written in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "languages", + "What alphabet is Tocharian written in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "languages", + "What alphabet is Puquina written in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "languages", + "What alphabet is Ulch written in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 11, + "false_yes": 0, + "wrong": 0, + "n": 12, + "p50_ms": 2.98, + "fails": [ + [ + "languages", + "What alphabet is Tocharian written in?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-models/manifest.json b/root/specialists/rel-models/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..5a1491f22863d7671f1455e52b99c06836327b31 --- /dev/null +++ b/root/specialists/rel-models/manifest.json @@ -0,0 +1,77 @@ +{ + "id": "rel-models", + "name": "Oracle7 Relations: Models and fashion designers", + "number": 207, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-models/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-models", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "models", + "kind": "models" + } + }, + "accept": { + "kinds": [ + "models" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-models/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [], + "occupations": [ + 4610556, + 3501317 + ] + }, + "readers": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-models/organ_relation_v2.py b/root/specialists/rel-models/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-models/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-models/readers.json b/root/specialists/rel-models/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..c13089e7f6ebfd5218117298dde068a3062d6c8b --- /dev/null +++ b/root/specialists/rel-models/readers.json @@ -0,0 +1,13 @@ +{ + "keys": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-models/relation_panel_v2.json b/root/specialists/rel-models/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..17e321d0f02e4755310227121545873c7495159d --- /dev/null +++ b/root/specialists/rel-models/relation_panel_v2.json @@ -0,0 +1,1730 @@ +[ + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where was Whitney Port born?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q259385" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where was Drena De Niro born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q541821" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where was Laura Basuki born?", + "expect": "Berlin", + "relation": "fwd P19", + "entity": "Q4259893" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where was Devon Aoki born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q230817" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where was Ireland Baldwin born?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q13561648" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where was Jane Goldman born?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q32661" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where was Tara Sharma born?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q7685136" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where was Sophie Monk born?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q189132" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where was Reynaldo Gianecchini born?", + "expect": "S\u00e3o Paulo", + "relation": "fwd P19", + "entity": "Q2345358" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where was Irene Sharaff born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q450022" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where was Diane Lane born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q255070" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where was Angelyne born?", + "expect": "Poland", + "relation": "fwd P19", + "entity": "Q513037" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "What is the birthplace of Milene Domingues?", + "expect": "S\u00e3o Paulo", + "relation": "fwd P19", + "entity": "Q265122" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "What is the birthplace of Yurizan Beltran?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q3621587" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "What is the birthplace of Ecco2k?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q84323645" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "What is the birthplace of Coco Rocha?", + "expect": "Toronto", + "relation": "fwd P19", + "entity": "Q237928" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "What is the birthplace of Silvia Dionisio?", + "expect": "Rome", + "relation": "fwd P19", + "entity": "Q528080" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "What is the birthplace of Camille Rowe?", + "expect": "Paris", + "relation": "fwd P19", + "entity": "Q2935061" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "What is the birthplace of Jim Palmer?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q1356627" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "What is the birthplace of Margaret Cho?", + "expect": "San Francisco", + "relation": "fwd P19", + "entity": "Q257243" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "What is the birthplace of Helena Ranaldi?", + "expect": "S\u00e3o Paulo", + "relation": "fwd P19", + "entity": "Q3129672" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "What is the birthplace of Rainey Qualley?", + "expect": "United States", + "relation": "fwd P19", + "entity": "Q15069886" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "What is the birthplace of Alessia Marcuzzi?", + "expect": "Rome", + "relation": "fwd P19", + "entity": "Q2247774" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "What is the birthplace of Madeline Carroll?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q254980" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where did Jacqueline Kennedy Onassis die?", + "expect": "New York City", + "relation": "fwd P20", + "entity": "Q165421" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where did Kay Parker die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q261159" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where did Priscilla Lawson die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q286928" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where did Maria Zambaco die?", + "expect": "Paris", + "relation": "fwd P20", + "entity": "Q276064" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where did Halston die?", + "expect": "San Francisco", + "relation": "fwd P20", + "entity": "Q456243" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where did Hessy Levinsons Taft die?", + "expect": "San Francisco", + "relation": "fwd P20", + "entity": "Q18207929" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where did Marie Spartali Stillman die?", + "expect": "London", + "relation": "fwd P20", + "entity": "Q134150" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where did Barbara Strozzi die?", + "expect": "Padua", + "relation": "fwd P20", + "entity": "Q232235" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where did Liz Claiborne die?", + "expect": "New York City", + "relation": "fwd P20", + "entity": "Q465637" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where did Leila Fawzi die?", + "expect": "Cairo", + "relation": "fwd P20", + "entity": "Q12237905" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where did Capucine die?", + "expect": "Lausanne", + "relation": "fwd P20", + "entity": "Q256466" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Where did Mama Cax die?", + "expect": "London", + "relation": "fwd P20", + "entity": "Q79267134" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In which city did Yma Sumac die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q239030" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In which city did Giorgio Armani die?", + "expect": "Milan", + "relation": "fwd P20", + "entity": "Q157054" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In which city did Veronica Franco die?", + "expect": "Venice", + "relation": "fwd P20", + "entity": "Q257493" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In which city did Erica Ash die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q5387851" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In which city did Rick Genest die?", + "expect": "Montreal", + "relation": "fwd P20", + "entity": "Q965951" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In which city did Jiah Khan die?", + "expect": "Mumbai", + "relation": "fwd P20", + "entity": "Q3595158" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In which city did Luisa Casati die?", + "expect": "London", + "relation": "fwd P20", + "entity": "Q461416" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In which city did Rene Bond die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q467715" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In which city did Gayle Hunnicutt die?", + "expect": "London", + "relation": "fwd P20", + "entity": "Q449616" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In which city did Hillevi Rombin die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q2306411" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In which city did Estelle Taylor die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q439655" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In which city did Charlbi Dean die?", + "expect": "New York City", + "relation": "fwd P20", + "entity": "Q101064944" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When was Mikako Ichikawa born?", + "expect": "13 June 1978", + "relation": "fwd P569", + "entity": "Q1042876" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When was Carole Bouquet born?", + "expect": "18 August 1957", + "relation": "fwd P569", + "entity": "Q106607" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When was Harnaaz Sandhu born?", + "expect": "3 March 2000", + "relation": "fwd P569", + "entity": "Q108756568" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When was Aki Maeda born?", + "expect": "11 July 1985", + "relation": "fwd P569", + "entity": "Q1093071" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When was Dana Vespoli born?", + "expect": "22 September 1972", + "relation": "fwd P569", + "entity": "Q1079746" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When was Sarah Mintz born?", + "expect": "1 September 1975", + "relation": "fwd P569", + "entity": "Q1092355" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When was Takumi Kitamura born?", + "expect": "3 November 1997", + "relation": "fwd P569", + "entity": "Q10855755" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When was Giulio Berruti born?", + "expect": "27 September 1984", + "relation": "fwd P569", + "entity": "Q1117917" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When was \u00c9va Henger born?", + "expect": "2 November 1972", + "relation": "fwd P569", + "entity": "Q1035295" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When was Hannah Dodd born?", + "expect": "17 May 1995", + "relation": "fwd P569", + "entity": "Q109291399" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When was Kaho born?", + "expect": "30 June 1991", + "relation": "fwd P569", + "entity": "Q1036386" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When was Deva Cassel born?", + "expect": "12 September 2004", + "relation": "fwd P569", + "entity": "Q112213837" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year was Karen Dianne Baldwin born?", + "expect": "1963", + "relation": "fwd P569", + "entity": "Q1124614" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year was Kiko Mizuhara born?", + "expect": "1990", + "relation": "fwd P569", + "entity": "Q1051455" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year was Charlbi Dean born?", + "expect": "1990", + "relation": "fwd P569", + "entity": "Q101064944" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year was Emmanuelle B\u00e9art born?", + "expect": "1963", + "relation": "fwd P569", + "entity": "Q106458" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year was Lena Horne born?", + "expect": "1917", + "relation": "fwd P569", + "entity": "Q112307" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year was Bonnie Wright born?", + "expect": "1991", + "relation": "fwd P569", + "entity": "Q105466" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year was Lu Han born?", + "expect": "1990", + "relation": "fwd P569", + "entity": "Q10788758" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year was Dylan Riley Synder born?", + "expect": "1997", + "relation": "fwd P569", + "entity": "Q1060778" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year was Lalela Mswane born?", + "expect": "1997", + "relation": "fwd P569", + "entity": "Q108910133" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year was Moran Atias born?", + "expect": "1981", + "relation": "fwd P569", + "entity": "Q1090947" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year was Sei Ashina born?", + "expect": "1983", + "relation": "fwd P569", + "entity": "Q1059441" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year was Black Sherif born?", + "expect": "2002", + "relation": "fwd P569", + "entity": "Q107740983" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When did Miho Nakayama die?", + "expect": "6 December 2024", + "relation": "fwd P570", + "entity": "Q1318594" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When did Xenia Paj\u010din die?", + "expect": "16 March 2010", + "relation": "fwd P570", + "entity": "Q1261526" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When did Hector Hodler die?", + "expect": "31 March 1920", + "relation": "fwd P570", + "entity": "Q12608" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When did Silvana Mangano die?", + "expect": "16 December 1989", + "relation": "fwd P570", + "entity": "Q106919" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When did Doug McClure die?", + "expect": "5 February 1995", + "relation": "fwd P570", + "entity": "Q1251819" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When did Aaliyah die?", + "expect": "25 August 2001", + "relation": "fwd P570", + "entity": "Q11617" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When did Colton Ford die?", + "expect": "19 May 2025", + "relation": "fwd P570", + "entity": "Q1112161" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When did Ottavio Missoni die?", + "expect": "9 May 2013", + "relation": "fwd P570", + "entity": "Q10535842" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When did Y\u016bjir\u014d Ishihara die?", + "expect": "17 July 1987", + "relation": "fwd P570", + "entity": "Q1322220" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When did Berry Berenson die?", + "expect": "11 September 2001", + "relation": "fwd P570", + "entity": "Q1288128" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When did Leila Fawzi die?", + "expect": "12 January 2005", + "relation": "fwd P570", + "entity": "Q12237905" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "When did Lee Radziwill die?", + "expect": "15 February 2019", + "relation": "fwd P570", + "entity": "Q1081523" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year did Dorothy Hart die?", + "expect": "2004", + "relation": "fwd P570", + "entity": "Q1250303" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year did Ai Iijima die?", + "expect": "2008", + "relation": "fwd P570", + "entity": "Q1204617" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year did Sei Ashina die?", + "expect": "2020", + "relation": "fwd P570", + "entity": "Q1059441" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year did Jean Patou die?", + "expect": "1936", + "relation": "fwd P570", + "entity": "Q1229352" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year did Lyubov Panchenko die?", + "expect": "2022", + "relation": "fwd P570", + "entity": "Q111588744" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year did Lena Horne die?", + "expect": "2010", + "relation": "fwd P570", + "entity": "Q112307" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year did Leila Pahlavi die?", + "expect": "2001", + "relation": "fwd P570", + "entity": "Q1136913" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year did Charlbi Dean die?", + "expect": "2022", + "relation": "fwd P570", + "entity": "Q101064944" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year did Camille Claudel die?", + "expect": "1943", + "relation": "fwd P570", + "entity": "Q120582" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year did Mariano Fortuny die?", + "expect": "1949", + "relation": "fwd P570", + "entity": "Q1113061" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year did Oleg Cassini die?", + "expect": "2006", + "relation": "fwd P570", + "entity": "Q1343117" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "In what year did Farrah Fawcett die?", + "expect": "2009", + "relation": "fwd P570", + "entity": "Q102341" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "What nationality was Takumi Kitamura?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q10855755" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "What nationality was Momoka Ariyasu?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q616540" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "What nationality was Rila Fukushima?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q7334155" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "What nationality was Nozomi Sasaki?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q465236" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "What nationality was GACKT?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q44606" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "What nationality was Yui Aragaki?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1137510" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "What nationality was Douglas Coupland?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q322060" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "What nationality was K\u014d Masaki?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q163793" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "What nationality was Yui Mizuno?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q15944170" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "What nationality was Tsubasa Honda?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q3616120" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "What nationality was Dylan Bruce?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q5318700" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "What nationality was Mana Sakura?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q3285138" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Which country was Anne Watanabe a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1055604" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Which country was Sasha Clements a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q16128113" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Which country was Jacqueline MacInnes Wood a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q258211" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Which country was Chelah Horsdal a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q1069031" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Which country was Rena N\u014dnen a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q9016731" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Which country was Kate Todd a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q269705" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Which country was Coco Rocha a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q237928" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Which country was Ken Hirai a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q468166" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Which country was Chieko Kawabe a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q242132" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Which country was Haruka Ayase a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1206963" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Which country was Ken Shimizu a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q3111320" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Which country was Y\u014dko Shimada a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q271854" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Boris Kodjoe married to?", + "expect": "Nicole Ari Parker", + "relation": "fwd P26", + "entity": "Q112167" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Padma Lakshmi married to?", + "expect": "Salman Rushdie", + "relation": "fwd P26", + "entity": "Q464835" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Malin Baryard-Johnsson married to?", + "expect": "Henrik Johnsson", + "relation": "fwd P26", + "entity": "Q450220" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Aamina Sheikh married to?", + "expect": "Mohib Mirza", + "relation": "fwd P26", + "entity": "Q4661481" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Sophia Thomalla married to?", + "expect": "Andy LaPlegua", + "relation": "fwd P26", + "entity": "Q109608" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Gretchen Carlson married to?", + "expect": "Casey Close", + "relation": "fwd P26", + "entity": "Q465597" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Stephanie Romanov married to?", + "expect": "Nick Wechsler", + "relation": "fwd P26", + "entity": "Q441008" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Eesha Koppikhar married to?", + "expect": "Timmy Narang", + "relation": "fwd P26", + "entity": "Q466974" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Myl\u00e8ne Jampano\u00ef married to?", + "expect": "Milind Soman", + "relation": "fwd P26", + "entity": "Q433743" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Annette Vadim married to?", + "expect": "Roger Vadim", + "relation": "fwd P26", + "entity": "Q2534120" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Lupe Fuentes married to?", + "expect": "Evan Seinfeld", + "relation": "fwd P26", + "entity": "Q168543" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Alessandro Gassmann married to?", + "expect": "Sabrina Knaflitz", + "relation": "fwd P26", + "entity": "Q1276918" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who is the spouse of Sherri Saum?", + "expect": "Kamar de los Reyes", + "relation": "fwd P26", + "entity": "Q2573710" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who is the spouse of Aya Hirano?", + "expect": "Masashi Taniguchi", + "relation": "fwd P26", + "entity": "Q237405" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who is the spouse of Namie Amuro?", + "expect": "Sam", + "relation": "fwd P26", + "entity": "Q266676" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who is the spouse of Rene Russo?", + "expect": "Dan Gilroy", + "relation": "fwd P26", + "entity": "Q229612" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who is the spouse of Sunny Mabrey?", + "expect": "Ethan Embry", + "relation": "fwd P26", + "entity": "Q452647" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who is the spouse of Belinda Green?", + "expect": "John Singleton", + "relation": "fwd P26", + "entity": "Q1934976" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who is the spouse of La Toya Jackson?", + "expect": "Jack Gordon", + "relation": "fwd P26", + "entity": "Q217427" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who is the spouse of Judy Ann Santos?", + "expect": "Ryan Agoncillo", + "relation": "fwd P26", + "entity": "Q1928501" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who is the spouse of Akshata Murty?", + "expect": "Rishi Sunak", + "relation": "fwd P26", + "entity": "Q22997426" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who is the spouse of Marzia Kjellberg?", + "expect": "PewDiePie", + "relation": "fwd P26", + "entity": "Q18148459" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who is the spouse of Kazuya Kamenashi?", + "expect": "Minami Tanaka", + "relation": "fwd P26", + "entity": "Q355142" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who is the spouse of Stacy Haiduk?", + "expect": "Bradford Tatum", + "relation": "fwd P26", + "entity": "Q293254" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Gloria Vanderbilt's father?", + "expect": "Reginald Claypoole Vanderbilt", + "relation": "fwd P22", + "entity": "Q264730" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Dylan O'Brien's father?", + "expect": "Patrick O'Brien", + "relation": "fwd P22", + "entity": "Q714458" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Tina Knowles's father?", + "expect": "Lumis Beyinc\u00e9", + "relation": "fwd P22", + "entity": "Q2623520" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Khushali Kumar's father?", + "expect": "Gulshan Kumar", + "relation": "fwd P22", + "entity": "Q65640372" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Shoko Nakagawa's father?", + "expect": "Katsuhiko Nakagawa", + "relation": "fwd P22", + "entity": "Q685028" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Alessandro Gassmann's father?", + "expect": "Vittorio Gassman", + "relation": "fwd P22", + "entity": "Q1276918" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Ang\u00e8le's father?", + "expect": "Marka", + "relation": "fwd P22", + "entity": "Q45192617" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Lewis Tan's father?", + "expect": "Philip Tan", + "relation": "fwd P22", + "entity": "Q27244661" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Kaia Gerber's father?", + "expect": "Rande Gerber", + "relation": "fwd P22", + "entity": "Q22673974" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Patrick Schwarzenegger's father?", + "expect": "Arnold Schwarzenegger", + "relation": "fwd P22", + "entity": "Q901541" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Berg\u00fczar Korel's father?", + "expect": "Tanju Korel", + "relation": "fwd P22", + "entity": "Q1271784" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Princess Maria-Olympia of Greece and Denmark's father?", + "expect": "Pavlos, Crown Prince of Greece", + "relation": "fwd P22", + "entity": "Q11341012" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the father of Gabriella Wilde?", + "expect": "John Anstruther-Gough-Calthorpe", + "relation": "fwd P22", + "entity": "Q371860" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the father of Brian J. White?", + "expect": "Jo Jo White", + "relation": "fwd P22", + "entity": "Q1762270" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the father of Kabir Bedi?", + "expect": "Baba Bedi XVI", + "relation": "fwd P22", + "entity": "Q312719" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the father of Arvind Swamy?", + "expect": "Delhi Kumar", + "relation": "fwd P22", + "entity": "Q258005" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the father of Morgan Lily?", + "expect": "Andy Gross", + "relation": "fwd P22", + "entity": "Q268076" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the father of Shazahn Padamsee?", + "expect": "Alyque Padamsee", + "relation": "fwd P22", + "entity": "Q7491730" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the father of Laura Prepon?", + "expect": "Michael Prepon", + "relation": "fwd P22", + "entity": "Q171567" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the father of Anna Maria Perez de Tagle?", + "expect": "Archie P\u00e9rez de Tagle", + "relation": "fwd P22", + "entity": "Q233412" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the father of Chunky Pandey?", + "expect": "Sharad Panday", + "relation": "fwd P22", + "entity": "Q3676086" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the father of Leila Pahlavi?", + "expect": "Mohammad Reza I of Iran", + "relation": "fwd P22", + "entity": "Q1136913" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the father of Lily Aldridge?", + "expect": "Alan Aldridge", + "relation": "fwd P22", + "entity": "Q242368" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the father of Sadie Frost?", + "expect": "David Vaughan", + "relation": "fwd P22", + "entity": "Q283703" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Joan Bennett Kennedy's mother?", + "expect": "Virginia Joan Stead", + "relation": "fwd P25", + "entity": "Q441424" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Poppy Delevingne's mother?", + "expect": "Pandora Stevens", + "relation": "fwd P25", + "entity": "Q1383000" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Lily-Rose Depp's mother?", + "expect": "Vanessa Paradis", + "relation": "fwd P25", + "entity": "Q20670730" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Rumer Willis's mother?", + "expect": "Demi Moore", + "relation": "fwd P25", + "entity": "Q234566" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Julio Iglesias Jr.'s mother?", + "expect": "Isabel Preysler", + "relation": "fwd P25", + "entity": "Q1832274" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Amelia Windsor's mother?", + "expect": "Sylvana Windsor, Countess of St Andrews", + "relation": "fwd P25", + "entity": "Q3743378" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Weronika Rosati's mother?", + "expect": "Teresa Rosati", + "relation": "fwd P25", + "entity": "Q2789894" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Ang\u00e8le's mother?", + "expect": "Laurence Bibot", + "relation": "fwd P25", + "entity": "Q45192617" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Yumi Adachi's mother?", + "expect": "Yuri Adachi", + "relation": "fwd P25", + "entity": "Q2663922" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Anita Pallenberg's mother?", + "expect": "Paula Wiederhold", + "relation": "fwd P25", + "entity": "Q60306" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Count Nikolai of Monpezat's mother?", + "expect": "Alexandra Manley, Countess of Frederiksborg", + "relation": "fwd P25", + "entity": "Q241033" + }, + { + "split": "dev", + "kind": "models", + "valid": true, + "q": "Who was Natacha Rambova's mother?", + "expect": "Winifred Kimball", + "relation": "fwd P25", + "entity": "Q458874" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the mother of Diane von F\u00fcrstenberg?", + "expect": "Liliane Nahmias", + "relation": "fwd P25", + "entity": "Q272438" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the mother of Mischa Barton?", + "expect": "Nuala Quinn-Barton", + "relation": "fwd P25", + "entity": "Q207458" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the mother of Ali Lohan?", + "expect": "Dina Lohan", + "relation": "fwd P25", + "entity": "Q264326" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the mother of Sara Michael Foster?", + "expect": "Rebecca Dyer", + "relation": "fwd P25", + "entity": "Q237897" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the mother of Carolyn Bessette-Kennedy?", + "expect": "Anne Messina", + "relation": "fwd P25", + "entity": "Q449173" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the mother of Oliver Jackson-Cohen?", + "expect": "Betty Jackson", + "relation": "fwd P25", + "entity": "Q3132212" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the mother of Kendall Jenner?", + "expect": "Kris Jenner", + "relation": "fwd P25", + "entity": "Q1375057" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the mother of Rob Pilatus?", + "expect": "Antonie Poschenrieder Pilatus", + "relation": "fwd P25", + "entity": "Q64949" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the mother of Zo\u00eb Lund?", + "expect": "Barbara Lekberg", + "relation": "fwd P25", + "entity": "Q1432551" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the mother of Lucille Ricksen?", + "expect": "Ingeborg Nielsen Ericksen", + "relation": "fwd P25", + "entity": "Q458228" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the mother of Rooney Mara?", + "expect": "Kathleen McNulty Mara", + "relation": "fwd P25", + "entity": "Q228766" + }, + { + "split": "heldout", + "kind": "models", + "valid": true, + "q": "Who was the mother of Yuna?", + "expect": "Anum Wahab", + "relation": "fwd P25", + "entity": "Q606702" + } +] \ No newline at end of file diff --git a/root/specialists/rel-models/relspec_scorer.py b/root/specialists/rel-models/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-models/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-models/verdict_dev.json b/root/specialists/rel-models/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..656e77b6f5f4cda43433e7f892e5a35a5e71ae63 --- /dev/null +++ b/root/specialists/rel-models/verdict_dev.json @@ -0,0 +1,114 @@ +{ + "id": "rel-models", + "name": "Oracle7 Relations: Models and fashion designers", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:32:27Z", + "domain": { + "head": { + "correct": 10, + "false_yes": 0, + "wrong": 18, + "n": 96, + "p50_ms": 474.33, + "fails": [ + [ + "models", + "Where was Drena De Niro born?", + "deliberation:where", + "[ev:direct] Drena De Niro (born September 3, 1970) is an American actress and filmmaker wh" + ], + [ + "models", + "Where was Devon Aoki born?", + "unverified:factoid:page", + "I found a passage that may be related, but I can't verify it answers your question: \"Devon" + ], + [ + "models", + "Where was Ireland Baldwin born?", + "deliberation:where", + "[ev:direct] She also wrote that she had an abortion in response to an unrelated incident, " + ], + [ + "models", + "Where was Tara Sharma born?", + "verified:cube>PLACE|factoid:page", + "English. Tara Sharma (born 11 January 1977) is an English actress, model, entrepreneur, cr" + ], + [ + "models", + "Where was Sophie Monk born?", + "deliberation:where", + "[ev:direct] She was a member of the pop girl group Bardot, winners of the first season of " + ], + [ + "models", + "Where was Irene Sharaff born?", + "deliberation:where", + "[ev:direct] She was its first recipient in 1993. [enwiki_88914cd05d7e3dd71afcf678]" + ], + [ + "models", + "Where was Angelyne born?", + "deliberation:where", + "[ev:direct] She is known for being in many billboards in and around Los Angeles, Californi" + ], + [ + "models", + "Where did Jacqueline Kennedy Onassis die?", + "deliberation:where", + "[ev:direct] In 1994 she died in her sleep from non-Hodgkin's lymphoma in New York. [simple" + ] + ] + }, + "spec": { + "correct": 96, + "false_yes": 0, + "wrong": 0, + "n": 96, + "p50_ms": 4.14, + "fails": [] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-models/verdict_heldout.json b/root/specialists/rel-models/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..2ad830d34c1e6de53d47f9b932507da7824563b6 --- /dev/null +++ b/root/specialists/rel-models/verdict_heldout.json @@ -0,0 +1,121 @@ +{ + "id": "rel-models", + "name": "Oracle7 Relations: Models and fashion designers", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:33:15Z", + "domain": { + "head": { + "correct": 25, + "false_yes": 0, + "wrong": 5, + "n": 96, + "p50_ms": 514.95, + "fails": [ + [ + "models", + "What is the birthplace of Milene Domingues?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "models", + "What is the birthplace of Yurizan Beltran?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "models", + "What is the birthplace of Ecco2k?", + "organ:math>evaluate", + "[ev:derived] 2*k. In steps: read 2*k; then simplify. Checked: equivalent to the input at r" + ], + [ + "models", + "What is the birthplace of Coco Rocha?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "models", + "What is the birthplace of Silvia Dionisio?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "models", + "What is the birthplace of Camille Rowe?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "models", + "What is the birthplace of Jim Palmer?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "models", + "What is the birthplace of Margaret Cho?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ] + ] + }, + "spec": { + "correct": 95, + "false_yes": 0, + "wrong": 0, + "n": 96, + "p50_ms": 3.91, + "fails": [ + [ + "models", + "Who was the mother of Yuna?", + "specialist:rel-models>unverified", + "I can't verify the son of of Yuna from my records, so I won't guess." + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-museums/manifest.json b/root/specialists/rel-museums/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..0edef9e6f616613947e1b0e9839ede3c3d7062dd --- /dev/null +++ b/root/specialists/rel-museums/manifest.json @@ -0,0 +1,71 @@ +{ + "id": "rel-museums", + "name": "Oracle7 Relations: Museums", + "number": 154, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-museums/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-museums", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "museums", + "kind": "museums" + } + }, + "accept": { + "kinds": [ + "museums" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-museums/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [ + 33506 + ], + "occupations": [] + }, + "readers": [ + "84", + "571", + "17" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-museums/organ_relation_v2.py b/root/specialists/rel-museums/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-museums/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-museums/patterns.json b/root/specialists/rel-museums/patterns.json new file mode 100644 index 0000000000000000000000000000000000000000..65febd86ae95e3f92049c1a88047d462ee424ecd --- /dev/null +++ b/root/specialists/rel-museums/patterns.json @@ -0,0 +1,8 @@ +{ + "fwd|which|architect": [ + 84, + 1.0, + 1.0, + 12 + ] +} \ No newline at end of file diff --git a/root/specialists/rel-museums/readers.json b/root/specialists/rel-museums/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..0abf7c7cbbb68961826dbd0308f6c96ccc4e3e78 --- /dev/null +++ b/root/specialists/rel-museums/readers.json @@ -0,0 +1,8 @@ +{ + "keys": [ + "84", + "571", + "17" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-museums/relation_panel_v2.json b/root/specialists/rel-museums/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..cbb05d5353859aaf182bbb4fc912f662fdd10947 --- /dev/null +++ b/root/specialists/rel-museums/relation_panel_v2.json @@ -0,0 +1,632 @@ +[ + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "Who was the architect of Riverside Museum?", + "expect": "Zaha Hadid", + "relation": "fwd P84", + "entity": "Q7338547" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "Who was the architect of Complejo Cultural Los Pinos?", + "expect": "Mart\u00ednez del R\u00edo family", + "relation": "fwd P84", + "entity": "Q2418266" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "Who was the architect of Humboldt Forum?", + "expect": "Franco Stella", + "relation": "fwd P84", + "entity": "Q20196262" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "Who was the architect of Hirshhorn Museum and Sculpture Garden?", + "expect": "Gordon Bunshaft", + "relation": "fwd P84", + "entity": "Q1620553" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "Who was the architect of Museum of the Americas?", + "expect": "Luis Moya Blanco", + "relation": "fwd P84", + "entity": "Q2568412" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "Who was the architect of The Frick Collection?", + "expect": "Carr\u00e8re and Hastings", + "relation": "fwd P84", + "entity": "Q682827" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "Who was the architect of Stockholm Observatory?", + "expect": "Carl H\u00e5rleman", + "relation": "fwd P84", + "entity": "Q681497" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "Who was the architect of National Gallery of Victoria?", + "expect": "Mario Bellini", + "relation": "fwd P84", + "entity": "Q1464509" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "Who was the architect of Palazzo Medici Riccardi?", + "expect": "Michelozzo", + "relation": "fwd P84", + "entity": "Q911047" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "Who was the architect of Barbican Centre?", + "expect": "Chamberlin, Powell and Bon", + "relation": "fwd P84", + "entity": "Q653858" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "Who was the architect of Mus\u00e9e d'Orsay?", + "expect": "Victor Laloux", + "relation": "fwd P84", + "entity": "Q23402" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "Who was the architect of Monastery of S\u00e3o Vicente de Fora?", + "expect": "Filippo Terzi", + "relation": "fwd P84", + "entity": "Q1776168" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Who designed Mus\u00e9e des Beaux-Arts de Rouen?", + "expect": "Louis Sauvageot", + "relation": "fwd P84", + "entity": "Q3086934" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Who designed Cliveden?", + "expect": "Charles Barry", + "relation": "fwd P84", + "entity": "Q2464716" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Who designed Macao Science Center?", + "expect": "Pei Architects", + "relation": "fwd P84", + "entity": "Q3084238" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Who designed Hofburg Palace?", + "expect": "Filiberto Lucchese", + "relation": "fwd P84", + "entity": "Q46242" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Who designed Academy of Fine Arts Vienna?", + "expect": "Theophil Hansen", + "relation": "fwd P84", + "entity": "Q414219" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Who designed Horniman Museum and Gardens?", + "expect": "Charles Harrison Townsend", + "relation": "fwd P84", + "entity": "Q1628487" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Who designed Auckland War Memorial Museum T\u0101maki Paenga Hira?", + "expect": "Grierson, Aimer and Draffin", + "relation": "fwd P84", + "entity": "Q758657" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Who designed Canterbury Museum?", + "expect": "Benjamin Mountfort", + "relation": "fwd P84", + "entity": "Q1033769" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Who designed Hammer Museum?", + "expect": "Edward Larrabee Barnes", + "relation": "fwd P84", + "entity": "Q677561" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Who designed Staatliche Kunsthalle Karlsruhe?", + "expect": "Heinrich H\u00fcbsch", + "relation": "fwd P84", + "entity": "Q658725" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Who designed Palazzo Schifanoia?", + "expect": "Pietro Benvenuto degli Ordini", + "relation": "fwd P84", + "entity": "Q1276962" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Who designed National Museum of Qatar?", + "expect": "Jean Nouvel", + "relation": "fwd P84", + "entity": "Q3084218" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "When was Royal Asiatic Society of Great Britain and Ireland founded?", + "expect": "1823", + "relation": "fwd P571", + "entity": "Q1417172" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "When was Museo Poldi Pezzoli founded?", + "expect": "25 April 1881", + "relation": "fwd P571", + "entity": "Q1190657" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "When was Carnegie Museum of Art founded?", + "expect": "1895", + "relation": "fwd P571", + "entity": "Q1043967" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "When was Shanghai Museum founded?", + "expect": "1952", + "relation": "fwd P571", + "entity": "Q1051293" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "When was The Old Town founded?", + "expect": "1914", + "relation": "fwd P571", + "entity": "Q1186756" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "When was Pinacoteca di Brera founded?", + "expect": "1776", + "relation": "fwd P571", + "entity": "Q150066" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "When was Casa Loma founded?", + "expect": "1914", + "relation": "fwd P571", + "entity": "Q1046446" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "When was Royal Museum of Fine Arts Antwerp founded?", + "expect": "5 May 1810", + "relation": "fwd P571", + "entity": "Q1471477" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "When was Museo dell'Opera del Duomo founded?", + "expect": "1891", + "relation": "fwd P571", + "entity": "Q1200696" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "When was MACBA Barcelona Museum of Contemporary Art founded?", + "expect": "28 November 1995", + "relation": "fwd P571", + "entity": "Q1067140" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "When was Institute for the Study of Ancient Cultures, West Asia & North Africa founded?", + "expect": "1919", + "relation": "fwd P571", + "entity": "Q1276053" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "When was Freer Gallery of Art founded?", + "expect": "1923", + "relation": "fwd P571", + "entity": "Q1075126" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "In what year was Wartburg established?", + "expect": "1067", + "relation": "fwd P571", + "entity": "Q151545" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "In what year was London Transport Museum established?", + "expect": "1980", + "relation": "fwd P571", + "entity": "Q1541098" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "In what year was Gu\u00e9delon Castle established?", + "expect": "1997", + "relation": "fwd P571", + "entity": "Q1557685" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "In what year was Alte Pinakothek established?", + "expect": "1836", + "relation": "fwd P571", + "entity": "Q154568" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "In what year was Wereldmuseum Amsterdam established?", + "expect": "1864", + "relation": "fwd P571", + "entity": "Q1131589" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "In what year was National Museum of Modern Art, Kyoto established?", + "expect": "1963", + "relation": "fwd P571", + "entity": "Q1055628" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "In what year was Peggy Guggenheim Collection established?", + "expect": "1980", + "relation": "fwd P571", + "entity": "Q1049033" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "In what year was National Museum of Natural History established?", + "expect": "1910", + "relation": "fwd P571", + "entity": "Q148554" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "In what year was Mus\u00e9e Marmottan Monet established?", + "expect": "1934", + "relation": "fwd P571", + "entity": "Q1327886" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "In what year was Brera Astronomical Observatory established?", + "expect": "1764", + "relation": "fwd P571", + "entity": "Q1580885" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "In what year was National Museum of Art, Architecture and Design established?", + "expect": "2003", + "relation": "fwd P571", + "entity": "Q1132918" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "In what year was Mus\u00e9e des Arts et M\u00e9tiers established?", + "expect": "1794", + "relation": "fwd P571", + "entity": "Q1538826" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "In which country is Nagasaki Atomic Bomb Museum?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1099077" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "In which country is Ohara Museum of Art?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q2977589" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "In which country is Royal Ontario Museum?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q649250" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "In which country is Carleton University?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q1041737" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "In which country is Edo-Tokyo Open Air Architectural Museum?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1051229" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "In which country is Montreal Museum of Fine Arts?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q860812" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "In which country is Canadian Museum of Nature?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q1032232" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "In which country is Hakone Open-Air Museum?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1134422" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "In which country is Mus\u00e9e national des beaux-arts du Qu\u00e9bec?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q2338135" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "In which country is Casa Loma?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q1046446" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "In which country is HMCS Haida?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q931718" + }, + { + "split": "dev", + "kind": "museums", + "valid": true, + "q": "In which country is Art Gallery of Ontario?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q670250" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Which country is The National Museum of Modern Art in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1359908" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Which country is National Art Center, Tokyo in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1362638" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Which country is Hiroshima Castle in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q41977" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Which country is The Aga Khan Museum in?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q4690937" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Which country is Hiroshima Peace Memorial Museum in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1200076" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Which country is Bata Shoe Museum in?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q810693" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Which country is National Gallery of Canada in?", + "expect": "Canada", + "relation": "fwd P17", + "entity": "Q1068063" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Which country is Miho Museum in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1268542" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Which country is National Museum of Western Art in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1362629" + }, + { + "split": "heldout", + "kind": "museums", + "valid": true, + "q": "Which country is National Museum of Modern Art, Kyoto in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1055628" + } +] \ No newline at end of file diff --git a/root/specialists/rel-museums/relspec_scorer.py b/root/specialists/rel-museums/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-museums/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-museums/verdict_dev.json b/root/specialists/rel-museums/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..8181b78267f83f09ebe28df207abf3cbf300f7a9 --- /dev/null +++ b/root/specialists/rel-museums/verdict_dev.json @@ -0,0 +1,121 @@ +{ + "id": "rel-museums", + "name": "Oracle7 Relations: Museums", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:09:49Z", + "domain": { + "head": { + "correct": 16, + "false_yes": 0, + "wrong": 3, + "n": 36, + "p50_ms": 1748.17, + "fails": [ + [ + "museums", + "Who was the architect of Riverside Museum?", + "unverified:factoid:page", + "I found a passage that may be related, but I can't verify it answers your question: \"The R" + ], + [ + "museums", + "Who was the architect of Complejo Cultural Los Pinos?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "museums", + "Who was the architect of Humboldt Forum?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "museums", + "Who was the architect of Hirshhorn Museum and Sculpture Garden?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "museums", + "Who was the architect of Museum of the Americas?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "museums", + "Who was the architect of The Frick Collection?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "museums", + "Who was the architect of Stockholm Observatory?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "museums", + "Who was the architect of Palazzo Medici Riccardi?", + "unverified:compose:bridge", + "I found a passage that may be related, but I can't verify it answers your question: \"In An" + ] + ] + }, + "spec": { + "correct": 35, + "false_yes": 0, + "wrong": 0, + "n": 36, + "p50_ms": 5.14, + "fails": [ + [ + "museums", + "When was Museo dell'Opera del Duomo founded?", + "specialist:rel-museums>unverified", + "I can't verify the year written of Museo dell'Opera del Duomo from my records, so I won't " + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-museums/verdict_heldout.json b/root/specialists/rel-museums/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..3a7cd6c7263aa527be106793097dcab0d9c94a8e --- /dev/null +++ b/root/specialists/rel-museums/verdict_heldout.json @@ -0,0 +1,127 @@ +{ + "id": "rel-museums", + "name": "Oracle7 Relations: Museums", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:11:01Z", + "domain": { + "head": { + "correct": 11, + "false_yes": 0, + "wrong": 1, + "n": 34, + "p50_ms": 1664.03, + "fails": [ + [ + "museums", + "Who designed Mus\u00e9e des Beaux-Arts de Rouen?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "museums", + "Who designed Macao Science Center?", + "factoid:withheld|vessel:receipt", + "I have no admitted record that answers that about \"Macao Science Center\", so I will not gu" + ], + [ + "museums", + "Who designed Hofburg Palace?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "museums", + "Who designed Academy of Fine Arts Vienna?", + "unverified:factoid:fts", + "I found a passage that may be related, but I can't verify it answers your question: \"A gra" + ], + [ + "museums", + "Who designed Auckland War Memorial Museum T\u0101maki Paenga Hira?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "museums", + "Who designed Canterbury Museum?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "museums", + "Who designed Hammer Museum?", + "unverified:factoid:fts", + "I found a passage that may be related, but I can't verify it answers your question: \"The H" + ], + [ + "museums", + "Who designed Staatliche Kunsthalle Karlsruhe?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 32, + "false_yes": 0, + "wrong": 0, + "n": 34, + "p50_ms": 3.53, + "fails": [ + [ + "museums", + "In what year was National Museum of Natural History established?", + "specialist:rel-museums>unverified", + "I can't verify the year written of National Museum of Natural History from my records, so " + ], + [ + "museums", + "Which country is National Gallery of Canada in?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-musicians/manifest.json b/root/specialists/rel-musicians/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..abd9853ce3ef29c6177fd2d00821310a110b2d42 --- /dev/null +++ b/root/specialists/rel-musicians/manifest.json @@ -0,0 +1,82 @@ +{ + "id": "rel-musicians", + "name": "Oracle7 Relations: Instrumentalists", + "number": 193, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-musicians/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-musicians", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "musicians", + "kind": "musicians" + } + }, + "accept": { + "kinds": [ + "musicians" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-musicians/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [], + "occupations": [ + 639669, + 855091, + 486748, + 1259917, + 386854 + ] + }, + "readers": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25", + "1303", + "463" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-musicians/organ_relation_v2.py b/root/specialists/rel-musicians/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-musicians/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-musicians/readers.json b/root/specialists/rel-musicians/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..057b7131ec92a3b181fbc0a556634ee9e4286976 --- /dev/null +++ b/root/specialists/rel-musicians/readers.json @@ -0,0 +1,31 @@ +{ + "keys": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25", + "1303", + "463" + ], + "dropped": [ + [ + "19", + "fwd", + 0 + ], + [ + "19", + "fwd", + 1 + ], + [ + "27", + "fwd", + 0 + ] + ] +} \ No newline at end of file diff --git a/root/specialists/rel-musicians/relation_panel_v2.json b/root/specialists/rel-musicians/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..3fddb38bdcc7268adef2c73ac6293a468dee2b4f --- /dev/null +++ b/root/specialists/rel-musicians/relation_panel_v2.json @@ -0,0 +1,2162 @@ +[ + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where was Wilhelmine of Prussia, Margravine of Brandenburg-Bayreuth born?", + "expect": "Berlin", + "relation": "fwd P19", + "entity": "Q237740" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where was Nikolai Fraiture born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q1195235" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where was Sophie Gay born?", + "expect": "Paris", + "relation": "fwd P19", + "entity": "Q273200" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where was John P. Hammond born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q1368185" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where was Cindy Breakspeare born?", + "expect": "Toronto", + "relation": "fwd P19", + "entity": "Q253612" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where was Emily Meade born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q460503" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where was Paul Sacher born?", + "expect": "Basel", + "relation": "fwd P19", + "entity": "Q124102" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where was Julian Rachlin born?", + "expect": "Vilnius", + "relation": "fwd P19", + "entity": "Q78796" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where was Marc Dorcel born?", + "expect": "Paris", + "relation": "fwd P19", + "entity": "Q951882" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where was Jack Haley born?", + "expect": "Boston", + "relation": "fwd P19", + "entity": "Q927057" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where was Owen Pallett born?", + "expect": "Toronto", + "relation": "fwd P19", + "entity": "Q162045" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where was Phil LaMarr born?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q356541" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "What is the birthplace of Mal Waldron?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q955767" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "What is the birthplace of Michael Shrieve?", + "expect": "San Francisco", + "relation": "fwd P19", + "entity": "Q1929406" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "What is the birthplace of Leonard Feather?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q1382271" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "What is the birthplace of Josiah Warren?", + "expect": "Boston", + "relation": "fwd P19", + "entity": "Q931005" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "What is the birthplace of Kenny Drew?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q721315" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "What is the birthplace of Simone Cristicchi?", + "expect": "Rome", + "relation": "fwd P19", + "entity": "Q257339" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "What is the birthplace of Alan Silvestri?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q313537" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "What is the birthplace of Steve Lukather?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q318483" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "What is the birthplace of Branscombe Richmond?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q131866" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "What is the birthplace of Nikolaus Harnoncourt?", + "expect": "Berlin", + "relation": "fwd P19", + "entity": "Q78526" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "What is the birthplace of Terri Nunn?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q434025" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "What is the birthplace of Five for Fighting?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q337844" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where did Klaus Egge die?", + "expect": "Oslo", + "relation": "fwd P20", + "entity": "Q610575" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where did Lizabeth Scott die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q264011" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where did Walter Ruttmann die?", + "expect": "Berlin", + "relation": "fwd P20", + "entity": "Q77365" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where did Vladimir de Pachmann die?", + "expect": "Rome", + "relation": "fwd P20", + "entity": "Q674861" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where did Jerry Finn die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q586229" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where did Charles Mackerras die?", + "expect": "London", + "relation": "fwd P20", + "entity": "Q322172" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where did Nicolai Ghiaurov die?", + "expect": "Modena", + "relation": "fwd P20", + "entity": "Q363430" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where did Richard Rodney Bennett die?", + "expect": "New York City", + "relation": "fwd P20", + "entity": "Q959863" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where did Radka Toneff die?", + "expect": "Oslo", + "relation": "fwd P20", + "entity": "Q446644" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where did Jimmie Rodgers die?", + "expect": "New York City", + "relation": "fwd P20", + "entity": "Q366358" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where did Gisela May die?", + "expect": "Berlin", + "relation": "fwd P20", + "entity": "Q452526" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Where did Cathy Berberian die?", + "expect": "Rome", + "relation": "fwd P20", + "entity": "Q285462" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In which city did Vakhtang Kikabidze die?", + "expect": "Tbilisi", + "relation": "fwd P20", + "entity": "Q380280" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In which city did Karen Dior die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q2501637" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In which city did K\u00e2tip \u00c7elebi die?", + "expect": "Istanbul", + "relation": "fwd P20", + "entity": "Q390123" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In which city did Michael Glinka die?", + "expect": "Berlin", + "relation": "fwd P20", + "entity": "Q181885" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In which city did Claude Prosper Jolyot de Cr\u00e9billon die?", + "expect": "Paris", + "relation": "fwd P20", + "entity": "Q733161" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In which city did Allan Jones die?", + "expect": "New York City", + "relation": "fwd P20", + "entity": "Q2837729" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In which city did Gillo Pontecorvo die?", + "expect": "Rome", + "relation": "fwd P20", + "entity": "Q53031" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In which city did Marisa Del Frate die?", + "expect": "Rome", + "relation": "fwd P20", + "entity": "Q1899326" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In which city did Pierre Attaingnant die?", + "expect": "Paris", + "relation": "fwd P20", + "entity": "Q644849" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In which city did Nicolas Slonimsky die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q555602" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In which city did Mike Bloomfield die?", + "expect": "San Francisco", + "relation": "fwd P20", + "entity": "Q919156" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In which city did Balys Dvarionas die?", + "expect": "Vilnius", + "relation": "fwd P20", + "entity": "Q805870" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When was Giacomo Meyerbeer born?", + "expect": "5 September 1791", + "relation": "fwd P569", + "entity": "Q105237" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When was Bucky Pizzarelli born?", + "expect": "9 January 1926", + "relation": "fwd P569", + "entity": "Q1000366" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When was Charles Bradley born?", + "expect": "5 November 1948", + "relation": "fwd P569", + "entity": "Q1063796" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When was Carl Switzer born?", + "expect": "7 August 1927", + "relation": "fwd P569", + "entity": "Q1040783" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When was Aki Maeda born?", + "expect": "11 July 1985", + "relation": "fwd P569", + "entity": "Q1093071" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When was Dori Ghezzi born?", + "expect": "30 March 1946", + "relation": "fwd P569", + "entity": "Q1052374" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When was Chulabhorn, Princess Srisavangavadhana born?", + "expect": "4 July 1957", + "relation": "fwd P569", + "entity": "Q1089410" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When was Andrei Ursu born?", + "expect": "16 January 1993", + "relation": "fwd P569", + "entity": "Q111009310" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When was Clarence \"Gatemouth\" Brown born?", + "expect": "18 April 1924", + "relation": "fwd P569", + "entity": "Q1095432" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When was Sheldon Riley born?", + "expect": "14 March 1999", + "relation": "fwd P569", + "entity": "Q111020242" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When was Che'Nelle born?", + "expect": "10 March 1983", + "relation": "fwd P569", + "entity": "Q1068634" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When was Stig Olin born?", + "expect": "11 September 1920", + "relation": "fwd P569", + "entity": "Q1040407" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year was Anna-Maria Ravnopolska-Dean born?", + "expect": "1960", + "relation": "fwd P569", + "entity": "Q107467" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year was Toshiyuki Nishida born?", + "expect": "1947", + "relation": "fwd P569", + "entity": "Q1060054" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year was Fyodor Stravinsky born?", + "expect": "1843", + "relation": "fwd P569", + "entity": "Q1001867" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year was Suho born?", + "expect": "1991", + "relation": "fwd P569", + "entity": "Q10822003" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year was Yuri Kasparyan born?", + "expect": "1963", + "relation": "fwd P569", + "entity": "Q1068795" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year was La Zarra born?", + "expect": "1987", + "relation": "fwd P569", + "entity": "Q111269595" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year was Keisya Levronka born?", + "expect": "2003", + "relation": "fwd P569", + "entity": "Q109429908" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year was Mark Linkous born?", + "expect": "1962", + "relation": "fwd P569", + "entity": "Q1031340" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year was Clifton Chenier born?", + "expect": "1925", + "relation": "fwd P569", + "entity": "Q1101377" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year was Micaela Sch\u00e4fer born?", + "expect": "1983", + "relation": "fwd P569", + "entity": "Q101524" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year was Ture Rangstr\u00f6m born?", + "expect": "1884", + "relation": "fwd P569", + "entity": "Q1117342" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year was Clifford Grey born?", + "expect": "1887", + "relation": "fwd P569", + "entity": "Q1101276" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When did Spencer Williams die?", + "expect": "14 July 1965", + "relation": "fwd P570", + "entity": "Q1282480" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When did Roger D\u00e9sormi\u00e8re die?", + "expect": "25 October 1963", + "relation": "fwd P570", + "entity": "Q1349225" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When did Johnnie Ray die?", + "expect": "24 February 1990", + "relation": "fwd P570", + "entity": "Q1198056" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When did Lorin Maazel die?", + "expect": "13 July 2014", + "relation": "fwd P570", + "entity": "Q117710" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When did Carlos di Sarli die?", + "expect": "12 January 1960", + "relation": "fwd P570", + "entity": "Q1042863" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When did Jimmy McCulloch die?", + "expect": "27 September 1979", + "relation": "fwd P570", + "entity": "Q1347221" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When did Jeanne Moreau die?", + "expect": "31 July 2017", + "relation": "fwd P570", + "entity": "Q106099" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When did Don Gibson die?", + "expect": "17 November 2003", + "relation": "fwd P570", + "entity": "Q1239171" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When did Leslie West die?", + "expect": "23 December 2020", + "relation": "fwd P570", + "entity": "Q1344554" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When did Claude Nobs die?", + "expect": "10 January 2013", + "relation": "fwd P570", + "entity": "Q116313" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When did Robert Lockwood Jr. die?", + "expect": "21 November 2006", + "relation": "fwd P570", + "entity": "Q1351212" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "When did Gary Mounfield die?", + "expect": "20 November 2025", + "relation": "fwd P570", + "entity": "Q118154" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year did Jos\u00e9 Alfredo Jim\u00e9nez die?", + "expect": "1973", + "relation": "fwd P570", + "entity": "Q1352007" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year did Ramses Shaffy die?", + "expect": "2009", + "relation": "fwd P570", + "entity": "Q1343144" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year did Paul Kammerer die?", + "expect": "1926", + "relation": "fwd P570", + "entity": "Q113522" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year did George Adams die?", + "expect": "1992", + "relation": "fwd P570", + "entity": "Q1331323" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year did Clifford Grey die?", + "expect": "1941", + "relation": "fwd P570", + "entity": "Q1101276" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year did Jimmy Rogers die?", + "expect": "1997", + "relation": "fwd P570", + "entity": "Q1347919" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year did Dick Foran die?", + "expect": "1979", + "relation": "fwd P570", + "entity": "Q1209649" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year did Pat Carroll die?", + "expect": "2022", + "relation": "fwd P570", + "entity": "Q1264306" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year did Eleazar de Carvalho die?", + "expect": "1996", + "relation": "fwd P570", + "entity": "Q1240481" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year did Jean Guillou die?", + "expect": "2019", + "relation": "fwd P570", + "entity": "Q1349794" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year did Adolphe Appia die?", + "expect": "1928", + "relation": "fwd P570", + "entity": "Q124077" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "In what year did Jaki Byard die?", + "expect": "1999", + "relation": "fwd P570", + "entity": "Q1346401" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What nationality was Stan Rogers?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q3025760" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What nationality was Ky\u014dko Koizumi?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1197212" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What nationality was Nobuhiko Okamoto?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1345336" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What nationality was Ayaka \u014chashi?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q9125022" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What nationality was Maaya Sakamoto?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q235216" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What nationality was Takashi Sorimachi?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q555515" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What nationality was Yuki Kajiura?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q132433" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What nationality was Kathleen Howard?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q975874" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What nationality was Megumi Han?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q8966502" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What nationality was Joanna Shimkus?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q432234" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What nationality was Alexander Rybak?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q131259" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What nationality was Einar Selvik?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q4575153" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which country was Kanon Suzuki a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1201353" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which country was Ni-Ki a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q108043218" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which country was Mai Kuraki a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q236799" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which country was Lynda Boyd a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q766825" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which country was Kana Ueda a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1155353" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which country was Randy Bachman a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q1972182" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which country was Geir R\u00f6nning a citizen of?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q1498057" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which country was Megumi Hayashibara a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q266670" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which country was Nao T\u014dyama a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q865906" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which country was Keiko Matsui a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q237934" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which country was Deadmau5 a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q49009" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which country was Marc-Andr\u00e9 Hamelin a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q45189" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Regis Philbin married to?", + "expect": "Joy Philbin", + "relation": "fwd P26", + "entity": "Q463673" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Ruth Crawford Seeger married to?", + "expect": "Charles Seeger", + "relation": "fwd P26", + "entity": "Q451393" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Michael Bubl\u00e9 married to?", + "expect": "Lusiana Lopilato", + "relation": "fwd P26", + "entity": "Q153694" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Perrie Edwards married to?", + "expect": "Alex Oxlade-Chamberlain", + "relation": "fwd P26", + "entity": "Q16126719" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was M\u00e1juska Pusk\u00e1s married to?", + "expect": "Abbas II", + "relation": "fwd P26", + "entity": "Q113865" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Lupe Fuentes married to?", + "expect": "Evan Seinfeld", + "relation": "fwd P26", + "entity": "Q168543" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Celia Cruz married to?", + "expect": "Pedro Knight", + "relation": "fwd P26", + "entity": "Q474045" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Lyubov Orlova married to?", + "expect": "Grigori Aleksandrov", + "relation": "fwd P26", + "entity": "Q236229" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Shawn Yue married to?", + "expect": "Sarah Wang", + "relation": "fwd P26", + "entity": "Q144033" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Paul Stanley married to?", + "expect": "Pamela Bowen", + "relation": "fwd P26", + "entity": "Q295542" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Maria Theresa of Naples and Sicily married to?", + "expect": "Francis II, Holy Roman Emperor", + "relation": "fwd P26", + "entity": "Q164504" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Simone Simons married to?", + "expect": "Oliver Palotai", + "relation": "fwd P26", + "entity": "Q236100" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who is the spouse of Vanessa Paradis?", + "expect": "Samuel Benchetrit", + "relation": "fwd P26", + "entity": "Q51023" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who is the spouse of Larisa Golubkina?", + "expect": "Andrei Mironov", + "relation": "fwd P26", + "entity": "Q4142441" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who is the spouse of Julian Cheung?", + "expect": "Anita Yuen", + "relation": "fwd P26", + "entity": "Q697144" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who is the spouse of Natalya Varley?", + "expect": "Vladimir Tikhonov", + "relation": "fwd P26", + "entity": "Q510170" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who is the spouse of David Arquette?", + "expect": "Courteney Cox", + "relation": "fwd P26", + "entity": "Q294185" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who is the spouse of Lasse Berghagen?", + "expect": "Lill-Babs", + "relation": "fwd P26", + "entity": "Q493733" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who is the spouse of David F. Sandberg?", + "expect": "Lotta Losten", + "relation": "fwd P26", + "entity": "Q16775487" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who is the spouse of Bill Hader?", + "expect": "Maggie Carey", + "relation": "fwd P26", + "entity": "Q14537" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who is the spouse of Byron Janis?", + "expect": "Maria Cooper Janis", + "relation": "fwd P26", + "entity": "Q1018612" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who is the spouse of Ihsahn?", + "expect": "Ihriel", + "relation": "fwd P26", + "entity": "Q386992" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who is the spouse of Heino?", + "expect": "Hannelore Kramm", + "relation": "fwd P26", + "entity": "Q6541" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who is the spouse of Aida Garifullina?", + "expect": "Alexey Vorobyov", + "relation": "fwd P26", + "entity": "Q13203005" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Francis Hopkinson's father?", + "expect": "Thomas Hopkinson", + "relation": "fwd P22", + "entity": "Q1397375" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Tibors de Sarenom's father?", + "expect": "William of Aumelas", + "relation": "fwd P22", + "entity": "Q5220" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Veit Bach's father?", + "expect": "Hans Bach", + "relation": "fwd P22", + "entity": "Q700622" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Nick Menza's father?", + "expect": "Don Menza", + "relation": "fwd P22", + "entity": "Q1067812" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Leif Segerstam's father?", + "expect": "Selim Segerstam", + "relation": "fwd P22", + "entity": "Q381726" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Cem Karaca's father?", + "expect": "Mehmet Karaca", + "relation": "fwd P22", + "entity": "Q1053260" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Cosima Wagner's father?", + "expect": "Franz Liszt", + "relation": "fwd P22", + "entity": "Q75789" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Leopold August Abel's father?", + "expect": "Christian Ferdinand Abel", + "relation": "fwd P22", + "entity": "Q2665908" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Cree Summer's father?", + "expect": "Don Francks", + "relation": "fwd P22", + "entity": "Q262838" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Walter Damrosch's father?", + "expect": "Leopold Damrosch", + "relation": "fwd P22", + "entity": "Q725579" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Angham's father?", + "expect": "Mohammad Suleiman", + "relation": "fwd P22", + "entity": "Q2380190" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Patricia Kraus's father?", + "expect": "Alfredo Kraus", + "relation": "fwd P22", + "entity": "Q460761" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the father of Piero Piccioni?", + "expect": "Attilio Piccioni", + "relation": "fwd P22", + "entity": "Q1665575" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the father of Mi\u00facha?", + "expect": "S\u00e9rgio Buarque de Holanda", + "relation": "fwd P22", + "entity": "Q451002" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the father of Desi Arnaz Jr.?", + "expect": "Desi Arnaz", + "relation": "fwd P22", + "entity": "Q324882" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the father of Chucho Vald\u00e9s?", + "expect": "Bebo Vald\u00e9s", + "relation": "fwd P22", + "entity": "Q918872" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the father of Adam Arkin?", + "expect": "Alan Arkin", + "relation": "fwd P22", + "entity": "Q340213" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the father of Bengt Djurberg?", + "expect": "Fredrik Vilhelm Djurberg", + "relation": "fwd P22", + "entity": "Q3437839" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the father of Nyusha?", + "expect": "Vladimir Shurochkin", + "relation": "fwd P22", + "entity": "Q125666" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the father of Ky-Mani Marley?", + "expect": "Bob Marley", + "relation": "fwd P22", + "entity": "Q741513" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the father of Sarah Polley?", + "expect": "Harry Gulkin", + "relation": "fwd P22", + "entity": "Q234212" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the father of Natalia Lafourcade?", + "expect": "Gast\u00f3n Lafourcade", + "relation": "fwd P22", + "entity": "Q3298047" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the father of Thomas Mann?", + "expect": "Thomas Johann Heinrich Mann", + "relation": "fwd P22", + "entity": "Q37030" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the father of Herman Severin Lovenskjold?", + "expect": "Eggert Christopher Frederik L\u00f8venskiold", + "relation": "fwd P22", + "entity": "Q1610355" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Minouche Barelli's mother?", + "expect": "Lucienne Delyle", + "relation": "fwd P25", + "entity": "Q200498" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Philip, Prince of Eulenburg's mother?", + "expect": "Alexandrine Gr\u00e4fin zu Eulenburg-Hertefeld", + "relation": "fwd P25", + "entity": "Q213964" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Charles Ives's mother?", + "expect": "Mary Elizabeth Parmelee", + "relation": "fwd P25", + "entity": "Q309648" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Theodore the Studite's mother?", + "expect": "Theoctista", + "relation": "fwd P25", + "entity": "Q361405" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Alia Bhatt's mother?", + "expect": "Soni Razdan", + "relation": "fwd P25", + "entity": "Q4725343" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was David Foster's mother?", + "expect": "Eleanor Foster", + "relation": "fwd P25", + "entity": "Q77112" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Ralph Siegel's mother?", + "expect": "Ingeborg D\u00f6derlein", + "relation": "fwd P25", + "entity": "Q665856" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Elina Duni's mother?", + "expect": "Bessa Myftiu", + "relation": "fwd P25", + "entity": "Q116769" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Anna German's mother?", + "expect": "Irma Mertens-Berner", + "relation": "fwd P25", + "entity": "Q298022" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Carl Wilson's mother?", + "expect": "Audree Wilson", + "relation": "fwd P25", + "entity": "Q504920" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Ermanno Wolf-Ferrari's mother?", + "expect": "Emilia Ferrari", + "relation": "fwd P25", + "entity": "Q57275" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Who was Samuel Barber's mother?", + "expect": "Marguerite McLeod Barber", + "relation": "fwd P25", + "entity": "Q216870" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the mother of Herman Severin Lovenskjold?", + "expect": "Frederikke L\u00f8venskiold", + "relation": "fwd P25", + "entity": "Q1610355" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the mother of Zhu Xi?", + "expect": "Zhu Shi", + "relation": "fwd P25", + "entity": "Q9397" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the mother of Franz Werfel?", + "expect": "Albine Kussi", + "relation": "fwd P25", + "entity": "Q78514" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the mother of Tom\u00e1s Luis de Victoria?", + "expect": "Francisca Su\u00e1rez de la Concha", + "relation": "fwd P25", + "entity": "Q215128" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the mother of Lunalilo?", + "expect": "Kek\u0101uluohi", + "relation": "fwd P25", + "entity": "Q499103" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the mother of Ansel Elgort?", + "expect": "Grethe Barrett Holby", + "relation": "fwd P25", + "entity": "Q13426679" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the mother of Melba Moore?", + "expect": "Bonnie Davis", + "relation": "fwd P25", + "entity": "Q448876" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the mother of Marie d'Agoult?", + "expect": "Elisabeth de Flavigny", + "relation": "fwd P25", + "entity": "Q253453" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the mother of George Sand?", + "expect": "Sophie Victoire Delaborde", + "relation": "fwd P25", + "entity": "Q3816" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the mother of Ben Becker?", + "expect": "Monika Hansen", + "relation": "fwd P25", + "entity": "Q77968" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the mother of Georg V of Hanover?", + "expect": "Frederica of Mecklenburg-Strelitz", + "relation": "fwd P25", + "entity": "Q57428" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Who was the mother of Eri Fukatsu?", + "expect": "Yumiko Fukatsu", + "relation": "fwd P25", + "entity": "Q1073991" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What instrument does Tommy Ramone play?", + "expect": "drum kit", + "relation": "fwd P1303", + "entity": "Q366900" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What instrument does John Tardy play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q2468212" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What instrument does Julie Caitlin Brown play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q446696" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What instrument does Najwa Karam play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q1197287" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What instrument does Natalya Andrejchenko play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q449925" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What instrument does Constance Moore play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q273211" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What instrument does Elvana Gjata play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q462706" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What instrument does Johanna Kinkel play?", + "expect": "piano", + "relation": "fwd P1303", + "entity": "Q165824" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What instrument does Sook-Yin Lee play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q462176" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What instrument does Elisabeth Leonskaja play?", + "expect": "piano", + "relation": "fwd P1303", + "entity": "Q447946" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What instrument does Juelz Santana play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q445386" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "What instrument does Elena Gheorghe play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q236044" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which instrument did Karol Rathaus play?", + "expect": "piano", + "relation": "fwd P1303", + "entity": "Q84660" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which instrument did Paco Pe\u00f1a play?", + "expect": "guitar", + "relation": "fwd P1303", + "entity": "Q1244961" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which instrument did Kishori Amonkar play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q2117321" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which instrument did Anne Wiggins Brown play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q446689" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which instrument did Yui Horie play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q50033" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which instrument did Wolfgang Fl\u00fcr play?", + "expect": "drum kit", + "relation": "fwd P1303", + "entity": "Q681136" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which instrument did Helen Kane play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q1281772" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which instrument did Paulina Goto play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q9057086" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which instrument did Katerine Duska play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q60614353" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which instrument did Renata Mauro play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q451712" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which instrument did Ruggiero Ricci play?", + "expect": "violin", + "relation": "fwd P1303", + "entity": "Q718368" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which instrument did Pastor Troy play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q2056297" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Which band was Sampsa Astala a member of?", + "expect": "Lordi", + "relation": "fwd P463", + "entity": "Q927469" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Which band was Lena Katina a member of?", + "expect": "t.A.T.u.", + "relation": "fwd P463", + "entity": "Q228826" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Which band was DJ Muggs a member of?", + "expect": "Cypress Hill", + "relation": "fwd P463", + "entity": "Q955323" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Which band was Don Carlos a member of?", + "expect": "Black Uhuru", + "relation": "fwd P463", + "entity": "Q636103" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Which band was Jonas Berggren a member of?", + "expect": "Ace of Base", + "relation": "fwd P463", + "entity": "Q981785" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Which band was Ronn Moss a member of?", + "expect": "Player", + "relation": "fwd P463", + "entity": "Q948723" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Which band was Eug\u00e8ne Scribe a member of?", + "expect": "Acad\u00e9mie Fran\u00e7aise", + "relation": "fwd P463", + "entity": "Q319261" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Which band was Hayley Williams a member of?", + "expect": "Paramore", + "relation": "fwd P463", + "entity": "Q201562" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Which band was Randy Blythe a member of?", + "expect": "Lamb of God", + "relation": "fwd P463", + "entity": "Q455474" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Which band was Hiro Yamamoto a member of?", + "expect": "Soundgarden", + "relation": "fwd P463", + "entity": "Q461564" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Which band was Big Boi a member of?", + "expect": "OutKast", + "relation": "fwd P463", + "entity": "Q371202" + }, + { + "split": "dev", + "kind": "musicians", + "valid": true, + "q": "Which band was Proof a member of?", + "expect": "D12", + "relation": "fwd P463", + "entity": "Q314597" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which group did Elaine Brown play in?", + "expect": "Black Panther Party", + "relation": "fwd P463", + "entity": "Q3395025" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which group did Andy Rourke play in?", + "expect": "The Smiths", + "relation": "fwd P463", + "entity": "Q527320" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which group did Romeo Santos play in?", + "expect": "Aventura", + "relation": "fwd P463", + "entity": "Q2570042" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which group did Alessandro Scarlatti play in?", + "expect": "Arcadian Academy", + "relation": "fwd P463", + "entity": "Q183087" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which group did J\u00f3zef Elsner play in?", + "expect": "Warsaw Society of Friends of Learning", + "relation": "fwd P463", + "entity": "Q471647" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which group did Princess Eug\u00e9nie of Sweden play in?", + "expect": "Royal Swedish Academy of Fine Arts", + "relation": "fwd P463", + "entity": "Q526915" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which group did Abd\u00fclaziz play in?", + "expect": "Ottoman dynasty", + "relation": "fwd P463", + "entity": "Q151500" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which group did Tom Kaulitz play in?", + "expect": "Tokio Hotel", + "relation": "fwd P463", + "entity": "Q1622098" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which group did Emma Bunton play in?", + "expect": "Spice Girls", + "relation": "fwd P463", + "entity": "Q219878" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which group did Joe Elliott play in?", + "expect": "Def Leppard", + "relation": "fwd P463", + "entity": "Q541573" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which group did Steve Jocz play in?", + "expect": "Sum 41", + "relation": "fwd P463", + "entity": "Q910568" + }, + { + "split": "heldout", + "kind": "musicians", + "valid": true, + "q": "Which group did Gwen Stefani play in?", + "expect": "No Doubt", + "relation": "fwd P463", + "entity": "Q483379" + } +] \ No newline at end of file diff --git a/root/specialists/rel-musicians/relspec_scorer.py b/root/specialists/rel-musicians/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-musicians/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-musicians/verdict_dev.json b/root/specialists/rel-musicians/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..2cd51e743cc4f2a7e64685d8b538b3edbf91d0a0 --- /dev/null +++ b/root/specialists/rel-musicians/verdict_dev.json @@ -0,0 +1,171 @@ +{ + "id": "rel-musicians", + "name": "Oracle7 Relations: Instrumentalists", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:21:21Z", + "domain": { + "head": { + "correct": 22, + "false_yes": 0, + "wrong": 17, + "n": 120, + "p50_ms": 497.46, + "fails": [ + [ + "musicians", + "Where was Wilhelmine of Prussia, Margravine of Brandenburg-Bayreuth bo", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "musicians", + "Where was Nikolai Fraiture born?", + "deliberation:where", + "[ev:direct] Since co-founding the band in 1998, he has released seven studio albums with t" + ], + [ + "musicians", + "Where was John P. Hammond born?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "musicians", + "Where was Cindy Breakspeare born?", + "unverified:factoid:page", + "I found a passage that may be related, but I can't verify it answers your question: \"Cynth" + ], + [ + "musicians", + "Where was Emily Meade born?", + "deliberation:where", + "[ev:direct] She played Ella Blake in the science fiction series Fringe in its third season" + ], + [ + "musicians", + "Where was Paul Sacher born?", + "deliberation:where", + "[ev:direct] At the time of his death, Sacher was the majority shareholder of the Hoffmann-" + ], + [ + "musicians", + "Where was Marc Dorcel born?", + "deliberation:where", + "[ev:direct] Marc Dorcel (born in March 1934 as Marcel Herskovitz) is a French-Hungarian pr" + ], + [ + "musicians", + "Where was Owen Pallett born?", + "unverified:factoid:page", + "I found a passage that may be related, but I can't verify it answers your question: \"Owen " + ] + ] + }, + "spec": { + "correct": 92, + "false_yes": 0, + "wrong": 0, + "n": 120, + "p50_ms": 5.08, + "fails": [ + [ + "musicians", + "Where was Wilhelmine of Prussia, Margravine of Brandenburg-Bayreuth bo", + "specialist:rel-musicians>unverified", + "I can't verify the POB of Wilhelmine of Prussia, Margravine of Brandenburg-Bayreuth from m" + ], + [ + "musicians", + "Where was Nikolai Fraiture born?", + "specialist:rel-musicians>unverified", + "I can't verify the POB of Nikolai Fraiture from my records, so I won't guess." + ], + [ + "musicians", + "Where was Sophie Gay born?", + "specialist:rel-musicians>unverified", + "I can't verify the POB of Sophie Gay from my records, so I won't guess." + ], + [ + "musicians", + "Where was John P. Hammond born?", + "specialist:rel-musicians>unverified", + "I can't verify the POB of John P. Hammond from my records, so I won't guess." + ], + [ + "musicians", + "Where was Cindy Breakspeare born?", + "specialist:rel-musicians>unverified", + "I can't verify the POB of Cindy Breakspeare from my records, so I won't guess." + ], + [ + "musicians", + "Where was Emily Meade born?", + "specialist:rel-musicians>unverified", + "I can't verify the POB of Emily Meade from my records, so I won't guess." + ], + [ + "musicians", + "Where was Paul Sacher born?", + "specialist:rel-musicians>unverified", + "I can't verify the POB of Paul Sacher from my records, so I won't guess." + ], + [ + "musicians", + "Where was Julian Rachlin born?", + "specialist:rel-musicians>unverified", + "I can't verify the POB of Julian Rachlin from my records, so I won't guess." + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 151, + "false_yes": 0 + }, + "n": 401, + "swept_in": 1, + "taken_by_specialist": [ + { + "family": "open_relation", + "q": "In which city did Dylan Thomas die?", + "path": "specialist:rel-musicians>musicians", + "head_correct": 0, + "spec_correct": 1 + } + ], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-musicians/verdict_heldout.json b/root/specialists/rel-musicians/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..87ca1ea8a8d4817bd9c54a6b455e9972b7ad6bf2 --- /dev/null +++ b/root/specialists/rel-musicians/verdict_heldout.json @@ -0,0 +1,129 @@ +{ + "id": "rel-musicians", + "name": "Oracle7 Relations: Instrumentalists", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:22:22Z", + "domain": { + "head": { + "correct": 21, + "false_yes": 0, + "wrong": 2, + "n": 120, + "p50_ms": 522.18, + "fails": [ + [ + "musicians", + "What is the birthplace of Mal Waldron?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "musicians", + "What is the birthplace of Michael Shrieve?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "musicians", + "What is the birthplace of Leonard Feather?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "musicians", + "What is the birthplace of Josiah Warren?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "musicians", + "What is the birthplace of Kenny Drew?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "musicians", + "What is the birthplace of Simone Cristicchi?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "musicians", + "What is the birthplace of Alan Silvestri?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "musicians", + "What is the birthplace of Steve Lukather?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ] + ] + }, + "spec": { + "correct": 119, + "false_yes": 0, + "wrong": 0, + "n": 120, + "p50_ms": 5.8, + "fails": [ + [ + "musicians", + "Who was the father of Desi Arnaz Jr.?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 151, + "false_yes": 0 + }, + "n": 401, + "swept_in": 1, + "taken_by_specialist": [ + { + "family": "open_relation", + "q": "In which city did Dylan Thomas die?", + "path": "specialist:rel-musicians>musicians", + "head_correct": 0, + "spec_correct": 1 + } + ], + "head_cache_hits": 401 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-mythology/manifest.json b/root/specialists/rel-mythology/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..f34575fa50ffd54f42cc3787916fd3d386e9df9e --- /dev/null +++ b/root/specialists/rel-mythology/manifest.json @@ -0,0 +1,74 @@ +{ + "id": "rel-mythology", + "name": "Oracle7 Relations: Mythological figures", + "number": 190, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-mythology/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-mythology", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "mythology", + "kind": "mythology" + } + }, + "accept": { + "kinds": [ + "mythology" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-mythology/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [ + 22988604, + 20830276, + 4271324, + 178885 + ], + "occupations": [] + }, + "readers": [ + "22", + "25", + "26" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-mythology/organ_relation_v2.py b/root/specialists/rel-mythology/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-mythology/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-mythology/readers.json b/root/specialists/rel-mythology/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..6dfa818796beba441aae1447c39c82efefaf726f --- /dev/null +++ b/root/specialists/rel-mythology/readers.json @@ -0,0 +1,8 @@ +{ + "keys": [ + "22", + "25", + "26" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-mythology/relation_panel_v2.json b/root/specialists/rel-mythology/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..ff57d7b4e5b40b17f34e635b9e971f17e5ac5e23 --- /dev/null +++ b/root/specialists/rel-mythology/relation_panel_v2.json @@ -0,0 +1,650 @@ +[ + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Copreus's father?", + "expect": "Pelops", + "relation": "fwd P22", + "entity": "Q2641203" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Porthaon's father?", + "expect": "Agenor", + "relation": "fwd P22", + "entity": "Q1178970" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Iambe's father?", + "expect": "Pan", + "relation": "fwd P22", + "entity": "Q1790716" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Alecto's father?", + "expect": "Uranus", + "relation": "fwd P22", + "entity": "Q1643451" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Cepheus, King of Tegea's father?", + "expect": "Aleus", + "relation": "fwd P22", + "entity": "Q1509662" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Antinous son of Eupeithes's father?", + "expect": "Eupeithes", + "relation": "fwd P22", + "entity": "Q579000" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Omphale's father?", + "expect": "Iardanus", + "relation": "fwd P22", + "entity": "Q486698" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Ancaeus's father?", + "expect": "Lycurgus of Arcadia", + "relation": "fwd P22", + "entity": "Q2446902" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Andhaka's father?", + "expect": "Hira\u1e47y\u0101k\u1e63a", + "relation": "fwd P22", + "entity": "Q491813" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Creusa's father?", + "expect": "Priam", + "relation": "fwd P22", + "entity": "Q375174" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Tapati's father?", + "expect": "Surya", + "relation": "fwd P22", + "entity": "Q4451421" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Actaeon's father?", + "expect": "Aristaeus", + "relation": "fwd P22", + "entity": "Q208531" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the father of Pygmalion of Tyre?", + "expect": "Mattan I", + "relation": "fwd P22", + "entity": "Q1879787" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the father of Terpsichore?", + "expect": "Zeus", + "relation": "fwd P22", + "entity": "Q104042" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the father of Ascalaphus?", + "expect": "Ares", + "relation": "fwd P22", + "entity": "Q660196" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the father of Chronos?", + "expect": "Hydros", + "relation": "fwd P22", + "entity": "Q272918" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the father of Machaon?", + "expect": "Asclepius", + "relation": "fwd P22", + "entity": "Q674319" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the father of P\u0101\u1e47\u1e0du?", + "expect": "Vyasa", + "relation": "fwd P22", + "entity": "Q857071" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the father of Cian?", + "expect": "Dian Cecht", + "relation": "fwd P22", + "entity": "Q1091393" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the father of Androgeus?", + "expect": "Minos", + "relation": "fwd P22", + "entity": "Q512388" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the father of Watatsumi?", + "expect": "Izanagi", + "relation": "fwd P22", + "entity": "Q1474187" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the father of Menelaus?", + "expect": "Atreus", + "relation": "fwd P22", + "entity": "Q171839" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the father of Hippodamia?", + "expect": "Oenomaus", + "relation": "fwd P22", + "entity": "Q328354" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the father of R\u0101va\u1e47a?", + "expect": "Vishrava", + "relation": "fwd P22", + "entity": "Q235102" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Shamash's mother?", + "expect": "Ningal", + "relation": "fwd P25", + "entity": "Q332188" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Anat's mother?", + "expect": "Asherah", + "relation": "fwd P25", + "entity": "Q487290" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Melpomene's mother?", + "expect": "Mnemosyne", + "relation": "fwd P25", + "entity": "Q103992" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Aglaurus, daughter of Cecrops's mother?", + "expect": "Aglauros", + "relation": "fwd P25", + "entity": "Q584492" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Eurypylus's mother?", + "expect": "Astyoche", + "relation": "fwd P25", + "entity": "Q120831" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Telegonus's mother?", + "expect": "Circe", + "relation": "fwd P25", + "entity": "Q1333887" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Phineus's mother?", + "expect": "Anchiroe", + "relation": "fwd P25", + "entity": "Q1471454" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Asteria's mother?", + "expect": "Phoebe", + "relation": "fwd P25", + "entity": "Q18642285" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Oileus's mother?", + "expect": "Agrianome", + "relation": "fwd P25", + "entity": "Q975447" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Macaria's mother?", + "expect": "Deianira", + "relation": "fwd P25", + "entity": "Q1550960" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Helenus's mother?", + "expect": "Hecuba", + "relation": "fwd P25", + "entity": "Q729332" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Ochimus's mother?", + "expect": "Rhodos", + "relation": "fwd P25", + "entity": "Q426041" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the mother of The Morr\u00edgan?", + "expect": "Ernmas", + "relation": "fwd P25", + "entity": "Q828550" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the mother of Sopdu?", + "expect": "Sopdet", + "relation": "fwd P25", + "entity": "Q1195229" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the mother of Pallas?", + "expect": "Gaia", + "relation": "fwd P25", + "entity": "Q2463695" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the mother of Atreus?", + "expect": "Hippodamia", + "relation": "fwd P25", + "entity": "Q192469" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the mother of Amycus?", + "expect": "Bithynis", + "relation": "fwd P25", + "entity": "Q697942" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the mother of Arcas?", + "expect": "Callisto", + "relation": "fwd P25", + "entity": "Q606422" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the mother of Deiphobus?", + "expect": "Hecuba", + "relation": "fwd P25", + "entity": "Q736813" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the mother of Orestes?", + "expect": "Clytemnestra", + "relation": "fwd P25", + "entity": "Q192407" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the mother of Nausicaa?", + "expect": "Arete", + "relation": "fwd P25", + "entity": "Q135224" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the mother of Sthenelus son of Capaneus?", + "expect": "Evadne", + "relation": "fwd P25", + "entity": "Q1060267" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the mother of Tsukuyomi?", + "expect": "Izanami", + "relation": "fwd P25", + "entity": "Q595520" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who was the mother of Porphyrion?", + "expect": "Gaia", + "relation": "fwd P25", + "entity": "Q1421201" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Amphiaraus married to?", + "expect": "Eriphyle", + "relation": "fwd P26", + "entity": "Q330584" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Pandareus married to?", + "expect": "Harmotho\u00eb", + "relation": "fwd P26", + "entity": "Q1428276" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Hou Yi married to?", + "expect": "Chang'e", + "relation": "fwd P26", + "entity": "Q1065105" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Chiron married to?", + "expect": "Chariclo", + "relation": "fwd P26", + "entity": "Q183417" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Tefnut married to?", + "expect": "Shu", + "relation": "fwd P26", + "entity": "Q116273" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Shamash married to?", + "expect": "Aya", + "relation": "fwd P26", + "entity": "Q526992" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Yarikh married to?", + "expect": "Nikkal", + "relation": "fwd P26", + "entity": "Q1519326" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Alcinous married to?", + "expect": "Arete", + "relation": "fwd P26", + "entity": "Q496595" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was El married to?", + "expect": "Asherah", + "relation": "fwd P26", + "entity": "Q1316633" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Cecrops II married to?", + "expect": "Metiadusa", + "relation": "fwd P26", + "entity": "Q974346" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Varaha married to?", + "expect": "Bh\u016bmi", + "relation": "fwd P26", + "entity": "Q517977" + }, + { + "split": "dev", + "kind": "mythology", + "valid": true, + "q": "Who was Kunt\u012b married to?", + "expect": "P\u0101\u1e47\u1e0du", + "relation": "fwd P26", + "entity": "Q844424" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who is the spouse of Iole?", + "expect": "Hyllus", + "relation": "fwd P26", + "entity": "Q744147" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who is the spouse of Erechtheus?", + "expect": "Praxithea", + "relation": "fwd P26", + "entity": "Q301219" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who is the spouse of Polydorus?", + "expect": "Nycte\u00efs", + "relation": "fwd P26", + "entity": "Q1061554" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who is the spouse of Bel?", + "expect": "B\u00ealit", + "relation": "fwd P26", + "entity": "Q2894617" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who is the spouse of Iphimedeia?", + "expect": "Aloeus", + "relation": "fwd P26", + "entity": "Q1672201" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who is the spouse of Ngai?", + "expect": "Olapa", + "relation": "fwd P26", + "entity": "Q1758221" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who is the spouse of Thyestes?", + "expect": "Laodameia", + "relation": "fwd P26", + "entity": "Q622504" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who is the spouse of Izanagi?", + "expect": "Izanami", + "relation": "fwd P26", + "entity": "Q813858" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who is the spouse of Kamadeva?", + "expect": "Rati", + "relation": "fwd P26", + "entity": "Q113155" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who is the spouse of Nehebkau?", + "expect": "Nehmetawy", + "relation": "fwd P26", + "entity": "Q2044276" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who is the spouse of Uttar\u0101?", + "expect": "Abhimanyu", + "relation": "fwd P26", + "entity": "Q2389445" + }, + { + "split": "heldout", + "kind": "mythology", + "valid": true, + "q": "Who is the spouse of Titania?", + "expect": "Oberon", + "relation": "fwd P26", + "entity": "Q2332221" + } +] \ No newline at end of file diff --git a/root/specialists/rel-mythology/relspec_scorer.py b/root/specialists/rel-mythology/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-mythology/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-mythology/verdict_dev.json b/root/specialists/rel-mythology/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..a1c3a2de077f375327ee8d4bab41769567262e57 --- /dev/null +++ b/root/specialists/rel-mythology/verdict_dev.json @@ -0,0 +1,163 @@ +{ + "id": "rel-mythology", + "name": "Oracle7 Relations: Mythological figures", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:20:25Z", + "domain": { + "head": { + "correct": 2, + "false_yes": 0, + "wrong": 0, + "n": 36, + "p50_ms": 506.45, + "fails": [ + [ + "mythology", + "Who was Copreus's father?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mythology", + "Who was Porthaon's father?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mythology", + "Who was Iambe's father?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mythology", + "Who was Alecto's father?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mythology", + "Who was Cepheus, King of Tegea's father?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mythology", + "Who was Antinous son of Eupeithes's father?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mythology", + "Who was Omphale's father?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mythology", + "Who was Ancaeus's father?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 28, + "false_yes": 0, + "wrong": 0, + "n": 36, + "p50_ms": 5.59, + "fails": [ + [ + "mythology", + "Who was Antinous son of Eupeithes's father?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mythology", + "Who was Ancaeus's father?", + "specialist:rel-mythology>unverified", + "I can't verify the son of of Ancaeus from my records, so I won't guess." + ], + [ + "mythology", + "Who was Creusa's father?", + "specialist:rel-mythology>unverified", + "I can't verify the son of of Creusa from my records, so I won't guess." + ], + [ + "mythology", + "Who was Eurypylus's mother?", + "specialist:rel-mythology>unverified", + "I can't verify the son of of Eurypylus from my records, so I won't guess." + ], + [ + "mythology", + "Who was Phineus's mother?", + "specialist:rel-mythology>unverified", + "I can't verify the son of of Phineus from my records, so I won't guess." + ], + [ + "mythology", + "Who was Macaria's mother?", + "specialist:rel-mythology>unverified", + "I can't verify the son of of Macaria from my records, so I won't guess." + ], + [ + "mythology", + "Who was Shamash married to?", + "specialist:rel-mythology>unverified", + "I can't verify the wives of Shamash from my records, so I won't guess." + ], + [ + "mythology", + "Who was El married to?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-mythology/verdict_heldout.json b/root/specialists/rel-mythology/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..034c4e7fa8e806a60f4aa3d51f113b954b6a7712 --- /dev/null +++ b/root/specialists/rel-mythology/verdict_heldout.json @@ -0,0 +1,157 @@ +{ + "id": "rel-mythology", + "name": "Oracle7 Relations: Mythological figures", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:20:53Z", + "domain": { + "head": { + "correct": 1, + "false_yes": 0, + "wrong": 0, + "n": 36, + "p50_ms": 510.86, + "fails": [ + [ + "mythology", + "Who was the father of Terpsichore?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mythology", + "Who was the father of Ascalaphus?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mythology", + "Who was the father of Chronos?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mythology", + "Who was the father of Machaon?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mythology", + "Who was the father of P\u0101\u1e47\u1e0du?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mythology", + "Who was the father of Cian?", + "unverified:factoid:page", + "I found a passage that may be related, but I can't verify it answers your question: \"In Ir" + ], + [ + "mythology", + "Who was the father of Androgeus?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "mythology", + "Who was the father of Watatsumi?", + "unverified:factoid:page", + "I found a passage that may be related, but I can't verify it answers your question: \"What " + ] + ] + }, + "spec": { + "correct": 29, + "false_yes": 0, + "wrong": 1, + "n": 36, + "p50_ms": 4.83, + "fails": [ + [ + "mythology", + "Who was the father of Ascalaphus?", + "specialist:rel-mythology>unverified", + "I can't verify the son of of Ascalaphus from my records, so I won't guess." + ], + [ + "mythology", + "Who was the father of Hippodamia?", + "specialist:rel-mythology>unverified", + "I can't verify the son of of Hippodamia from my records, so I won't guess." + ], + [ + "mythology", + "Who was the mother of Pallas?", + "specialist:rel-mythology>mythology", + "Eurybia. From the Wikidata relation store: Pallas (Q457294) - son of (P25) - Eurybia." + ], + [ + "mythology", + "Who is the spouse of Polydorus?", + "specialist:rel-mythology>unverified", + "I can't verify the wives of Polydorus from my records, so I won't guess." + ], + [ + "mythology", + "Who is the spouse of Bel?", + "specialist:rel-mythology>unverified", + "I can't verify the wives of Marduk from my records, so I won't guess." + ], + [ + "mythology", + "Who is the spouse of Uttar\u0101?", + "specialist:rel-mythology>unverified", + "I can't verify the wives of Uttar\u0101 from my records, so I won't guess." + ], + [ + "mythology", + "Who is the spouse of Titania?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-religions/manifest.json b/root/specialists/rel-religions/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..b358a15522c0e64453a6a8c91238b7f6fe6eaada --- /dev/null +++ b/root/specialists/rel-religions/manifest.json @@ -0,0 +1,70 @@ +{ + "id": "rel-religions", + "name": "Oracle7 Relations: Religions", + "number": 174, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-religions/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-religions", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "religions", + "kind": "religions" + } + }, + "accept": { + "kinds": [ + "religions" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-religions/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [ + 9174 + ], + "occupations": [] + }, + "readers": [ + "112", + "571" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-religions/organ_relation_v2.py b/root/specialists/rel-religions/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-religions/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-religions/readers.json b/root/specialists/rel-religions/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..5e7cf7c3e208240ca35c8988058161630bcaccd9 --- /dev/null +++ b/root/specialists/rel-religions/readers.json @@ -0,0 +1,7 @@ +{ + "keys": [ + "112", + "571" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-religions/relation_panel_v2.json b/root/specialists/rel-religions/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..b72ffee4534ddecfc5f73460bb89091c071e091d --- /dev/null +++ b/root/specialists/rel-religions/relation_panel_v2.json @@ -0,0 +1,353 @@ +[ + { + "split": "dev", + "kind": "religions", + "valid": true, + "q": "Who founded Umbanda?", + "expect": "Z\u00e9lio Fernandino de Moraes", + "relation": "fwd P112", + "entity": "Q1431297" + }, + { + "split": "dev", + "kind": "religions", + "valid": true, + "q": "Who founded Burkhanism?", + "expect": "shepherd", + "relation": "fwd P112", + "entity": "Q2659042" + }, + { + "split": "dev", + "kind": "religions", + "valid": true, + "q": "Who founded Falun Gong?", + "expect": "Li Hongzhi", + "relation": "fwd P112", + "entity": "Q185802" + }, + { + "split": "dev", + "kind": "religions", + "valid": true, + "q": "Who founded Tendai?", + "expect": "Saich\u014d", + "relation": "fwd P112", + "entity": "Q855964" + }, + { + "split": "dev", + "kind": "religions", + "valid": true, + "q": "Who founded Native American Church?", + "expect": "Quanah Parker", + "relation": "fwd P112", + "entity": "Q920084" + }, + { + "split": "dev", + "kind": "religions", + "valid": true, + "q": "Who founded Rajneesh movement?", + "expect": "Osho", + "relation": "fwd P112", + "entity": "Q266037" + }, + { + "split": "dev", + "kind": "religions", + "valid": true, + "q": "Who founded LaVeyan Satanism?", + "expect": "Anton LaVey", + "relation": "fwd P112", + "entity": "Q256223" + }, + { + "split": "dev", + "kind": "religions", + "valid": true, + "q": "Who founded B\u00e1bism?", + "expect": "B\u00e1b", + "relation": "fwd P112", + "entity": "Q204128" + }, + { + "split": "dev", + "kind": "religions", + "valid": true, + "q": "Who founded Eckankar?", + "expect": "Paul Twitchell", + "relation": "fwd P112", + "entity": "Q1281268" + }, + { + "split": "dev", + "kind": "religions", + "valid": true, + "q": "Who founded Yiguandao?", + "expect": "Wang Jueyi", + "relation": "fwd P112", + "entity": "Q714127" + }, + { + "split": "dev", + "kind": "religions", + "valid": true, + "q": "Who founded Fundamentalist Church of Jesus Christ of Latter Day Saints?", + "expect": "Lorin C. Woolley", + "relation": "fwd P112", + "entity": "Q499224" + }, + { + "split": "dev", + "kind": "religions", + "valid": true, + "q": "Who founded Tenrikyo?", + "expect": "Nakayama Miki", + "relation": "fwd P112", + "entity": "Q737323" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "Who was the founder of J\u014ddo Shinsh\u016b?", + "expect": "Shinran", + "relation": "fwd P112", + "entity": "Q912221" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "Who was the founder of Positive Christianity?", + "expect": "Nazi Party", + "relation": "fwd P112", + "entity": "Q691253" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "Who was the founder of Brahma Kumaris?", + "expect": "Dada Lekhraj", + "relation": "fwd P112", + "entity": "Q897299" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "Who was the founder of Good News International Ministries?", + "expect": "Paul Nthenge Mackenzie", + "relation": "fwd P112", + "entity": "Q117837664" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "Who was the founder of Raelism?", + "expect": "Ra\u00ebl", + "relation": "fwd P112", + "entity": "Q631897" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "Who was the founder of Yazidism?", + "expect": "Adi ibn Musafir", + "relation": "fwd P112", + "entity": "Q18670106" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "Who was the founder of Theosophy?", + "expect": "Helena Blavatsky", + "relation": "fwd P112", + "entity": "Q178671" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "Who was the founder of S\u014dt\u014d?", + "expect": "D\u014dgen", + "relation": "fwd P112", + "entity": "Q749085" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "Who was the founder of New Thought?", + "expect": "Phineas Quimby", + "relation": "fwd P112", + "entity": "Q940573" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "Who was the founder of Coconut Religion?", + "expect": "Nguy\u1ec5n Thanh Nam", + "relation": "fwd P112", + "entity": "Q13408013" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "Who was the founder of Jediism?", + "expect": "Yoda", + "relation": "fwd P112", + "entity": "Q258945" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "Who was the founder of Nichiren Sh\u014dsh\u016b?", + "expect": "Nissh\u014d", + "relation": "fwd P112", + "entity": "Q834462" + }, + { + "split": "dev", + "kind": "religions", + "valid": true, + "q": "When was H\u00f2a H\u1ea3o founded?", + "expect": "4 July 1939", + "relation": "fwd P571", + "entity": "Q1369404" + }, + { + "split": "dev", + "kind": "religions", + "valid": true, + "q": "When was Iglesia Maradoniana founded?", + "expect": "1999", + "relation": "fwd P571", + "entity": "Q1203626" + }, + { + "split": "dev", + "kind": "religions", + "valid": true, + "q": "When was Homaranismo founded?", + "expect": "1906", + "relation": "fwd P571", + "entity": "Q1426400" + }, + { + "split": "dev", + "kind": "religions", + "valid": true, + "q": "When was Pastafarianism founded?", + "expect": "2005", + "relation": "fwd P571", + "entity": "Q14397660" + }, + { + "split": "dev", + "kind": "religions", + "valid": true, + "q": "When was Order of the Solar Temple founded?", + "expect": "1984", + "relation": "fwd P571", + "entity": "Q1571099" + }, + { + "split": "dev", + "kind": "religions", + "valid": true, + "q": "When was White Lotus founded?", + "expect": "1300", + "relation": "fwd P571", + "entity": "Q1142216" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "In what year was Kimbanguist Church established?", + "expect": "1921", + "relation": "fwd P571", + "entity": "Q1549204" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "In what year was Good News International Ministries established?", + "expect": "2003", + "relation": "fwd P571", + "entity": "Q117837664" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "In what year was Onmy\u014dd\u014d established?", + "expect": "600", + "relation": "fwd P571", + "entity": "Q1340540" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "In what year was Happy Science established?", + "expect": "1986", + "relation": "fwd P571", + "entity": "Q1061176" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "In what year was Latter Day Saint movement established?", + "expect": "1830", + "relation": "fwd P571", + "entity": "Q1097673" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "In what year was Reformed Christianity established?", + "expect": "1519", + "relation": "fwd P571", + "entity": "Q101849" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "In what year was State Shinto established?", + "expect": "1868", + "relation": "fwd P571", + "entity": "Q1197248" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "In what year was The Church of Almighty God established?", + "expect": "1989", + "relation": "fwd P571", + "entity": "Q1022157" + }, + { + "split": "heldout", + "kind": "religions", + "valid": true, + "q": "In what year was Coconut Religion established?", + "expect": "1963", + "relation": "fwd P571", + "entity": "Q13408013" + } +] \ No newline at end of file diff --git a/root/specialists/rel-religions/relspec_scorer.py b/root/specialists/rel-religions/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-religions/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-religions/verdict_dev.json b/root/specialists/rel-religions/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..474d2e30d4ee93c953ac778d00babed5d5525c70 --- /dev/null +++ b/root/specialists/rel-religions/verdict_dev.json @@ -0,0 +1,114 @@ +{ + "id": "rel-religions", + "name": "Oracle7 Relations: Religions", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:17:46Z", + "domain": { + "head": { + "correct": 8, + "false_yes": 0, + "wrong": 1, + "n": 18, + "p50_ms": 537.26, + "fails": [ + [ + "religions", + "Who founded Burkhanism?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "religions", + "Who founded Native American Church?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "religions", + "Who founded B\u00e1bism?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "religions", + "Who founded Fundamentalist Church of Jesus Christ of Latter Day Saints", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "religions", + "When was H\u00f2a H\u1ea3o founded?", + "capability:when_did|vessel:reinforced", + "The admitted record for H\u00f2a H\u1ea3o contains no dated statement about when it found. It may al" + ], + [ + "religions", + "When was Iglesia Maradoniana founded?", + "verified:cube>YEAR|factoid:page", + "1998. The Church was founded on October 30, 1998 (Maradona's 38th birthday) in the city of" + ], + [ + "religions", + "When was Homaranismo founded?", + "capability:when_did|vessel:reinforced", + "The admitted record for Homaranismo contains no dated statement about when it found. It ma" + ], + [ + "religions", + "When was Pastafarianism founded?", + "capability:when_did|vessel:reinforced", + "The admitted record for Pastafarianism contains no dated statement about when it found. It" + ] + ] + }, + "spec": { + "correct": 18, + "false_yes": 0, + "wrong": 0, + "n": 18, + "p50_ms": 4.13, + "fails": [] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-religions/verdict_heldout.json b/root/specialists/rel-religions/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..018b090e61b608695b9b4e27c7cadd2c2961230f --- /dev/null +++ b/root/specialists/rel-religions/verdict_heldout.json @@ -0,0 +1,114 @@ +{ + "id": "rel-religions", + "name": "Oracle7 Relations: Religions", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:18:09Z", + "domain": { + "head": { + "correct": 4, + "false_yes": 0, + "wrong": 12, + "n": 21, + "p50_ms": 86.8, + "fails": [ + [ + "religions", + "Who was the founder of J\u014ddo Shinsh\u016b?", + "arb:explain_simply->capability:explain_s", + "[ev:unknown] In simple terms: The dictionary sense: One who founds or establishes (a compa" + ], + [ + "religions", + "Who was the founder of Positive Christianity?", + "arb:explain_simply->capability:explain_s", + "[ev:unknown] In simple terms: The dictionary sense: One who founds or establishes (a compa" + ], + [ + "religions", + "Who was the founder of Brahma Kumaris?", + "unverified:factoid:page", + "I found a passage that may be related, but I can't verify it answers your question: \"The f" + ], + [ + "religions", + "Who was the founder of Good News International Ministries?", + "precision_guard:R2_dump_for_slot_questio", + "I can't verify an answer to that exact question, so I won't guess." + ], + [ + "religions", + "Who was the founder of Raelism?", + "arb:explain_simply->capability:explain_s", + "[ev:unknown] In simple terms: The dictionary sense: One who founds or establishes (a compa" + ], + [ + "religions", + "Who was the founder of Yazidism?", + "arb:explain_simply->capability:explain_s", + "[ev:unknown] In simple terms: The dictionary sense: One who founds or establishes (a compa" + ], + [ + "religions", + "Who was the founder of Theosophy?", + "arb:explain_simply->capability:explain_s", + "[ev:unknown] In simple terms: The dictionary sense: One who founds or establishes (a compa" + ], + [ + "religions", + "Who was the founder of S\u014dt\u014d?", + "arb:explain_simply->capability:explain_s", + "[ev:unknown] In simple terms: The dictionary sense: One who founds or establishes (a compa" + ] + ] + }, + "spec": { + "correct": 21, + "false_yes": 0, + "wrong": 0, + "n": 21, + "p50_ms": 2.56, + "fails": [] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-singers/manifest.json b/root/specialists/rel-singers/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..374e2d6c34bd6f579deaf42e15efb5a443cc67f4 --- /dev/null +++ b/root/specialists/rel-singers/manifest.json @@ -0,0 +1,78 @@ +{ + "id": "rel-singers", + "name": "Oracle7 Relations: Singers", + "number": 192, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-singers/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-singers", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "singers", + "kind": "singers" + } + }, + "accept": { + "kinds": [ + "singers" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-singers/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [], + "occupations": [ + 177220 + ] + }, + "readers": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25", + "1303", + "463" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-singers/organ_relation_v2.py b/root/specialists/rel-singers/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-singers/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-singers/patterns.json b/root/specialists/rel-singers/patterns.json new file mode 100644 index 0000000000000000000000000000000000000000..e6c3f44130fe51a1f587ab6303f02e7cad134664 --- /dev/null +++ b/root/specialists/rel-singers/patterns.json @@ -0,0 +1,68 @@ +{ + "fwd|which|musician": [ + 1303, + 1.0, + 1.0, + 14 + ], + "fwd|which|instrument": [ + 1303, + 1.0, + 1.0, + 30 + ], + "fwd|instrument|*": [ + 1303, + 0.913, + 1.0, + 54 + ], + "fwd|instrument|played": [ + 1303, + 1.0, + 1.0, + 13 + ], + "fwd|instrument|instrument": [ + 1303, + 0.913, + 1.0, + 54 + ], + "fwd|instrument|jazz": [ + 1303, + 1.0, + 1.0, + 13 + ], + "inv|who|composed": [ + 800, + 0.918, + 1.0, + 96 + ], + "inv|who|oratorio": [ + 800, + 1.0, + 1.0, + 11 + ], + "fwd|group|group": [ + 463, + 0.923, + 1.0, + 19 + ], + "fwd|group|*": [ + 463, + 0.923, + 1.0, + 19 + ], + "fwd|instrument|musician": [ + 1303, + 1.0, + 1.0, + 16 + ] +} \ No newline at end of file diff --git a/root/specialists/rel-singers/readers.json b/root/specialists/rel-singers/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..b236d424b2a48ec46f503021212386d6eaf6c090 --- /dev/null +++ b/root/specialists/rel-singers/readers.json @@ -0,0 +1,26 @@ +{ + "keys": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25", + "1303", + "463" + ], + "dropped": [ + [ + "19", + "fwd", + 0 + ], + [ + "19", + "fwd", + 1 + ] + ] +} \ No newline at end of file diff --git a/root/specialists/rel-singers/relation_panel_v2.json b/root/specialists/rel-singers/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..a22bd6788e465289a2614a345ed773a583db3051 --- /dev/null +++ b/root/specialists/rel-singers/relation_panel_v2.json @@ -0,0 +1,2162 @@ +[ + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where was Mopreme Shakur born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q1352765" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where was Judith Gautier born?", + "expect": "Paris", + "relation": "fwd P19", + "entity": "Q2523100" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where was Rupert Hine born?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q1347182" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where was Walter Huston born?", + "expect": "Toronto", + "relation": "fwd P19", + "entity": "Q162621" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where was Lily-Rose Depp born?", + "expect": "Paris", + "relation": "fwd P19", + "entity": "Q20670730" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where was Hannah Mancini born?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q4022352" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where was Kim Fowley born?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q1378199" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where was Lauren Harris born?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q2068558" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where was Freya Ridings born?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q55956247" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where was Rosa Valetti born?", + "expect": "Berlin", + "relation": "fwd P19", + "entity": "Q4826" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where was Laurence Fox born?", + "expect": "Yorkshire", + "relation": "fwd P19", + "entity": "Q1189353" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where was Petra Haden born?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q2283054" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "What is the birthplace of Bishop Briggs?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q24207153" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "What is the birthplace of Maurice LaMarche?", + "expect": "Toronto", + "relation": "fwd P19", + "entity": "Q847124" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "What is the birthplace of Mackenzie Phillips?", + "expect": "Alexandria", + "relation": "fwd P19", + "entity": "Q452475" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "What is the birthplace of Sandy Denny?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q236638" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "What is the birthplace of Hamilton Camp?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q323503" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "What is the birthplace of Andy Milonakis?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q326440" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "What is the birthplace of Ian MacKaye?", + "expect": "Washington, D.C.", + "relation": "fwd P19", + "entity": "Q455545" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "What is the birthplace of Gabriella Tucci?", + "expect": "Rome", + "relation": "fwd P19", + "entity": "Q3094102" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "What is the birthplace of Ren\u00e9 Kollo?", + "expect": "Berlin", + "relation": "fwd P19", + "entity": "Q62286" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "What is the birthplace of Sharon Robinson?", + "expect": "San Francisco", + "relation": "fwd P19", + "entity": "Q467827" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "What is the birthplace of Kyla Pratt?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q240366" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "What is the birthplace of Patti Austin?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q238422" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where did Katalin Kar\u00e1dy die?", + "expect": "New York City", + "relation": "fwd P20", + "entity": "Q453895" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where did Jim Capaldi die?", + "expect": "London", + "relation": "fwd P20", + "entity": "Q1392515" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where did Klara Rumyanova die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q2367082" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where did Cesare Bonizzi die?", + "expect": "Bergamo", + "relation": "fwd P20", + "entity": "Q715603" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where did Catherine Spaak die?", + "expect": "Rome", + "relation": "fwd P20", + "entity": "Q437406" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where did Irm Hermann die?", + "expect": "Berlin", + "relation": "fwd P20", + "entity": "Q78441" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where did Johann Mattheson die?", + "expect": "Hamburg", + "relation": "fwd P20", + "entity": "Q170333" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where did Manfred Krug die?", + "expect": "Berlin", + "relation": "fwd P20", + "entity": "Q91587" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where did Doc Pomus die?", + "expect": "New York City", + "relation": "fwd P20", + "entity": "Q704718" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where did Beverly Sills die?", + "expect": "New York City", + "relation": "fwd P20", + "entity": "Q235517" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where did Ilene Woods die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q270771" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Where did Kishore Kumar die?", + "expect": "Mumbai", + "relation": "fwd P20", + "entity": "Q471542" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In which city did Jan Werner Danielsen die?", + "expect": "Oslo", + "relation": "fwd P20", + "entity": "Q948466" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In which city did Vlasta Burian die?", + "expect": "Prague", + "relation": "fwd P20", + "entity": "Q1350633" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In which city did Mieczys\u0142awa \u0106wikli\u0144ska die?", + "expect": "Warsaw", + "relation": "fwd P20", + "entity": "Q2115737" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In which city did Erkin Koray die?", + "expect": "Toronto", + "relation": "fwd P20", + "entity": "Q259405" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In which city did Jim Carroll die?", + "expect": "New York City", + "relation": "fwd P20", + "entity": "Q444806" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In which city did Madame du Barry die?", + "expect": "Paris", + "relation": "fwd P20", + "entity": "Q230677" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In which city did Ian Wallace die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q1864685" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In which city did Angela Lansbury die?", + "expect": "Los Angeles", + "relation": "fwd P20", + "entity": "Q206856" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In which city did Herman Brood die?", + "expect": "Amsterdam", + "relation": "fwd P20", + "entity": "Q719447" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In which city did Doug Ingle die?", + "expect": "San Francisco", + "relation": "fwd P20", + "entity": "Q2567097" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In which city did Lhasa de Sela die?", + "expect": "Montreal", + "relation": "fwd P20", + "entity": "Q464097" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In which city did Sara Sad\u0131yqova die?", + "expect": "Kazan", + "relation": "fwd P20", + "entity": "Q4404938" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When was Shahzoda born?", + "expect": "28 July 1979", + "relation": "fwd P569", + "entity": "Q1092624" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When was Umberto Bindi born?", + "expect": "12 May 1932", + "relation": "fwd P569", + "entity": "Q1123779" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When was J\u00e9r\u00e9mie Makiese born?", + "expect": "15 June 2000", + "relation": "fwd P569", + "entity": "Q108550738" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When was Che'Nelle born?", + "expect": "10 March 1983", + "relation": "fwd P569", + "entity": "Q1068634" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When was Hamza Namira born?", + "expect": "15 November 1980", + "relation": "fwd P569", + "entity": "Q1103528" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When was Chisato Moritaka born?", + "expect": "11 April 1969", + "relation": "fwd P569", + "entity": "Q1051876" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When was Danny Jones born?", + "expect": "12 March 1986", + "relation": "fwd P569", + "entity": "Q1051550" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When was Blanco born?", + "expect": "10 February 2003", + "relation": "fwd P569", + "entity": "Q105076439" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When was Christophe born?", + "expect": "13 October 1945", + "relation": "fwd P569", + "entity": "Q1086279" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When was Dougie Poynter born?", + "expect": "30 November 1987", + "relation": "fwd P569", + "entity": "Q1051531" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When was Asmik Grigorian born?", + "expect": "12 May 1981", + "relation": "fwd P569", + "entity": "Q11201210" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When was Maurice Chevalier born?", + "expect": "12 September 1888", + "relation": "fwd P569", + "entity": "Q106001" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year was Nils Poppe born?", + "expect": "1908", + "relation": "fwd P569", + "entity": "Q1067321" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year was Tatsuhisa Suzuki born?", + "expect": "1983", + "relation": "fwd P569", + "entity": "Q1076849" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year was Nessa Barrett born?", + "expect": "2002", + "relation": "fwd P569", + "entity": "Q107413717" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year was Ghazala Javed born?", + "expect": "1988", + "relation": "fwd P569", + "entity": "Q1008702" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year was Veronica Fusaro born?", + "expect": "1997", + "relation": "fwd P569", + "entity": "Q104902237" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year was AnnaSophia Robb born?", + "expect": "1993", + "relation": "fwd P569", + "entity": "Q105695" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year was Lim Hyun-sik born?", + "expect": "1992", + "relation": "fwd P569", + "entity": "Q10884727" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year was Nadir R\u00fcst\u0259mli born?", + "expect": "1999", + "relation": "fwd P569", + "entity": "Q110897616" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year was Black Sherif born?", + "expect": "2002", + "relation": "fwd P569", + "entity": "Q107740983" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year was Teddy Swims born?", + "expect": "1992", + "relation": "fwd P569", + "entity": "Q105542333" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year was Aidan Cassar born?", + "expect": "1999", + "relation": "fwd P569", + "entity": "Q110969065" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year was Henrik Klingenberg born?", + "expect": "1978", + "relation": "fwd P569", + "entity": "Q1035348" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When did Halid Be\u0161li\u0107 die?", + "expect": "7 October 2025", + "relation": "fwd P570", + "entity": "Q1280798" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When did Dolores del R\u00edo die?", + "expect": "11 April 1983", + "relation": "fwd P570", + "entity": "Q124057" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When did Don Redman die?", + "expect": "30 November 1964", + "relation": "fwd P570", + "entity": "Q1188936" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When did Stig Olin die?", + "expect": "28 June 2008", + "relation": "fwd P570", + "entity": "Q1040407" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When did Mel Tillis die?", + "expect": "19 November 2017", + "relation": "fwd P570", + "entity": "Q1238180" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When did Yutaka Ozaki die?", + "expect": "25 April 1992", + "relation": "fwd P570", + "entity": "Q1193077" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When did Larry Norman die?", + "expect": "24 February 2008", + "relation": "fwd P570", + "entity": "Q1349745" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When did Martin Held die?", + "expect": "31 January 1992", + "relation": "fwd P570", + "entity": "Q112253" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When did Bai Guang die?", + "expect": "27 August 1999", + "relation": "fwd P570", + "entity": "Q1320703" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When did John Holt die?", + "expect": "19 October 2014", + "relation": "fwd P570", + "entity": "Q1101296" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When did Carmen Miranda die?", + "expect": "5 August 1955", + "relation": "fwd P570", + "entity": "Q121655" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "When did Fredo Santana die?", + "expect": "19 January 2018", + "relation": "fwd P570", + "entity": "Q13107451" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year did Meliton Balanchivadze die?", + "expect": "1937", + "relation": "fwd P570", + "entity": "Q1237722" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year did Buddy Ebsen die?", + "expect": "2003", + "relation": "fwd P570", + "entity": "Q1001214" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year did Ivo Robi\u0107 die?", + "expect": "2000", + "relation": "fwd P570", + "entity": "Q1282731" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year did Nico Fidenco die?", + "expect": "2022", + "relation": "fwd P570", + "entity": "Q1072590" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year did Johnny Rebel die?", + "expect": "2016", + "relation": "fwd P570", + "entity": "Q1345752" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year did Bahiga Hafez die?", + "expect": "1983", + "relation": "fwd P570", + "entity": "Q11035405" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year did Rudi Carrell die?", + "expect": "2006", + "relation": "fwd P570", + "entity": "Q126035" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year did Mehrdad Minavand die?", + "expect": "2021", + "relation": "fwd P570", + "entity": "Q1124093" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year did Clint Walker die?", + "expect": "2018", + "relation": "fwd P570", + "entity": "Q1101643" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year did Jack Cassidy die?", + "expect": "1976", + "relation": "fwd P570", + "entity": "Q1350489" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year did Eddie Rabbitt die?", + "expect": "1998", + "relation": "fwd P570", + "entity": "Q1282956" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "In what year did Damo Suzuki die?", + "expect": "2024", + "relation": "fwd P570", + "entity": "Q1158704" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What nationality was Maon Kurosaki?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1074952" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What nationality was Chisato Moritaka?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1051876" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What nationality was Avan Jogia?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q368424" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What nationality was Riyoko Ikeda?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q256425" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What nationality was Christine Guldbrandsen?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q234399" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What nationality was Takeshi Kusao?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q2311661" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What nationality was Mai Hagiwara?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q778500" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What nationality was Anja Garbarek?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q243059" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What nationality was Daniel Caesar?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q29589083" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What nationality was Noriko Hidaka?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q49563" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What nationality was Nikki Yanofsky?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q291485" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What nationality was Hiroyuki Sanada?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q705522" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which country was Miyabi Natsuyaki a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q723293" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which country was Riisa Naka a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q271886" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which country was Toshihiko Seki a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1201334" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which country was Heath a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1602025" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which country was Nao T\u014dyama a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q865906" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which country was Kyoko Fukada a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q253882" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which country was Bernice Liu a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q455672" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which country was Hiroyuki Yoshino a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1202709" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which country was ICS Vortex a citizen of?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q438921" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which country was Mikuni Shimokawa a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q750013" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which country was Michael Seater a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q527526" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which country was Kaori Momoi a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q442924" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Tomomi Itano married to?", + "expect": "Keiji Takahashi", + "relation": "fwd P26", + "entity": "Q1154210" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Boris Novkovi\u0107 married to?", + "expect": "Bojana Gregori\u0107", + "relation": "fwd P26", + "entity": "Q471704" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Mika Kanai married to?", + "expect": "K\u014dichi Yamadera", + "relation": "fwd P26", + "entity": "Q1193042" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Viktor de Kowa married to?", + "expect": "Michiko Tanaka", + "relation": "fwd P26", + "entity": "Q90910" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Franka Bateli\u0107 married to?", + "expect": "Vedran \u0106orluka", + "relation": "fwd P26", + "entity": "Q468367" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Sergey Bezrukov married to?", + "expect": "Anna Matison", + "relation": "fwd P26", + "entity": "Q473580" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Maria Antonia Walpurgis of Bavaria married to?", + "expect": "Friedrich Christian I, Elector of Saxony", + "relation": "fwd P26", + "entity": "Q61649" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Ad-Rock married to?", + "expect": "Kathleen Hanna", + "relation": "fwd P26", + "entity": "Q349799" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Nancy Wilson married to?", + "expect": "Cameron Crowe", + "relation": "fwd P26", + "entity": "Q263772" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Alejandro Sanz married to?", + "expect": "Raquel Perera", + "relation": "fwd P26", + "entity": "Q276170" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Jane Russell married to?", + "expect": "Bob Waterfield", + "relation": "fwd P26", + "entity": "Q217033" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Mickie James married to?", + "expect": "Nick Aldis", + "relation": "fwd P26", + "entity": "Q270712" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who is the spouse of Maybelle Carter?", + "expect": "Ezra Carter", + "relation": "fwd P26", + "entity": "Q442398" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who is the spouse of Maureen Forrester?", + "expect": "Eugene Kash", + "relation": "fwd P26", + "entity": "Q263172" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who is the spouse of Mikuni Shimokawa?", + "expect": "Tsuyoshi Koyama", + "relation": "fwd P26", + "entity": "Q750013" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who is the spouse of Jan Werich?", + "expect": "Zde\u0148ka Houskov\u00e1", + "relation": "fwd P26", + "entity": "Q949091" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who is the spouse of Rita Montaner?", + "expect": "Xavier Cugat", + "relation": "fwd P26", + "entity": "Q448525" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who is the spouse of Monica Nielsen?", + "expect": "Torsten Bj\u00f6rklund", + "relation": "fwd P26", + "entity": "Q4969417" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who is the spouse of Mary Carlisle?", + "expect": "James Blakeley", + "relation": "fwd P26", + "entity": "Q718786" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who is the spouse of Mandy Moore?", + "expect": "Taylor Goldsmith", + "relation": "fwd P26", + "entity": "Q187832" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who is the spouse of Elaine Stritch?", + "expect": "John Bay", + "relation": "fwd P26", + "entity": "Q242735" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who is the spouse of Joanna Gleason?", + "expect": "Chris Sarandon", + "relation": "fwd P26", + "entity": "Q273830" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who is the spouse of Amanda Lear?", + "expect": "Alain-Philippe Malagnac", + "relation": "fwd P26", + "entity": "Q454010" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who is the spouse of Jessica Par\u00e9?", + "expect": "Joseph M. Smith", + "relation": "fwd P26", + "entity": "Q263533" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Armaan Malik's father?", + "expect": "Daboo Malik", + "relation": "fwd P22", + "entity": "Q4792489" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Bebel Gilberto's father?", + "expect": "Jo\u00e3o Gilberto", + "relation": "fwd P22", + "entity": "Q258140" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Stephen Foster's father?", + "expect": "William B. Foster", + "relation": "fwd P22", + "entity": "Q305202" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Nancy Sinatra's father?", + "expect": "Frank Sinatra", + "relation": "fwd P22", + "entity": "Q233937" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Kim Soo-hyun's father?", + "expect": "Kim Chung-hoon", + "relation": "fwd P22", + "entity": "Q496491" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Katey Sagal's father?", + "expect": "Boris Sagal", + "relation": "fwd P22", + "entity": "Q229244" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Anja Garbarek's father?", + "expect": "Jan Garbarek", + "relation": "fwd P22", + "entity": "Q243059" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Margaret Whiting's father?", + "expect": "Richard A. Whiting", + "relation": "fwd P22", + "entity": "Q289108" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Melissa Horn's father?", + "expect": "Eddie Weitzberg", + "relation": "fwd P22", + "entity": "Q2741243" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Alan Arkin's father?", + "expect": "David I. Arkin", + "relation": "fwd P22", + "entity": "Q108283" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Jorge Negrete's father?", + "expect": "David Negrete Fern\u00e1ndez", + "relation": "fwd P22", + "entity": "Q734580" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was D\u00e9sir\u00e9e Art\u00f4t's father?", + "expect": "Jean D\u00e9sir\u00e9 Montagney Art\u00f4t", + "relation": "fwd P22", + "entity": "Q271414" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the father of Lykke Li?", + "expect": "Johan Zachrisson", + "relation": "fwd P22", + "entity": "Q270724" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the father of Mai Kuraki?", + "expect": "Isomi Yamasaki", + "relation": "fwd P22", + "entity": "Q236799" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the father of Hank Williams III?", + "expect": "Hank Williams Jr.", + "relation": "fwd P22", + "entity": "Q741600" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the father of Finneas O'Connell?", + "expect": "Patrick O'Connell", + "relation": "fwd P22", + "entity": "Q20029978" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the father of Wolf Biermann?", + "expect": "Dagobert Biermann", + "relation": "fwd P22", + "entity": "Q323063" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the father of Peter Ustinov?", + "expect": "Jona von Ustinov", + "relation": "fwd P22", + "entity": "Q55796" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the father of Kadriye Nurmambet?", + "expect": "Ahmet Nurmambet", + "relation": "fwd P22", + "entity": "Q17523911" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the father of Daniel Viglietti?", + "expect": "C\u00e9dar Viglietti", + "relation": "fwd P22", + "entity": "Q1163000" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the father of China Anne McClain?", + "expect": "Michael McClain", + "relation": "fwd P22", + "entity": "Q230943" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the father of Paul Robeson?", + "expect": "William Drew Robeson I", + "relation": "fwd P22", + "entity": "Q273233" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the father of Meret Becker?", + "expect": "Rolf Becker", + "relation": "fwd P22", + "entity": "Q65511" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the father of Ahmet Zappa?", + "expect": "Frank Zappa", + "relation": "fwd P22", + "entity": "Q401963" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Dolores del R\u00edo's mother?", + "expect": "Antonia L\u00f3pez-Negrete", + "relation": "fwd P25", + "entity": "Q124057" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Burna Boy's mother?", + "expect": "Bose Ogulu", + "relation": "fwd P25", + "entity": "Q17305712" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Chulabhorn, Princess Srisavangavadhana's mother?", + "expect": "Sirikit", + "relation": "fwd P25", + "entity": "Q1089410" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Scott Caan's mother?", + "expect": "Sheila Ryan", + "relation": "fwd P25", + "entity": "Q314673" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Robert Schwartzman's mother?", + "expect": "Talia Shire", + "relation": "fwd P25", + "entity": "Q2001430" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Jack Black's mother?", + "expect": "Judith Love Cohen", + "relation": "fwd P25", + "entity": "Q483907" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Michelle Creber's mother?", + "expect": "Monique Creber", + "relation": "fwd P25", + "entity": "Q3856870" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Dalida's mother?", + "expect": "Giuseppina Gigliotti", + "relation": "fwd P25", + "entity": "Q539171" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Miguel \u00c1ngel Mu\u00f1oz's mother?", + "expect": "Cristina Blanco", + "relation": "fwd P25", + "entity": "Q1078846" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Riki Sorsa's mother?", + "expect": "Margaretha von Bahr", + "relation": "fwd P25", + "entity": "Q1889743" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Lil Tracy's mother?", + "expect": "Coko", + "relation": "fwd P25", + "entity": "Q45898064" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Who was Jacqueline Boyer's mother?", + "expect": "Lucienne Boyer", + "relation": "fwd P25", + "entity": "Q230747" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the mother of Shania Twain?", + "expect": "Sharron Morrison", + "relation": "fwd P25", + "entity": "Q131433" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the mother of Harry Crosby?", + "expect": "Kathryn Crosby", + "relation": "fwd P25", + "entity": "Q13218111" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the mother of Josie Ho?", + "expect": "Lucina Laam", + "relation": "fwd P25", + "entity": "Q455691" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the mother of Jake Weary?", + "expect": "Kim Zimmer", + "relation": "fwd P25", + "entity": "Q3545522" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the mother of Kathryn Grayson?", + "expect": "Lillian Florence Hedrick", + "relation": "fwd P25", + "entity": "Q234117" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the mother of Milo Manheim?", + "expect": "Camryn Manheim", + "relation": "fwd P25", + "entity": "Q47540917" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the mother of Maxim Galkin?", + "expect": "Natalya Grigoryevna Galkina", + "relation": "fwd P25", + "entity": "Q559485" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the mother of Lorna Luft?", + "expect": "Judy Garland", + "relation": "fwd P25", + "entity": "Q448983" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the mother of Charles Boyer?", + "expect": "Augustine Marie Louise Durand", + "relation": "fwd P25", + "entity": "Q105987" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the mother of Chow Yun-fat?", + "expect": "Chen Lifang", + "relation": "fwd P25", + "entity": "Q181425" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the mother of Rachael MacFarlane?", + "expect": "Ann Perry Sager", + "relation": "fwd P25", + "entity": "Q2382385" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Who was the mother of Romina Power?", + "expect": "Linda Christian", + "relation": "fwd P25", + "entity": "Q236135" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What instrument does Danijela Martinovi\u0107 play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q284245" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What instrument does Gilda Radner play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q266808" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What instrument does Troy Donahue play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q516035" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What instrument does C.J. Perry Barnyashev play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q15739824" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What instrument does Amjad Sabri play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q24717996" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What instrument does Sopho Gelovani play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q2152286" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What instrument does M. Pokora play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q380799" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What instrument does Doris Kenyon play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q276419" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What instrument does Victoria Maurette play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q175991" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What instrument does Daveigh Chase play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q237774" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What instrument does Natalie Maines play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q242605" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "What instrument does Riyoko Ikeda play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q256425" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which instrument did Kelli O'Hara play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q4328796" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which instrument did Natacha Atlas play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q235896" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which instrument did Kiely Williams play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q270123" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which instrument did Benjamin Ingrosso play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q4889354" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which instrument did Ariel Lin play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q253724" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which instrument did Yvette Guilbert play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q239838" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which instrument did Frederica von Stade play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q265872" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which instrument did Emma Kok play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q122171684" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which instrument did Maasa Sudo play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q1196253" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which instrument did Yoshino Kimura play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q1143649" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which instrument did Gentleman play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q452250" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which instrument did Hugues Aufray play?", + "expect": "voice", + "relation": "fwd P1303", + "entity": "Q50034" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Which band was Eddy Grant a member of?", + "expect": "The Equals", + "relation": "fwd P463", + "entity": "Q399890" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Which band was Shaun Morgan a member of?", + "expect": "Seether", + "relation": "fwd P463", + "entity": "Q2014395" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Which band was Joakim Brod\u00e9n a member of?", + "expect": "Sabaton", + "relation": "fwd P463", + "entity": "Q5587019" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Which band was Alan Wilson a member of?", + "expect": "Canned Heat", + "relation": "fwd P463", + "entity": "Q719520" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Which band was Bizarre a member of?", + "expect": "D12", + "relation": "fwd P463", + "entity": "Q364526" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Which band was Dino Dvornik a member of?", + "expect": "Bijelo Dugme", + "relation": "fwd P463", + "entity": "Q1226635" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Which band was Mr Lordi a member of?", + "expect": "Lordi", + "relation": "fwd P463", + "entity": "Q724517" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Which band was Melle Mel a member of?", + "expect": "Grandmaster Flash and the Furious Five", + "relation": "fwd P463", + "entity": "Q64549" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Which band was Andrew Latimer a member of?", + "expect": "Camel", + "relation": "fwd P463", + "entity": "Q435786" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Which band was Enya a member of?", + "expect": "Clannad", + "relation": "fwd P463", + "entity": "Q38257" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Which band was Takahiro Nishijima a member of?", + "expect": "AAA", + "relation": "fwd P463", + "entity": "Q1041260" + }, + { + "split": "dev", + "kind": "singers", + "valid": true, + "q": "Which band was Burton C. Bell a member of?", + "expect": "Fear Factory", + "relation": "fwd P463", + "entity": "Q1017117" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which group did Zico play in?", + "expect": "Block B", + "relation": "fwd P463", + "entity": "Q7696122" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which group did Buzz Osborne play in?", + "expect": "Melvins", + "relation": "fwd P463", + "entity": "Q711367" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which group did Jun Matsumoto play in?", + "expect": "Arashi", + "relation": "fwd P463", + "entity": "Q347428" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which group did Marian Anderson play in?", + "expect": "American Academy of Arts and Sciences", + "relation": "fwd P463", + "entity": "Q231923" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which group did Andrew Ridgeley play in?", + "expect": "Wham!", + "relation": "fwd P463", + "entity": "Q1195390" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which group did Emilija Koki\u0107 play in?", + "expect": "Riva", + "relation": "fwd P463", + "entity": "Q447343" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which group did Ray Thomas play in?", + "expect": "The Moody Blues", + "relation": "fwd P463", + "entity": "Q1398746" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which group did Josephine Baker play in?", + "expect": "freemasonry", + "relation": "fwd P463", + "entity": "Q151972" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which group did Jamie Cook play in?", + "expect": "Arctic Monkeys", + "relation": "fwd P463", + "entity": "Q2148580" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which group did Nick Valensi play in?", + "expect": "The Strokes", + "relation": "fwd P463", + "entity": "Q955635" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which group did Duncan James play in?", + "expect": "Blue", + "relation": "fwd P463", + "entity": "Q312450" + }, + { + "split": "heldout", + "kind": "singers", + "valid": true, + "q": "Which group did AJ Michalka play in?", + "expect": "Aly & AJ", + "relation": "fwd P463", + "entity": "Q236066" + } +] \ No newline at end of file diff --git a/root/specialists/rel-singers/relspec_scorer.py b/root/specialists/rel-singers/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-singers/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-singers/verdict_dev.json b/root/specialists/rel-singers/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..0c9ce48a7d95d30b1f71f73b21eb8d333840d486 --- /dev/null +++ b/root/specialists/rel-singers/verdict_dev.json @@ -0,0 +1,163 @@ +{ + "id": "rel-singers", + "name": "Oracle7 Relations: Singers", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:20:38Z", + "domain": { + "head": { + "correct": 22, + "false_yes": 0, + "wrong": 18, + "n": 120, + "p50_ms": 495.6, + "fails": [ + [ + "singers", + "Where was Mopreme Shakur born?", + "deliberation:where", + "[ev:direct] Shakur's memoir, This Thug's Life, was published in 2026. [enwiki_c5232d6b8398" + ], + [ + "singers", + "Where was Walter Huston born?", + "deliberation:where", + "[ev:direct] Huston won the Academy Award for Best Supporting Actor for his role in The Tre" + ], + [ + "singers", + "Where was Lily-Rose Depp born?", + "deliberation:where", + "[ev:direct] She is known for her role as Ellen Hutter in the 2024 supernatural horror movi" + ], + [ + "singers", + "Where was Hannah Mancini born?", + "deliberation:where", + "[ev:direct] Hannah Leah Mancini (born 22 January 1980), also known as Stella Mercury or si" + ], + [ + "singers", + "Where was Lauren Harris born?", + "deliberation:where", + "[ev:direct] She released one solo album Calm Before the Storm, in 2008. [enwiki_c7d3b35170" + ], + [ + "singers", + "Where was Freya Ridings born?", + "deliberation:where", + "[ev:direct] Ridings rose to prominence in 2017 with her ballad, \"Lost Without You\", which " + ], + [ + "singers", + "Where was Laurence Fox born?", + "deliberation:where", + "[ev:direct] He is known for his role as DS James Hathaway in the British TV drama series L" + ], + [ + "singers", + "Where did Katalin Kar\u00e1dy die?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 106, + "false_yes": 0, + "wrong": 0, + "n": 120, + "p50_ms": 6.52, + "fails": [ + [ + "singers", + "Where was Mopreme Shakur born?", + "specialist:rel-singers>unverified", + "I can't verify the POB of Mopreme Shakur from my records, so I won't guess." + ], + [ + "singers", + "Where was Judith Gautier born?", + "specialist:rel-singers>unverified", + "I can't verify the POB of Judith Gautier from my records, so I won't guess." + ], + [ + "singers", + "Where was Rupert Hine born?", + "specialist:rel-singers>unverified", + "I can't verify the POB of Rupert Hine from my records, so I won't guess." + ], + [ + "singers", + "Where was Walter Huston born?", + "specialist:rel-singers>unverified", + "I can't verify the POB of Walter Huston from my records, so I won't guess." + ], + [ + "singers", + "Where was Lily-Rose Depp born?", + "specialist:rel-singers>unverified", + "I can't verify the POB of Lily-Rose Depp from my records, so I won't guess." + ], + [ + "singers", + "Where was Hannah Mancini born?", + "specialist:rel-singers>unverified", + "I can't verify the POB of Hannah Mancini from my records, so I won't guess." + ], + [ + "singers", + "Where was Kim Fowley born?", + "specialist:rel-singers>unverified", + "I can't verify the POB of Kim Fowley from my records, so I won't guess." + ], + [ + "singers", + "Where was Lauren Harris born?", + "specialist:rel-singers>unverified", + "I can't verify the POB of Lauren Harris from my records, so I won't guess." + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-singers/verdict_heldout.json b/root/specialists/rel-singers/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..788b74f416fe8b74b1854f36cf0a535d964105af --- /dev/null +++ b/root/specialists/rel-singers/verdict_heldout.json @@ -0,0 +1,139 @@ +{ + "id": "rel-singers", + "name": "Oracle7 Relations: Singers", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:21:46Z", + "domain": { + "head": { + "correct": 26, + "false_yes": 0, + "wrong": 0, + "n": 120, + "p50_ms": 518.48, + "fails": [ + [ + "singers", + "What is the birthplace of Bishop Briggs?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "singers", + "What is the birthplace of Maurice LaMarche?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "singers", + "What is the birthplace of Mackenzie Phillips?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "singers", + "What is the birthplace of Sandy Denny?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "singers", + "What is the birthplace of Hamilton Camp?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "singers", + "What is the birthplace of Andy Milonakis?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "singers", + "What is the birthplace of Ian MacKaye?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "singers", + "What is the birthplace of Gabriella Tucci?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ] + ] + }, + "spec": { + "correct": 116, + "false_yes": 0, + "wrong": 0, + "n": 120, + "p50_ms": 6.43, + "fails": [ + [ + "singers", + "In which city did Ian Wallace die?", + "specialist:rel-singers>unverified", + "I can't verify the POD of Ian Wallace from my records, so I won't guess." + ], + [ + "singers", + "Which country was Heath a citizen of?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "singers", + "Who was the mother of Harry Crosby?", + "specialist:rel-singers>unverified", + "I can't verify the son of of Bing Crosby from my records, so I won't guess." + ], + [ + "singers", + "Which instrument did Gentleman play?", + "unverified:factoid:fts", + "I found a passage that may be related, but I can't verify it answers your question: \"Knowi" + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-speedskaters/manifest.json b/root/specialists/rel-speedskaters/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..6485f26fffd63e172ea1ec008d275b91acfcd158 --- /dev/null +++ b/root/specialists/rel-speedskaters/manifest.json @@ -0,0 +1,77 @@ +{ + "id": "rel-speedskaters", + "name": "Oracle7 Relations: Speed skaters", + "number": 283, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-speedskaters/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-speedskaters", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "speedskaters", + "kind": "speedskaters" + } + }, + "accept": { + "kinds": [ + "speedskaters" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-speedskaters/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [], + "occupations": [ + 10866633 + ] + }, + "readers": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25", + "1532" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-speedskaters/organ_relation_v2.py b/root/specialists/rel-speedskaters/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-speedskaters/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-speedskaters/readers.json b/root/specialists/rel-speedskaters/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..e1ec7e417d53f7c52dc4f3c5787b30ff51cef723 --- /dev/null +++ b/root/specialists/rel-speedskaters/readers.json @@ -0,0 +1,14 @@ +{ + "keys": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25", + "1532" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-speedskaters/relation_panel_v2.json b/root/specialists/rel-speedskaters/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..8a659f756651aa2d21599bae1adf1e550e2f95ef --- /dev/null +++ b/root/specialists/rel-speedskaters/relation_panel_v2.json @@ -0,0 +1,1280 @@ +[ + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Where was Sylvia Albrecht born?", + "expect": "Berlin", + "relation": "fwd P19", + "entity": "Q204320" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "What is the birthplace of Lucille Opitz?", + "expect": "Berlin", + "relation": "fwd P19", + "entity": "Q436336" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "What is the birthplace of Ayano Sato?", + "expect": "Japan", + "relation": "fwd P19", + "entity": "Q27866004" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "What is the birthplace of Irving Jaffee?", + "expect": "New York City", + "relation": "fwd P19", + "entity": "Q1108813" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "What is the birthplace of Elwira Seroczy\u0144ska?", + "expect": "Vilnius", + "relation": "fwd P19", + "entity": "Q3051873" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Where did Laila Schou Nilsen die?", + "expect": "Oslo", + "relation": "fwd P20", + "entity": "Q139283" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Where did Tatyana Averina die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q198915" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Where did Roald Aas die?", + "expect": "Oslo", + "relation": "fwd P20", + "entity": "Q494675" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Where did Korn\u00e9l Pajor die?", + "expect": "Sweden", + "relation": "fwd P20", + "entity": "Q743966" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Where did Paulien van Deutekom die?", + "expect": "Netherlands", + "relation": "fwd P20", + "entity": "Q271334" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Where did Lisbeth Korsmo die?", + "expect": "Oslo", + "relation": "fwd P20", + "entity": "Q3494795" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Where did Tamara Rylova die?", + "expect": "Saint Petersburg", + "relation": "fwd P20", + "entity": "Q1964136" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Where did Bernt Evensen die?", + "expect": "Oslo", + "relation": "fwd P20", + "entity": "Q497771" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Where did Klara Guseva die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q176785" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Where did Oleg Goncharenko die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q2665434" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Where did Boris Stenin die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q2053127" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Where did Hjalmar Andersen die?", + "expect": "Oslo", + "relation": "fwd P20", + "entity": "Q464753" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In which city did Roald Larsen die?", + "expect": "Oslo", + "relation": "fwd P20", + "entity": "Q1274116" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In which city did Viktor Kosichkin die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q497288" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In which city did Sverre Farstad die?", + "expect": "Oslo", + "relation": "fwd P20", + "entity": "Q493718" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In which city did Odd Lundberg die?", + "expect": "Oslo", + "relation": "fwd P20", + "entity": "Q727759" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In which city did Elwira Seroczy\u0144ska die?", + "expect": "London", + "relation": "fwd P20", + "entity": "Q3051873" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In which city did Sergey Khlebnikov die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q1976870" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In which city did Oskar Olsen die?", + "expect": "Oslo", + "relation": "fwd P20", + "entity": "Q2889724" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In which city did Kees Broekman die?", + "expect": "Berlin", + "relation": "fwd P20", + "entity": "Q2180141" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In which city did Rafael Grach die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q1964510" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "When was Reidar Liaklev born?", + "expect": "15 July 1917", + "relation": "fwd P569", + "entity": "Q1109017" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "When was Wataru Morishige born?", + "expect": "17 July 2000", + "relation": "fwd P569", + "entity": "Q110897028" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "When was Peder Kongshaug born?", + "expect": "13 August 2001", + "relation": "fwd P569", + "entity": "Q105279115" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "When was John Farrell born?", + "expect": "28 August 1906", + "relation": "fwd P569", + "entity": "Q1046299" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "When was Casey Dawson born?", + "expect": "2 August 2000", + "relation": "fwd P569", + "entity": "Q110916450" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "When was Charles Mathiesen born?", + "expect": "12 February 1911", + "relation": "fwd P569", + "entity": "Q1065494" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "When was Sven Kramer born?", + "expect": "23 April 1986", + "relation": "fwd P569", + "entity": "Q111320" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In what year was Viktor Knoch born?", + "expect": "1989", + "relation": "fwd P569", + "entity": "Q1114338" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In what year was Sten Stensen born?", + "expect": "1947", + "relation": "fwd P569", + "entity": "Q1109397" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In what year was Momoka Horikawa born?", + "expect": "2003", + "relation": "fwd P569", + "entity": "Q110517953" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In what year was Carl Verheijen born?", + "expect": "1975", + "relation": "fwd P569", + "entity": "Q1040930" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In what year was Geir Karlstad born?", + "expect": "1963", + "relation": "fwd P569", + "entity": "Q1109531" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In what year was Fred Anton Maier born?", + "expect": "1938", + "relation": "fwd P569", + "entity": "Q1109236" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In what year was Daniil Aldoshkin born?", + "expect": "2001", + "relation": "fwd P569", + "entity": "Q105110943" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In what year was Irving Jaffee born?", + "expect": "1906", + "relation": "fwd P569", + "entity": "Q1108813" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In what year was Denis Kuzin born?", + "expect": "1989", + "relation": "fwd P569", + "entity": "Q1046306" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "When did Charles Mathiesen die?", + "expect": "7 November 1994", + "relation": "fwd P570", + "entity": "Q1065494" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "When did Sigvard Ericsson die?", + "expect": "2 November 2019", + "relation": "fwd P570", + "entity": "Q1342555" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "When did Igor Zhelezovski die?", + "expect": "12 June 2021", + "relation": "fwd P570", + "entity": "Q1267921" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "When did Reidar Liaklev die?", + "expect": "1 March 2006", + "relation": "fwd P570", + "entity": "Q1109017" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "When did John Farrell die?", + "expect": "20 June 1994", + "relation": "fwd P570", + "entity": "Q1046299" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In what year did Irving Jaffee die?", + "expect": "1981", + "relation": "fwd P570", + "entity": "Q1108813" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In what year did Fred Anton Maier die?", + "expect": "2015", + "relation": "fwd P570", + "entity": "Q1109236" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In what year did Roald Larsen die?", + "expect": "1959", + "relation": "fwd P570", + "entity": "Q1274116" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In what year did Harald Str\u00f8m die?", + "expect": "1977", + "relation": "fwd P570", + "entity": "Q1135506" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "In what year did Ken Henry die?", + "expect": "2009", + "relation": "fwd P570", + "entity": "Q1148189" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "What nationality was Ga\u00e9tan Boucher?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q494831" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "What nationality was Reidar Liaklev?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q1109017" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "What nationality was Laurent Dubreuil?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q4038571" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "What nationality was Miho Takagi?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q444421" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "What nationality was Georg Krog?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q1505066" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "What nationality was Sverre Lunde Pedersen?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q1822720" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "What nationality was Peder Kongshaug?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q105279115" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "What nationality was H\u00e5vard Holmefjord Lorentzen?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q2451441" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "What nationality was Axel Paulsen?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q28943" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "What nationality was Susan Auch?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q445612" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "What nationality was Lucas Makowsky?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q2112793" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "What nationality was Ivar Ballangrud?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q381511" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country was Geir Karlstad a citizen of?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q1109531" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country was Yukinori Miyabe a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q3269109" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country was Johann Olav Koss a citizen of?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q318403" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country was Ayano Sato a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q27866004" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country was Gordon Audley a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q337999" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country was Jan Egil Storholt a citizen of?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q494685" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country was Masako Hozumi a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q240036" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country was Willy Logan a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q1783621" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country was Denny Morrison a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q267728" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country was Clara Hughes a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q232682" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country was Sverre Farstad a citizen of?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q493718" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country was Ragne Wiklund a citizen of?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q47270251" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Who was Connie Carpenter-Phinney married to?", + "expect": "Davis Phinney", + "relation": "fwd P26", + "entity": "Q272590" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Who was Ids Postma married to?", + "expect": "Anni Friesinger-Postma", + "relation": "fwd P26", + "entity": "Q493739" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Who was Katarzyna Nied\u017awiedzka married to?", + "expect": "Konrad Nied\u017awiedzki", + "relation": "fwd P26", + "entity": "Q270232" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Who was Leah Poulos married to?", + "expect": "Peter Mueller", + "relation": "fwd P26", + "entity": "Q445525" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Who was Hans van Helden married to?", + "expect": "Marie-France van Helden", + "relation": "fwd P26", + "entity": "Q74967" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Who was Marrit Leenstra married to?", + "expect": "Matteo Anesi", + "relation": "fwd P26", + "entity": "Q446903" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Who was Hiromi Yamamoto married to?", + "expect": "Takeshi Yamanaka", + "relation": "fwd P26", + "entity": "Q1131845" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Who was Heather Richardson-Bergsma married to?", + "expect": "Jorrit Bergsma", + "relation": "fwd P26", + "entity": "Q2044956" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Who was Matteo Anesi married to?", + "expect": "Marrit Leenstra", + "relation": "fwd P26", + "entity": "Q1337603" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Who was Andrea Ehrig-Mitscherlich married to?", + "expect": "Andreas Ehrig", + "relation": "fwd P26", + "entity": "Q267513" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Who was Ivanie Blondin married to?", + "expect": "Konr\u00e1d Nagy", + "relation": "fwd P26", + "entity": "Q2383047" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Who was Dede Barry married to?", + "expect": "Michael Barry", + "relation": "fwd P26", + "entity": "Q452641" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who is the spouse of Tomas Gustafson?", + "expect": "Elisabet Gustafson", + "relation": "fwd P26", + "entity": "Q636419" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who is the spouse of Bonnie Blair?", + "expect": "Dave Cruikshank", + "relation": "fwd P26", + "entity": "Q231513" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who is the spouse of Viktor Knoch?", + "expect": "Marta W\u00f3jcik", + "relation": "fwd P26", + "entity": "Q1114338" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who is the spouse of Simen Agdestein?", + "expect": "Marianne Aasen", + "relation": "fwd P26", + "entity": "Q381121" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who is the spouse of Arne Dankers?", + "expect": "Kerry Simpson", + "relation": "fwd P26", + "entity": "Q571952" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who is the spouse of Jorrit Bergsma?", + "expect": "Heather Richardson-Bergsma", + "relation": "fwd P26", + "entity": "Q4084036" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who is the spouse of Helga Haase?", + "expect": "Helmut Haase", + "relation": "fwd P26", + "entity": "Q268484" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who is the spouse of Mark Tuitert?", + "expect": "Helen van Goozen", + "relation": "fwd P26", + "entity": "Q470221" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who is the spouse of Leo Visser?", + "expect": "Sandra Voetelink", + "relation": "fwd P26", + "entity": "Q46104" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who is the spouse of Viktor Hald Thorup?", + "expect": "Sofia Thorup", + "relation": "fwd P26", + "entity": "Q21817229" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who is the spouse of Sheila Young?", + "expect": "Jim Ochowicz", + "relation": "fwd P26", + "entity": "Q260955" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who is the spouse of Valentina Stenina?", + "expect": "Boris Stenin", + "relation": "fwd P26", + "entity": "Q2664022" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Who was Sverre Lunde Pedersen's father?", + "expect": "Jarle Pedersen", + "relation": "fwd P22", + "entity": "Q1822720" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Who was Davide Ghiotto's father?", + "expect": "Federico Ghiotto", + "relation": "fwd P22", + "entity": "Q28872364" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Who was Sven Kramer's father?", + "expect": "Yep Kramer", + "relation": "fwd P22", + "entity": "Q111320" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Who was Bernt Evensen's father?", + "expect": "Christian Evensen", + "relation": "fwd P22", + "entity": "Q497771" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Who was Alexander S\u00f8rloth's father?", + "expect": "G\u00f8ran S\u00f8rloth", + "relation": "fwd P22", + "entity": "Q13784739" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who was the father of Ard Schenk?", + "expect": "Klaas Schenk", + "relation": "fwd P22", + "entity": "Q41522" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who was the father of Jessica Gregg?", + "expect": "Randy Gregg", + "relation": "fwd P22", + "entity": "Q458272" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who was the father of Carl Verheijen?", + "expect": "Eddy Verheijen", + "relation": "fwd P22", + "entity": "Q1040930" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who was the father of Suzanne Schulting?", + "expect": "Jan Schulting", + "relation": "fwd P22", + "entity": "Q22001922" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who was the father of Anni Friesinger-Postma?", + "expect": "Georg Friesinger", + "relation": "fwd P22", + "entity": "Q70552" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who was the father of Prince Bertil, Duke of Halland?", + "expect": "Gustaf VI Adolf of Sweden", + "relation": "fwd P22", + "entity": "Q361261" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Who was H\u00e5vard Holmefjord Lorentzen's mother?", + "expect": "Liv Holmefjord", + "relation": "fwd P25", + "entity": "Q2451441" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Who was Laurent Dubreuil's mother?", + "expect": "Ariane Loignon", + "relation": "fwd P25", + "entity": "Q4038571" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who was the mother of Carl Verheijen?", + "expect": "Rieneke Demming", + "relation": "fwd P25", + "entity": "Q1040930" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who was the mother of Anni Friesinger-Postma?", + "expect": "Janina Korowicka", + "relation": "fwd P25", + "entity": "Q70552" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who was the mother of Metod\u011bj J\u00edlek?", + "expect": "Pavl\u00edna J\u00edlkov\u00e1", + "relation": "fwd P25", + "entity": "Q123255049" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who was the mother of Prince Bertil, Duke of Halland?", + "expect": "Princess Margaret of Connaught", + "relation": "fwd P25", + "entity": "Q361261" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Who was the mother of Jessica Gregg?", + "expect": "Kathy Vogt", + "relation": "fwd P25", + "entity": "Q458272" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Which country does Lassi Parkkinen represent?", + "expect": "Finland", + "relation": "fwd P1532", + "entity": "Q2541351" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Which country does Brian Hansen represent?", + "expect": "United States", + "relation": "fwd P1532", + "entity": "Q656844" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Which country does Jutta Leerdam represent?", + "expect": "Netherlands", + "relation": "fwd P1532", + "entity": "Q47208599" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Which country does Ivanie Blondin represent?", + "expect": "Canada", + "relation": "fwd P1532", + "entity": "Q2383047" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Which country does Tom-Jelte Slagter represent?", + "expect": "Netherlands", + "relation": "fwd P1532", + "entity": "Q1363155" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Which country does Laurent Dubreuil represent?", + "expect": "Canada", + "relation": "fwd P1532", + "entity": "Q4038571" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Which country does Antoinette Rijpma-de Jong represent?", + "expect": "Netherlands", + "relation": "fwd P1532", + "entity": "Q2284005" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Which country does Wang Beixing represent?", + "expect": "People's Republic of China", + "relation": "fwd P1532", + "entity": "Q254705" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Which country does Connie Carpenter-Phinney represent?", + "expect": "United States", + "relation": "fwd P1532", + "entity": "Q272590" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Which country does Eric Heiden represent?", + "expect": "United States", + "relation": "fwd P1532", + "entity": "Q311289" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Which country does Casey Dawson represent?", + "expect": "United States", + "relation": "fwd P1532", + "entity": "Q110916450" + }, + { + "split": "dev", + "kind": "speedskaters", + "valid": true, + "q": "Which country does Manabu Horii represent?", + "expect": "Japan", + "relation": "fwd P1532", + "entity": "Q1131407" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country did Mia Manganello play for?", + "expect": "United States", + "relation": "fwd P1532", + "entity": "Q1926551" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country did Maaike Head play for?", + "expect": "Netherlands", + "relation": "fwd P1532", + "entity": "Q2658599" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country did Femke Kok play for?", + "expect": "Netherlands", + "relation": "fwd P1532", + "entity": "Q73228523" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country did Denny Morrison play for?", + "expect": "Canada", + "relation": "fwd P1532", + "entity": "Q267728" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country did Nana Takagi play for?", + "expect": "Japan", + "relation": "fwd P1532", + "entity": "Q11670148" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country did Fred Anton Maier play for?", + "expect": "Norway", + "relation": "fwd P1532", + "entity": "Q1109236" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country did Sylvie Daigle play for?", + "expect": "Canada", + "relation": "fwd P1532", + "entity": "Q181753" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country did Thomas Krol play for?", + "expect": "Netherlands", + "relation": "fwd P1532", + "entity": "Q2115565" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country did Jordan Stolz play for?", + "expect": "United States", + "relation": "fwd P1532", + "entity": "Q81907278" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country did Joy Beune play for?", + "expect": "Netherlands", + "relation": "fwd P1532", + "entity": "Q51726895" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country did Johann Olav Koss play for?", + "expect": "Norway", + "relation": "fwd P1532", + "entity": "Q318403" + }, + { + "split": "heldout", + "kind": "speedskaters", + "valid": true, + "q": "Which country did Yukinori Miyabe play for?", + "expect": "Japan", + "relation": "fwd P1532", + "entity": "Q3269109" + } +] \ No newline at end of file diff --git a/root/specialists/rel-speedskaters/relspec_scorer.py b/root/specialists/rel-speedskaters/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-speedskaters/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-speedskaters/verdict_dev.json b/root/specialists/rel-speedskaters/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..0f67677451b4f0a130fefef14d804fe31768ae92 --- /dev/null +++ b/root/specialists/rel-speedskaters/verdict_dev.json @@ -0,0 +1,114 @@ +{ + "id": "rel-speedskaters", + "name": "Oracle7 Relations: Speed skaters", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w406", + "time": "2026-10-13T03:04:16Z", + "domain": { + "head": { + "correct": 24, + "false_yes": 0, + "wrong": 7, + "n": 68, + "p50_ms": 594.76, + "fails": [ + [ + "speedskaters", + "Where did Tatyana Averina die?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "speedskaters", + "Where did Paulien van Deutekom die?", + "deliberation:where", + "[ev:direct] On 2 January 2019, Van Deutekom died from lung cancer in The Hague, aged 37. [" + ], + [ + "speedskaters", + "Where did Tamara Rylova die?", + "deliberation:where", + "[ev:direct] Rylova died on 1 February 2021 in Moscow, aged 89. [simplewiki_a48aecfd711c7b4" + ], + [ + "speedskaters", + "Where did Klara Guseva die?", + "deliberation:where", + "[ev:direct] Klara Ivanovna Guseva (8 March 1937 in Tambov Oblast \u2013 12 May 2019) was a Russ" + ], + [ + "speedskaters", + "Where did Oleg Goncharenko die?", + "deliberation:where", + "[ev:direct] Born in Kharkiv, Ukraine, Oleg Goncharenko made his international debut in 195" + ], + [ + "speedskaters", + "Where did Boris Stenin die?", + "deliberation:where", + "[ev:direct] Living in Sverdlovsk, Stenin met and married fellow skater Valentina Stenina (" + ], + [ + "speedskaters", + "When was Reidar Liaklev born?", + "capability:when_did|vessel:receipt", + "The admitted record for Reidar Liaklev contains no dated statement about when it born. It " + ], + [ + "speedskaters", + "When was Wataru Morishige born?", + "unverified:factoid:page", + "I found a passage that may be related, but I can't verify it answers your question: \"Watar" + ] + ] + }, + "spec": { + "correct": 68, + "false_yes": 0, + "wrong": 0, + "n": 68, + "p50_ms": 2.15, + "fails": [] + } + }, + "core": { + "head": { + "correct": 132, + "false_yes": 0 + }, + "spec": { + "correct": 132, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-speedskaters/verdict_heldout.json b/root/specialists/rel-speedskaters/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..9e73892bc31e03651035c2c15b1f9aa223613b93 --- /dev/null +++ b/root/specialists/rel-speedskaters/verdict_heldout.json @@ -0,0 +1,114 @@ +{ + "id": "rel-speedskaters", + "name": "Oracle7 Relations: Speed skaters", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w406", + "time": "2026-10-13T03:05:12Z", + "domain": { + "head": { + "correct": 26, + "false_yes": 0, + "wrong": 1, + "n": 74, + "p50_ms": 622.81, + "fails": [ + [ + "speedskaters", + "What is the birthplace of Lucille Opitz?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "speedskaters", + "What is the birthplace of Ayano Sato?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "speedskaters", + "What is the birthplace of Irving Jaffee?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "speedskaters", + "What is the birthplace of Elwira Seroczy\u0144ska?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "speedskaters", + "In which city did Roald Larsen die?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "speedskaters", + "In which city did Viktor Kosichkin die?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "speedskaters", + "In which city did Sverre Farstad die?", + "organ:relation>READ>FRAME>LINK>RELATE:fw", + "[ev:direct] Trondheim. Sverre Farstad (8 February 1920 \u2013 27 March 1978) was a Norwegian sp" + ], + [ + "speedskaters", + "In which city did Odd Lundberg die?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 74, + "false_yes": 0, + "wrong": 0, + "n": 74, + "p50_ms": 2.9, + "fails": [] + } + }, + "core": { + "head": { + "correct": 132, + "false_yes": 0 + }, + "spec": { + "correct": 132, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-sportsteams/manifest.json b/root/specialists/rel-sportsteams/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..1bdfe1b12deccd9f722bde6d012cdf3550a6c7de --- /dev/null +++ b/root/specialists/rel-sportsteams/manifest.json @@ -0,0 +1,74 @@ +{ + "id": "rel-sportsteams", + "name": "Oracle7 Relations: Sports teams", + "number": 166, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-sportsteams/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-sportsteams", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "sportsteams", + "kind": "sportsteams" + } + }, + "accept": { + "kinds": [ + "sportsteams" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-sportsteams/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [ + 13393265, + 13027888, + 4498974, + 17156793 + ], + "occupations": [] + }, + "readers": [ + "115", + "118", + "571" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-sportsteams/organ_relation_v2.py b/root/specialists/rel-sportsteams/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-sportsteams/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-sportsteams/readers.json b/root/specialists/rel-sportsteams/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..55719b596e5be0ea3ac4b2a1b581daeb01f3fdab --- /dev/null +++ b/root/specialists/rel-sportsteams/readers.json @@ -0,0 +1,8 @@ +{ + "keys": [ + "115", + "118", + "571" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-sportsteams/relation_panel_v2.json b/root/specialists/rel-sportsteams/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..4466ec0f1d22c1ce99192212e42542f0c762de1e --- /dev/null +++ b/root/specialists/rel-sportsteams/relation_panel_v2.json @@ -0,0 +1,650 @@ +[ + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "What is the home ground of Hartford Whalers?", + "expect": "Matthews Arena", + "relation": "fwd P115", + "entity": "Q830968" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "What is the home ground of Avangard Omsk?", + "expect": "Omsk Arena", + "relation": "fwd P115", + "entity": "Q787888" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "What is the home ground of Kolossos Rodou B.C.?", + "expect": "Kallithea Palais des Sports", + "relation": "fwd P115", + "entity": "Q1645286" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "What is the home ground of HC Sparta Praha?", + "expect": "O\u2082 arena", + "relation": "fwd P115", + "entity": "Q1425170" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "What is the home ground of Seattle Kraken?", + "expect": "Climate Pledge Arena", + "relation": "fwd P115", + "entity": "Q59422166" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "What is the home ground of Band\u0131rma B.K.?", + "expect": "TEKS\u00dcT Kara Ali Acar Sport Hall", + "relation": "fwd P115", + "entity": "Q3702" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "What is the home ground of BC UNICS?", + "expect": "Basket-Hall Arena", + "relation": "fwd P115", + "entity": "Q25757" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "What is the home ground of CB Sant Josep?", + "expect": "Palau Girona-Fontajau", + "relation": "fwd P115", + "entity": "Q44010" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "What is the home ground of Tofa\u015f S.K.?", + "expect": "Tofa\u015f Nil\u00fcfer Spor Salonu", + "relation": "fwd P115", + "entity": "Q2278800" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "What is the home ground of BC Lietkabelis?", + "expect": "Kalnapilio Arena", + "relation": "fwd P115", + "entity": "Q47101" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "What is the home ground of Artland Dragons?", + "expect": "Artland-Arena", + "relation": "fwd P115", + "entity": "Q684077" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "What is the home ground of Cleveland Rebels?", + "expect": "Cleveland Arena", + "relation": "fwd P115", + "entity": "Q3421779" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which stadium do Mikkelin Jukurit play in?", + "expect": "Kalevankankaan j\u00e4\u00e4halli", + "relation": "fwd P115", + "entity": "Q1933716" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which stadium do Juvecaserta Basket play in?", + "expect": "PalaMaggi\u00f2", + "relation": "fwd P115", + "entity": "Q36326" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which stadium do L\u00f8renskog IK play in?", + "expect": "L\u00f8renskog Ishall", + "relation": "fwd P115", + "entity": "Q1782837" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which stadium do Texas Stars play in?", + "expect": "Cedar Park Center", + "relation": "fwd P115", + "entity": "Q682872" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which stadium do Paris Basketball play in?", + "expect": "Adidas Arena", + "relation": "fwd P115", + "entity": "Q56291131" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which stadium do HC Pardubice play in?", + "expect": "Enteria arena", + "relation": "fwd P115", + "entity": "Q615869" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which stadium do Oklahoma City Blue play in?", + "expect": "Cox Convention Center", + "relation": "fwd P115", + "entity": "Q1575624" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which stadium do PBC Ural Great Perm play in?", + "expect": "Universal Sports Palace Molot", + "relation": "fwd P115", + "entity": "Q25759" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which stadium do Maccabi Tel Aviv B.C. play in?", + "expect": "Menora Mivtachim Arena", + "relation": "fwd P115", + "entity": "Q819694" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which stadium do FC Sportul Studen\u021besc Bucure\u0219ti play in?", + "expect": "Stadionul Regie", + "relation": "fwd P115", + "entity": "Q842134" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which stadium do BC Nev\u0117\u017eis play in?", + "expect": "K\u0117dainiai Arena", + "relation": "fwd P115", + "entity": "Q47096" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which stadium do Basket Zielona G\u00f3ra play in?", + "expect": "CRS Hall Zielona G\u00f3ra", + "relation": "fwd P115", + "entity": "Q868581" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "Which league does Nanterre 92 play in?", + "expect": "LNB \u00c9lite", + "relation": "fwd P118", + "entity": "Q1630671" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "Which league does Gen\u00e8ve-Servette HC play in?", + "expect": "National League", + "relation": "fwd P118", + "entity": "Q688882" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "Which league does Wilkes-Barre/Scranton Penguins play in?", + "expect": "American Hockey League", + "relation": "fwd P118", + "entity": "Q1550804" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "Which league does Ottawa Senators play in?", + "expect": "National Hockey League", + "relation": "fwd P118", + "entity": "Q203013" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "Which league does Hershey Bears play in?", + "expect": "American Hockey League", + "relation": "fwd P118", + "entity": "Q569225" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "Which league does Sokil Kyiv play in?", + "expect": "Ukrainian Hockey Championship", + "relation": "fwd P118", + "entity": "Q1563947" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "Which league does Seattle Kraken play in?", + "expect": "National Hockey League", + "relation": "fwd P118", + "entity": "Q59422166" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "Which league does Grand Rapids Gold play in?", + "expect": "NBA G League", + "relation": "fwd P118", + "entity": "Q16982503" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "Which league does HC CSKA Moscow play in?", + "expect": "Kontinental Hockey League", + "relation": "fwd P118", + "entity": "Q752418" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "Which league does EC Red Bull Salzburg play in?", + "expect": "ICE Hockey League", + "relation": "fwd P118", + "entity": "Q36936" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "Which league does Noblesville Boom play in?", + "expect": "NBA G League", + "relation": "fwd P118", + "entity": "Q1438822" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "Which league does CB San Pablo Burgos play in?", + "expect": "Segunda FEB", + "relation": "fwd P118", + "entity": "Q20936645" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which league do Trabzonspor Basketball play in?", + "expect": "Basketball Super League", + "relation": "fwd P118", + "entity": "Q2128426" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which league do Sioux Falls Skyforce play in?", + "expect": "NBA G League", + "relation": "fwd P118", + "entity": "Q2060261" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which league do Fukuoka SoftBank Hawks play in?", + "expect": "Pacific League", + "relation": "fwd P118", + "entity": "Q129164" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which league do AS Monaco Basket play in?", + "expect": "LNB \u00c9lite", + "relation": "fwd P118", + "entity": "Q2868091" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which league do Connecticut Sun play in?", + "expect": "Women's National Basketball Association", + "relation": "fwd P118", + "entity": "Q1126243" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which league do Oklahoma City Blue play in?", + "expect": "NBA G League", + "relation": "fwd P118", + "entity": "Q1575624" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which league do Calgary Flames play in?", + "expect": "National Hockey League", + "relation": "fwd P118", + "entity": "Q194126" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which league do Yunost Minsk play in?", + "expect": "Belarusian Extraleague", + "relation": "fwd P118", + "entity": "Q36982" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which league do Saitama Seibu Lions play in?", + "expect": "Pacific League", + "relation": "fwd P118", + "entity": "Q325819" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which league do Limoges CSP play in?", + "expect": "LNB \u00c9lite", + "relation": "fwd P118", + "entity": "Q1419876" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which league do Vaasan Sport play in?", + "expect": "Liiga", + "relation": "fwd P118", + "entity": "Q942233" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "Which league do EC KAC play in?", + "expect": "ICE Hockey League", + "relation": "fwd P118", + "entity": "Q166510" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "When was HKM Zvolen founded?", + "expect": "1927", + "relation": "fwd P571", + "entity": "Q1412658" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "When was Galatasaray S.K. founded?", + "expect": "1923", + "relation": "fwd P571", + "entity": "Q1420393" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "When was Severstal Cherepovets founded?", + "expect": "1956", + "relation": "fwd P571", + "entity": "Q1422185" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "When was Dallas Mavericks founded?", + "expect": "1980", + "relation": "fwd P571", + "entity": "Q132893" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "When was Quebec Bulldogs founded?", + "expect": "1888", + "relation": "fwd P571", + "entity": "Q1469113" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "When was Frankfurt Universe founded?", + "expect": "2007", + "relation": "fwd P571", + "entity": "Q1444903" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "When was Phoenix Mercury founded?", + "expect": "1997", + "relation": "fwd P571", + "entity": "Q1274643" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "When was Metallurg Novokuznetsk founded?", + "expect": "1949", + "relation": "fwd P571", + "entity": "Q1422392" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "When was V\u00e5lerenga Ishockey founded?", + "expect": "1913", + "relation": "fwd P571", + "entity": "Q1418604" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "When was San Antonio Spurs founded?", + "expect": "1967", + "relation": "fwd P571", + "entity": "Q159729" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "When was KK Union Olimpija founded?", + "expect": "1946", + "relation": "fwd P571", + "entity": "Q1137737" + }, + { + "split": "dev", + "kind": "sportsteams", + "valid": true, + "q": "When was Tappara founded?", + "expect": "1955", + "relation": "fwd P571", + "entity": "Q1419127" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "In what year was HC B\u00edl\u00ed Tyg\u0159i Liberec established?", + "expect": "1956", + "relation": "fwd P571", + "entity": "Q1019555" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "In what year was KK Bosna established?", + "expect": "1951", + "relation": "fwd P571", + "entity": "Q1479090" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "In what year was KK Zadar established?", + "expect": "1945", + "relation": "fwd P571", + "entity": "Q1141306" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "In what year was Milwaukee Admirals established?", + "expect": "1970", + "relation": "fwd P571", + "entity": "Q1267828" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "In what year was Lule\u00e5 HF established?", + "expect": "1977", + "relation": "fwd P571", + "entity": "Q1422772" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "In what year was Maroussi B.C. established?", + "expect": "1950", + "relation": "fwd P571", + "entity": "Q1355529" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "In what year was ZSC Lions established?", + "expect": "1930", + "relation": "fwd P571", + "entity": "Q136398" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "In what year was Chicago Wolves established?", + "expect": "1994", + "relation": "fwd P571", + "entity": "Q1072030" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "In what year was Fukuoka SoftBank Hawks established?", + "expect": "1938", + "relation": "fwd P571", + "entity": "Q129164" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "In what year was Lokomotiv Kuban established?", + "expect": "1946", + "relation": "fwd P571", + "entity": "Q1458596" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "In what year was Grand Rapids Griffins established?", + "expect": "1996", + "relation": "fwd P571", + "entity": "Q1542857" + }, + { + "split": "heldout", + "kind": "sportsteams", + "valid": true, + "q": "In what year was Fr\u00f6lunda HC established?", + "expect": "1938", + "relation": "fwd P571", + "entity": "Q1142013" + } +] \ No newline at end of file diff --git a/root/specialists/rel-sportsteams/relspec_scorer.py b/root/specialists/rel-sportsteams/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-sportsteams/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-sportsteams/verdict_dev.json b/root/specialists/rel-sportsteams/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..5a6839551b21f39262e52aa7b57f5d2dd1125081 --- /dev/null +++ b/root/specialists/rel-sportsteams/verdict_dev.json @@ -0,0 +1,133 @@ +{ + "id": "rel-sportsteams", + "name": "Oracle7 Relations: Sports teams", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:14:36Z", + "domain": { + "head": { + "correct": 8, + "false_yes": 0, + "wrong": 1, + "n": 36, + "p50_ms": 520.09, + "fails": [ + [ + "sportsteams", + "What is the home ground of Hartford Whalers?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "sportsteams", + "What is the home ground of Avangard Omsk?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "sportsteams", + "What is the home ground of Kolossos Rodou B.C.?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "sportsteams", + "What is the home ground of HC Sparta Praha?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "sportsteams", + "What is the home ground of Seattle Kraken?", + "unverified:corpus_query:property_of", + "I found a passage that may be related, but I can't verify it answers your question: \"They " + ], + [ + "sportsteams", + "What is the home ground of Band\u0131rma B.K.?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "sportsteams", + "What is the home ground of BC UNICS?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "sportsteams", + "What is the home ground of CB Sant Josep?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ] + ] + }, + "spec": { + "correct": 33, + "false_yes": 0, + "wrong": 0, + "n": 36, + "p50_ms": 3.45, + "fails": [ + [ + "sportsteams", + "Which league does Ottawa Senators play in?", + "specialist:rel-sportsteams>unverified", + "I can't verify the tournament of Ottawa Senators from my records, so I won't guess." + ], + [ + "sportsteams", + "Which league does HC CSKA Moscow play in?", + "specialist:rel-sportsteams>unverified", + "I can't verify the tournament of HC CSKA Moscow from my records, so I won't guess." + ], + [ + "sportsteams", + "When was Galatasaray S.K. founded?", + "specialist:rel-sportsteams>unverified", + "I can't verify the year written of Galatasaray S.K. from my records, so I won't guess." + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-sportsteams/verdict_heldout.json b/root/specialists/rel-sportsteams/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..c77613e006276ee7469af870aef79372039dbbf1 --- /dev/null +++ b/root/specialists/rel-sportsteams/verdict_heldout.json @@ -0,0 +1,114 @@ +{ + "id": "rel-sportsteams", + "name": "Oracle7 Relations: Sports teams", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:15:10Z", + "domain": { + "head": { + "correct": 7, + "false_yes": 0, + "wrong": 0, + "n": 36, + "p50_ms": 986.64, + "fails": [ + [ + "sportsteams", + "Which stadium do Mikkelin Jukurit play in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "sportsteams", + "Which stadium do Juvecaserta Basket play in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "sportsteams", + "Which stadium do L\u00f8renskog IK play in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "sportsteams", + "Which stadium do Texas Stars play in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "sportsteams", + "Which stadium do Paris Basketball play in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "sportsteams", + "Which stadium do HC Pardubice play in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "sportsteams", + "Which stadium do Oklahoma City Blue play in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "sportsteams", + "Which stadium do PBC Ural Great Perm play in?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 36, + "false_yes": 0, + "wrong": 0, + "n": 36, + "p50_ms": 2.3, + "fails": [] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-theatres/manifest.json b/root/specialists/rel-theatres/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..69f67405bd8aca698df50ef44f1517594edaa64f --- /dev/null +++ b/root/specialists/rel-theatres/manifest.json @@ -0,0 +1,72 @@ +{ + "id": "rel-theatres", + "name": "Oracle7 Relations: Theatres and opera houses", + "number": 248, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-theatres/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-theatres", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "theatres", + "kind": "theatres" + } + }, + "accept": { + "kinds": [ + "theatres" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-theatres/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [ + 24354, + 153562 + ], + "occupations": [] + }, + "readers": [ + "84", + "1619", + "17" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-theatres/organ_relation_v2.py b/root/specialists/rel-theatres/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-theatres/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-theatres/readers.json b/root/specialists/rel-theatres/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..95ea541888104d5aa041e88cc3d5c74cc3cd1f83 --- /dev/null +++ b/root/specialists/rel-theatres/readers.json @@ -0,0 +1,8 @@ +{ + "keys": [ + "84", + "1619", + "17" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-theatres/relation_panel_v2.json b/root/specialists/rel-theatres/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..0d967619daa6e20c5577df35234d54d20ab60473 --- /dev/null +++ b/root/specialists/rel-theatres/relation_panel_v2.json @@ -0,0 +1,452 @@ +[ + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "Who was the architect of Concertgebouw?", + "expect": "Dolf van Gendt", + "relation": "fwd P84", + "entity": "Q849957" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "Who was the architect of Aldwych Theatre?", + "expect": "W. G. R. Sprague", + "relation": "fwd P84", + "entity": "Q1783531" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "Who was the architect of Teatro Comunale?", + "expect": "Galli da Bibiena family", + "relation": "fwd P84", + "entity": "Q2306368" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "Who was the architect of Barbican Centre?", + "expect": "Chamberlin, Powell and Bon", + "relation": "fwd P84", + "entity": "Q653858" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "Who was the architect of Croatian National Theatre in Zagreb?", + "expect": "Fellner & Helmer", + "relation": "fwd P84", + "entity": "Q268151" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "Who was the architect of Drottningholm Palace Theatre?", + "expect": "Carl Fredrik Adelcrantz", + "relation": "fwd P84", + "entity": "Q3058143" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "Who was the architect of Athens Concert Hall?", + "expect": "Emmanouil Vourekas", + "relation": "fwd P84", + "entity": "Q582203" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "Who was the architect of Esplanade \u2013 Theatres on the Bay?", + "expect": "DP Architects", + "relation": "fwd P84", + "entity": "Q559113" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "Who was the architect of Teatro Farnese?", + "expect": "Giovan Battista Aleotti", + "relation": "fwd P84", + "entity": "Q1507811" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "Who was the architect of Shanghai Grand Theatre?", + "expect": "Jean-Marie Charpentier", + "relation": "fwd P84", + "entity": "Q1325611" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "Who was the architect of Theater des Westens?", + "expect": "Bernhard Sehring", + "relation": "fwd P84", + "entity": "Q698233" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "Who was the architect of Opera Carlo Felice Genova?", + "expect": "Carlo Barabino", + "relation": "fwd P84", + "entity": "Q2299021" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "Who designed Th\u00e9\u00e2tre du Ch\u00e2telet?", + "expect": "Gabriel Davioud", + "relation": "fwd P84", + "entity": "Q1469315" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "Who designed La Monumental?", + "expect": "Manuel Joaquim Raspall i Mayol", + "relation": "fwd P84", + "entity": "Q337522" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "Who designed Baku Puppet Theatre?", + "expect": "J\u00f3zef Plo\u015bko", + "relation": "fwd P84", + "entity": "Q597749" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "Who designed Haus der Kulturen der Welt?", + "expect": "Hugh Stubbins", + "relation": "fwd P84", + "entity": "Q704933" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "Who designed Theatre Royal Haymarket?", + "expect": "John Nash", + "relation": "fwd P84", + "entity": "Q540426" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "Who designed Apollo Theatre?", + "expect": "Lewin Sharp", + "relation": "fwd P84", + "entity": "Q4780361" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "Who designed Carltheater?", + "expect": "August Sicard von Sicardsburg", + "relation": "fwd P84", + "entity": "Q877699" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "Who designed Theater in der Josefstadt?", + "expect": "Joseph Kornh\u00e4usel", + "relation": "fwd P84", + "entity": "Q167619" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "Who designed Op\u00e9ra de Monte-Carlo?", + "expect": "Charles Garnier", + "relation": "fwd P84", + "entity": "Q1577048" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "Who designed Adelphi Theatre?", + "expect": "Ernest Schaufelberg", + "relation": "fwd P84", + "entity": "Q355319" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "Who designed Egyptian Royal Opera House?", + "expect": "Pietro Avoscani", + "relation": "fwd P84", + "entity": "Q1572776" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "Who designed Volkstheater?", + "expect": "Fellner & Helmer", + "relation": "fwd P84", + "entity": "Q688555" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "When did Theater des Westens open?", + "expect": "1896", + "relation": "fwd P1619", + "entity": "Q698233" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "When did Bataclan open?", + "expect": "3 February 1865", + "relation": "fwd P1619", + "entity": "Q810700" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "When did National Theater of Albania open?", + "expect": "1939", + "relation": "fwd P1619", + "entity": "Q597573" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "When did Teatro Lirico Giuseppe Verdi open?", + "expect": "21 April 1801", + "relation": "fwd P1619", + "entity": "Q2294135" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "When did Teatro Real open?", + "expect": "1850", + "relation": "fwd P1619", + "entity": "Q211250" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "When did Teatro Comunale open?", + "expect": "1763", + "relation": "fwd P1619", + "entity": "Q2306368" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "When did His Majesty's Theatre open?", + "expect": "1897", + "relation": "fwd P1619", + "entity": "Q1155331" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "When did Op\u00e9ra Bastille open?", + "expect": "14 July 1989", + "relation": "fwd P1619", + "entity": "Q638423" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "When did Copenhagen Opera House open?", + "expect": "15 January 2005", + "relation": "fwd P1619", + "entity": "Q838297" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "When did Od\u00e9on-Th\u00e9\u00e2tre de l'Europe open?", + "expect": "1782", + "relation": "fwd P1619", + "entity": "Q1133501" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "When did Dubai Opera House open?", + "expect": "31 August 2016", + "relation": "fwd P1619", + "entity": "Q2913336" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "When did National Theatre Oslo open?", + "expect": "1899", + "relation": "fwd P1619", + "entity": "Q565382" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "In what year did Municipal Theater of S\u00e3o Paulo open?", + "expect": "1911", + "relation": "fwd P1619", + "entity": "Q2297627" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "In what year did Teatro Municipal open?", + "expect": "1909", + "relation": "fwd P1619", + "entity": "Q1968538" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "In what year did Oslo Opera House open?", + "expect": "2008", + "relation": "fwd P1619", + "entity": "Q43280" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "In what year did Theatre Royal Haymarket open?", + "expect": "1821", + "relation": "fwd P1619", + "entity": "Q540426" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "In what year did Teatro Argentina open?", + "expect": "1732", + "relation": "fwd P1619", + "entity": "Q588377" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "In what year did Peacock Theater open?", + "expect": "2007", + "relation": "fwd P1619", + "entity": "Q7048038" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "In what year did Aarhus Theatre open?", + "expect": "1900", + "relation": "fwd P1619", + "entity": "Q1138832" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "In what year did Abay Opera House open?", + "expect": "1934", + "relation": "fwd P1619", + "entity": "Q304839" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "In what year did Manoel Theatre open?", + "expect": "1732", + "relation": "fwd P1619", + "entity": "Q576800" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "In what year did Teatro Massimo Vittorio Emanuele open?", + "expect": "1897", + "relation": "fwd P1619", + "entity": "Q261439" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "In what year did Op\u00e9ra de Monte-Carlo open?", + "expect": "1879", + "relation": "fwd P1619", + "entity": "Q1577048" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "In what year did Teatro Nacional de S\u00e3o Carlos open?", + "expect": "1793", + "relation": "fwd P1619", + "entity": "Q1146936" + }, + { + "split": "dev", + "kind": "theatres", + "valid": true, + "q": "In which country is New National Theatre Tokyo?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q1056064" + }, + { + "split": "heldout", + "kind": "theatres", + "valid": true, + "q": "Which country is Kabuki-za in?", + "expect": "Japan", + "relation": "fwd P17", + "entity": "Q3082575" + } +] \ No newline at end of file diff --git a/root/specialists/rel-theatres/relspec_scorer.py b/root/specialists/rel-theatres/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-theatres/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-theatres/verdict_dev.json b/root/specialists/rel-theatres/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..02d4bd56ef0130002ea10c163489ca2ec7b0e532 --- /dev/null +++ b/root/specialists/rel-theatres/verdict_dev.json @@ -0,0 +1,139 @@ +{ + "id": "rel-theatres", + "name": "Oracle7 Relations: Theatres and opera houses", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w406", + "time": "2026-10-13T03:09:57Z", + "domain": { + "head": { + "correct": 3, + "false_yes": 0, + "wrong": 1, + "n": 25, + "p50_ms": 1619.03, + "fails": [ + [ + "theatres", + "Who was the architect of Concertgebouw?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "theatres", + "Who was the architect of Aldwych Theatre?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "theatres", + "Who was the architect of Teatro Comunale?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "theatres", + "Who was the architect of Croatian National Theatre in Zagreb?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "theatres", + "Who was the architect of Drottningholm Palace Theatre?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "theatres", + "Who was the architect of Athens Concert Hall?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "theatres", + "Who was the architect of Esplanade \u2013 Theatres on the Bay?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "theatres", + "Who was the architect of Shanghai Grand Theatre?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 21, + "false_yes": 0, + "wrong": 0, + "n": 25, + "p50_ms": 2.46, + "fails": [ + [ + "theatres", + "Who was the architect of Concertgebouw?", + "specialist:rel-theatres>unverified", + "I can't verify the architecture firm of Concertgebouw from my records, so I won't guess." + ], + [ + "theatres", + "Who was the architect of Teatro Comunale?", + "specialist:rel-theatres>unverified", + "I can't verify the architecture firm of Teatro Comunale from my records, so I won't guess." + ], + [ + "theatres", + "When did Teatro Comunale open?", + "specialist:rel-theatres>unverified", + "I can't verify the opening date of Teatro Comunale from my records, so I won't guess." + ], + [ + "theatres", + "When did His Majesty's Theatre open?", + "specialist:rel-theatres>unverified", + "I can't verify the opening date of His Majesty's Theatre from my records, so I won't guess" + ] + ] + } + }, + "core": { + "head": { + "correct": 132, + "false_yes": 0 + }, + "spec": { + "correct": 132, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-theatres/verdict_heldout.json b/root/specialists/rel-theatres/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..32876db3906d9d1cf7fb91d3145aa7fefdb7d332 --- /dev/null +++ b/root/specialists/rel-theatres/verdict_heldout.json @@ -0,0 +1,127 @@ +{ + "id": "rel-theatres", + "name": "Oracle7 Relations: Theatres and opera houses", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w406", + "time": "2026-10-13T03:10:55Z", + "domain": { + "head": { + "correct": 7, + "false_yes": 0, + "wrong": 0, + "n": 25, + "p50_ms": 650.23, + "fails": [ + [ + "theatres", + "Who designed Baku Puppet Theatre?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "theatres", + "Who designed Theatre Royal Haymarket?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "theatres", + "Who designed Carltheater?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "theatres", + "Who designed Theater in der Josefstadt?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "theatres", + "Who designed Op\u00e9ra de Monte-Carlo?", + "unverified:factoid:page", + "I found a passage that may be related, but I can't verify it answers your question: \"Build" + ], + [ + "theatres", + "Who designed Adelphi Theatre?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "theatres", + "Who designed Egyptian Royal Opera House?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "theatres", + "Who designed Volkstheater?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 23, + "false_yes": 0, + "wrong": 0, + "n": 25, + "p50_ms": 2.06, + "fails": [ + [ + "theatres", + "Who designed Adelphi Theatre?", + "specialist:rel-theatres>unverified", + "I can't verify the architecture firm of Adelphi Theatre from my records, so I won't guess." + ], + [ + "theatres", + "In what year did Teatro Municipal open?", + "specialist:rel-theatres>unverified", + "I can't verify the opening date of Teatro Municipal from my records, so I won't guess." + ] + ] + } + }, + "core": { + "head": { + "correct": 132, + "false_yes": 0 + }, + "spec": { + "correct": 132, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-theologians/manifest.json b/root/specialists/rel-theologians/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..1289226eaaf63e2b571fd9379184418481b07958 --- /dev/null +++ b/root/specialists/rel-theologians/manifest.json @@ -0,0 +1,79 @@ +{ + "id": "rel-theologians", + "name": "Oracle7 Relations: Theologians and religious leaders", + "number": 224, + "tier": "R", + "sources": [ + { + "name": "Wikidata (relation store v2: typed statements of the items with an English Wikipedia article)", + "licence": "CC0 1.0", + "url": "https://www.wikidata.org/" + }, + { + "name": "Readers written by Oracle7, each phrasing measured on TriviaQA / Mintaka / WebQuestions TRAIN questions (>= 90% answering precision kept)", + "licence": "Apache-2.0 / CC BY 4.0 (question sets)", + "url": "https://huggingface.co/datasets/mandarjoshi/trivia_qa" + } + ], + "store": { + "path": "__ORACLE7_ROOT__/specialists/rel-theologians/readers.json", + "shared": "__ORACLE7_ROOT__/relstore/relations_v2.sqlite3 (Wikidata relation store, shared by every relation specialist and the core's router; ships once with the release)" + }, + "organ": { + "dir": "__ORACLE7_ROOT__/specialists/rel-theologians", + "module": "organ_relation_v2", + "class": "RelationOrganV2", + "init": { + "domain": "theologians", + "kind": "theologians" + } + }, + "accept": { + "kinds": [ + "theologians" + ], + "declines_in_domain": [ + "unverified" + ], + "context_regex": "" + }, + "panel": { + "path": "__ORACLE7_ROOT__/specialists/rel-theologians/relation_panel_v2.json", + "splits": [ + "dev", + "heldout" + ], + "exclude_kinds_composed": [], + "scorer_module": "relspec_scorer", + "scorer_fn": "ok" + }, + "routing_cues": [], + "budgets": { + "latency_p50_ms": 1000, + "store_mb": 1 + }, + "core_sample": { + "n": 400, + "seed": 20261008 + }, + "domain": { + "roots": [], + "occupations": [ + 1234713, + 15995642 + ] + }, + "readers": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25", + "1366", + "1365" + ], + "notes": "Exact relation reading over Wikidata within one domain (hand-written readers measured on natural TRAIN questions, plus mined patterns): answers only when one names the relation and the store gives one value; silent otherwise. Panel: two phrasings per relation written for people (dev and held-out differ), entities never seen in mining; expect = the store's value (tests reading, not Wikidata's truth). Same author, disclosed. Recognise-then-decline: a forward relation question about an in-domain entity it cannot read reliably is declined, never left to a weaker route." +} \ No newline at end of file diff --git a/root/specialists/rel-theologians/organ_relation_v2.py b/root/specialists/rel-theologians/organ_relation_v2.py new file mode 100644 index 0000000000000000000000000000000000000000..c52a1f7777a1aeb1e62b6fcd4b07b98768610cbd --- /dev/null +++ b/root/specialists/rel-theologians/organ_relation_v2.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""organ_relation_v2 - one RELATION SPECIALIST (v2): a domain read two ways over the Wikidata relation store - + 1. its HAND-WRITTEN READERS (wander-train/relation_spec_v2 + relation_readers_v1): whole-question phrasings with an entity + slot, each measured on 140k natural TRAIN questions first (phrasings below 90% answering precision dropped); + 2. its MINED PATTERNS (wander-train/relation_spec_v1), when the domain has any (>= 90% on both halves of the train pool). +It answers only when one of them names the relation and the store gives exactly one value; otherwise it is silent and the +turn goes on to the core. Every answer carries its receipt (subject Q-id, property, value). +Returns {kind, status, response, value} or None.""" +import json +import os + +import relation_spec_v1 as RS1 +import relation_spec_v2 as RS2 + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def _key(k): + return k if isinstance(k, str) and not k.lstrip("-").isdigit() else int(k) + + +class RelationOrganV2: + def __init__(self, domain, readers="readers.json", patterns="patterns.json", kind=None): + self.domain = domain + self.kind = kind or domain + r = json.load(open(os.path.join(HERE, readers))) + self.readers = [_key(k) for k in r["keys"]] + self.dropped = frozenset((_key(k), d, int(i)) for k, d, i in r.get("dropped", [])) + p = os.path.join(HERE, patterns) + self.patterns = json.load(open(p)) if os.path.exists(p) else {} + + def answer(self, text, session_id="default"): + q = str(text or "") + try: + a = RS2.answer(q, self.domain, self.readers, self.dropped) + if not a and self.patterns: + a = RS1.answer(q, self.domain, self.patterns) + except Exception: # noqa: BLE001 - a store problem is silence, never a guess + return None + if not a: + return None + rs = RS1._rs() + if a.get("decline"): + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + return {"kind": "unverified", "status": "withheld", "value": None, + "response": "I can't verify the %s of %s from my records, so I won't guess." % (RS1.prop_label(a["property"]), subj)} + subj = rs.label(a["subject_qid"]) or "Q%d" % a["subject_qid"] + plab = RS1.prop_label(a["property"]) + if a["direction"] == "fwd": + receipt = "%s (Q%d) - %s (P%d) - %s" % (subj, a["subject_qid"], plab, a["property"], a["answer"]) + else: + lab = rs.label(a["linked_qid"]) or "Q%d" % a["linked_qid"] + receipt = "%s (Q%d) - %s (P%d) - %s (Q%d)" % (subj, a["subject_qid"], plab, a["property"], lab, a["linked_qid"]) + return {"kind": self.kind, "status": "answered", "value": a["answer"], + "response": "%s. From the Wikidata relation store: %s." % (a["answer"], receipt)} diff --git a/root/specialists/rel-theologians/readers.json b/root/specialists/rel-theologians/readers.json new file mode 100644 index 0000000000000000000000000000000000000000..aede631ee9657afcec1a5c9dfbbd1fd644ee9864 --- /dev/null +++ b/root/specialists/rel-theologians/readers.json @@ -0,0 +1,15 @@ +{ + "keys": [ + "19", + "20", + "569", + "570", + "27", + "26", + "22", + "25", + "1366", + "1365" + ], + "dropped": [] +} \ No newline at end of file diff --git a/root/specialists/rel-theologians/relation_panel_v2.json b/root/specialists/rel-theologians/relation_panel_v2.json new file mode 100644 index 0000000000000000000000000000000000000000..a2ba614d97d3446cb5fc65f6bdc3d1a04c8bbe89 --- /dev/null +++ b/root/specialists/rel-theologians/relation_panel_v2.json @@ -0,0 +1,1811 @@ +[ + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where was Francesco Marmaggi born?", + "expect": "Rome", + "relation": "fwd P19", + "entity": "Q1360335" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where was Philo of Alexandria born?", + "expect": "Alexandria", + "relation": "fwd P19", + "entity": "Q189597" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where was Al-Zafir born?", + "expect": "Cairo", + "relation": "fwd P19", + "entity": "Q285953" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where was Miguel d'Escoto Brockmann born?", + "expect": "Los Angeles", + "relation": "fwd P19", + "entity": "Q113935" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where was Antonio Bacci born?", + "expect": "Italy", + "relation": "fwd P19", + "entity": "Q551527" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where was Jacob Litzman born?", + "expect": "Germany", + "relation": "fwd P19", + "entity": "Q2120884" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where was Gu\u00f0brandur \u00deorl\u00e1ksson born?", + "expect": "Iceland", + "relation": "fwd P19", + "entity": "Q522982" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where was Israel Kirzner born?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q349109" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where was Richard Whately born?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q2997652" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where was Carlo Grano born?", + "expect": "Rome", + "relation": "fwd P19", + "entity": "Q698055" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where was Giles of Rome born?", + "expect": "Rome", + "relation": "fwd P19", + "entity": "Q380647" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where was Philip Doddridge born?", + "expect": "London", + "relation": "fwd P19", + "entity": "Q2718478" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "What is the birthplace of Clement?", + "expect": "Rome", + "relation": "fwd P19", + "entity": "Q42887" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "What is the birthplace of Nizar?", + "expect": "Cairo", + "relation": "fwd P19", + "entity": "Q2634332" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "What is the birthplace of Nicolas Malebranche?", + "expect": "Paris", + "relation": "fwd P19", + "entity": "Q309818" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "What is the birthplace of Al-Adid?", + "expect": "Cairo", + "relation": "fwd P19", + "entity": "Q286460" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "What is the birthplace of Andrea Riccardi?", + "expect": "Rome", + "relation": "fwd P19", + "entity": "Q48602" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "What is the birthplace of Al-Hakim bi-Amr Allah?", + "expect": "Cairo", + "relation": "fwd P19", + "entity": "Q342137" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "What is the birthplace of Isaac ben Solomon al-Israeli?", + "expect": "Egypt", + "relation": "fwd P19", + "entity": "Q536837" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "What is the birthplace of Cotton Mather?", + "expect": "Boston", + "relation": "fwd P19", + "entity": "Q380719" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "What is the birthplace of Agust\u00edn Garc\u00eda-Gasco Vicente?", + "expect": "Spain", + "relation": "fwd P19", + "entity": "Q399253" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "What is the birthplace of Anastasius Sinaita?", + "expect": "Alexandria", + "relation": "fwd P19", + "entity": "Q473291" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "What is the birthplace of Pietro Della Valle?", + "expect": "Rome", + "relation": "fwd P19", + "entity": "Q545024" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "What is the birthplace of Al-Jabarti?", + "expect": "Cairo", + "relation": "fwd P19", + "entity": "Q658401" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where did Achille Silvestrini die?", + "expect": "Vatican City", + "relation": "fwd P20", + "entity": "Q340251" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where did Erdmann Neumeister die?", + "expect": "Hamburg", + "relation": "fwd P20", + "entity": "Q67938" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where did Giovanni Cheli die?", + "expect": "Rome", + "relation": "fwd P20", + "entity": "Q918313" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where did Albertus Magnus die?", + "expect": "Cologne", + "relation": "fwd P20", + "entity": "Q60059" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where did Alcuin die?", + "expect": "Tours", + "relation": "fwd P20", + "entity": "Q154332" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where did David Strauss die?", + "expect": "Ludwigsburg", + "relation": "fwd P20", + "entity": "Q57219" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where did Nikolay Zabolotsky die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q515872" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where did Antonio Riberi die?", + "expect": "Rome", + "relation": "fwd P20", + "entity": "Q604590" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where did Al-Musta'li die?", + "expect": "Cairo", + "relation": "fwd P20", + "entity": "Q285668" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where did Johannes Pfefferkorn die?", + "expect": "Cologne", + "relation": "fwd P20", + "entity": "Q66486" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where did Sebastiano Baggio die?", + "expect": "Rome", + "relation": "fwd P20", + "entity": "Q982074" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Where did Hans Urs von Balthasar die?", + "expect": "Basel", + "relation": "fwd P20", + "entity": "Q122976" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In which city did Giuseppe Paupini die?", + "expect": "Rome", + "relation": "fwd P20", + "entity": "Q1352456" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In which city did Isaac Barrow die?", + "expect": "London", + "relation": "fwd P20", + "entity": "Q207718" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In which city did Eduard Zeller die?", + "expect": "Stuttgart", + "relation": "fwd P20", + "entity": "Q61862" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In which city did Jan \u0160r\u00e1mek die?", + "expect": "Prague", + "relation": "fwd P20", + "entity": "Q694849" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In which city did Al-Adid die?", + "expect": "Cairo", + "relation": "fwd P20", + "entity": "Q286460" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In which city did Nicolae Milescu die?", + "expect": "Moscow", + "relation": "fwd P20", + "entity": "Q1918880" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In which city did Muhammad al-Badr die?", + "expect": "London", + "relation": "fwd P20", + "entity": "Q711230" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In which city did Antonio Mar\u00eda Javierre Ortas die?", + "expect": "Rome", + "relation": "fwd P20", + "entity": "Q539180" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In which city did Ibn 'Ata Allah die?", + "expect": "Cairo", + "relation": "fwd P20", + "entity": "Q2827445" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In which city did Alfredo Ottaviani die?", + "expect": "Vatican City", + "relation": "fwd P20", + "entity": "Q368201" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In which city did Philip Schaff die?", + "expect": "New York City", + "relation": "fwd P20", + "entity": "Q115922" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In which city did Leo Allatius die?", + "expect": "Rome", + "relation": "fwd P20", + "entity": "Q725712" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When was Al-Shahrastani born?", + "expect": "1086", + "relation": "fwd P569", + "entity": "Q1050887" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When was Karl Barth born?", + "expect": "10 May 1886", + "relation": "fwd P569", + "entity": "Q107473" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When was Istv\u00e1n K\u00fczmics born?", + "expect": "1723", + "relation": "fwd P569", + "entity": "Q1050640" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When was Abd Allah ibn Ja'far born?", + "expect": "622", + "relation": "fwd P569", + "entity": "Q1112978" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When was Sojourner Truth born?", + "expect": "1797", + "relation": "fwd P569", + "entity": "Q105180" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When was Karl Gerok born?", + "expect": "30 January 1815", + "relation": "fwd P569", + "entity": "Q111367" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When was Nafi' al-Madani born?", + "expect": "689", + "relation": "fwd P569", + "entity": "Q112465" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When was Jerzy Nowosielski born?", + "expect": "7 January 1923", + "relation": "fwd P569", + "entity": "Q1125065" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When was Suhayb ar-Rumi born?", + "expect": "587", + "relation": "fwd P569", + "entity": "Q1112992" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When was Public Universal Friend born?", + "expect": "29 November 1752", + "relation": "fwd P569", + "entity": "Q10306630" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When was Carl Paul Caspari born?", + "expect": "8 February 1814", + "relation": "fwd P569", + "entity": "Q1040041" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When was Esmaeil Khatib born?", + "expect": "1961", + "relation": "fwd P569", + "entity": "Q108120922" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year was Charles Hartshorne born?", + "expect": "1897", + "relation": "fwd P569", + "entity": "Q1064777" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year was Naser Makarem Shirazi born?", + "expect": "1927", + "relation": "fwd P569", + "entity": "Q1075947" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year was Carlos Osoro born?", + "expect": "1945", + "relation": "fwd P569", + "entity": "Q1043124" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year was Gaetano Bisleti born?", + "expect": "1856", + "relation": "fwd P569", + "entity": "Q1109770" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year was Atsuko Ikeda born?", + "expect": "1931", + "relation": "fwd P569", + "entity": "Q1030348" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year was Kazuko Takatsukasa born?", + "expect": "1929", + "relation": "fwd P569", + "entity": "Q1030373" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year was Adam of Bremen born?", + "expect": "1100", + "relation": "fwd P569", + "entity": "Q109244" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year was Abu Darda born?", + "expect": "586", + "relation": "fwd P569", + "entity": "Q1112739" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year was Charles de Bovelles born?", + "expect": "1479", + "relation": "fwd P569", + "entity": "Q1066534" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year was Alfons Maria Stickler born?", + "expect": "1910", + "relation": "fwd P569", + "entity": "Q112159" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year was Arius born?", + "expect": "250", + "relation": "fwd P569", + "entity": "Q106026" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year was Martin Hattala born?", + "expect": "1821", + "relation": "fwd P569", + "entity": "Q1040777" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When did Kurt Marti die?", + "expect": "11 February 2017", + "relation": "fwd P570", + "entity": "Q123494" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When did Hans Urs von Balthasar die?", + "expect": "26 June 1988", + "relation": "fwd P570", + "entity": "Q122976" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When did Rbi Menachem Mendel Schneersohn die?", + "expect": "29 March 1866", + "relation": "fwd P570", + "entity": "Q1337389" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When did Bernhard Studer die?", + "expect": "2 May 1887", + "relation": "fwd P570", + "entity": "Q120356" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When did Hussein bin Ali die?", + "expect": "4 June 1931", + "relation": "fwd P570", + "entity": "Q128906" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When did Ibn Qayyim al-Jawziyya die?", + "expect": "24 September 1350", + "relation": "fwd P570", + "entity": "Q119679" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When did Henri Schwery die?", + "expect": "7 January 2021", + "relation": "fwd P570", + "entity": "Q115681" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When did Dino Monduzzi die?", + "expect": "13 October 2006", + "relation": "fwd P570", + "entity": "Q1226645" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When did Karl Adolph Gjellerup die?", + "expect": "11 October 1919", + "relation": "fwd P570", + "entity": "Q131487" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When did Suhayb ar-Rumi die?", + "expect": "4 March 659", + "relation": "fwd P570", + "entity": "Q1112992" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When did Benno Gut die?", + "expect": "8 December 1970", + "relation": "fwd P570", + "entity": "Q115801" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "When did Richard Simon die?", + "expect": "11 April 1712", + "relation": "fwd P570", + "entity": "Q1345478" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year did Charles Fox Parham die?", + "expect": "1929", + "relation": "fwd P570", + "entity": "Q1064415" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year did Anne Hutchinson die?", + "expect": "1643", + "relation": "fwd P570", + "entity": "Q11608" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year did Giuseppe Paupini die?", + "expect": "1992", + "relation": "fwd P570", + "entity": "Q1352456" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year did Theodore Bibliander die?", + "expect": "1564", + "relation": "fwd P570", + "entity": "Q115851" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year did Konrad Pellikan die?", + "expect": "1556", + "relation": "fwd P570", + "entity": "Q116548" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year did Xenophanes die?", + "expect": "477 BC", + "relation": "fwd P570", + "entity": "Q131671" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year did \u00c7avu\u015fzade Mehmed Cem\u00e2leddin Efendi die?", + "expect": "1938", + "relation": "fwd P570", + "entity": "Q1262170" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year did Charles Williams die?", + "expect": "1945", + "relation": "fwd P570", + "entity": "Q124735" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year did Hasan-i Sabbah die?", + "expect": "1124", + "relation": "fwd P570", + "entity": "Q124745907" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year did Cornelius a Lapide die?", + "expect": "1637", + "relation": "fwd P570", + "entity": "Q1134021" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year did Mirza Basheer-ud-Din Mahmood Ahmad die?", + "expect": "1965", + "relation": "fwd P570", + "entity": "Q1147544" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "In what year did Charles Hartshorne die?", + "expect": "2000", + "relation": "fwd P570", + "entity": "Q1064777" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "What nationality was Anathon Aall?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q487387" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "What nationality was Gerald Emmett Carter?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q586927" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "What nationality was Jacob Aall?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q511046" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "What nationality was Ingrid Mattson?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q3595667" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "What nationality was Michael Sars?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q264482" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "What nationality was Bernard Lonergan?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q530983" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "What nationality was Hirata Atsutane?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q2572749" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "What nationality was Carl Paul Caspari?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q1040041" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Which country was Nakayama Miki a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q2723199" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Which country was Henrik Wergeland a citizen of?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q351705" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Which country was Kjell Magne Bondevik a citizen of?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q207655" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Which country was Kazuko Takatsukasa a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1030373" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Which country was Atsuko Ikeda a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q1030348" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Which country was J. I. Packer a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q1191946" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Which country was Jan Kj\u00e6rstad a citizen of?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q473196" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Which country was Shinran a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q512934" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Which country was Job Getcha a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q15123533" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Which country was Berislav Grgi\u0107 a citizen of?", + "expect": "Norway", + "relation": "fwd P27", + "entity": "Q434169" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Which country was Marc Ouellet a citizen of?", + "expect": "Canada", + "relation": "fwd P27", + "entity": "Q711547" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Which country was Sayako Kuroda a citizen of?", + "expect": "Japan", + "relation": "fwd P27", + "entity": "Q229333" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Miles Joseph Berkeley married to?", + "expect": "Cecilia Emma Berkeley", + "relation": "fwd P26", + "entity": "Q662338" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Yosef Yitzchok Schneersohn married to?", + "expect": "Nechama Dina Schneerson", + "relation": "fwd P26", + "entity": "Q966359" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was David Strauss married to?", + "expect": "Agnese Schebest", + "relation": "fwd P26", + "entity": "Q57219" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was George Berkeley married to?", + "expect": "Anne Forster", + "relation": "fwd P26", + "entity": "Q82049" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Chaim Kanievsky married to?", + "expect": "Batsheva Kanievsky", + "relation": "fwd P26", + "entity": "Q2760338" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Ethan Allen married to?", + "expect": "Frances Montresor Buchanan Allen Penniman", + "relation": "fwd P26", + "entity": "Q552007" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Gottfried Kinkel married to?", + "expect": "Johanna Kinkel", + "relation": "fwd P26", + "entity": "Q68325" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Solomon Schechter married to?", + "expect": "Mathilde Roth Schechter", + "relation": "fwd P26", + "entity": "Q1391460" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Nikolai Berdyaev married to?", + "expect": "Lydia Yudifovna Berdyaev", + "relation": "fwd P26", + "entity": "Q184656" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Michael Bell married to?", + "expect": "Victoria Carroll", + "relation": "fwd P26", + "entity": "Q925891" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Wolfgang Capito married to?", + "expect": "Wibrandis Rosenblatt", + "relation": "fwd P26", + "entity": "Q1368362" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Johannes Oecolampadius married to?", + "expect": "Wibrandis Rosenblatt", + "relation": "fwd P26", + "entity": "Q123450" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who is the spouse of Ernest Renan?", + "expect": "Corn\u00e9lie Renan", + "relation": "fwd P26", + "entity": "Q157155" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who is the spouse of As-Saffah?", + "expect": "Umm Salamah al-Makhzumiyah", + "relation": "fwd P26", + "entity": "Q252087" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who is the spouse of Guru Angad Dev?", + "expect": "Mata Khivi", + "relation": "fwd P26", + "entity": "Q370204" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who is the spouse of \u02bbAbdu'l-Bah\u00e1?", + "expect": "Mun\u00edrih", + "relation": "fwd P26", + "entity": "Q216954" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who is the spouse of Alice von Hildebrand?", + "expect": "Dietrich von Hildebrand", + "relation": "fwd P26", + "entity": "Q275370" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who is the spouse of Rick Warren?", + "expect": "Kay Warren", + "relation": "fwd P26", + "entity": "Q380107" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who is the spouse of Johann Georg Sulzer?", + "expect": "Wilhelmine Sulzer-Keusenhoff", + "relation": "fwd P26", + "entity": "Q116036" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who is the spouse of Umar II?", + "expect": "Fatima bint Abd al-Malik", + "relation": "fwd P26", + "entity": "Q298403" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who is the spouse of Akiva ben Joseph?", + "expect": "Rachel, wife of Rabbi Akiva", + "relation": "fwd P26", + "entity": "Q310821" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who is the spouse of Alexei Khomyakov?", + "expect": "Ekaterina Mikhailovna Khomyakova", + "relation": "fwd P26", + "entity": "Q358497" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who is the spouse of Johann Gottfried Herder?", + "expect": "Caroline Herder", + "relation": "fwd P26", + "entity": "Q155547" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who is the spouse of Ibn Hajar al-Asqalani?", + "expect": "Anas Khatun", + "relation": "fwd P26", + "entity": "Q471116" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Moses Isserles's father?", + "expect": "Israel ben Josef", + "relation": "fwd P22", + "entity": "Q1949189" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Uta Ranke-Heinemann's father?", + "expect": "Gustav Heinemann", + "relation": "fwd P22", + "entity": "Q63834" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Said bin Ahmad Al Busaidi's father?", + "expect": "Ahmad bin Said Al Busaidi", + "relation": "fwd P22", + "entity": "Q885411" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was William Penn's father?", + "expect": "William Penn", + "relation": "fwd P22", + "entity": "Q209152" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Muhammad ibn Ali al-Abbasi's father?", + "expect": "Al\u00ed ibn Abd-Al\u00b7lah ibn al-Abb\u00e0s", + "relation": "fwd P22", + "entity": "Q6892574" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Al-Mutawakkil's father?", + "expect": "Al-Mu'tasim", + "relation": "fwd P22", + "entity": "Q220789" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Al-Aziz Billah's father?", + "expect": "onseko", + "relation": "fwd P22", + "entity": "Q286542" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Count Hieronymus von Colloredo's father?", + "expect": "Rudolf Josef Colloredo-Mels und Waldsee", + "relation": "fwd P22", + "entity": "Q615681" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Guru Hargobind's father?", + "expect": "Guru Arjan", + "relation": "fwd P22", + "entity": "Q381425" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Harun al-Rashid's father?", + "expect": "Al-Mahdi", + "relation": "fwd P22", + "entity": "Q131002" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Rabbi Shmuel Schneersohn's father?", + "expect": "Rbi Menachem Mendel Schneersohn", + "relation": "fwd P22", + "entity": "Q937451" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Paul Egede's father?", + "expect": "Hans Egede", + "relation": "fwd P22", + "entity": "Q1364794" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the father of Adam Stefan Sapieha?", + "expect": "Adam Stanis\u0142aw Sapieha", + "relation": "fwd P22", + "entity": "Q350963" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the father of Masaharta?", + "expect": "Pinedjem I", + "relation": "fwd P22", + "entity": "Q724676" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the father of Al-Mustakfi?", + "expect": "Al-Muktafi", + "relation": "fwd P22", + "entity": "Q293640" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the father of Wilhelm Schickard?", + "expect": "Lucas Schickhardt", + "relation": "fwd P22", + "entity": "Q57403" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the father of Sulayman ibn Abd al-Malik?", + "expect": "Abd al-Malik ibn Marwan", + "relation": "fwd P22", + "entity": "Q284233" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the father of Al-Mustazhir?", + "expect": "Al-Muqtadi", + "relation": "fwd P22", + "entity": "Q293632" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the father of Muhammad Taqi Usmani?", + "expect": "Muhammad Shafi Usmani", + "relation": "fwd P22", + "entity": "Q1392062" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the father of Al-Muttaqi?", + "expect": "Al-Muqtadir", + "relation": "fwd P22", + "entity": "Q284759" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the father of Al-Jabarti?", + "expect": "Hassan al-Jabarti", + "relation": "fwd P22", + "entity": "Q658401" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the father of Anton I of Georgia?", + "expect": "Jesse of Kartli", + "relation": "fwd P22", + "entity": "Q590458" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the father of Adolf von Harnack?", + "expect": "Theodosius Harnack", + "relation": "fwd P22", + "entity": "Q164699" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the father of Clement?", + "expect": "Titus Flavius Sabinus", + "relation": "fwd P22", + "entity": "Q42887" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was William Penn's mother?", + "expect": "Margaret Jasper", + "relation": "fwd P25", + "entity": "Q209152" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Ali al-Rida's mother?", + "expect": "Ummul Ban\u012bn Najmah", + "relation": "fwd P25", + "entity": "Q25105" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Immanuel Hermann Fichte's mother?", + "expect": "Johanna Fichte", + "relation": "fwd P25", + "entity": "Q77154" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Abd Allah ibn Yasin's mother?", + "expect": "Tin Izamaren", + "relation": "fwd P25", + "entity": "Q552693" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Gotthold Ephraim Lessing's mother?", + "expect": "Justina Salome Lessing", + "relation": "fwd P25", + "entity": "Q34628" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Matthew Henry's mother?", + "expect": "Katherine Henry", + "relation": "fwd P25", + "entity": "Q663216" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was B. B. Warfield's mother?", + "expect": "Mary Cabell Warfield (Breckenridge)", + "relation": "fwd P25", + "entity": "Q817426" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was William Ellery Channing's mother?", + "expect": "Lucy Ellery", + "relation": "fwd P25", + "entity": "Q1352783" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was George Storrs's mother?", + "expect": "Lucinda Howe Storrs", + "relation": "fwd P25", + "entity": "Q970034" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Musa al-Kazim's mother?", + "expect": "\u1e24am\u012bda al-Barbariyya", + "relation": "fwd P25", + "entity": "Q315031" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was Muhammad ibn al-Hanafiyyah's mother?", + "expect": "Khawla al-Hanafiyya", + "relation": "fwd P25", + "entity": "Q939884" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who was August Hermann Francke's mother?", + "expect": "Anna Sophia Francke", + "relation": "fwd P25", + "entity": "Q58753" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the mother of F\u00e9licit\u00e9 de La Mennais?", + "expect": "Gratienne-Jeanne Lorin", + "relation": "fwd P25", + "entity": "Q334973" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the mother of Al-Mansur?", + "expect": "Sallamah Umm Abdallah", + "relation": "fwd P25", + "entity": "Q31066" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the mother of Ahmed Raza Khan Barelvi?", + "expect": "Hussaini khanum", + "relation": "fwd P25", + "entity": "Q3629485" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the mother of Grand Duchess Tatiana Nikolaevna of Russia?", + "expect": "Alexandra Feodorovna (Alix of Hesse)", + "relation": "fwd P25", + "entity": "Q158148" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the mother of Charles Wesley?", + "expect": "Susanna Wesley", + "relation": "fwd P25", + "entity": "Q349070" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the mother of Hermann Usener?", + "expect": "Charlotte Usener", + "relation": "fwd P25", + "entity": "Q63078" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the mother of Henrik Wergeland?", + "expect": "Alette Dorothea Wergeland", + "relation": "fwd P25", + "entity": "Q351705" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the mother of Olof Celsius?", + "expect": "Sara Edmundsdotter Figrelia", + "relation": "fwd P25", + "entity": "Q954771" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the mother of F\u0101tima bint M\u016bs\u0101?", + "expect": "Ummul Ban\u012bn Najmah", + "relation": "fwd P25", + "entity": "Q445398" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the mother of Kazuko Takatsukasa?", + "expect": "K\u014djun", + "relation": "fwd P25", + "entity": "Q1030373" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the mother of Ahmad ibn Hanbal?", + "expect": "Safiya bint Maymuna", + "relation": "fwd P25", + "entity": "Q194442" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was the mother of Philips of Marnix, Lord of Saint-Aldegonde?", + "expect": "Marie de Hemericourt, Vrouwe van Mont de St.Aldegonde", + "relation": "fwd P25", + "entity": "Q701605" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who succeeded Isma'il ibn Jafar?", + "expect": "Muhammad ibn Ismail", + "relation": "fwd P1366", + "entity": "Q1650217" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who succeeded Dovber Schneuri?", + "expect": "Rbi Menachem Mendel Schneersohn", + "relation": "fwd P1366", + "entity": "Q2662227" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who succeeded Ali al-Rida?", + "expect": "Muhammad al-Jawad", + "relation": "fwd P1366", + "entity": "Q25105" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who succeeded Ali al-Hadi?", + "expect": "Hasan al-Askari", + "relation": "fwd P1366", + "entity": "Q315377" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who succeeded John Winthrop?", + "expect": "Thomas Dudley", + "relation": "fwd P1366", + "entity": "Q720766" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was Hasan al-Askari's successor?", + "expect": "Muhammad al-Mahdi", + "relation": "fwd P1366", + "entity": "Q315920" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was Muhammad al-Jawad's successor?", + "expect": "Ali al-Hadi", + "relation": "fwd P1366", + "entity": "Q25088" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was Muhammad II of C\u00f3rdoba's successor?", + "expect": "Hisham III of C\u00f3rdoba", + "relation": "fwd P1366", + "entity": "Q919257" + }, + { + "split": "heldout", + "kind": "theologians", + "valid": true, + "q": "Who was Muhammad al-Baqir's successor?", + "expect": "Jaafar Al-Sadiq", + "relation": "fwd P1366", + "entity": "Q311153" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who preceded Rbi Menachem Mendel Schneersohn?", + "expect": "Dovber Schneuri", + "relation": "fwd P1365", + "entity": "Q1337389" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who preceded Abu Bakr al-Baghdadi?", + "expect": "Abu Omar al-Baghdadi", + "relation": "fwd P1365", + "entity": "Q2821724" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who preceded Abol-Ghasem Kashani?", + "expect": "Hassan Emami", + "relation": "fwd P1365", + "entity": "Q322703" + }, + { + "split": "dev", + "kind": "theologians", + "valid": true, + "q": "Who preceded John Winthrop?", + "expect": "John Endecott", + "relation": "fwd P1365", + "entity": "Q720766" + } +] \ No newline at end of file diff --git a/root/specialists/rel-theologians/relspec_scorer.py b/root/specialists/rel-theologians/relspec_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..20857c516f3aba54571c6a4f901f609658346691 --- /dev/null +++ b/root/specialists/rel-theologians/relspec_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""relspec_scorer - a relation item is right when the reply's ANSWER (its first sentence, before the receipt) contains the +panel's expected value, compared case- and accent-insensitively on whole words; a must-decline item answered is a false +yes. (ok, asserted)""" +import re +import unicodedata + + +def _norm(s): + s = unicodedata.normalize("NFKD", str(s)) + s = "".join(c for c in s if not unicodedata.combining(c)).lower() + return " ".join(re.findall(r"[a-z0-9]+", s)) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + first = re.split(r"\.\s+From the Wikidata relation store", text)[0] + first = re.sub(r"^\s*\[ev:[a-z_]+\]\s*", "", first) + want = _norm(p["expect"]) + return bool(want) and (" %s " % want) in (" %s " % _norm(first)), True diff --git a/root/specialists/rel-theologians/verdict_dev.json b/root/specialists/rel-theologians/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..884b3087d567c77699a14acb3644aaaa0138b16f --- /dev/null +++ b/root/specialists/rel-theologians/verdict_dev.json @@ -0,0 +1,139 @@ +{ + "id": "rel-theologians", + "name": "Oracle7 Relations: Theologians and religious leaders", + "tier": "R", + "split": "dev", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:49:40Z", + "domain": { + "head": { + "correct": 19, + "false_yes": 0, + "wrong": 17, + "n": 101, + "p50_ms": 496.56, + "fails": [ + [ + "theologians", + "Where was Philo of Alexandria born?", + "deliberation:where", + "[ev:direct] According to the Jewish historian Titus Flavius Josephus, born Yosef ben Matit" + ], + [ + "theologians", + "Where was Miguel d'Escoto Brockmann born?", + "deliberation:where", + "[ev:direct] He was also nominated as Libyan Representative to the UN in March 2011. [simpl" + ], + [ + "theologians", + "Where was Antonio Bacci born?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "theologians", + "Where was Jacob Litzman born?", + "organ:relation>READ>FRAME>LINK>RELATE:fw", + "[ev:direct] Canaan. He dies and is buried in Canaan. [simplewiki_3fd942fd1a1c95a1e27edb82]" + ], + [ + "theologians", + "Where was Gu\u00f0brandur \u00deorl\u00e1ksson born?", + "verified:weak>PLACE|compose:bridge", + "Julius Caesar. [ev:derived] July 12 or 13 \u2013 100 BC: Julius Caesar is born. [simplewiki_061" + ], + [ + "theologians", + "Where was Richard Whately born?", + "deliberation:where", + "[ev:direct] He published only one course of Introductory Lectures in two editions (1831 & " + ], + [ + "theologians", + "Where was Giles of Rome born?", + "deliberation:where", + "[ev:direct] His pedagogical writings have been published in German by Michael Kaufmann (Fr" + ], + [ + "theologians", + "Where did Erdmann Neumeister die?", + "deliberation:where", + "[ev:direct] He was born in Uichteritz near Wei\u00dfenfels in the province Saxonia of Germany. " + ] + ] + }, + "spec": { + "correct": 97, + "false_yes": 0, + "wrong": 2, + "n": 101, + "p50_ms": 2.85, + "fails": [ + [ + "theologians", + "Where was Philo of Alexandria born?", + "deliberation:where", + "[ev:direct] According to the Jewish historian Titus Flavius Josephus, born Yosef ben Matit" + ], + [ + "theologians", + "Where was Giles of Rome born?", + "deliberation:where", + "[ev:direct] His pedagogical writings have been published in German by Michael Kaufmann (Fr" + ], + [ + "theologians", + "Who was Said bin Ahmad Al Busaidi's father?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "theologians", + "Who was William Penn's father?", + "act:clarify|vessel:reinforced", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/rel-theologians/verdict_heldout.json b/root/specialists/rel-theologians/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..6e5b2ef1862ecefbaa0188a75d8d5f0497d47871 --- /dev/null +++ b/root/specialists/rel-theologians/verdict_heldout.json @@ -0,0 +1,114 @@ +{ + "id": "rel-theologians", + "name": "Oracle7 Relations: Theologians and religious leaders", + "tier": "R", + "split": "heldout", + "head": "oracle_release_runtime_w525", + "time": "2026-10-09T00:50:59Z", + "domain": { + "head": { + "correct": 16, + "false_yes": 0, + "wrong": 3, + "n": 100, + "p50_ms": 516.63, + "fails": [ + [ + "theologians", + "What is the birthplace of Clement?", + "unverified:corpus_query:property_of", + "I found a passage that may be related, but I can't verify it answers your question: \"It wa" + ], + [ + "theologians", + "What is the birthplace of Nizar?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "theologians", + "What is the birthplace of Nicolas Malebranche?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "theologians", + "What is the birthplace of Al-Adid?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "theologians", + "What is the birthplace of Andrea Riccardi?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "theologians", + "What is the birthplace of Al-Hakim bi-Amr Allah?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "theologians", + "What is the birthplace of Isaac ben Solomon al-Israeli?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ], + [ + "theologians", + "What is the birthplace of Cotton Mather?", + "corpus_query:property_of|vessel:receipt", + "No provenance-admitted sentence in the abstracts corpus answers that.\n\nI have received \"Wh" + ] + ] + }, + "spec": { + "correct": 100, + "false_yes": 0, + "wrong": 0, + "n": 100, + "p50_ms": 1.77, + "fails": [] + } + }, + "core": { + "head": { + "correct": 150, + "false_yes": 0 + }, + "spec": { + "correct": 150, + "false_yes": 0 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [], + "head_cache_hits": 400 + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.0, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/seismology/manifest.json b/root/specialists/seismology/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..b9645e8ebdb631504d04f2125abf42f0f244f424 --- /dev/null +++ b/root/specialists/seismology/manifest.json @@ -0,0 +1,23 @@ +{ + "id": "seismology", + "name": "Oracle7 Seismology & Earthquakes", + "number": 23, + "tier": "B", + "sources": [ + {"name": "USGS Earthquake Hazards Program - magnitude, energy (10^1.5 per unit), amplitude (10x per unit), S-P travel-time location", "licence": "public domain (US government)", "url": "https://www.usgs.gov/programs/earthquake-hazards/earthquake-magnitude-energy-release-and-shaking-intensity"}, + {"name": "IASPEI standard moment magnitude Mw = (log10 M0 - 9.1)/1.5 (Hanks & Kanamori 1979)", "licence": "facts", "url": "http://www.iaspei.org/commissions/commission-on-seismological-observation-and-interpretation/Summary_WG_recommendations_20130327.pdf"} + ], + "store": {"path": "__ORACLE7_ROOT__/specialists/seismology/organ_seismology_v1.py"}, + "organ": {"dir": "__ORACLE7_ROOT__/specialists/seismology", "module": "organ_seismology_v1", "class": "SeismologyOrgan", "init": {}}, + "accept": { + "kinds": ["energy_ratio", "amplitude_ratio", "mw", "m0", "sp_distance", "gr_count"], + "declines_in_domain": ["underspecified", "impossible"], + "context_regex": "\\b(?:earthquakes?|quakes?|magnitude|seismic|seismogram|richter|s-p|p[- ]?waves?|s[- ]?waves?|gutenberg|b-value|epicent\\w+)\\b" + }, + "panel": {"path": "__ORACLE7_ROOT__/specialists/seismology/seismology_panel_v1.json", "splits": ["dev", "heldout"], + "exclude_kinds_composed": [], "scorer_module": "seismology_scorer", "scorer_fn": "ok"}, + "routing_cues": ["energy ratio between magnitudes", "amplitude ratio", "moment magnitude", "seismic moment", "S-P distance", "Gutenberg-Richter"], + "budgets": {"latency_p50_ms": 50, "store_mb": 1}, + "core_sample": {"n": 400, "seed": 20260928}, + "notes": "Relations named in each answer. 'How many times stronger' is ASKED BACK (energy 10^(1.5 dM) vs amplitude 10^dM differ) - never picked. S-P distance only with both wave speeds given (no rule of thumb); Gutenberg-Richter only with a and b. Never predicts or forecasts earthquakes (falls through). Narrowed from the start (narrow_v1)." +} diff --git a/root/specialists/seismology/narrow_v1.py b/root/specialists/seismology/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/seismology/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/seismology/organ_seismology_v1.py b/root/specialists/seismology/organ_seismology_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..f1784ecc885e237c23c42b214863c873ce5aed0f --- /dev/null +++ b/root/specialists/seismology/organ_seismology_v1.py @@ -0,0 +1,117 @@ +#!/usr/bin/env python3 +"""organ_seismology_v1 - earthquake magnitude arithmetic, relation named in every answer: +- energy ratio between two magnitudes: 10^(1.5 x dM) (Gutenberg-Richter energy relation, as USGS teaches it); +- ground-motion amplitude ratio: 10^dM (the magnitude scale is logarithmic in amplitude); +- moment magnitude from seismic moment: Mw = (log10 M0 - 9.1) / 1.5, M0 in N m (IASPEI standard); and M0 from Mw; +- epicentral distance from the S-P interval, ONLY with both wave speeds given: d = dt / (1/vs - 1/vp); +- Gutenberg-Richter frequency, ONLY with a and b given: N(>= M) = 10^(a - b M). +Declines: an S-P distance with no wave speeds (the answer depends on the crust; no rule of thumb is assumed), a +Gutenberg-Richter count with no a / b, vs >= vp. Never predicts earthquakes. Narrowed from the start (narrow_v1). +Returns {kind, status, response, value}.""" +from __future__ import annotations + +import math +import re + +from narrow_v1 import narrative, short_direct + +N = r"(\d+(?:\.\d+)?)" +SCI = r"(\d+(?:\.\d+)?)\s*(?:(?:x|×|\*)\s*10\s*\^?\s*([+-]?\d+)|e([+-]?\d+))?" + + +def g(x): + if x == 0: + return "0" + if abs(x) >= 1e6 or abs(x) < 1e-3: + return "%.3e" % x + return ("%.3f" % x).rstrip("0").rstrip(".") if abs(x) < 1000 else format(round(x), ",") + + +def sci(m, i): + v = float(m.group(i)) + e = m.group(i + 1) or m.group(i + 2) + return v * 10 ** int(e) if e else v + + +class SeismologyOrgan: + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def _need(self, what): + return self._say("underspecified", "I need %s to work that out; I won't assume it." % what, status="withheld") + + def answer(self, text, session_id="default"): + if narrative(text): + return None + r = self._answer(text) + if r and r.get("status") != "answered" and not short_direct(text): + return None + return r + + def _answer(self, text): + t = " ".join(str(text or "").split()) + low = t.lower() + if re.search(r"\bpredict\w*\b|\bforecast\w*\b|\bwhen will\b|\bnext (?:big )?(?:earthquake|quake)\b", low): + return None + quake = re.search(r"\bearthquakes?\b|\bquakes?\b|\bmagnitude\b|\bseismic\b|\bseismogram\b|\brichter\b|\bs-p\b|\bp[- ]waves?\b|\bs[- ]waves?\b|\bgutenberg\b", low) + if not quake: + return None + # --- S-P distance + if re.search(r"\bs\s*-\s*p\b|\bs-p\b|\bp[- ]?waves?\b.*\bs[- ]?waves?\b|\bs[- ]?waves?\b.*\bp[- ]?waves?\b", low) and re.search(r"\bdistance\b|\bhow far\b|\bepicenter\b|\bepicentre\b", low): + dt = re.search(N + r"\s*(?:s\b|sec\w*)", low) + vp = re.search(r"\bp[- ]?waves?\s*(?:travel\w*|speed|velocity|move\w*)?\s*(?:of|at|is|=)?\s*" + N + r"\s*km\s*/\s*s|" + N + r"\s*km\s*/\s*s\s*(?:for\s+)?(?:the\s+)?p[- ]?waves?", low) + vs = re.search(r"\bs[- ]?waves?\s*(?:travel\w*|speed|velocity|move\w*)?\s*(?:of|at|is|=)?\s*" + N + r"\s*km\s*/\s*s|" + N + r"\s*km\s*/\s*s\s*(?:for\s+)?(?:the\s+)?s[- ]?waves?", low) + if not dt: + return self._need("the S-P arrival-time difference") + if not vp or not vs: + return self._need("the P- and S-wave speeds (they depend on the crust; I won't assume a rule of thumb)") + p_, s_ = float(vp.group(1) or vp.group(2)), float(vs.group(1) or vs.group(2)) + if s_ >= p_ or s_ <= 0: + return self._say("impossible", "S waves are slower than P waves; an S-wave speed of %s km/s at or above a P-wave speed of %s km/s is not physical." % (g(s_), g(p_)), + status="withheld") + d = float(dt.group(1)) / (1 / s_ - 1 / p_) + return self._say("sp_distance", "The distance is %s km (Δt ÷ (1/vs - 1/vp) = %s s ÷ (1/%s - 1/%s))." % (g(d), dt.group(1), g(s_), g(p_)), d) + # --- moment magnitude <-> seismic moment + m0 = re.search(r"\b(?:seismic )?moment\s*(?:of|is|=|m0)?\s*(?:m0\s*=\s*)?" + SCI + r"\s*(?:n\s*[·.*]?\s*m|newton[- ]met(?:er|re)s?)", low) + if m0 and re.search(r"\bmoment magnitude\b|\bmw\b|\bmagnitude\b", low): + M0 = sci(m0, 1) + if M0 <= 0: + return None + mw = (math.log10(M0) - 9.1) / 1.5 + return self._say("mw", "The moment magnitude is %s (Mw = (log10 M0 - 9.1) / 1.5, M0 = %s N·m; IASPEI)." % (g(mw), g(M0)), mw) + mwm = re.search(r"\b(?:magnitude|mw|m)\s*(?:of\s*)?(\d(?:\.\d+)?)\b", low) + if mwm and re.search(r"\bseismic moment\b", low) and re.search(r"\bwhat\b|\bfind\b|\bhow (?:much|large)\b|\bcalculate\b", low): + mw = float(mwm.group(1)) + M0 = 10 ** (1.5 * mw + 9.1) + return self._say("m0", "The seismic moment is %s N·m (M0 = 10^(1.5 Mw + 9.1), Mw %s; IASPEI)." % (g(M0), g(mw)), M0) + # --- Gutenberg-Richter frequency + if re.search(r"\bgutenberg\b|\bb[- ]value\b|\ba[- ]value\b|\bhow many (?:earthquakes|quakes)\b", low) and re.search(r"\bper year\b|\bhow many\b|\bexpected number\b|\bannual\b", low): + am = re.search(r"\ba\s*(?:[- ]?value)?\s*(?:of|is|=)\s*" + N, low) + bm = re.search(r"\bb\s*(?:[- ]?value)?\s*(?:of|is|=)\s*" + N, low) + mm = re.search(r"\bmagnitude\s*(?:of\s*)?(?:>=|≥|at least|or (?:greater|more|larger)|)\s*(\d(?:\.\d+)?)|(\d(?:\.\d+)?)\s*or (?:greater|more|larger|above)", low) + if not am or not bm: + return self._need("the Gutenberg-Richter a and b values for the region") + if not mm: + return self._need("the magnitude threshold") + M = float(mm.group(1) or mm.group(2)) + n = 10 ** (float(am.group(1)) - float(bm.group(1)) * M) + return self._say("gr_count", "The expected number is %s per year with magnitude ≥ %s (log10 N = a - bM = %s - %s × %s)." % ( + g(n), g(M), am.group(1), bm.group(1), g(M)), n) + # --- energy / amplitude ratio between two magnitudes + mags = [float(x) for x in re.findall(r"\b(?:magnitude|mag\.?|m|mw|ml)\s*[-=]?\s*(\d(?:\.\d+)?)\b", low)] + if len(mags) < 2: + mags = [float(x) for x in re.findall(r"(?= 2 and re.search(r"\bhow many times\b|\bhow much (?:more|stronger|bigger|larger)\b|\bratio\b|\bfactor\b|\btimes (?:more|stronger|larger|bigger)\b", low): + a, b = mags[0], mags[1] + hi, lo = max(a, b), min(a, b) + dM = hi - lo + # "stronger" alone is ambiguous (energy ~32x vs amplitude 10x per step) -> asks, never picks + if re.search(r"\benergy\b|\bjoules?\b", low) and not re.search(r"\bamplitude\b|\bshaking\b|\bground motion\b|\bwave height\b", low): + v = 10 ** (1.5 * dM) + return self._say("energy_ratio", "The energy ratio is %s times (10^(1.5 × %s) for M%s vs M%s)." % (g(v), g(dM), g(hi), g(lo)), v) + if re.search(r"\bamplitude\b|\bshaking\b|\bground motion\b|\bseismogram\b|\bwave height\b", low): + v = 10 ** dM + return self._say("amplitude_ratio", "The amplitude ratio is %s times (10^%s for M%s vs M%s; ground motion on a seismogram)." % (g(v), g(dM), g(hi), g(lo)), v) + return self._say("underspecified", "Do you mean the energy released or the shaking amplitude? They differ: energy grows 10^(1.5 × %s) = %s times, " + "amplitude 10^%s = %s times, for M%s vs M%s." % (g(dM), g(10 ** (1.5 * dM)), g(dM), g(10 ** dM), g(hi), g(lo)), status="withheld") + return None diff --git a/root/specialists/seismology/seismology_panel_v1.json b/root/specialists/seismology/seismology_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..178a9570fff5d21c35833f791eefb8e5d7f7a0a2 --- /dev/null +++ b/root/specialists/seismology/seismology_panel_v1.json @@ -0,0 +1,478 @@ +[ + { + "split": "dev", + "kind": "energy", + "valid": true, + "q": "How many times more energy does a magnitude 7.5 earthquake release than a magnitude 6?", + "expect": 177.82794100389228 + }, + { + "split": "dev", + "kind": "energy", + "valid": true, + "q": "How many times more energy does a magnitude 6 earthquake release than a magnitude 4?", + "expect": 1000.0 + }, + { + "split": "dev", + "kind": "energy", + "valid": true, + "q": "How many times more energy does a magnitude 7 earthquake release than a magnitude 5?", + "expect": 1000.0 + }, + { + "split": "dev", + "kind": "energy", + "valid": true, + "q": "How many times more energy does a magnitude 4.5 earthquake release than a magnitude 3?", + "expect": 177.82794100389228 + }, + { + "split": "dev", + "kind": "energy", + "valid": true, + "q": "How many times more energy does a magnitude 8 earthquake release than a magnitude 6?", + "expect": 1000.0 + }, + { + "split": "dev", + "kind": "energy", + "valid": true, + "q": "How many times more energy does a magnitude 6.5 earthquake release than a magnitude 5?", + "expect": 177.82794100389228 + }, + { + "split": "dev", + "kind": "amp", + "valid": true, + "q": "How many times larger is the ground-motion amplitude of a magnitude 9 earthquake than a magnitude 7?", + "expect": 100 + }, + { + "split": "dev", + "kind": "amp", + "valid": true, + "q": "How many times larger is the ground-motion amplitude of a magnitude 8.2 earthquake than a magnitude 6.2?", + "expect": 99.9999999999998 + }, + { + "split": "dev", + "kind": "amp", + "valid": true, + "q": "How many times larger is the ground-motion amplitude of a magnitude 5 earthquake than a magnitude 3?", + "expect": 100 + }, + { + "split": "dev", + "kind": "amp", + "valid": true, + "q": "How many times larger is the ground-motion amplitude of a magnitude 6 earthquake than a magnitude 4?", + "expect": 100 + }, + { + "split": "dev", + "kind": "amp", + "valid": true, + "q": "How many times larger is the ground-motion amplitude of a magnitude 6 earthquake than a magnitude 5.5?", + "expect": 3.1622776601683795 + }, + { + "split": "dev", + "kind": "mw", + "valid": true, + "q": "What is the moment magnitude of an earthquake with a seismic moment of 1.1 x 10^21 N m?", + "expect": 7.960928456772151 + }, + { + "split": "dev", + "kind": "mw", + "valid": true, + "q": "What is the moment magnitude of an earthquake with a seismic moment of 2.2 x 10^20 N m?", + "expect": 7.494948453881471 + }, + { + "split": "dev", + "kind": "mw", + "valid": true, + "q": "What is the moment magnitude of an earthquake with a seismic moment of 4.0 x 10^17 N m?", + "expect": 5.668039994218642 + }, + { + "split": "dev", + "kind": "mw", + "valid": true, + "q": "What is the moment magnitude of an earthquake with a seismic moment of 3.5 x 10^19 N m?", + "expect": 6.962712029566851 + }, + { + "split": "dev", + "kind": "mw", + "valid": true, + "q": "What is the moment magnitude of an earthquake with a seismic moment of 7.9 x 10^18 N m?", + "expect": 6.531751394193628 + }, + { + "split": "dev", + "kind": "m0", + "valid": true, + "q": "What is the seismic moment of a magnitude 9.1 earthquake?", + "expect": 5.623413251903491e+22 + }, + { + "split": "dev", + "kind": "m0", + "valid": true, + "q": "What is the seismic moment of a magnitude 5 earthquake?", + "expect": 3.981071705534986e+16 + }, + { + "split": "dev", + "kind": "m0", + "valid": true, + "q": "What is the seismic moment of a magnitude 8 earthquake?", + "expect": 1.2589254117941712e+21 + }, + { + "split": "dev", + "kind": "m0", + "valid": true, + "q": "What is the seismic moment of a magnitude 7.3 earthquake?", + "expect": 1.122018454301956e+20 + }, + { + "split": "dev", + "kind": "m0", + "valid": true, + "q": "What is the seismic moment of a magnitude 6.5 earthquake?", + "expect": 7.079457843841402e+18 + }, + { + "split": "dev", + "kind": "sp", + "valid": true, + "q": "The S-P interval is 8 s with P waves at 5.8 km/s and S waves at 3.4 km/s. What is the distance to the earthquake?", + "expect": 65.73333333333333 + }, + { + "split": "dev", + "kind": "sp", + "valid": true, + "q": "The S-P interval is 20 s with P waves at 6 km/s and S waves at 3.5 km/s. What is the distance to the earthquake?", + "expect": 168.0 + }, + { + "split": "dev", + "kind": "sp", + "valid": true, + "q": "The S-P interval is 25 s with P waves at 6.5 km/s and S waves at 3.7 km/s. What is the distance to the earthquake?", + "expect": 214.73214285714295 + }, + { + "split": "dev", + "kind": "sp", + "valid": true, + "q": "The S-P interval is 12 s with P waves at 6.2 km/s and S waves at 3.6 km/s. What is the distance to the earthquake?", + "expect": 103.0153846153846 + }, + { + "split": "dev", + "kind": "sp", + "valid": true, + "q": "The S-P interval is 50 s with P waves at 7.8 km/s and S waves at 4.4 km/s. What is the distance to the earthquake?", + "expect": 504.7058823529413 + }, + { + "split": "dev", + "kind": "gr", + "valid": true, + "q": "With Gutenberg-Richter a = 6 and b = 1, how many earthquakes of magnitude 5 or greater are expected per year?", + "expect": 10 + }, + { + "split": "dev", + "kind": "gr", + "valid": true, + "q": "With Gutenberg-Richter a = 5 and b = 1, how many earthquakes of magnitude 4 or greater are expected per year?", + "expect": 10 + }, + { + "split": "dev", + "kind": "gr", + "valid": true, + "q": "With Gutenberg-Richter a = 4.5 and b = 0.9, how many earthquakes of magnitude 3 or greater are expected per year?", + "expect": 63.0957344480193 + }, + { + "split": "dev", + "kind": "gr", + "valid": true, + "q": "With Gutenberg-Richter a = 7 and b = 1.1, how many earthquakes of magnitude 6 or greater are expected per year?", + "expect": 2.511886431509577 + }, + { + "split": "dev", + "kind": "gr", + "valid": true, + "q": "With Gutenberg-Richter a = 5.2 and b = 1, how many earthquakes of magnitude 3 or greater are expected per year?", + "expect": 158.48931924611142 + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "An earthquake has an S-P interval of 30 s. How far away is it?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "With b = 1, how many earthquakes of magnitude 4 or greater occur per year?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "S waves travel at 7 km/s and P waves at 5 km/s; the S-P time is 10 s. How far is the epicenter?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "energy", + "valid": true, + "q": "An M9 quake versus an M7 quake: by what factor does the energy released differ?", + "expect": 1000.0 + }, + { + "split": "heldout", + "kind": "energy", + "valid": true, + "q": "An M7 quake versus an M5 quake: by what factor does the energy released differ?", + "expect": 1000.0 + }, + { + "split": "heldout", + "kind": "energy", + "valid": true, + "q": "An M8.2 quake versus an M6.2 quake: by what factor does the energy released differ?", + "expect": 999.9999999999969 + }, + { + "split": "heldout", + "kind": "energy", + "valid": true, + "q": "An M8 quake versus an M6 quake: by what factor does the energy released differ?", + "expect": 1000.0 + }, + { + "split": "heldout", + "kind": "energy", + "valid": true, + "q": "An M7.5 quake versus an M6 quake: by what factor does the energy released differ?", + "expect": 177.82794100389228 + }, + { + "split": "heldout", + "kind": "energy", + "valid": true, + "q": "An M4.5 quake versus an M3 quake: by what factor does the energy released differ?", + "expect": 177.82794100389228 + }, + { + "split": "heldout", + "kind": "amp", + "valid": true, + "q": "Compare seismogram amplitude for a magnitude 7 and a magnitude 5 earthquake: how many times larger is it?", + "expect": 100 + }, + { + "split": "heldout", + "kind": "amp", + "valid": true, + "q": "Compare seismogram amplitude for a magnitude 6.5 and a magnitude 5 earthquake: how many times larger is it?", + "expect": 31.622776601683793 + }, + { + "split": "heldout", + "kind": "amp", + "valid": true, + "q": "Compare seismogram amplitude for a magnitude 5 and a magnitude 3 earthquake: how many times larger is it?", + "expect": 100 + }, + { + "split": "heldout", + "kind": "amp", + "valid": true, + "q": "Compare seismogram amplitude for a magnitude 7.5 and a magnitude 6 earthquake: how many times larger is it?", + "expect": 31.622776601683793 + }, + { + "split": "heldout", + "kind": "amp", + "valid": true, + "q": "Compare seismogram amplitude for a magnitude 9 and a magnitude 7 earthquake: how many times larger is it?", + "expect": 100 + }, + { + "split": "heldout", + "kind": "mw", + "valid": true, + "q": "Find the moment magnitude for a seismic moment M0 = 3.5e19 N\u00b7m.", + "expect": 6.962712029566851 + }, + { + "split": "heldout", + "kind": "mw", + "valid": true, + "q": "Find the moment magnitude for a seismic moment M0 = 2.2e20 N\u00b7m.", + "expect": 7.494948453881471 + }, + { + "split": "heldout", + "kind": "mw", + "valid": true, + "q": "Find the moment magnitude for a seismic moment M0 = 7.9e18 N\u00b7m.", + "expect": 6.531751394193628 + }, + { + "split": "heldout", + "kind": "mw", + "valid": true, + "q": "Find the moment magnitude for a seismic moment M0 = 4.0e17 N\u00b7m.", + "expect": 5.668039994218642 + }, + { + "split": "heldout", + "kind": "mw", + "valid": true, + "q": "Find the moment magnitude for a seismic moment M0 = 1.0e23 N\u00b7m.", + "expect": 9.266666666666667 + }, + { + "split": "heldout", + "kind": "m0", + "valid": true, + "q": "Calculate the seismic moment released by a magnitude 6.5 quake in N m.", + "expect": 7.079457843841402e+18 + }, + { + "split": "heldout", + "kind": "m0", + "valid": true, + "q": "Calculate the seismic moment released by a magnitude 7.3 quake in N m.", + "expect": 1.122018454301956e+20 + }, + { + "split": "heldout", + "kind": "m0", + "valid": true, + "q": "Calculate the seismic moment released by a magnitude 5.5 quake in N m.", + "expect": 2.238721138568347e+17 + }, + { + "split": "heldout", + "kind": "m0", + "valid": true, + "q": "Calculate the seismic moment released by a magnitude 7 quake in N m.", + "expect": 3.981071705534986e+19 + }, + { + "split": "heldout", + "kind": "m0", + "valid": true, + "q": "Calculate the seismic moment released by a magnitude 8 quake in N m.", + "expect": 1.2589254117941712e+21 + }, + { + "split": "heldout", + "kind": "sp", + "valid": true, + "q": "S waves arrive 12 seconds after P waves; P waves travel at 6.2 km/s and S waves at 3.6 km/s. How far away is the epicenter?", + "expect": 103.0153846153846 + }, + { + "split": "heldout", + "kind": "sp", + "valid": true, + "q": "S waves arrive 8 seconds after P waves; P waves travel at 5.8 km/s and S waves at 3.4 km/s. How far away is the epicenter?", + "expect": 65.73333333333333 + }, + { + "split": "heldout", + "kind": "sp", + "valid": true, + "q": "S waves arrive 35 seconds after P waves; P waves travel at 8 km/s and S waves at 4.5 km/s. How far away is the epicenter?", + "expect": 360.00000000000006 + }, + { + "split": "heldout", + "kind": "sp", + "valid": true, + "q": "S waves arrive 50 seconds after P waves; P waves travel at 7.8 km/s and S waves at 4.4 km/s. How far away is the epicenter?", + "expect": 504.7058823529413 + }, + { + "split": "heldout", + "kind": "sp", + "valid": true, + "q": "S waves arrive 20 seconds after P waves; P waves travel at 6 km/s and S waves at 3.5 km/s. How far away is the epicenter?", + "expect": 168.0 + }, + { + "split": "heldout", + "kind": "gr", + "valid": true, + "q": "For a region with a-value 6.4 and b-value 0.95, how many quakes of magnitude at least 5 occur per year?", + "expect": 44.668359215096345 + }, + { + "split": "heldout", + "kind": "gr", + "valid": true, + "q": "For a region with a-value 5 and b-value 1, how many quakes of magnitude at least 4 occur per year?", + "expect": 10 + }, + { + "split": "heldout", + "kind": "gr", + "valid": true, + "q": "For a region with a-value 6 and b-value 1, how many quakes of magnitude at least 5 occur per year?", + "expect": 10 + }, + { + "split": "heldout", + "kind": "gr", + "valid": true, + "q": "For a region with a-value 5.2 and b-value 1, how many quakes of magnitude at least 3 occur per year?", + "expect": 158.48931924611142 + }, + { + "split": "heldout", + "kind": "gr", + "valid": true, + "q": "For a region with a-value 7 and b-value 1.1, how many quakes of magnitude at least 6 occur per year?", + "expect": 2.511886431509577 + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "The S-P time of an earthquake was 45 seconds. What is the epicentral distance?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "If the b-value is 0.9, how many magnitude 6 or greater quakes are expected per year?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "The P waves travel 4 km/s and S waves 6 km/s with an S-P time of 12 s. How far away is the quake?", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/seismology/seismology_panel_v1.py b/root/specialists/seismology/seismology_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..7ed8e589c1007fb86f07f18074c6a2e6f0320047 --- /dev/null +++ b/root/specialists/seismology/seismology_panel_v1.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python3 +"""seismology_panel_v1 - the sealed panel for specialist #23 (seismology). Expected values from the relations written +here: energy ratio 10^(1.5 dM); amplitude ratio 10^dM; Mw = (log10 M0 - 9.1)/1.5; M0 = 10^(1.5 Mw + 9.1); +d = dt / (1/vs - 1/vp); N = 10^(a - b M). No "stronger" items (ambiguous between energy and amplitude). +Must-decline: an S-P distance with no wave speeds, a Gutenberg-Richter count missing a or b, S faster than P. +Dev / held-out differ in seed and phrasing. usage: seismology_panel_v1.py """ +import collections +import json +import math +import random +import sys + +T = {"dev": {"energy": "How many times more energy does a magnitude {a} earthquake release than a magnitude {b}?", + "amp": "How many times larger is the ground-motion amplitude of a magnitude {a} earthquake than a magnitude {b}?", + "mw": "What is the moment magnitude of an earthquake with a seismic moment of {m0x} N m?", + "m0": "What is the seismic moment of a magnitude {mw} earthquake?", + "sp": "The S-P interval is {dt} s with P waves at {vp} km/s and S waves at {vs} km/s. What is the distance to the earthquake?", + "gr": "With Gutenberg-Richter a = {a} and b = {b}, how many earthquakes of magnitude {m} or greater are expected per year?"}, + "heldout": {"energy": "An M{a} quake versus an M{b} quake: by what factor does the energy released differ?", + "amp": "Compare seismogram amplitude for a magnitude {a} and a magnitude {b} earthquake: how many times larger is it?", + "mw": "Find the moment magnitude for a seismic moment M0 = {m0e} N·m.", + "m0": "Calculate the seismic moment released by a magnitude {mw} quake in N m.", + "sp": "S waves arrive {dt} seconds after P waves; P waves travel at {vp} km/s and S waves at {vs} km/s. How far away is the epicenter?", + "gr": "For a region with a-value {a} and b-value {b}, how many quakes of magnitude at least {m} occur per year?"}} +DECLINE = {"dev": ["An earthquake has an S-P interval of 30 s. How far away is it?", + "With b = 1, how many earthquakes of magnitude 4 or greater occur per year?", + "S waves travel at 7 km/s and P waves at 5 km/s; the S-P time is 10 s. How far is the epicenter?"], + "heldout": ["The S-P time of an earthquake was 45 seconds. What is the epicentral distance?", + "If the b-value is 0.9, how many magnitude 6 or greater quakes are expected per year?", + "The P waves travel 4 km/s and S waves 6 km/s with an S-P time of 12 s. How far away is the quake?"]} +PAIRS = [(7, 5), (6, 4), (8, 6), (6.5, 5), (7.5, 6), (5, 3), (9, 7), (6, 5.5), (8.2, 6.2), (4.5, 3)] +M0S = [(3.5, 19), (1.1, 21), (2.2, 20), (4.0, 17), (7.9, 18), (1.0, 23), (5.6, 22)] +MWS = [5, 5.5, 6, 6.5, 7, 7.3, 8, 9.1] +SPS = [(20, 6, 3.5), (12, 6.2, 3.6), (35, 8, 4.5), (8, 5.8, 3.4), (50, 7.8, 4.4), (25, 6.5, 3.7)] +GRS = [(5, 1, 4), (6, 1, 5), (4.5, 0.9, 3), (7, 1.1, 6), (5.2, 1, 3), (6.4, 0.95, 5)] + + +def main(): + items = [] + for split, seed in (("dev", 23), ("heldout", 2323)): + rng = random.Random(seed) + t = T[split] + add = [] + for a, b in rng.sample(PAIRS, 6): + add.append(("energy", {"a": a, "b": b}, 10 ** (1.5 * (a - b)))) + for a, b in rng.sample(PAIRS, 5): + add.append(("amp", {"a": a, "b": b}, 10 ** (a - b))) + for c, e in rng.sample(M0S, 5): + M0 = c * 10 ** e + add.append(("mw", {"m0x": "%s x 10^%d" % (c, e), "m0e": "%se%d" % (c, e)}, (math.log10(M0) - 9.1) / 1.5)) + for mw in rng.sample(MWS, 5): + add.append(("m0", {"mw": mw}, 10 ** (1.5 * mw + 9.1))) + for dt, vp, vs in rng.sample(SPS, 5): + add.append(("sp", {"dt": dt, "vp": vp, "vs": vs}, dt / (1 / vs - 1 / vp))) + for a, b, m in rng.sample(GRS, 5): + add.append(("gr", {"a": a, "b": b, "m": m}, 10 ** (a - b * m))) + for kind, kw, exp in add: + items.append({"split": split, "kind": kind, "valid": True, "q": t[kind].format(**kw), "expect": exp}) + for q in DECLINE[split]: + items.append({"split": split, "kind": "decline", "valid": False, "q": q, "expect": "decline"}) + json.dump(items, open(sys.argv[1], "w"), indent=1) + print("panel:", dict(collections.Counter(i["split"] for i in items))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/seismology/seismology_scorer.py b/root/specialists/seismology/seismology_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..4bba239d5aa62c23e4d8b79fc2c3e1f351dc4f19 --- /dev/null +++ b/root/specialists/seismology/seismology_scorer.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 +"""seismology_scorer - the first number after "is" in the REPLY TEXT (commas and e-notation / "x 10^n" read) must be +within 0.5% of the panel's relation (0.01 absolute for a moment magnitude). A must-decline item answered is a false +yes. (ok, asserted).""" +import re + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + m = re.search(r"\bis\s+(?:about\s+|approximately\s+|~)?(-?[\d,]*\.?\d+)(?:\s*(?:e|x\s*10\s*\^|×\s*10\s*\^?)\s*([+-]?\d+))?", text) + if not m: + return False, True + got = float(m.group(1).replace(",", "")) * (10 ** int(m.group(2)) if m.group(2) else 1) + e = float(p["expect"]) + tol = 0.01 if p["kind"] == "mw" else 0.005 * abs(e) + return abs(got - e) <= tol, True diff --git a/root/specialists/seismology/verdict_dev.json b/root/specialists/seismology/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..15dce1746632516b2f5a75db4f4c554b3f67221d --- /dev/null +++ b/root/specialists/seismology/verdict_dev.json @@ -0,0 +1,113 @@ +{ + "id": "seismology", + "name": "Oracle7 Seismology & Earthquakes", + "tier": "B", + "split": "dev", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T07:58:08Z", + "domain": { + "head": { + "correct": 3, + "false_yes": 0, + "wrong": 15, + "n": 34, + "p50_ms": 43.43, + "fails": [ + [ + "energy", + "How many times more energy does a magnitude 7.5 earthquake release tha", + "cube:read>frame>link>expand>bind>check>v", + "[ev:direct] 3. It was released on December 3, 2002, and was Taylor Dayne's last single for" + ], + [ + "energy", + "How many times more energy does a magnitude 6 earthquake release than ", + "cube:read>frame>link>expand>bind>check>v", + "[ev:direct] 3. It was released on December 3, 2002, and was Taylor Dayne's last single for" + ], + [ + "energy", + "How many times more energy does a magnitude 7 earthquake release than ", + "cube:read>frame>link>expand>bind>check>v", + "[ev:direct] 3. It was released on December 3, 2002, and was Taylor Dayne's last single for" + ], + [ + "energy", + "How many times more energy does a magnitude 4.5 earthquake release tha", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "energy", + "How many times more energy does a magnitude 8 earthquake release than ", + "cube:read>frame>link>expand>bind>check>v", + "[ev:direct] 3. It was released on December 3, 2002, and was Taylor Dayne's last single for" + ], + [ + "energy", + "How many times more energy does a magnitude 6.5 earthquake release tha", + "cube:read>frame>link>expand>bind>check>v", + "[ev:direct] 3. It was released on December 3, 2002, and was Taylor Dayne's last single for" + ], + [ + "amp", + "How many times larger is the ground-motion amplitude of a magnitude 9 ", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "amp", + "How many times larger is the ground-motion amplitude of a magnitude 8.", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 34, + "false_yes": 0, + "wrong": 0, + "n": 34, + "p50_ms": 0.05, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/seismology/verdict_heldout.json b/root/specialists/seismology/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..46ae34b209d2197a2b5621169d93f15cb27cd451 --- /dev/null +++ b/root/specialists/seismology/verdict_heldout.json @@ -0,0 +1,144 @@ +{ + "id": "seismology", + "name": "Oracle7 Seismology & Earthquakes", + "tier": "B", + "split": "heldout", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T08:02:15Z", + "domain": { + "head": { + "correct": 3, + "false_yes": 0, + "wrong": 0, + "n": 34, + "p50_ms": 433.66, + "fails": [ + [ + "energy", + "An M9 quake versus an M7 quake: by what factor does the energy release", + "factoid:withheld|vessel:receipt", + "I have no admitted record that answers that about \"An M9\", so I will not guess. The reply " + ], + [ + "energy", + "An M7 quake versus an M5 quake: by what factor does the energy release", + "factoid:withheld|vessel:receipt", + "I have no admitted record that answers that about \"An M7\", so I will not guess. The reply " + ], + [ + "energy", + "An M8.2 quake versus an M6.2 quake: by what factor does the energy rel", + "factoid:withheld|vessel:receipt", + "I have no admitted record that answers that about \"An M8.2\", so I will not guess. The repl" + ], + [ + "energy", + "An M8 quake versus an M6 quake: by what factor does the energy release", + "factoid:withheld|vessel:receipt", + "I have no admitted record that answers that about \"An M8\", so I will not guess. The reply " + ], + [ + "energy", + "An M7.5 quake versus an M6 quake: by what factor does the energy relea", + "factoid:withheld|vessel:receipt", + "I have no admitted record that answers that about \"An M7.5\", so I will not guess. The repl" + ], + [ + "energy", + "An M4.5 quake versus an M3 quake: by what factor does the energy relea", + "factoid:withheld|vessel:receipt", + "I have no admitted record that answers that about \"An M4.5\", so I will not guess. The repl" + ], + [ + "amp", + "Compare seismogram amplitude for a magnitude 7 and a magnitude 5 earth", + "capability:compare|vessel:receipt", + "I cannot compare these: no provenance-admitted material exists for seismogram amplitude fo" + ], + [ + "amp", + "Compare seismogram amplitude for a magnitude 6.5 and a magnitude 5 ear", + "capability:compare|vessel:receipt", + "I cannot compare these: no provenance-admitted material exists for seismogram amplitude fo" + ] + ] + }, + "spec": { + "correct": 29, + "false_yes": 0, + "wrong": 0, + "n": 34, + "p50_ms": 0.04, + "fails": [ + [ + "gr", + "For a region with a-value 6.4 and b-value 0.95, how many quakes of mag", + "specialist:seismology>underspecified", + "I need the Gutenberg-Richter a and b values for the region to work that out; I won't assum" + ], + [ + "gr", + "For a region with a-value 5 and b-value 1, how many quakes of magnitud", + "specialist:seismology>underspecified", + "I need the Gutenberg-Richter a and b values for the region to work that out; I won't assum" + ], + [ + "gr", + "For a region with a-value 6 and b-value 1, how many quakes of magnitud", + "specialist:seismology>underspecified", + "I need the Gutenberg-Richter a and b values for the region to work that out; I won't assum" + ], + [ + "gr", + "For a region with a-value 5.2 and b-value 1, how many quakes of magnit", + "specialist:seismology>underspecified", + "I need the Gutenberg-Richter a and b values for the region to work that out; I won't assum" + ], + [ + "gr", + "For a region with a-value 7 and b-value 1.1, how many quakes of magnit", + "specialist:seismology>underspecified", + "I need the Gutenberg-Richter a and b values for the region to work that out; I won't assum" + ] + ] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/soil/manifest.json b/root/specialists/soil/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..b7fecadd026848e1e663bd9e5f680ac70366b5c5 --- /dev/null +++ b/root/specialists/soil/manifest.json @@ -0,0 +1,22 @@ +{ + "id": "soil", + "name": "Oracle7 Soil Science", + "number": 25, + "tier": "B", + "sources": [ + {"name": "USDA NRCS soil texture triangle and texture-class rules (Soil Survey Manual, USDA Handbook 18); bulk density, porosity (particle density 2.65 g/cm3) and water content - NRCS Soil Quality Indicators", "licence": "public domain (US government)", "url": "https://www.nrcs.usda.gov/resources/education-and-teaching-materials/soil-texture-calculator"} + ], + "store": {"path": "__ORACLE7_ROOT__/specialists/soil/organ_soil_v1.py"}, + "organ": {"dir": "__ORACLE7_ROOT__/specialists/soil", "module": "organ_soil_v1", "class": "SoilOrgan", "init": {}}, + "accept": { + "kinds": ["texture", "bulk_density", "porosity", "gwc", "vwc"], + "declines_in_domain": ["underspecified", "impossible"], + "context_regex": "\\b(?:soil|sand|silt|clay|bulk density|porosity|water content)\\b" + }, + "panel": {"path": "__ORACLE7_ROOT__/specialists/soil/soil_panel_v1.json", "splits": ["dev", "heldout"], + "exclude_kinds_composed": [], "scorer_module": "soil_scorer", "scorer_fn": "ok"}, + "routing_cues": ["soil texture class", "sand silt clay percentages", "bulk density", "soil porosity", "gravimetric water content"], + "budgets": {"latency_p50_ms": 50, "store_mb": 1}, + "core_sample": {"n": 400, "seed": 20260928}, + "notes": "USDA texture class by the NRCS triangle rules; particle density 2.65 g/cm3 (typical mineral soil) unless given, said so in each answer. Panel texture expectations were read off the triangle by hand for interior points, not computed by the organ's rules. Only answers when the turn is about soil (soil/texture/bulk density/porosity/water content vocabulary). Narrowed from the start (narrow_v1)." +} diff --git a/root/specialists/soil/narrow_v1.py b/root/specialists/soil/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/soil/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/soil/organ_soil_v1.py b/root/specialists/soil/organ_soil_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..33f923811cdf98222a078e18e711733838188501 --- /dev/null +++ b/root/specialists/soil/organ_soil_v1.py @@ -0,0 +1,140 @@ +#!/usr/bin/env python3 +"""organ_soil_v1 - soil physical arithmetic, rule named in every answer: +- USDA texture class from sand / silt / clay percentages (the NRCS texture-triangle rules; the third fraction is + 100 minus the other two when only two are given); +- bulk density = oven-dry mass / core volume (g/cm3); +- total porosity = 1 - bulk density / particle density (2.65 g/cm3, typical mineral soil, unless another is given); +- gravimetric water content = (wet - dry) / dry mass; volumetric = gravimetric x bulk density (water 1 g/cm3). +Declines: fractions that do not sum to 100, a single fraction, a dry mass above the wet mass, a bulk density at or +above the particle density. Narrowed from the start (narrow_v1). Returns {kind, status, response, value}.""" +from __future__ import annotations + +import re + +from narrow_v1 import narrative, short_direct + +N = r"(\d+(?:\.\d+)?)" + + +def texture(sand, silt, clay): + """USDA NRCS texture-triangle rules, in order""" + if silt + 1.5 * clay < 15: + return "sand" + if silt + 2 * clay < 30: + return "loamy sand" + if (7 <= clay < 20 and sand > 52) or (clay < 7 and silt < 50): + return "sandy loam" + if 7 <= clay < 27 and 28 <= silt < 50 and sand <= 52: + return "loam" + if (silt >= 50 and 12 <= clay < 27) or (50 <= silt < 80 and clay < 12): + return "silt loam" + if silt >= 80 and clay < 12: + return "silt" + if 20 <= clay < 35 and silt < 28 and sand > 45: + return "sandy clay loam" + if 27 <= clay < 40 and 20 < sand <= 45: + return "clay loam" + if 27 <= clay < 40 and sand <= 20: + return "silty clay loam" + if clay >= 35 and sand > 45: + return "sandy clay" + if clay >= 40 and silt >= 40: + return "silty clay" + if clay >= 40 and sand <= 45 and silt < 40: + return "clay" + return None + + +def g(x): + return ("%.3f" % x).rstrip("0").rstrip(".") + + +class SoilOrgan: + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def _need(self, what): + return self._say("underspecified", "I need %s to work that out; I won't assume it." % what, status="withheld") + + def _bad(self, why): + return self._say("impossible", why, status="withheld") + + def answer(self, text, session_id="default"): + if narrative(text): + return None + r = self._answer(text) + if r and r.get("status") != "answered" and not short_direct(text): + return None + return r + + def _frac(self, low, name): + m = re.search(N + r"\s*%\s*" + name + r"\b", low) or re.search(r"\b" + name + r"\s*(?:content\s*)?(?:of|is|=|:)?\s*" + N + r"\s*%", low) + return float(m.group(1)) if m else None + + def _answer(self, text): + t = " ".join(str(text or "").split()) + low = t.lower() + # "texture" alone is not soil ("creamy texture, very smooth" is a food remark - core overlap, dev): soil vocabulary + # or a sand / silt / clay fraction must be present + if not re.search(r"\bsoil\b|\bbulk density\b|\bporosity\b|\bwater content\b|\d\s*%\s*(?:sand|silt|clay)\b|\b(?:sand|silt|clay)\s*\d", low): + return None + # --- texture class + if re.search(r"\btexture\b|\btextural\b|\bclassify\b|\bwhat (?:kind|type) of soil\b", low): + sa, si, cl = self._frac(low, "sand"), self._frac(low, "silt"), self._frac(low, "clay") + given = [x for x in (sa, si, cl) if x is not None] + if len(given) < 2: + return self._need("at least two of the sand, silt and clay percentages") + if any(x < 0 or x > 100 for x in given): + return self._bad("A particle-size fraction must be between 0% and 100%.") + if len(given) == 3 and abs(sum(given) - 100) > 0.5: + return self._bad("Sand + silt + clay must total 100%%; these total %s%%." % g(sum(given))) + if len(given) == 2: + rest = 100 - sum(given) + if rest < 0: + return self._bad("Those two fractions already exceed 100% (%s%%)." % g(sum(given))) + sa, si, cl = (rest if sa is None else sa), (rest if si is None else si), (rest if cl is None else cl) + c = texture(sa, si, cl) + if c is None: + return None + return self._say("texture", "The USDA texture class is %s (%s%% sand, %s%% silt, %s%% clay; NRCS texture triangle)." % (c, g(sa), g(si), g(cl)), c) + pd_m = re.search(r"\bparticle density\s*(?:of|is|=)?\s*" + N, low) + PD = float(pd_m.group(1)) if pd_m else 2.65 + # --- porosity from bulk density + if re.search(r"\bporosity\b", low): + bd = re.search(r"\bbulk density\s*(?:of|is|=|:)?\s*" + N, low) or re.search(N + r"\s*g\s*/\s*cm(?:3|³|\^3)\s*bulk density", low) + if not bd: + return self._need("the bulk density") + b = float(bd.group(1)) + if b <= 0 or b >= PD: + return self._bad("A bulk density of %s g/cm³ is not below the particle density (%s g/cm³), so the porosity would be zero or negative." % (g(b), g(PD))) + p = (1 - b / PD) * 100 + return self._say("porosity", "The total porosity is %s%% (1 - %s ÷ %s g/cm³ particle density%s)." % (g(p), g(b), g(PD), "" if pd_m else ", typical mineral soil"), p) + # --- gravimetric / volumetric water content + if re.search(r"\bwater content\b|\bmoisture content\b", low): + wm = re.search(N + r"\s*g\s*(?:when\s+)?wet\b|\bwet (?:mass|weight)\s*(?:of|is|=|:)?\s*" + N + r"\s*g|\bweighs\s+" + N + r"\s*g\s*wet\b", low) + dm = re.search(N + r"\s*g\s*(?:when\s+)?(?:oven[- ])?dry\b|\b(?:oven[- ])?dry (?:mass|weight)\s*(?:of|is|=|:)?\s*" + N + r"\s*g", low) + if not wm or not dm: + return self._need("both the wet and the oven-dry mass") + w = float(next(x for x in wm.groups() if x)); d = float(next(x for x in dm.groups() if x)) + if d <= 0 or d > w: + return self._bad("The oven-dry mass (%s g) cannot exceed the wet mass (%s g)." % (g(d), g(w))) + gw = (w - d) / d * 100 + if re.search(r"\bvolumetric\b", low): + bd = re.search(r"\bbulk density\s*(?:of|is|=|:)?\s*" + N, low) + if not bd: + return self._need("the bulk density (for volumetric water content)") + v = gw * float(bd.group(1)) + return self._say("vwc", "The volumetric water content is %s%% (gravimetric %s%% × bulk density %s g/cm³)." % (g(v), g(gw), bd.group(1)), v) + return self._say("gwc", "The gravimetric water content is %s%% ((%s - %s) ÷ %s g, oven-dry basis)." % (g(gw), g(w), g(d), g(d)), gw) + # --- bulk density + if re.search(r"\bbulk density\b", low): + mm = re.search(N + r"\s*g\b(?!\s*/)", low) + vm = re.search(N + r"\s*(?:cm3|cm³|cm\^3|cubic centimet(?:er|re)s|cc|ml)\b", low) + if not mm or not vm: + return self._need("the oven-dry mass (g) and the core volume (cm³)") + m_, v_ = float(mm.group(1)), float(vm.group(1)) + if v_ <= 0: + return None + b = m_ / v_ + return self._say("bulk_density", "The bulk density is %s g/cm³ (%s g oven-dry ÷ %s cm³)." % (g(b), g(m_), g(v_)), b) + return None diff --git a/root/specialists/soil/soil_panel_v1.json b/root/specialists/soil/soil_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..7a8a3c2537c48bde8774a643c8f639264955e1c0 --- /dev/null +++ b/root/specialists/soil/soil_panel_v1.json @@ -0,0 +1,506 @@ +[ + { + "split": "dev", + "kind": "texture", + "valid": true, + "q": "What is the soil texture class for 62% sand, 15% silt and 23% clay?", + "expect": "sandy clay loam" + }, + { + "split": "dev", + "kind": "texture", + "valid": true, + "q": "What is the soil texture class for 95% sand, 3% silt and 2% clay?", + "expect": "sand" + }, + { + "split": "dev", + "kind": "texture", + "valid": true, + "q": "What is the soil texture class for 45% sand, 35% silt and 20% clay?", + "expect": "loam" + }, + { + "split": "dev", + "kind": "texture", + "valid": true, + "q": "What is the soil texture class for 15% sand, 75% silt and 10% clay?", + "expect": "silt loam" + }, + { + "split": "dev", + "kind": "texture", + "valid": true, + "q": "What is the soil texture class for 10% sand, 55% silt and 35% clay?", + "expect": "silty clay loam" + }, + { + "split": "dev", + "kind": "texture", + "valid": true, + "q": "What is the soil texture class for 85% sand, 10% silt and 5% clay?", + "expect": "loamy sand" + }, + { + "split": "dev", + "kind": "texture", + "valid": true, + "q": "What is the soil texture class for 25% sand, 60% silt and 15% clay?", + "expect": "silt loam" + }, + { + "split": "dev", + "kind": "texture", + "valid": true, + "q": "What is the soil texture class for 55% sand, 7% silt and 38% clay?", + "expect": "sandy clay" + }, + { + "split": "dev", + "kind": "texture", + "valid": true, + "q": "What is the soil texture class for 70% sand, 20% silt and 10% clay?", + "expect": "sandy loam" + }, + { + "split": "dev", + "kind": "texture", + "valid": true, + "q": "What is the soil texture class for 10% sand, 45% silt and 45% clay?", + "expect": "silty clay" + }, + { + "split": "dev", + "kind": "texture2", + "valid": true, + "q": "A soil has 35% sand and 35% clay. What texture class is it?", + "expect": "clay loam" + }, + { + "split": "dev", + "kind": "texture2", + "valid": true, + "q": "A soil has 65% sand and 10% clay. What texture class is it?", + "expect": "sandy loam" + }, + { + "split": "dev", + "kind": "texture2", + "valid": true, + "q": "A soil has 5% sand and 50% clay. What texture class is it?", + "expect": "silty clay" + }, + { + "split": "dev", + "kind": "texture2", + "valid": true, + "q": "A soil has 30% sand and 45% clay. What texture class is it?", + "expect": "clay" + }, + { + "split": "dev", + "kind": "texture2", + "valid": true, + "q": "A soil has 20% sand and 60% clay. What texture class is it?", + "expect": "clay" + }, + { + "split": "dev", + "kind": "texture2", + "valid": true, + "q": "A soil has 45% sand and 20% clay. What texture class is it?", + "expect": "loam" + }, + { + "split": "dev", + "kind": "texture2", + "valid": true, + "q": "A soil has 8% sand and 32% clay. What texture class is it?", + "expect": "silty clay loam" + }, + { + "split": "dev", + "kind": "texture2", + "valid": true, + "q": "A soil has 5% sand and 7% clay. What texture class is it?", + "expect": "silt" + }, + { + "split": "dev", + "kind": "bulk", + "valid": true, + "q": "What is the bulk density of a soil core with 145 g dry mass and a volume of 100 cm3?", + "expect": 1.45 + }, + { + "split": "dev", + "kind": "bulk", + "valid": true, + "q": "What is the bulk density of a soil core with 96 g dry mass and a volume of 80 cm3?", + "expect": 1.2 + }, + { + "split": "dev", + "kind": "bulk", + "valid": true, + "q": "What is the bulk density of a soil core with 330 g dry mass and a volume of 250 cm3?", + "expect": 1.32 + }, + { + "split": "dev", + "kind": "bulk", + "valid": true, + "q": "What is the bulk density of a soil core with 400 g dry mass and a volume of 300 cm3?", + "expect": 1.3333333333333333 + }, + { + "split": "dev", + "kind": "bulk", + "valid": true, + "q": "What is the bulk density of a soil core with 210 g dry mass and a volume of 150 cm3?", + "expect": 1.4 + }, + { + "split": "dev", + "kind": "porosity", + "valid": true, + "q": "What is the porosity of a soil with bulk density 1.6 g/cm3?", + "expect": 39.622641509433954 + }, + { + "split": "dev", + "kind": "porosity", + "valid": true, + "q": "What is the porosity of a soil with bulk density 1.1 g/cm3?", + "expect": 58.49056603773584 + }, + { + "split": "dev", + "kind": "porosity", + "valid": true, + "q": "What is the porosity of a soil with bulk density 1.7 g/cm3?", + "expect": 35.84905660377359 + }, + { + "split": "dev", + "kind": "porosity", + "valid": true, + "q": "What is the porosity of a soil with bulk density 1.33 g/cm3?", + "expect": 49.81132075471698 + }, + { + "split": "dev", + "kind": "porosity", + "valid": true, + "q": "What is the porosity of a soil with bulk density 1.2 g/cm3?", + "expect": 54.71698113207547 + }, + { + "split": "dev", + "kind": "gwc", + "valid": true, + "q": "A soil sample weighs 80 g wet and 64 g dry. What is its gravimetric water content?", + "expect": 25.0 + }, + { + "split": "dev", + "kind": "gwc", + "valid": true, + "q": "A soil sample weighs 230 g wet and 190 g dry. What is its gravimetric water content?", + "expect": 21.052631578947366 + }, + { + "split": "dev", + "kind": "gwc", + "valid": true, + "q": "A soil sample weighs 55 g wet and 50 g dry. What is its gravimetric water content?", + "expect": 10.0 + }, + { + "split": "dev", + "kind": "gwc", + "valid": true, + "q": "A soil sample weighs 150 g wet and 125 g dry. What is its gravimetric water content?", + "expect": 20.0 + }, + { + "split": "dev", + "kind": "gwc", + "valid": true, + "q": "A soil sample weighs 120 g wet and 100 g dry. What is its gravimetric water content?", + "expect": 20.0 + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What is the texture class of a soil with 50% sand, 30% silt and 40% clay?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What texture class is a soil with 30% clay?", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "A soil sample weighs 80 g wet and 100 g dry. What is its gravimetric water content?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "texture", + "valid": true, + "q": "Classify this soil on the USDA texture triangle: clay 10%, sand 15%, silt 75%.", + "expect": "silt loam" + }, + { + "split": "heldout", + "kind": "texture", + "valid": true, + "q": "Classify this soil on the USDA texture triangle: clay 20%, sand 40%, silt 40%.", + "expect": "loam" + }, + { + "split": "heldout", + "kind": "texture", + "valid": true, + "q": "Classify this soil on the USDA texture triangle: clay 35%, sand 30%, silt 35%.", + "expect": "clay loam" + }, + { + "split": "heldout", + "kind": "texture", + "valid": true, + "q": "Classify this soil on the USDA texture triangle: clay 45%, sand 30%, silt 25%.", + "expect": "clay" + }, + { + "split": "heldout", + "kind": "texture", + "valid": true, + "q": "Classify this soil on the USDA texture triangle: clay 38%, sand 55%, silt 7%.", + "expect": "sandy clay" + }, + { + "split": "heldout", + "kind": "texture", + "valid": true, + "q": "Classify this soil on the USDA texture triangle: clay 5%, sand 85%, silt 10%.", + "expect": "loamy sand" + }, + { + "split": "heldout", + "kind": "texture", + "valid": true, + "q": "Classify this soil on the USDA texture triangle: clay 15%, sand 20%, silt 65%.", + "expect": "silt loam" + }, + { + "split": "heldout", + "kind": "texture", + "valid": true, + "q": "Classify this soil on the USDA texture triangle: clay 50%, sand 5%, silt 45%.", + "expect": "silty clay" + }, + { + "split": "heldout", + "kind": "texture", + "valid": true, + "q": "Classify this soil on the USDA texture triangle: clay 32%, sand 8%, silt 60%.", + "expect": "silty clay loam" + }, + { + "split": "heldout", + "kind": "texture", + "valid": true, + "q": "Classify this soil on the USDA texture triangle: clay 23%, sand 62%, silt 15%.", + "expect": "sandy clay loam" + }, + { + "split": "heldout", + "kind": "texture2", + "valid": true, + "q": "With 60% clay and 25% silt, which USDA texture class is the soil?", + "expect": "clay" + }, + { + "split": "heldout", + "kind": "texture2", + "valid": true, + "q": "With 10% clay and 25% silt, which USDA texture class is the soil?", + "expect": "sandy loam" + }, + { + "split": "heldout", + "kind": "texture2", + "valid": true, + "q": "With 7% clay and 88% silt, which USDA texture class is the soil?", + "expect": "silt" + }, + { + "split": "heldout", + "kind": "texture2", + "valid": true, + "q": "With 5% clay and 15% silt, which USDA texture class is the soil?", + "expect": "loamy sand" + }, + { + "split": "heldout", + "kind": "texture2", + "valid": true, + "q": "With 25% clay and 15% silt, which USDA texture class is the soil?", + "expect": "sandy clay loam" + }, + { + "split": "heldout", + "kind": "texture2", + "valid": true, + "q": "With 20% clay and 40% silt, which USDA texture class is the soil?", + "expect": "loam" + }, + { + "split": "heldout", + "kind": "texture2", + "valid": true, + "q": "With 15% clay and 65% silt, which USDA texture class is the soil?", + "expect": "silt loam" + }, + { + "split": "heldout", + "kind": "texture2", + "valid": true, + "q": "With 35% clay and 30% silt, which USDA texture class is the soil?", + "expect": "clay loam" + }, + { + "split": "heldout", + "kind": "bulk", + "valid": true, + "q": "Find the soil bulk density: oven-dry mass 330 g, core volume 250 cm3.", + "expect": 1.32 + }, + { + "split": "heldout", + "kind": "bulk", + "valid": true, + "q": "Find the soil bulk density: oven-dry mass 130 g, core volume 100 cm3.", + "expect": 1.3 + }, + { + "split": "heldout", + "kind": "bulk", + "valid": true, + "q": "Find the soil bulk density: oven-dry mass 96 g, core volume 80 cm3.", + "expect": 1.2 + }, + { + "split": "heldout", + "kind": "bulk", + "valid": true, + "q": "Find the soil bulk density: oven-dry mass 145 g, core volume 100 cm3.", + "expect": 1.45 + }, + { + "split": "heldout", + "kind": "bulk", + "valid": true, + "q": "Find the soil bulk density: oven-dry mass 210 g, core volume 150 cm3.", + "expect": 1.4 + }, + { + "split": "heldout", + "kind": "porosity", + "valid": true, + "q": "Soil bulk density is 1.1 g/cm3; find the total porosity.", + "expect": 58.49056603773584 + }, + { + "split": "heldout", + "kind": "porosity", + "valid": true, + "q": "Soil bulk density is 1.6 g/cm3; find the total porosity.", + "expect": 39.622641509433954 + }, + { + "split": "heldout", + "kind": "porosity", + "valid": true, + "q": "Soil bulk density is 1.7 g/cm3; find the total porosity.", + "expect": 35.84905660377359 + }, + { + "split": "heldout", + "kind": "porosity", + "valid": true, + "q": "Soil bulk density is 1.45 g/cm3; find the total porosity.", + "expect": 45.28301886792453 + }, + { + "split": "heldout", + "kind": "porosity", + "valid": true, + "q": "Soil bulk density is 1.33 g/cm3; find the total porosity.", + "expect": 49.81132075471698 + }, + { + "split": "heldout", + "kind": "gwc", + "valid": true, + "q": "Soil wet mass 80 g, oven-dry mass 64 g: find the gravimetric water content.", + "expect": 25.0 + }, + { + "split": "heldout", + "kind": "gwc", + "valid": true, + "q": "Soil wet mass 150 g, oven-dry mass 125 g: find the gravimetric water content.", + "expect": 20.0 + }, + { + "split": "heldout", + "kind": "gwc", + "valid": true, + "q": "Soil wet mass 120 g, oven-dry mass 100 g: find the gravimetric water content.", + "expect": 20.0 + }, + { + "split": "heldout", + "kind": "gwc", + "valid": true, + "q": "Soil wet mass 36 g, oven-dry mass 30 g: find the gravimetric water content.", + "expect": 20.0 + }, + { + "split": "heldout", + "kind": "gwc", + "valid": true, + "q": "Soil wet mass 230 g, oven-dry mass 190 g: find the gravimetric water content.", + "expect": 21.052631578947366 + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "Classify this soil on the USDA texture triangle: clay 10%, sand 70%, silt 10%.", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "Which USDA texture class is a soil with 45% silt?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "Soil bulk density is 3.1 g/cm3; find the total porosity.", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/soil/soil_panel_v1.py b/root/specialists/soil/soil_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..21b1b7b34002a48cfdc7c0cc806cea9648d51d3a --- /dev/null +++ b/root/specialists/soil/soil_panel_v1.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 +"""soil_panel_v1 - the sealed panel for specialist #25 (soil science). Texture classes are READ OFF THE USDA TEXTURE +TRIANGLE BY HAND for points chosen well inside each class (no boundary points) and typed in here - not computed by the +organ's rules. Bulk density m/V; porosity (1 - BD/2.65) x 100; gravimetric water (wet - dry)/dry x 100. +Must-decline: fractions not summing to 100, one fraction only, dry above wet, bulk density above particle density. +Dev / held-out differ in seed and phrasing. usage: soil_panel_v1.py """ +import collections +import json +import random +import sys + +T = {"dev": {"texture": "What is the soil texture class for {sand}% sand, {silt}% silt and {clay}% clay?", + "texture2": "A soil has {sand}% sand and {clay}% clay. What texture class is it?", + "bulk": "What is the bulk density of a soil core with {m} g dry mass and a volume of {v} cm3?", + "porosity": "What is the porosity of a soil with bulk density {bd} g/cm3?", + "gwc": "A soil sample weighs {w} g wet and {d} g dry. What is its gravimetric water content?"}, + "heldout": {"texture": "Classify this soil on the USDA texture triangle: clay {clay}%, sand {sand}%, silt {silt}%.", + "texture2": "With {clay}% clay and {silt}% silt, which USDA texture class is the soil?", + "bulk": "Find the soil bulk density: oven-dry mass {m} g, core volume {v} cm3.", + "porosity": "Soil bulk density is {bd} g/cm3; find the total porosity.", + "gwc": "Soil wet mass {w} g, oven-dry mass {d} g: find the gravimetric water content."}} +DECLINE = {"dev": ["What is the texture class of a soil with 50% sand, 30% silt and 40% clay?", "What texture class is a soil with 30% clay?", + "A soil sample weighs 80 g wet and 100 g dry. What is its gravimetric water content?"], + "heldout": ["Classify this soil on the USDA texture triangle: clay 10%, sand 70%, silt 10%.", + "Which USDA texture class is a soil with 45% silt?", "Soil bulk density is 3.1 g/cm3; find the total porosity."]} +# (sand, silt, clay) -> class, read off the triangle +PTS = [((95, 3, 2), "sand"), ((85, 10, 5), "loamy sand"), ((80, 15, 5), "loamy sand"), ((65, 25, 10), "sandy loam"), + ((70, 20, 10), "sandy loam"), ((40, 40, 20), "loam"), ((45, 35, 20), "loam"), ((20, 65, 15), "silt loam"), + ((25, 60, 15), "silt loam"), ((15, 75, 10), "silt loam"), ((5, 88, 7), "silt"), ((60, 15, 25), "sandy clay loam"), + ((62, 15, 23), "sandy clay loam"), ((35, 30, 35), "clay loam"), ((30, 35, 35), "clay loam"), ((10, 55, 35), "silty clay loam"), + ((8, 60, 32), "silty clay loam"), ((55, 7, 38), "sandy clay"), ((5, 45, 50), "silty clay"), ((10, 45, 45), "silty clay"), + ((20, 20, 60), "clay"), ((30, 25, 45), "clay"), ((15, 25, 60), "clay")] +CORES = [(130, 100), (145, 100), (330, 250), (400, 300), (96, 80), (210, 150)] +BDS = [1.1, 1.2, 1.33, 1.45, 1.6, 1.7] +WET = [(120, 100), (55, 50), (230, 190), (80, 64), (150, 125), (36, 30)] + + +def main(): + items = [] + for split, seed in (("dev", 25), ("heldout", 2525)): + rng = random.Random(seed) + t = T[split] + add = [] + for (sa, si, cl), c in rng.sample(PTS, 10): + add.append(("texture", {"sand": sa, "silt": si, "clay": cl}, c)) + for (sa, si, cl), c in rng.sample(PTS, 8): + add.append(("texture2", {"sand": sa, "silt": si, "clay": cl}, c)) + for m, v in rng.sample(CORES, 5): + add.append(("bulk", {"m": m, "v": v}, m / v)) + for bd in rng.sample(BDS, 5): + add.append(("porosity", {"bd": bd}, (1 - bd / 2.65) * 100)) + for w, d in rng.sample(WET, 5): + add.append(("gwc", {"w": w, "d": d}, (w - d) / d * 100)) + for kind, kw, exp in add: + items.append({"split": split, "kind": kind, "valid": True, "q": t[kind].format(**kw), "expect": exp}) + for q in DECLINE[split]: + items.append({"split": split, "kind": "decline", "valid": False, "q": q, "expect": "decline"}) + json.dump(items, open(sys.argv[1], "w"), indent=1) + print("panel:", dict(collections.Counter(i["split"] for i in items))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/soil/soil_scorer.py b/root/specialists/soil/soil_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..a4480d5ba0dd8029cbfaa3d1751653c88c203f65 --- /dev/null +++ b/root/specialists/soil/soil_scorer.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +"""soil_scorer - reads the REPLY TEXT. Texture items: the class named right after "is" (the LONGEST class name that +matches there, so "sandy clay loam" is not read as "sandy clay") must equal the expected class. Numeric items: the first +number after "is" within 0.5% (or 0.05 absolute). A must-decline item answered is a false yes. (ok, asserted).""" +import re + +CLASSES = sorted(["sand", "loamy sand", "sandy loam", "loam", "silt loam", "silt", "sandy clay loam", "clay loam", + "silty clay loam", "sandy clay", "silty clay", "clay"], key=len, reverse=True) + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + e = p["expect"] + if isinstance(e, str): + m = re.search(r"\bis\s+(?:an?\s+)?(" + "|".join(CLASSES) + r")\b", text, re.I) + return bool(m) and m.group(1).lower() == e, True + m = re.search(r"\bis\s+(-?\d+(?:\.\d+)?)", text) + if not m: + return False, True + return abs(float(m.group(1)) - e) <= max(0.005 * abs(e), 0.05), True diff --git a/root/specialists/soil/verdict_dev.json b/root/specialists/soil/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..0a5bff8325c6c6e26f760711185ff52a64ede669 --- /dev/null +++ b/root/specialists/soil/verdict_dev.json @@ -0,0 +1,113 @@ +{ + "id": "soil", + "name": "Oracle7 Soil Science", + "tier": "B", + "split": "dev", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T07:50:06Z", + "domain": { + "head": { + "correct": 2, + "false_yes": 1, + "wrong": 15, + "n": 36, + "p50_ms": 37.21, + "fails": [ + [ + "texture", + "What is the soil texture class for 62% sand, 15% silt and 23% clay?", + "arb:definitional->definitional_encyclope", + "That asks me to work out percentage, and I compute exactly or not at all. It is outside th" + ], + [ + "texture", + "What is the soil texture class for 95% sand, 3% silt and 2% clay?", + "arb:definitional->definitional_encyclope", + "That asks me to work out percentage, and I compute exactly or not at all. It is outside th" + ], + [ + "texture", + "What is the soil texture class for 45% sand, 35% silt and 20% clay?", + "arb:definitional->definitional_encyclope", + "That asks me to work out percentage, and I compute exactly or not at all. It is outside th" + ], + [ + "texture", + "What is the soil texture class for 15% sand, 75% silt and 10% clay?", + "arb:definitional->definitional_encyclope", + "That asks me to work out percentage, and I compute exactly or not at all. It is outside th" + ], + [ + "texture", + "What is the soil texture class for 10% sand, 55% silt and 35% clay?", + "arb:definitional->definitional_encyclope", + "That asks me to work out percentage, and I compute exactly or not at all. It is outside th" + ], + [ + "texture", + "What is the soil texture class for 85% sand, 10% silt and 5% clay?", + "arb:definitional->definitional_encyclope", + "That asks me to work out percentage, and I compute exactly or not at all. It is outside th" + ], + [ + "texture", + "What is the soil texture class for 25% sand, 60% silt and 15% clay?", + "arb:definitional->definitional_encyclope", + "That asks me to work out percentage, and I compute exactly or not at all. It is outside th" + ], + [ + "texture", + "What is the soil texture class for 55% sand, 7% silt and 38% clay?", + "arb:definitional->definitional_encyclope", + "That asks me to work out percentage, and I compute exactly or not at all. It is outside th" + ] + ] + }, + "spec": { + "correct": 36, + "false_yes": 0, + "wrong": 0, + "n": 36, + "p50_ms": 0.02, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/soil/verdict_heldout.json b/root/specialists/soil/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..eebff225853b6c59bb2c1ebc372e3cbd7386c0b0 --- /dev/null +++ b/root/specialists/soil/verdict_heldout.json @@ -0,0 +1,113 @@ +{ + "id": "soil", + "name": "Oracle7 Soil Science", + "tier": "B", + "split": "heldout", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T07:53:55Z", + "domain": { + "head": { + "correct": 1, + "false_yes": 2, + "wrong": 20, + "n": 36, + "p50_ms": 99.21, + "fails": [ + [ + "texture", + "Classify this soil on the USDA texture triangle: clay 10%, sand 15%, s", + "organ:converse>statement", + "Got it. Since you mention silt: Silt is granular material of a size between sand and clay " + ], + [ + "texture", + "Classify this soil on the USDA texture triangle: clay 20%, sand 40%, s", + "organ:converse>statement", + "Got it. Since you mention silt: Silt is granular material of a size between sand and clay " + ], + [ + "texture", + "Classify this soil on the USDA texture triangle: clay 35%, sand 30%, s", + "organ:converse>statement", + "Got it. Since you mention silt: Silt is granular material of a size between sand and clay " + ], + [ + "texture", + "Classify this soil on the USDA texture triangle: clay 45%, sand 30%, s", + "organ:converse>statement", + "Got it. Since you mention silt: Silt is granular material of a size between sand and clay " + ], + [ + "texture", + "Classify this soil on the USDA texture triangle: clay 38%, sand 55%, s", + "organ:converse>statement", + "Got it. Since you mention silt: Silt is granular material of a size between sand and clay " + ], + [ + "texture", + "Classify this soil on the USDA texture triangle: clay 5%, sand 85%, si", + "organ:converse>statement", + "Got it. Since you mention silt: Silt is granular material of a size between sand and clay " + ], + [ + "texture", + "Classify this soil on the USDA texture triangle: clay 15%, sand 20%, s", + "organ:converse>statement", + "Got it. Since you mention silt: Silt is granular material of a size between sand and clay " + ], + [ + "texture", + "Classify this soil on the USDA texture triangle: clay 50%, sand 5%, si", + "organ:converse>statement", + "Got it. Since you mention silt: Silt is granular material of a size between sand and clay " + ] + ] + }, + "spec": { + "correct": 36, + "false_yes": 0, + "wrong": 0, + "n": 36, + "p50_ms": 0.03, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/sports/manifest.json b/root/specialists/sports/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..3fa33e34508579bd2ffbe9866b134c3da43a6ca5 --- /dev/null +++ b/root/specialists/sports/manifest.json @@ -0,0 +1,23 @@ +{ + "id": "sports", + "name": "Oracle7 Sports & Rules (statistics)", + "number": 72, + "tier": "B", + "sources": [ + {"name": "MLB official statistics glossary (AVG, OBP, SLG, ERA, WHIP), NFL passer rating formula, basketball true shooting (published formulas)", "licence": "facts (formulas)", "url": "https://www.mlb.com/glossary"}, + {"name": "Wikipedia sports-statistics articles (formula cross-check)", "licence": "CC-BY-SA 4.0 (store ships share-alike)", "url": "https://en.wikipedia.org/wiki/Passer_rating"} + ], + "store": {"path": "__ORACLE7_ROOT__/specialists/sports/organ_sports_v1.py"}, + "organ": {"dir": "__ORACLE7_ROOT__/specialists/sports", "module": "organ_sports_v1", "class": "SportsOrgan", "init": {}}, + "accept": { + "kinds": ["avg", "obp", "slg", "era", "whip", "passer_rating", "ts_pct", "win_pct", "games_behind"], + "declines_in_domain": ["impossible"], + "context_regex": "\\b(?:batting average|on[- ]base|slugging|era|earned run|whip|passer rating|true shooting|win(?:ning)? percentage|games (?:behind|back))\\b" + }, + "panel": {"path": "__ORACLE7_ROOT__/specialists/sports/sports_panel_v1.json", "splits": ["dev", "heldout"], + "exclude_kinds_composed": [], "scorer_module": "sports_scorer", "scorer_fn": "ok"}, + "routing_cues": ["batting average", "on-base percentage", "slugging", "ERA", "WHIP", "passer rating", "true shooting", "win percentage", "games behind"], + "budgets": {"latency_p50_ms": 50, "store_mb": 1}, + "core_sample": {"n": 400, "seed": 20260928}, + "notes": "Formulas named in every answer; innings in box-score thirds (6.2 = 6 2/3); no betting odds or predictions. Games-behind order-free (absolute value) and the panel puts the leader first and last (panel rule). Narrowed from the start (narrow_v1)." +} diff --git a/root/specialists/sports/narrow_v1.py b/root/specialists/sports/narrow_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..647d4d5e961acd006c9de30f0ce8b0b8f5139cda --- /dev/null +++ b/root/specialists/sports/narrow_v1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 +"""narrow_v1 - the shared NARROWING rule for specialist organs (2026-09-29, from the full-core sweep): + + WORD PROBLEMS AND NARRATIVE TURNS BELONG TO THE HEAD. An organ answers a direct domain question. A turn that tells a + story ("Justine wants to put a deck ...", "A new energy drink advertises 106 calories for 8 ounces ...") or relates + quantities to each other ("the length is 9 inches more than the width") is a word problem, which the core's word- + problem organ owns; organs firing on its nouns declined it or answered a different question. + An organ may DECLINE only a short direct question (it is then refusing the domain question that was asked); on + anything longer it says nothing and the head answers. + +Narrowing only ever removes turns an organ takes, so on any input where it does not fire, the organ's reply is +byte-identical to the frozen version it wraps (checked per specialist by an invariance count before re-gating). +""" +import re + +RELATION = re.compile(r"\b(?:\d+(?:\.\d+)?|one|two|three|four|five|six|seven|eight|nine|ten)\s+(?:\w+\s+){0,2}(?:more|less|fewer|longer|shorter)\s+than\b|" + r"\b(?:twice|three times|half)\s+(?:as\s+\w+\s+as\s+)?the\s+\w+\b", re.I) + + +# a RATE ("106 calories for 8 ounces", "3 apples per 2 dollars") makes the turn a proportion problem +RATE = re.compile(r"\b\d+(?:\.\d+)?\s+[a-z]+\s+(?:for|per|every)\s+(?:\d+(?:\.\d+)?|a|an|one|each)\s+[a-z]+", re.I) +NUM = re.compile(r"(?= 3 or len(t.split()) > 40 or RELATION.search(t) is not None or RATE.search(t) is not None + + +def short_direct(t): + """a direct question an organ may decline: at most 2 sentences, at most 25 words, not narrative""" + t = str(t or "") + return sentences(t) <= 2 and len(t.split()) <= 25 and not narrative(t) diff --git a/root/specialists/sports/organ_sports_v1.py b/root/specialists/sports/organ_sports_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..8cec96c8d09ef2ed761c21b17c7b555465298e84 --- /dev/null +++ b/root/specialists/sports/organ_sports_v1.py @@ -0,0 +1,164 @@ +#!/usr/bin/env python3 +"""organ_sports_v1 - sports statistics by the published formulas, formula named in every answer: +- baseball: AVG = H / AB; OBP = (H + BB + HBP) / (AB + BB + HBP + SF); SLG = TB / AB with TB = 1B + 2 2B + 3 3B + 4 HR; + ERA = 9 ER / IP and WHIP = (BB + H) / IP, innings in box-score thirds notation (6.2 IP = 6 2/3); +- NFL passer rating: a = (CMP/ATT - 0.3) x 5, b = (YDS/ATT - 3) x 0.25, c = TD/ATT x 20, d = 2.375 - INT/ATT x 25, + each clamped to [0, 2.375]; rating = (a + b + c + d) / 6 x 100; +- basketball true shooting % = PTS / (2 (FGA + 0.44 FTA)); +- win percentage = (W + 0.5 T) / (W + L + T); games behind = ((W_A - W_B) + (L_B - L_A)) / 2. +Declines: zero at-bats / attempts / innings, an innings figure with .3 or more after the point. Narrowed from the +start (narrow_v1). Returns {kind, status, response, value}.""" +from __future__ import annotations + +import re + +from narrow_v1 import narrative, short_direct + +N = r"(\d+(?:,\d{3})*(?:\.\d+)?)" + + +def num(s): + return float(s.replace(",", "")) + + +def g3(x): + return "%.3f" % x + + +def g(x): + return ("%.2f" % x).rstrip("0").rstrip(".") + + +def stat(low, *names): + for nm in names: + m = re.search(N + r"\s*" + nm + r"\b", low) or re.search(r"\b" + nm + r"\s*(?:of|:|=)?\s*" + N, low) + if m: + return num(m.group(1)) + return None + + +class SportsOrgan: + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def _bad(self, why): + return self._say("impossible", why, status="withheld") + + def answer(self, text, session_id="default"): + if narrative(text): + return None + r = self._answer(text) + if r and r.get("status") != "answered" and not short_direct(text): + return None + return r + + def _ip(self, low): + m = re.search(r"(\d+)(?:\.(\d))?\s*(?:innings(?: pitched)?|ip)\b", low) + if not m: + return None, None + whole, frac = int(m.group(1)), int(m.group(2) or 0) + if frac >= 3: + return "bad", m.group(0) + return whole + frac / 3, m.group(0) + + def _answer(self, text): + t = " ".join(str(text or "").split()) + low = t.lower() + # --- passer rating + if re.search(r"\bpasser rating\b|\bqb rating\b|\bquarterback rating\b", low): + cmp_ = stat(low, r"completions?", r"cmp") + att = stat(low, r"attempts?", r"att", r"passes attempted") + yds = stat(low, r"(?:passing )?yards", r"yds") + td = stat(low, r"(?:passing )?touchdowns?", r"tds?") + it = stat(low, r"interceptions?", r"ints?", r"picks") + if None in (cmp_, att, yds, td, it): + return None + if att <= 0: + return self._bad("A passer rating needs at least one attempt.") + cl = lambda v: max(0.0, min(2.375, v)) + a, b, c, d = cl((cmp_ / att - 0.3) * 5), cl((yds / att - 3) * 0.25), cl(td / att * 20), cl(2.375 - it / att * 25) + r = (a + b + c + d) / 6 * 100 + return self._say("passer_rating", "The passer rating is %s (NFL formula: (%s + %s + %s + %s) / 6 × 100, each part clamped 0-2.375)." % ( + "%.1f" % r, g3(a), g3(b), g3(c), g3(d)), r) + # --- true shooting + if re.search(r"\btrue shooting\b|\bts%\b|\bts percentage\b", low): + pts = stat(low, r"points", r"pts") + fga = stat(low, r"field goal attempts", r"fga", r"shots") + fta = stat(low, r"free throw attempts", r"fta") + if None in (pts, fga, fta): + return None + den = 2 * (fga + 0.44 * fta) + if den <= 0: + return None + v = pts / den * 100 + return self._say("ts_pct", "The true shooting percentage is %s%% (PTS / (2 × (FGA + 0.44 FTA)) = %s / (2 × (%s + 0.44 × %s)))." % (g(v), g(pts), g(fga), g(fta)), v) + # --- ERA / WHIP + if re.search(r"\bera\b|\bearned run average\b|\bwhip\b", low): + ip, raw = self._ip(low) + if ip is None: + return None + if ip == "bad": + return self._bad("'%s' is not a valid innings figure: after the point, .1 and .2 mean one and two outs (thirds of an inning)." % raw) + if ip <= 0: + return self._bad("ERA and WHIP need innings pitched greater than zero.") + if re.search(r"\bwhip\b", low): + bb = stat(low, r"walks", r"bb") + h = stat(low, r"hits", r"h") + if bb is None or h is None: + return None + v = (bb + h) / ip + return self._say("whip", "The WHIP is %s ((BB + H) / IP = (%s + %s) / %s)." % ("%.2f" % v, g(bb), g(h), g(ip)), v) + er = stat(low, r"earned runs", r"er") + if er is None: + return None + v = 9 * er / ip + return self._say("era", "The ERA is %s (9 × %s earned runs ÷ %s innings)." % ("%.2f" % v, g(er), g(ip)), v) + # --- batting + ab = stat(low, r"at[- ]bats", r"ab") + h = stat(low, r"hits", r"h") + if ab is not None and re.search(r"\bbatting average\b|\bon[- ]base\b|\bobp\b|\bslugging\b|\bslg\b", low): + if ab <= 0: + return self._bad("A batting statistic needs at least one at-bat.") + if re.search(r"\bslugging\b|\bslg\b", low): + s1, s2, s3, hr = stat(low, r"singles", r"1b"), stat(low, r"doubles", r"2b"), stat(low, r"triples", r"3b"), stat(low, r"home runs", r"hr", r"homers") + if None in (s2, s3, hr): + return None + if s1 is None: + if h is None: + return None + s1 = h - s2 - s3 - hr + tb = s1 + 2 * s2 + 3 * s3 + 4 * hr + v = tb / ab + return self._say("slg", "The slugging percentage is %s (TB / AB = %s / %s; TB = 1B + 2×2B + 3×3B + 4×HR)." % (g3(v), g(tb), g(ab)), v) + if re.search(r"\bon[- ]base\b|\bobp\b", low): + bb = stat(low, r"walks", r"bb") or 0 + hbp = stat(low, r"hit by pitch(?:es)?", r"hbp") or 0 + sf = stat(low, r"sacrifice flies", r"sac flies", r"sf") or 0 + if h is None: + return None + v = (h + bb + hbp) / (ab + bb + hbp + sf) + return self._say("obp", "The on-base percentage is %s ((H + BB + HBP) / (AB + BB + HBP + SF) = %s / %s)." % (g3(v), g(h + bb + hbp), g(ab + bb + hbp + sf)), v) + if h is None: + return None + v = h / ab + return self._say("avg", "The batting average is %s (%s hits ÷ %s at-bats)." % (g3(v), g(h), g(ab)), v) + # --- win percentage / games behind + rec = re.search(r"\b(\d+)\s*-\s*(\d+)(?:\s*-\s*(\d+))?\b", low) + if re.search(r"\bgames behind\b|\bgames back\b|\bgb\b", low): + recs = re.findall(r"\b(\d+)\s*-\s*(\d+)\b", low) + if len(recs) < 2: + return None + (wa, la), (wb, lb) = [(int(a), int(b)) for a, b in recs[:2]] + v = abs((wa - wb) + (lb - la)) / 2 + return self._say("games_behind", "The gap is %s games (|(W_A - W_B) + (L_B - L_A)| / 2 = |(%d - %d) + (%d - %d)| / 2)." % (g(v), wa, wb, lb, la), v) + w = stat(low, r"wins", r"w") + l_ = stat(low, r"losses", r"l") + tie = stat(low, r"ties", r"draws", r"t") or 0 + if re.search(r"\bwin(?:ning)? percentage\b|\bwin pct\b|\bwin rate\b", low): + if (w is None or l_ is None) and rec: + w, l_, tie = int(rec.group(1)), int(rec.group(2)), int(rec.group(3) or 0) + if w is None or l_ is None or (w + l_ + tie) <= 0: + return None + v = (w + 0.5 * tie) / (w + l_ + tie) + return self._say("win_pct", "The winning percentage is %s ((W + ½T) / G = (%s + ½×%s) / %s)." % (g3(v), g(w), g(tie), g(w + l_ + tie)), v) + return None diff --git a/root/specialists/sports/sports_panel_v1.json b/root/specialists/sports/sports_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..0b52c6a2f9daea4661f7711252562786dd215ba2 --- /dev/null +++ b/root/specialists/sports/sports_panel_v1.json @@ -0,0 +1,268 @@ +[ + { + "split": "dev", + "kind": "avg", + "valid": true, + "q": "What is the batting average of a player with 150 hits in 500 at-bats?", + "expect": 0.3 + }, + { + "split": "dev", + "kind": "avg", + "valid": true, + "q": "What is the batting average of a player with 95 hits in 350 at-bats?", + "expect": 0.2714285714285714 + }, + { + "split": "dev", + "kind": "obp", + "valid": true, + "q": "What is the on-base percentage with 180 hits, 90 walks, 10 hit by pitches, 6 sacrifice flies and 580 at-bats?", + "expect": 0.40816326530612246 + }, + { + "split": "dev", + "kind": "obp", + "valid": true, + "q": "What is the on-base percentage with 150 hits, 60 walks, 5 hit by pitches, 5 sacrifice flies and 500 at-bats?", + "expect": 0.37719298245614036 + }, + { + "split": "dev", + "kind": "slg", + "valid": true, + "q": "What is the slugging percentage for 80 singles, 25 doubles, 2 triples and 40 home runs in 520 at-bats?", + "expect": 0.5692307692307692 + }, + { + "split": "dev", + "kind": "slg", + "valid": true, + "q": "What is the slugging percentage for 120 singles, 20 doubles, 8 triples and 10 home runs in 600 at-bats?", + "expect": 0.37333333333333335 + }, + { + "split": "dev", + "kind": "era", + "valid": true, + "q": "What is the ERA of a pitcher who allowed 45 earned runs in 200 innings pitched?", + "expect": 2.025 + }, + { + "split": "dev", + "kind": "era", + "valid": true, + "q": "What is the ERA of a pitcher who allowed 20 earned runs in 95.2 innings pitched?", + "expect": 1.881533101045296 + }, + { + "split": "dev", + "kind": "whip", + "valid": true, + "q": "What is the WHIP for 40 walks and 170 hits in 200 innings pitched?", + "expect": 1.05 + }, + { + "split": "dev", + "kind": "whip", + "valid": true, + "q": "What is the WHIP for 50 walks and 150 hits in 180.1 innings pitched?", + "expect": 1.1090573012939002 + }, + { + "split": "dev", + "kind": "qbr", + "valid": true, + "q": "What is the NFL passer rating for 15 completions, 40 attempts, 150 yards, 0 touchdowns and 3 interceptions?", + "expect": 17.708333333333336 + }, + { + "split": "dev", + "kind": "qbr", + "valid": true, + "q": "What is the NFL passer rating for 20 completions, 30 attempts, 250 yards, 2 touchdowns and 1 interceptions?", + "expect": 100.69444444444444 + }, + { + "split": "dev", + "kind": "ts", + "valid": true, + "q": "What is the true shooting percentage for 25 points on 18 field goal attempts and 4 free throw attempts?", + "expect": 63.25910931174089 + }, + { + "split": "dev", + "kind": "ts", + "valid": true, + "q": "What is the true shooting percentage for 30 points on 20 field goal attempts and 10 free throw attempts?", + "expect": 61.47540983606557 + }, + { + "split": "dev", + "kind": "win", + "valid": true, + "q": "What is the win percentage of a team with 8 wins, 8 losses and 1 ties?", + "expect": 0.5 + }, + { + "split": "dev", + "kind": "win", + "valid": true, + "q": "What is the win percentage of a team with 10 wins, 6 losses and 1 ties?", + "expect": 0.6176470588235294 + }, + { + "split": "dev", + "kind": "gb", + "valid": true, + "q": "How many games behind is a team at 66-72 if the leader is 70-70?", + "expect": 3.0 + }, + { + "split": "dev", + "kind": "gb_rev", + "valid": true, + "q": "The leader is 95-55. How many games back is a team at 88-62?", + "expect": 7.0 + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What is the ERA of a pitcher who allowed 3 earned runs in 6.4 innings pitched?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "avg", + "valid": true, + "q": "Batting average for 612 at-bats and 201 hits?", + "expect": 0.3284313725490196 + }, + { + "split": "heldout", + "kind": "avg", + "valid": true, + "q": "Batting average for 500 at-bats and 150 hits?", + "expect": 0.3 + }, + { + "split": "heldout", + "kind": "obp", + "valid": true, + "q": "OBP: 580 at-bats, 180 hits, 90 walks, 10 HBP, 6 sac flies?", + "expect": 0.40816326530612246 + }, + { + "split": "heldout", + "kind": "obp", + "valid": true, + "q": "OBP: 500 at-bats, 150 hits, 60 walks, 5 HBP, 5 sac flies?", + "expect": 0.37719298245614036 + }, + { + "split": "heldout", + "kind": "slg", + "valid": true, + "q": "Slugging: 600 at-bats with 10 home runs, 8 triples, 20 doubles and 120 singles?", + "expect": 0.37333333333333335 + }, + { + "split": "heldout", + "kind": "slg", + "valid": true, + "q": "Slugging: 520 at-bats with 40 home runs, 2 triples, 25 doubles and 80 singles?", + "expect": 0.5692307692307692 + }, + { + "split": "heldout", + "kind": "era", + "valid": true, + "q": "200 innings pitched and 45 earned runs: what is the earned run average?", + "expect": 2.025 + }, + { + "split": "heldout", + "kind": "era", + "valid": true, + "q": "180.1 innings pitched and 60 earned runs: what is the earned run average?", + "expect": 2.99445471349353 + }, + { + "split": "heldout", + "kind": "whip", + "valid": true, + "q": "Pitcher WHIP with 170 hits and 40 walks over 200 IP?", + "expect": 1.05 + }, + { + "split": "heldout", + "kind": "whip", + "valid": true, + "q": "Pitcher WHIP with 5 hits and 2 walks over 6.2 IP?", + "expect": 1.05 + }, + { + "split": "heldout", + "kind": "qbr", + "valid": true, + "q": "Passer rating: 40 attempts, 15 completions, 150 passing yards, 0 TDs, 3 interceptions?", + "expect": 17.708333333333336 + }, + { + "split": "heldout", + "kind": "qbr", + "valid": true, + "q": "Passer rating: 45 attempts, 30 completions, 320 passing yards, 3 TDs, 2 interceptions?", + "expect": 90.9722222222222 + }, + { + "split": "heldout", + "kind": "ts", + "valid": true, + "q": "True shooting %: 30 points, 20 FGA, 10 FTA?", + "expect": 61.47540983606557 + }, + { + "split": "heldout", + "kind": "ts", + "valid": true, + "q": "True shooting %: 40 points, 25 FGA, 15 FTA?", + "expect": 63.291139240506325 + }, + { + "split": "heldout", + "kind": "win", + "valid": true, + "q": "A team went 10-6-1. What is its winning percentage?", + "expect": 0.6176470588235294 + }, + { + "split": "heldout", + "kind": "win", + "valid": true, + "q": "A team went 50-32-0. What is its winning percentage?", + "expect": 0.6097560975609756 + }, + { + "split": "heldout", + "kind": "gb", + "valid": true, + "q": "Team A is 50-30 and team B is 45-36. How many games behind is team B?", + "expect": 5.5 + }, + { + "split": "heldout", + "kind": "gb_rev", + "valid": true, + "q": "With a record of 88-62, how many games back of a 95-55 leader?", + "expect": 7.0 + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "5.3 innings pitched and 2 earned runs: what is the earned run average?", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/sports/sports_panel_v1.py b/root/specialists/sports/sports_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..e5c95afebcb9ebb007767ef81c288f43cd853501 --- /dev/null +++ b/root/specialists/sports/sports_panel_v1.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python3 +"""sports_panel_v1 - the sealed panel for specialist #72 (sports & rules). Expected values from the published formulas +written here: AVG H/AB; OBP (H+BB+HBP)/(AB+BB+HBP+SF); SLG TB/AB; ERA 9 ER/IP; WHIP (BB+H)/IP with IP thirds; NFL +passer rating (anchor: a perfect 158.3); TS% PTS/(2(FGA + 0.44 FTA)); win% (W + T/2)/G; GB ((WA-WB)+(LB-LA))/2. Per the +panel rule, the two teams in games-behind appear leader-first and trailer-first in DEV. Must-decline: IP with .3+, zero +at-bats. Dev / held-out differ in seed and phrasing. usage: sports_panel_v1.py """ +import collections +import json +import random +import sys + + +def ip(s): + w, f = (s.split(".") + ["0"])[:2] + return int(w) + int(f) / 3 + + +def rating(c, a, y, t, i): + cl = lambda v: max(0.0, min(2.375, v)) + return (cl((c / a - 0.3) * 5) + cl((y / a - 3) * 0.25) + cl(t / a * 20) + cl(2.375 - i / a * 25)) / 6 * 100 + + +T = {"dev": {"avg": "What is the batting average of a player with {h} hits in {ab} at-bats?", + "obp": "What is the on-base percentage with {h} hits, {bb} walks, {hbp} hit by pitches, {sf} sacrifice flies and {ab} at-bats?", + "slg": "What is the slugging percentage for {s1} singles, {d} doubles, {tr} triples and {hr} home runs in {ab} at-bats?", + "era": "What is the ERA of a pitcher who allowed {er} earned runs in {ip} innings pitched?", + "whip": "What is the WHIP for {bb} walks and {h} hits in {ip} innings pitched?", + "qbr": "What is the NFL passer rating for {c} completions, {a} attempts, {y} yards, {t} touchdowns and {i} interceptions?", + "ts": "What is the true shooting percentage for {p} points on {fga} field goal attempts and {fta} free throw attempts?", + "win": "What is the win percentage of a team with {w} wins, {l} losses and {tie} ties?", + "gb": "How many games behind is a team at {w2}-{l2} if the leader is {w1}-{l1}?", + "gb_rev": "The leader is {w1}-{l1}. How many games back is a team at {w2}-{l2}?"}, + "heldout": {"avg": "Batting average for {ab} at-bats and {h} hits?", + "obp": "OBP: {ab} at-bats, {h} hits, {bb} walks, {hbp} HBP, {sf} sac flies?", + "slg": "Slugging: {ab} at-bats with {hr} home runs, {tr} triples, {d} doubles and {s1} singles?", + "era": "{ip} innings pitched and {er} earned runs: what is the earned run average?", + "whip": "Pitcher WHIP with {h} hits and {bb} walks over {ip} IP?", + "qbr": "Passer rating: {a} attempts, {c} completions, {y} passing yards, {t} TDs, {i} interceptions?", + "ts": "True shooting %: {p} points, {fga} FGA, {fta} FTA?", + "win": "A team went {w}-{l}-{tie}. What is its winning percentage?", + "gb": "Team A is {w1}-{l1} and team B is {w2}-{l2}. How many games behind is team B?", + "gb_rev": "With a record of {w2}-{l2}, how many games back of a {w1}-{l1} leader?"}} +DECLINE = {"dev": ["What is the ERA of a pitcher who allowed 3 earned runs in 6.4 innings pitched?"], + "heldout": ["5.3 innings pitched and 2 earned runs: what is the earned run average?"]} + + +def main(): + items = [] + for split, seed in (("dev", 72), ("heldout", 7272)): + rng = random.Random(seed) + t = T[split] + add = [] + for h, ab in rng.sample([(150, 500), (180, 600), (95, 350), (201, 612)], 2): + add.append(("avg", {"h": h, "ab": ab}, h / ab)) + for h, bb, hbp, sf, ab in rng.sample([(150, 60, 5, 5, 500), (120, 40, 2, 3, 450), (180, 90, 10, 6, 580)], 2): + add.append(("obp", {"h": h, "bb": bb, "hbp": hbp, "sf": sf, "ab": ab}, (h + bb + hbp) / (ab + bb + hbp + sf))) + for s1, d, tr, hr, ab in rng.sample([(100, 30, 5, 25, 550), (80, 25, 2, 40, 520), (120, 20, 8, 10, 600)], 2): + add.append(("slg", {"s1": s1, "d": d, "tr": tr, "hr": hr, "ab": ab}, (s1 + 2 * d + 3 * tr + 4 * hr) / ab)) + for er, ips in rng.sample([(60, "180.1"), (3, "6.2"), (45, "200"), (20, "95.2")], 2): + add.append(("era", {"er": er, "ip": ips}, 9 * er / ip(ips))) + for bb, h, ips in rng.sample([(50, 150, "180.1"), (2, 5, "6.2"), (40, 170, "200")], 2): + add.append(("whip", {"bb": bb, "h": h, "ip": ips}, (bb + h) / ip(ips))) + for c, a, y, td, i in rng.sample([(20, 30, 250, 2, 1), (25, 35, 400, 4, 0), (15, 40, 150, 0, 3), (30, 45, 320, 3, 2)], 2): + add.append(("qbr", {"c": c, "a": a, "y": y, "t": td, "i": i}, rating(c, a, y, td, i))) + for p, fga, fta in rng.sample([(30, 20, 10), (25, 18, 4), (40, 25, 15)], 2): + add.append(("ts", {"p": p, "fga": fga, "fta": fta}, p / (2 * (fga + 0.44 * fta)) * 100)) + for w, l, tie in rng.sample([(10, 6, 1), (50, 32, 0), (8, 8, 1)], 2): + add.append(("win", {"w": w, "l": l, "tie": tie}, (w + 0.5 * tie) / (w + l + tie))) + for w1, l1, w2, l2 in rng.sample([(90, 60, 85, 65), (50, 30, 45, 36), (70, 70, 66, 72)], 1): + add.append(("gb", {"w1": w1, "l1": l1, "w2": w2, "l2": l2}, ((w1 - w2) + (l2 - l1)) / 2)) + for w1, l1, w2, l2 in rng.sample([(95, 55, 88, 62), (40, 20, 35, 26)], 1): + add.append(("gb_rev", {"w1": w1, "l1": l1, "w2": w2, "l2": l2}, ((w1 - w2) + (l2 - l1)) / 2)) + for kind, kw, exp in add: + items.append({"split": split, "kind": kind, "valid": True, "q": t[kind].format(**kw), "expect": exp}) + for q in DECLINE[split]: + items.append({"split": split, "kind": "decline", "valid": False, "q": q, "expect": "decline"}) + json.dump(items, open(sys.argv[1], "w"), indent=1) + print("panel:", dict(collections.Counter(i["split"] for i in items))) + + +if __name__ == "__main__": + assert abs(rating(20, 20, 250, 3, 0) - 158.3) < 0.1 # a perfect rating anchor + main() diff --git a/root/specialists/sports/sports_scorer.py b/root/specialists/sports/sports_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..cc85d571fbd03a5a902199aa6dca88a6638e4c4f --- /dev/null +++ b/root/specialists/sports/sports_scorer.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 +"""sports_scorer - the first number after "is" in the REPLY TEXT must match the panel's formula: averages / OBP / SLG +/ win% within 0.001 absolute (they are reported to three decimals), ERA / WHIP within 0.006, passer rating within 0.06, +TS% within 0.06, games behind exactly (to the half game). A must-decline item answered is a false yes. (ok, asserted).""" +import re + +TOL = {"avg": 0.001, "obp": 0.001, "slg": 0.001, "win": 0.001, "era": 0.006, "whip": 0.006, "qbr": 0.06, "ts": 0.06, "gb": 1e-9, "gb_rev": 1e-9} + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + m = re.search(r"\bis\s+(?:about\s+)?(\d*\.?\d+)", text) + if not m: + return False, True + return abs(float(m.group(1)) - float(p["expect"])) <= TOL[p["kind"]], True diff --git a/root/specialists/sports/verdict_dev.json b/root/specialists/sports/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..3c4d510d1536537d4fbd8e01d038dde1dce7975f --- /dev/null +++ b/root/specialists/sports/verdict_dev.json @@ -0,0 +1,113 @@ +{ + "id": "sports", + "name": "Oracle7 Sports & Rules (statistics)", + "tier": "B", + "split": "dev", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T09:45:24Z", + "domain": { + "head": { + "correct": 0, + "false_yes": 1, + "wrong": 13, + "n": 19, + "p50_ms": 52.87, + "fails": [ + [ + "avg", + "What is the batting average of a player with 150 hits in 500 at-bats?", + "op:statistics", + "The mean is 325. sum is 650 over 2 values. 650 / 2 = 325. I checked it by a second method " + ], + [ + "avg", + "What is the batting average of a player with 95 hits in 350 at-bats?", + "op:statistics", + "The mean is 445/2. sum is 445 over 2 values. 445 / 2 = 445/2. I checked it by a second met" + ], + [ + "obp", + "What is the on-base percentage with 180 hits, 90 walks, 10 hit by pitc", + "arb:definitional->definitional_encyclope", + "[ev:direct] I have no admitted entry for \u201con-base percentage with 180 hits, 90 walks, 10 h" + ], + [ + "obp", + "What is the on-base percentage with 150 hits, 60 walks, 5 hit by pitch", + "arb:definitional->document_runtime|subst", + "[ev:unknown] I have no admitted entry for \u201con-base percentage with 150 hits, 60 walks, 5 h" + ], + [ + "slg", + "What is the slugging percentage for 80 singles, 25 doubles, 2 triples ", + "arb:timeline->capability:timeline|vessel", + "A timeline needs at least two dated statements; the admitted material on percentage contai" + ], + [ + "slg", + "What is the slugging percentage for 120 singles, 20 doubles, 8 triples", + "arb:timeline->capability:timeline|vessel", + "A timeline needs at least two dated statements; the admitted material on percentage contai" + ], + [ + "era", + "What is the ERA of a pitcher who allowed 45 earned runs in 200 innings", + "factoid:page", + "[ev:direct] An era in geology is a time scale of several hundred million years. [simplewik" + ], + [ + "era", + "What is the ERA of a pitcher who allowed 20 earned runs in 95.2 inning", + "factoid:page", + "[ev:direct] An era in geology is a time scale of several hundred million years. [simplewik" + ] + ] + }, + "spec": { + "correct": 19, + "false_yes": 0, + "wrong": 0, + "n": 19, + "p50_ms": 0.05, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/sports/verdict_heldout.json b/root/specialists/sports/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..ef80a01222ee9121d4578f819322b8f44f778ff2 --- /dev/null +++ b/root/specialists/sports/verdict_heldout.json @@ -0,0 +1,113 @@ +{ + "id": "sports", + "name": "Oracle7 Sports & Rules (statistics)", + "tier": "B", + "split": "heldout", + "head": "oracle_release_runtime_w503", + "time": "2026-09-29T09:49:11Z", + "domain": { + "head": { + "correct": 0, + "false_yes": 1, + "wrong": 8, + "n": 19, + "p50_ms": 31.16, + "fails": [ + [ + "avg", + "Batting average for 612 at-bats and 201 hits?", + "op:statistics", + "The mean is 813/2. sum is 813 over 2 values. 813 / 2 = 813/2. I checked it by a second met" + ], + [ + "avg", + "Batting average for 500 at-bats and 150 hits?", + "op:statistics", + "The mean is 325. sum is 650 over 2 values. 650 / 2 = 325. I checked it by a second method " + ], + [ + "obp", + "OBP: 580 at-bats, 180 hits, 90 walks, 10 HBP, 6 sac flies?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "obp", + "OBP: 500 at-bats, 150 hits, 60 walks, 5 HBP, 5 sac flies?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "slg", + "Slugging: 600 at-bats with 10 home runs, 8 triples, 20 doubles and 120", + "arb:timeline->capability:timeline|vessel", + "A timeline needs at least two dated statements; the admitted material on 600 contains 0.\n\n" + ], + [ + "slg", + "Slugging: 520 at-bats with 40 home runs, 2 triples, 25 doubles and 80 ", + "arb:timeline->capability:timeline|vessel", + "A timeline needs at least two dated statements; the admitted material on 40 contains 0.\n\nI" + ], + [ + "era", + "200 innings pitched and 45 earned runs: what is the earned run average", + "arb:definitional->document_runtime", + "[ev:unknown] Earned run average is defined as (baseball) a measure of a pitcher's effectiv" + ], + [ + "era", + "180.1 innings pitched and 60 earned runs: what is the earned run avera", + "arb:definitional->document_runtime", + "[ev:unknown] Earned run average is defined as (baseball) a measure of a pitcher's effectiv" + ] + ] + }, + "spec": { + "correct": 19, + "false_yes": 0, + "wrong": 0, + "n": 19, + "p50_ms": 0.05, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "swept_in": 0, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/units/manifest.json b/root/specialists/units/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..7afa961aa5a0c2f9538df5ac20d4965c78b63e7f --- /dev/null +++ b/root/specialists/units/manifest.json @@ -0,0 +1,22 @@ +{ + "id": "units", + "name": "Oracle7 Units & Metrology", + "number": 47, + "tier": "A", + "sources": [ + {"name": "NIST SP 811 and the SI Brochure: exact definitions of the inch, foot, mile, pound, US gallon, atmosphere, calorie and others", "licence": "public domain (NIST)", "url": "https://www.nist.gov/pml/special-publication-811"} + ], + "store": {"path": "__ORACLE7_ROOT__/specialists/units/organ_units_v1.py"}, + "organ": {"dir": "__ORACLE7_ROOT__/specialists/units", "module": "organ_units_v1", "class": "UnitsOrgan", "init": {}}, + "accept": { + "kinds": ["convert", "temperature"], + "declines_in_domain": ["mismatch", "impossible"], + "context_regex": "\\b(?:convert|how many|express|in|to)\\b" + }, + "panel": {"path": "__ORACLE7_ROOT__/specialists/units/units_panel_v1.json", "splits": ["dev", "heldout"], + "exclude_kinds_composed": [], "scorer_module": "units_scorer", "scorer_fn": "ok"}, + "routing_cues": ["convert", "how many", "in km", "in miles", "to celsius", "to fahrenheit", "psi", "kWh"], + "budgets": {"latency_p50_ms": 50, "store_mb": 1}, + "core_sample": {"n": 400, "seed": 20260928}, + "notes": "The core has some unit operations of its own (op:unit_convert); the gate decides whether this specialist adds anything over them. Panel factors restated independently of the organ's table; dev/held-out differ in seed and phrasing (same author)." +} diff --git a/root/specialists/units/organ_units_v1.py b/root/specialists/units/organ_units_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..7f10dcd2c2b5321416200351f951ad2f42789c01 --- /dev/null +++ b/root/specialists/units/organ_units_v1.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python3 +"""organ_units_v1 - unit conversion with NIST's exact SI definitions (NIST SP 811 / SI Brochure; public domain): length, +mass, volume, area, speed, time, pressure, energy, power, data, temperature (affine). Refuses a conversion between +different quantities (metres to kilograms) instead of forcing one. Returns {kind, status, response, value}.""" +from __future__ import annotations + +import re + +# name -> (quantity, factor to SI base) - exact where the definition is exact +U = {} +def reg(q, names, factor): + for n in names: + U[n] = (q, factor) +reg("length", ["m", "meter", "meters", "metre", "metres"], 1.0); reg("length", ["km", "kilometer", "kilometers", "kilometre", "kilometres"], 1e3) +reg("length", ["cm", "centimeter", "centimeters", "centimetre", "centimetres"], 1e-2); reg("length", ["mm", "millimeter", "millimeters", "millimetre", "millimetres"], 1e-3) +reg("length", ["in", "inch", "inches"], 0.0254); reg("length", ["ft", "foot", "feet"], 0.3048); reg("length", ["yd", "yard", "yards"], 0.9144) +reg("length", ["mi", "mile", "miles"], 1609.344); reg("length", ["nmi", "nautical mile", "nautical miles"], 1852.0) +reg("mass", ["kg", "kilogram", "kilograms"], 1.0); reg("mass", ["g", "gram", "grams"], 1e-3); reg("mass", ["mg", "milligram", "milligrams"], 1e-6) +reg("mass", ["lb", "lbs", "pound", "pounds"], 0.45359237); reg("mass", ["oz", "ounce", "ounces"], 0.45359237 / 16) +reg("mass", ["t", "tonne", "tonnes", "metric ton", "metric tons"], 1e3); reg("mass", ["st", "stone", "stones"], 0.45359237 * 14) +reg("volume", ["l", "liter", "liters", "litre", "litres"], 1e-3); reg("volume", ["ml", "milliliter", "milliliters", "millilitre", "millilitres"], 1e-6) +reg("volume", ["gal", "gallon", "gallons", "us gallon", "us gallons"], 3.785411784e-3); reg("volume", ["qt", "quart", "quarts"], 3.785411784e-3 / 4) +reg("volume", ["pt", "pint", "pints"], 3.785411784e-3 / 8); reg("volume", ["cup", "cups"], 3.785411784e-3 / 16) +reg("volume", ["fl oz", "fluid ounce", "fluid ounces"], 3.785411784e-3 / 128); reg("volume", ["m3", "cubic meter", "cubic meters", "cubic metre", "cubic metres"], 1.0) +reg("area", ["m2", "square meter", "square meters", "square metre", "square metres"], 1.0); reg("area", ["ft2", "square foot", "square feet"], 0.3048 ** 2) +reg("area", ["acre", "acres"], 4046.8564224); reg("area", ["hectare", "hectares", "ha"], 1e4); reg("area", ["km2", "square kilometer", "square kilometers", "square kilometre", "square kilometres"], 1e6) +reg("area", ["mi2", "square mile", "square miles"], 1609.344 ** 2) +reg("speed", ["m/s", "meters per second", "metres per second"], 1.0); reg("speed", ["km/h", "kph", "kilometers per hour", "kilometres per hour"], 1000 / 3600) +reg("speed", ["mph", "miles per hour"], 1609.344 / 3600); reg("speed", ["knot", "knots", "kn"], 1852 / 3600) +reg("time", ["s", "sec", "second", "seconds"], 1.0); reg("time", ["min", "minute", "minutes"], 60.0); reg("time", ["h", "hr", "hour", "hours"], 3600.0) +reg("time", ["day", "days"], 86400.0); reg("time", ["week", "weeks"], 604800.0) +reg("pressure", ["pa", "pascal", "pascals"], 1.0); reg("pressure", ["kpa", "kilopascal", "kilopascals"], 1e3); reg("pressure", ["bar", "bars"], 1e5) +reg("pressure", ["atm", "atmosphere", "atmospheres"], 101325.0); reg("pressure", ["psi"], 6894.757293168361); reg("pressure", ["mmhg"], 133.322387415) +reg("energy", ["j", "joule", "joules"], 1.0); reg("energy", ["kj", "kilojoule", "kilojoules"], 1e3); reg("energy", ["cal", "calorie", "calories"], 4.184) +reg("energy", ["kcal", "kilocalorie", "kilocalories"], 4184.0); reg("energy", ["kwh", "kilowatt hour", "kilowatt hours", "kilowatt-hour", "kilowatt-hours"], 3.6e6) +reg("energy", ["btu"], 1055.05585262); reg("power", ["w", "watt", "watts"], 1.0); reg("power", ["kw", "kilowatt", "kilowatts"], 1e3) +reg("power", ["hp", "horsepower"], 745.69987158227022) +reg("data", ["byte", "bytes"], 1.0); reg("data", ["kb", "kilobyte", "kilobytes"], 1e3); reg("data", ["mb", "megabyte", "megabytes"], 1e6) +reg("data", ["gb", "gigabyte", "gigabytes"], 1e9); reg("data", ["tb", "terabyte", "terabytes"], 1e12); reg("data", ["kib", "kibibyte", "kibibytes"], 1024.0) +reg("data", ["mib", "mebibyte", "mebibytes"], 1024.0 ** 2); reg("data", ["gib", "gibibyte", "gibibytes"], 1024.0 ** 3) +TEMP = {"c": "C", "celsius": "C", "°c": "C", "degrees celsius": "C", "f": "F", "fahrenheit": "F", "°f": "F", "degrees fahrenheit": "F", + "k": "K", "kelvin": "K", "kelvins": "K"} +NAMES = sorted(list(U) + list(TEMP), key=len, reverse=True) +UNIT_RX = "(%s)" % "|".join(re.escape(n) for n in NAMES) +CONV = re.compile(r"(-?\d+(?:\.\d+)?)\s*" + UNIT_RX + r"\s+(?:to|in|into|=|as)\s+" + UNIT_RX + r"\b", re.I) +HOWMANY = re.compile(r"how many\s+" + UNIT_RX + r"\s+(?:are\s+)?(?:in|is|make up)\s+(?:an?\s+|one\s+)?(-?\d+(?:\.\d+)?\s*)?" + UNIT_RX + r"\b", re.I) + + +def to_k(v, u): + return v + 273.15 if u == "C" else (v - 32) * 5 / 9 + 273.15 if u == "F" else v + + +def from_k(k, u): + return k - 273.15 if u == "C" else (k - 273.15) * 9 / 5 + 32 if u == "F" else k + + +def g(x): + return ("%.6g" % x) + + +class UnitsOrgan: + def _say(self, kind, text, value=None, status="answered"): + return {"kind": kind, "status": status, "response": text, "value": value} + + def answer(self, text, session_id="default"): + t = " ".join(str(text or "").split()) + m = CONV.search(t) + if m: + v, a, b = float(m.group(1)), m.group(2).lower(), m.group(3).lower() + da, db = m.group(2), m.group(3) + else: + m = HOWMANY.search(t) + if not m: + return None + b, a = m.group(1).lower(), m.group(3).lower() + db, da = m.group(1), m.group(3) + v = float(m.group(2)) if m.group(2) else 1.0 + if a in TEMP or b in TEMP: + if not (a in TEMP and b in TEMP): + return self._say("mismatch", "%s and %s measure different things, so there's no conversion between them." % (a, b), status="withheld") + ua, ub = TEMP[a], TEMP[b] + k = to_k(v, ua) + if k < 0: + return self._say("impossible", "%g %s is below absolute zero, so it isn't a real temperature." % (v, ua), status="withheld") + r = from_k(k, ub) + return self._say("temperature", "%g %s is %s %s." % (v, "°" + ua if ua != "K" else "K", g(r), "°" + ub if ub != "K" else "K"), r) + qa, fa = U[a]; qb, fb = U[b] + if qa != qb: + return self._say("mismatch", "%s measures %s and %s measures %s, so there's no conversion between them." % (a, qa, b, qb), status="withheld") + r = v * fa / fb + return self._say("convert", "%g %s is %s %s (NIST exact factors)." % (v, da, g(r), db), r) diff --git a/root/specialists/units/units_panel_v1.json b/root/specialists/units/units_panel_v1.json new file mode 100644 index 0000000000000000000000000000000000000000..d909274aa040d7eefdcb5c2926bc71110be1df34 --- /dev/null +++ b/root/specialists/units/units_panel_v1.json @@ -0,0 +1,1066 @@ +[ + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 250 liters in quarts?", + "expect": 264.1720523581484 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 250 kPa in psi?", + "expect": 36.259434432552304 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 1 km/h to mph", + "expect": 0.6213711922373341 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 250 cm to inches", + "expect": 98.4251968503937 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 5 cups to quarts", + "expect": 1.25 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 5 kPa to psi", + "expect": 0.7251886886510461 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 12 kPa in bar?", + "expect": 0.12 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 1 psi to atm", + "expect": 0.06804596390987773 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 25 liters in gallons?", + "expect": 6.60430130895371 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 12 yards to m", + "expect": 10.9728 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 12 km/h in mph?", + "expect": 7.456454306848008 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 12 stone to pounds", + "expect": 168.0 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 25 m/s in knots?", + "expect": 48.596112311057105 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 2 kcal to kJ", + "expect": 8.368 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 250 knots to mph", + "expect": 287.69486200563705 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 250 km/h to knots", + "expect": 134.98920086404752 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 250 cm in feet?", + "expect": 8.202099737532809 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 10 m/s in km/h?", + "expect": 36.0 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 5 kJ to kWh", + "expect": 0.001388888888888889 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 2.5 quarts in ml?", + "expect": 2365.882365 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 2.5 g in kg?", + "expect": 0.0025 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 10 bar in atm?", + "expect": 9.869232667160128 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 25 yards to km", + "expect": 0.02286 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 1 liters to gallons", + "expect": 0.2641720523581484 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 5 stone in ounces?", + "expect": 1120.0 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 1 bar to kPa", + "expect": 100.0 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 1 g to pounds", + "expect": 0.002204622621848776 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 2 kWh to kcal", + "expect": 1720.8413001912045 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 250 cm in km?", + "expect": 0.0025 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 250 stone in g?", + "expect": 1587573.2950000002 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 100 atm in kPa?", + "expect": 10132.5 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 25 atm in bar?", + "expect": 25.33125 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 2.5 gallons to quarts", + "expect": 10.0 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 100 atm to psi", + "expect": 1469.594877551345 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 100 km/h to mph", + "expect": 62.1371192237334 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 2.5 pounds in stone?", + "expect": 0.17857142857142858 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 100 feet in km?", + "expect": 0.03048 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 250 cups to liters", + "expect": 59.147059125000006 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 10 kJ in kWh?", + "expect": 0.002777777777777778 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 2 km/h in m/s?", + "expect": 0.5555555555555556 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 10 kPa in bar?", + "expect": 0.1 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 2 kcal to kJ", + "expect": 8.368 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 12 kPa in psi?", + "expect": 1.7404528527625107 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 25 miles in km?", + "expect": 40.233599999999996 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 1 cm in feet?", + "expect": 0.03280839895013123 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 5 kJ in kcal?", + "expect": 1.1950286806883366 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 100 ounces in pounds?", + "expect": 6.25 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 100 liters to ml", + "expect": 100000.00000000001 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 250 inches in miles?", + "expect": 0.00394570707070707 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 2 kPa in psi?", + "expect": 0.29007547546041845 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 12 m in inches?", + "expect": 472.4409448818898 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 250 mph in m/s?", + "expect": 111.76 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 25 cups in liters?", + "expect": 5.9147059125 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 25 psi to kPa", + "expect": 172.36893232920903 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 2 stone in g?", + "expect": 12700.586360000001 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 100 km/h to knots", + "expect": 53.99568034561901 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 2.5 bar to atm", + "expect": 2.467308166790032 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 25 bar in atm?", + "expect": 24.67308166790032 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "Convert 12 J to kJ", + "expect": 0.012 + }, + { + "split": "dev", + "kind": "convert", + "valid": true, + "q": "What is 2 bar in atm?", + "expect": 1.9738465334320257 + }, + { + "split": "dev", + "kind": "temperature", + "valid": true, + "q": "What is 300 F in C?", + "expect": 148.8888888888889 + }, + { + "split": "dev", + "kind": "temperature", + "valid": true, + "q": "What is 212 K in C?", + "expect": -61.14999999999998 + }, + { + "split": "dev", + "kind": "temperature", + "valid": true, + "q": "What is 37 F in K?", + "expect": 275.92777777777775 + }, + { + "split": "dev", + "kind": "temperature", + "valid": true, + "q": "What is 37 K in C?", + "expect": -236.14999999999998 + }, + { + "split": "dev", + "kind": "temperature", + "valid": true, + "q": "What is 37 K in F?", + "expect": -393.07 + }, + { + "split": "dev", + "kind": "temperature", + "valid": true, + "q": "What is 20 K in C?", + "expect": -253.14999999999998 + }, + { + "split": "dev", + "kind": "temperature", + "valid": true, + "q": "What is 0 F in C?", + "expect": -17.77777777777777 + }, + { + "split": "dev", + "kind": "temperature", + "valid": true, + "q": "What is 20 K in F?", + "expect": -423.66999999999996 + }, + { + "split": "dev", + "kind": "temperature", + "valid": true, + "q": "What is 20 K in C?", + "expect": -253.14999999999998 + }, + { + "split": "dev", + "kind": "temperature", + "valid": true, + "q": "What is 20 F in C?", + "expect": -6.666666666666686 + }, + { + "split": "dev", + "kind": "temperature", + "valid": true, + "q": "What is 100 C in F?", + "expect": 212.0 + }, + { + "split": "dev", + "kind": "temperature", + "valid": true, + "q": "What is 100 C in K?", + "expect": 373.15 + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "Convert 5 meters to kilograms", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "Convert 5 liters to miles", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "Convert 5 pounds to feet", + "expect": "decline" + }, + { + "split": "dev", + "kind": "decline", + "valid": false, + "q": "What is -500 C in K?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 2.5 ounces in pounds.", + "expect": 0.15625 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many pounds is 2 g?", + "expect": 0.004409245243697552 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many quarts is 5 liters?", + "expect": 5.2834410471629685 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 1 g in ounces.", + "expect": 0.035273961949580414 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many bar is 2 kPa?", + "expect": 0.02 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 25 psi in atm.", + "expect": 1.7011490977469432 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 12 quarts in cups.", + "expect": 48.00000000000001 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many feet is 5 inches?", + "expect": 0.41666666666666663 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 250 J in kJ.", + "expect": 0.25 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 250 kJ in kcal.", + "expect": 59.751434034416825 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 10 gallons in ml.", + "expect": 37854.11784 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 5 inches in miles.", + "expect": 7.891414141414141e-05 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 2 stone in g.", + "expect": 12700.586360000001 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many psi is 100 atm?", + "expect": 1469.594877551345 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 100 psi in atm.", + "expect": 6.804596390987773 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many kPa is 2.5 atm?", + "expect": 253.3125 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 10 pounds in stone.", + "expect": 0.7142857142857143 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many gallons is 5 liters?", + "expect": 1.3208602617907421 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 100 feet in yards.", + "expect": 33.333333333333336 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 10 m in miles.", + "expect": 0.006213711922373339 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 100 ounces in stone.", + "expect": 0.4464285714285714 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many ounces is 250 g?", + "expect": 8.818490487395103 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many quarts is 250 ml?", + "expect": 0.2641720523581484 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many yards is 1 feet?", + "expect": 0.33333333333333337 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 2 kcal in J.", + "expect": 8368.0 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 100 km/h in mph.", + "expect": 62.1371192237334 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 10 yards in inches.", + "expect": 360.0 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 100 g in kg.", + "expect": 0.1 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many atm is 2.5 kPa?", + "expect": 0.02467308166790032 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many atm is 5 bar?", + "expect": 4.934616333580064 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 12 kcal in kWh.", + "expect": 0.013946666666666666 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many inches is 100 feet?", + "expect": 1200.0 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many mph is 10 knots?", + "expect": 11.507794480225483 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 100 cups in gallons.", + "expect": 6.25 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many J is 25 kJ?", + "expect": 25000.0 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 12 gallons in liters.", + "expect": 45.424941408 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 2.5 m/s in knots.", + "expect": 4.859611231105711 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 5 psi in bar.", + "expect": 0.34473786465841805 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many mph is 2.5 km/h?", + "expect": 1.5534279805933349 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 2 psi in kPa.", + "expect": 13.789514586336722 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many psi is 5 bar?", + "expect": 72.51886886510461 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 10 km in feet.", + "expect": 32808.39895013123 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many km is 100 feet?", + "expect": 0.03048 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 5 inches in yards.", + "expect": 0.1388888888888889 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 2 ml in quarts.", + "expect": 0.002113376418865187 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 250 stone in pounds.", + "expect": 3500.0 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 25 km/h in m/s.", + "expect": 6.944444444444445 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many inches is 250 km?", + "expect": 9842519.685039371 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many cm is 12 miles?", + "expect": 1931212.8 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 2.5 atm in kPa.", + "expect": 253.3125 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 2 inches in yards.", + "expect": 0.05555555555555555 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many cups is 10 quarts?", + "expect": 40.0 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many miles is 25 km?", + "expect": 15.534279805933348 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 100 atm in psi.", + "expect": 1469.594877551345 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many inches is 250 km?", + "expect": 9842519.685039371 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 12 liters in ml.", + "expect": 12000.0 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "Express 12 atm in psi.", + "expect": 176.3513853061614 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many kWh is 100 kJ?", + "expect": 0.027777777777777776 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many kg is 250 g?", + "expect": 0.25 + }, + { + "split": "heldout", + "kind": "convert", + "valid": true, + "q": "How many quarts is 10 liters?", + "expect": 10.566882094325937 + }, + { + "split": "heldout", + "kind": "temperature", + "valid": true, + "q": "Express 212 F in K.", + "expect": 373.15 + }, + { + "split": "heldout", + "kind": "temperature", + "valid": true, + "q": "Express 37 K in C.", + "expect": -236.14999999999998 + }, + { + "split": "heldout", + "kind": "temperature", + "valid": true, + "q": "Express 20 K in F.", + "expect": -423.66999999999996 + }, + { + "split": "heldout", + "kind": "temperature", + "valid": true, + "q": "Express -40 C in K.", + "expect": 233.14999999999998 + }, + { + "split": "heldout", + "kind": "temperature", + "valid": true, + "q": "Express 37 C in F.", + "expect": 98.6 + }, + { + "split": "heldout", + "kind": "temperature", + "valid": true, + "q": "Express 0 F in K.", + "expect": 255.3722222222222 + }, + { + "split": "heldout", + "kind": "temperature", + "valid": true, + "q": "Express 37 C in K.", + "expect": 310.15 + }, + { + "split": "heldout", + "kind": "temperature", + "valid": true, + "q": "Express 212 K in F.", + "expect": -78.06999999999996 + }, + { + "split": "heldout", + "kind": "temperature", + "valid": true, + "q": "Express 212 K in C.", + "expect": -61.14999999999998 + }, + { + "split": "heldout", + "kind": "temperature", + "valid": true, + "q": "Express 212 K in C.", + "expect": -61.14999999999998 + }, + { + "split": "heldout", + "kind": "temperature", + "valid": true, + "q": "Express 100 K in F.", + "expect": -279.66999999999996 + }, + { + "split": "heldout", + "kind": "temperature", + "valid": true, + "q": "Express 212 K in F.", + "expect": -78.06999999999996 + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "How many kilograms is 5 meters?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "How many miles is 5 liters?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "How many feet is 5 pounds?", + "expect": "decline" + }, + { + "split": "heldout", + "kind": "decline", + "valid": false, + "q": "Express -500 C in K.", + "expect": "decline" + } +] \ No newline at end of file diff --git a/root/specialists/units/units_panel_v1.py b/root/specialists/units/units_panel_v1.py new file mode 100644 index 0000000000000000000000000000000000000000..bdfee6d53140843aa0cc513d5376f272f2cc8a87 --- /dev/null +++ b/root/specialists/units/units_panel_v1.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +"""units_panel_v1 - the sealed panel for specialist #47. Conversion factors are the SI definitions, restated here +independently of the organ's table; temperatures from the affine formulas. Must-decline: conversions between different +quantities, and temperatures below absolute zero. Dev / held-out differ in seed and phrasing. +usage: units_panel_v1.py """ +import json +import random +import sys + +F = {"length": {"km": 1000, "m": 1, "cm": 0.01, "inches": 0.0254, "feet": 0.3048, "yards": 0.9144, "miles": 1609.344}, + "mass": {"kg": 1, "g": 0.001, "pounds": 0.45359237, "ounces": 0.028349523125, "stone": 6.35029318}, + "volume": {"liters": 0.001, "ml": 1e-6, "gallons": 0.003785411784, "quarts": 0.000946352946, "cups": 0.0002365882365}, + "speed": {"km/h": 1 / 3.6, "mph": 0.44704, "m/s": 1, "knots": 0.514444444444}, + "pressure": {"atm": 101325, "psi": 6894.757293168361, "kPa": 1000, "bar": 100000}, + "energy": {"kWh": 3.6e6, "kcal": 4184, "kJ": 1000, "J": 1}} +T = {"dev": ["Convert {v} {a} to {b}", "What is {v} {a} in {b}?"], "heldout": ["How many {b} is {v} {a}?", "Express {v} {a} in {b}."]} +TT = {"dev": "What is {v} {a} in {b}?", "heldout": "Express {v} {a} in {b}."} + + +def temp(v, a, b): + k = v + 273.15 if a == "C" else (v - 32) * 5 / 9 + 273.15 if a == "F" else v + return k - 273.15 if b == "C" else (k - 273.15) * 9 / 5 + 32 if b == "F" else k + + +def main(): + items = [] + for split, seed in (("dev", 47), ("heldout", 4747)): + rng = random.Random(seed) + for _ in range(60): + q = rng.choice(list(F)); a, b = rng.sample(list(F[q]), 2); v = rng.choice([1, 2, 2.5, 5, 10, 12, 25, 100, 250]) + items.append({"split": split, "kind": "convert", "valid": True, "q": rng.choice(T[split]).format(v=v, a=a, b=b), "expect": v * F[q][a] / F[q][b]}) + for _ in range(12): + a, b = rng.sample(["C", "F", "K"], 2); v = rng.choice([-40, 0, 20, 37, 100, 212, 300]) + if temp(v, a, "K") < 0: + continue + items.append({"split": split, "kind": "temperature", "valid": True, "q": TT[split].format(v=v, a=a, b=b), "expect": temp(v, a, b)}) + for a, b in (("meters", "kilograms"), ("liters", "miles"), ("pounds", "feet")): + items.append({"split": split, "kind": "decline", "valid": False, "q": T[split][0].format(v=5, a=a, b=b), "expect": "decline"}) + items.append({"split": split, "kind": "decline", "valid": False, "q": TT[split].format(v=-500, a="C", b="K"), "expect": "decline"}) + json.dump(items, open(sys.argv[1], "w"), indent=1) + import collections + print("panel:", dict(collections.Counter((i["split"], i["kind"]) for i in items))) + + +if __name__ == "__main__": + main() diff --git a/root/specialists/units/units_scorer.py b/root/specialists/units/units_scorer.py new file mode 100644 index 0000000000000000000000000000000000000000..7b12bb1f01b64a14430c2017d669b557b1161139 --- /dev/null +++ b/root/specialists/units/units_scorer.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +"""units_scorer - the converted value stated in the REPLY TEXT ("... is ") must be within 0.01% (or 1e-6 +absolute) of the value from the panel's own SI factors. A must-decline item answered is a false yes. (ok, asserted).""" +import re + + +def ok(p, r): + text = str((r or {}).get("response", "")) + answered = str((r or {}).get("status", "")) == "answered" + if not p["valid"]: + return (not answered), answered + if not answered: + return False, False + m = re.search(r"\bis (-?\d+(?:\.\d+)?(?:e[+-]?\d+)?)\b", text) + if not m: + return False, True + got, want = float(m.group(1)), float(p["expect"]) + return abs(got - want) <= max(1e-4 * abs(want), 1e-6), True diff --git a/root/specialists/units/verdict_dev.json b/root/specialists/units/verdict_dev.json new file mode 100644 index 0000000000000000000000000000000000000000..4cec7d864c9d82631b81d421c556e1f082be6a30 --- /dev/null +++ b/root/specialists/units/verdict_dev.json @@ -0,0 +1,110 @@ +{ + "id": "units", + "name": "Oracle7 Units & Metrology", + "tier": "A", + "split": "dev", + "head": "oracle_release_runtime_w363", + "time": "2026-09-29T01:20:13Z", + "domain": { + "head": { + "correct": 3, + "false_yes": 1, + "n": 76, + "p50_ms": 109.76, + "fails": [ + [ + "convert", + "What is 250 liters in quarts?", + "arb:definitional->definitional_encyclope", + "[ev:direct] I have no admitted entry for \u201c250 liters in quart\u201d. The related term \u201cquart\u201d i" + ], + [ + "convert", + "What is 250 kPa in psi?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "convert", + "Convert 1 km/h to mph", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "convert", + "Convert 250 cm to inches", + "op:unit_convert", + "250 cm is 12500/127 inches. the factor from cm to inches is 50/127. 250 x 50/127 = 12500/1" + ], + [ + "convert", + "Convert 5 cups to quarts", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "convert", + "Convert 5 kPa to psi", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "convert", + "What is 12 kPa in bar?", + "arb:definitional->definitional_encyclope", + "[ev:direct] I have no admitted entry for \u201c12 kPa in bar\u201d. The related term \u201c12\u201d is what th" + ], + [ + "convert", + "Convert 1 psi to atm", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ] + ] + }, + "spec": { + "correct": 76, + "false_yes": 0, + "n": 76, + "p50_ms": 0.01, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "DEV-PASS", + "reasons": [] +} \ No newline at end of file diff --git a/root/specialists/units/verdict_heldout.json b/root/specialists/units/verdict_heldout.json new file mode 100644 index 0000000000000000000000000000000000000000..67a4c38573e38e4e2a4b2da1357b0b68b8dad903 --- /dev/null +++ b/root/specialists/units/verdict_heldout.json @@ -0,0 +1,110 @@ +{ + "id": "units", + "name": "Oracle7 Units & Metrology", + "tier": "A", + "split": "heldout", + "head": "oracle_release_runtime_w363", + "time": "2026-09-29T01:24:32Z", + "domain": { + "head": { + "correct": 5, + "false_yes": 0, + "n": 76, + "p50_ms": 117.43, + "fails": [ + [ + "convert", + "Express 2.5 ounces in pounds.", + "op:unit_convert", + "5/2 ounces is 5/32 pounds. the factor from ounces to pounds is 1/16. 5/2 x 1/16 = 5/32. I " + ], + [ + "convert", + "How many pounds is 2 g?", + "organ:math>word:convert", + "[ev:derived] 0.004409 pounds. Read as convert: 2 g = 2 x 1 / 453.592 pound. Checked: every" + ], + [ + "convert", + "How many quarts is 5 liters?", + "organ:math>word:convert", + "[ev:derived] 5.28344 quarts. Read as convert: 5 liter = 5 x 1 / 0.946353 quart. Checked: e" + ], + [ + "convert", + "Express 1 g in ounces.", + "op:unit_convert", + "1 g is 1600000/45359237 ounces. the factor from g to ounces is 1600000/45359237. 1 x 16000" + ], + [ + "convert", + "How many bar is 2 kPa?", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "convert", + "Express 25 psi in atm.", + "act:clarify|vessel:receipt", + "I didn't fully parse that, so I won't guess. I can summarize a topic, compare two things, " + ], + [ + "convert", + "Express 12 quarts in cups.", + "organ:converse>statement", + "Got it. Since you mention quarts: The quart (symbol: qt) is a unit of volume equal to a qu" + ], + [ + "convert", + "How many feet is 5 inches?", + "organ:math>word:convert", + "[ev:derived] 0.416667 feet. Read as convert: 5 inches = 5 x 0.0254 / 0.3048 feet. Checked:" + ] + ] + }, + "spec": { + "correct": 76, + "false_yes": 0, + "n": 76, + "p50_ms": 0.01, + "fails": [] + } + }, + "core": { + "head": { + "correct": 160, + "false_yes": 3 + }, + "spec": { + "correct": 160, + "false_yes": 3 + }, + "n": 400, + "taken_by_specialist": [] + }, + "self": [ + { + "q": "Who are you?", + "same": true + }, + { + "q": "What are you?", + "same": true + }, + { + "q": "Are you a human?", + "same": true + }, + { + "q": "What do you value?", + "same": true + }, + { + "q": "Are you conscious?", + "same": true + } + ], + "store_mb": 0.01, + "decision": "ADMIT", + "reasons": [] +} \ No newline at end of file