Download baseline_regex.py from DHDRL/AgentSquares: direct link, hf CLI and curl.
- Browser
- Download file 889 Bytes
-
https://huggingface.co/DHDRL/AgentSquares/resolve/main/baseline_regex.py
- Command line
-
hf download hf://DHDRL/AgentSquares/baseline_regex.py
-
curl -L -o baseline_regex.py https://huggingface.co/DHDRL/AgentSquares/resolve/main/baseline_regex.py
889 Bytes
| """Dumb baseline: one permissive regex, no guards, no validation, no staleness, no retries.""" | |
| import re | |
| NAIVE = [re.compile(r"\bn\s*=\s*(\d+)\D{0,40}?(\d+\.\d+)"), | |
| re.compile(r"s\((\d+)\)\D{0,5}(\d+\.\d+)")] | |
| def extract_naive(text, meta): | |
| claims, seen = [], set() | |
| for p in NAIVE: | |
| for m in p.finditer(text): | |
| key = (int(m.group(1)), float(m.group(2))) | |
| if key in seen: | |
| continue | |
| seen.add(key) | |
| claims.append({"n": key[0], "s": key[1], "coordinates_available": False, "packing": None, | |
| "score": None, "source_url": meta["url"], | |
| "source_type": meta.get("source_type", "unknown"), | |
| "source_key": meta["url"], "date": meta.get("date", ""), | |
| "extracted_text": m.group(0)[:160]}) | |
| return claims, [] | |