67 lines
2.5 KiB
Python
67 lines
2.5 KiB
Python
"""Survey Fractonaut output for interesting/distinctive content."""
|
|
import json, sys, re
|
|
from collections import Counter
|
|
|
|
def load(p):
|
|
out = []
|
|
with open(p) as f:
|
|
for line in f:
|
|
line = line.strip()
|
|
if not line: continue
|
|
try: out.append(json.loads(line))
|
|
except: pass
|
|
return out
|
|
|
|
def text_of(e):
|
|
return (e.get("response") or e.get("observation") or e.get("error") or "").strip()
|
|
|
|
paths = sys.argv[1:] or [
|
|
"/mnt/d/Resonance_Engine/traj/regime_20260608T133638/fractonaut_observations.jsonl",
|
|
"/mnt/d/Resonance_Engine/fractonaut_chronicle.jsonl",
|
|
]
|
|
|
|
for p in paths:
|
|
print("=" * 78)
|
|
print(f"FILE: {p}")
|
|
print("=" * 78)
|
|
es = load(p)
|
|
print(f"entries: {len(es)}")
|
|
texts = [text_of(e) for e in es]
|
|
texts = [t for t in texts if t]
|
|
print(f"non-empty: {len(texts)}")
|
|
lens = sorted(len(t) for t in texts)
|
|
if not lens:
|
|
print("(no text)\n"); continue
|
|
print(f"length min/med/max: {lens[0]} / {lens[len(lens)//2]} / {lens[-1]}")
|
|
|
|
boiler = sum(1 for t in texts if re.match(r"^[Aa]symmetry", t))
|
|
idle = sum(1 for t in texts if t.lower().startswith("idle"))
|
|
cycle_ref = sum(1 for t in texts if "cycle 11943500" in t)
|
|
market_words = sum(1 for t in texts if re.search(r"\b(market|trade|buy|sell|price|volatility|liquidity|order|volume|spike|absorb|bid|ask|flow)\b", t, re.I))
|
|
pattern_words = sum(1 for t in texts if re.search(r"\b(resembl|similar|recall|earlier|history|like .*(before))\b", t, re.I))
|
|
print(f"start with 'asymmetry': {boiler}/{len(texts)}")
|
|
print(f"start with 'idle': {idle}/{len(texts)}")
|
|
print(f"reference cycle 11943500: {cycle_ref}/{len(texts)}")
|
|
print(f"mention market/trade words: {market_words}/{len(texts)}")
|
|
print(f"mention pattern/recall: {pattern_words}/{len(texts)}")
|
|
|
|
pairs = sorted(zip([len(t) for t in texts], texts), reverse=True)
|
|
print("\n--- 5 longest responses ---")
|
|
for L, t in pairs[:5]:
|
|
print(f"[{L} chars] {t[:800]}")
|
|
print()
|
|
|
|
novel = [t for t in texts if not re.match(r"^[Aa]symmetry", t) and not t.lower().startswith("idle")]
|
|
print(f"\n--- {len(novel)} non-boilerplate (showing 10) ---")
|
|
for t in novel[:10]:
|
|
print(f" - {t[:400]}")
|
|
|
|
words = Counter()
|
|
for t in texts:
|
|
for w in re.findall(r"[a-zA-Z]+", t.lower()):
|
|
if len(w) >= 5: words[w] += 1
|
|
print("\n--- top 20 words (len>=5) ---")
|
|
for w, c in words.most_common(20):
|
|
print(f" {c:5d} {w}")
|
|
print()
|