plt-dataset / scripts /stats.js
THE INVESTIGATOR
PLT Doctrine Dataset v1.0 - 188 trajectory tuples: 120 RCC, 10 Laws, 22 Archetypes, 12 Mistakes, 10 Soul Codes, 3 Decisions, 3 Reflections, 8 Snippets
50b456f
Raw
History Blame Contribute Delete
1.64 kB
#!/usr/bin/env node
'use strict';
/**
* PLT Dataset — Statistics & Composition Report
*/
const fs = require('fs');
const path = require('path');
const DATA = path.join(__dirname, '..', 'data');
const files = fs.readdirSync(DATA).filter(f => f.endsWith('.jsonl')).sort();
let grandTotal = 0;
console.log('=== PLT Dataset — Composition Report ===\n');
for (const file of files) {
const rows = fs.readFileSync(path.join(DATA, file), 'utf8')
.split('\n').filter(Boolean);
const parsed = rows.map(l => JSON.parse(l));
grandTotal += parsed.length;
// PLB distribution
const pl = { p: [], l: [], t: [] };
for (const r of parsed) {
pl.p.push(r.plb.profit);
pl.l.push(r.plb.love);
pl.t.push(r.plb.tax);
}
const avg = (arr) => (arr.reduce((a,b)=>a+b,0) / arr.length).toFixed(2);
const max = (arr) => Math.max(...arr);
const byType = {};
for (const r of parsed) byType[r.type] = (byType[r.type]||0) + 1;
console.log(`\n● ${file.replace('.jsonl','')}${parsed.length} rows`);
console.log(` Avg PLB: P:${avg(pl.p)} L:${avg(pl.l)} T:${avg(pl.t)}`);
console.log(` Max Tax: ${max(pl.t)} (teaches tax_form detectors)`);
const horizons = {};
for (const r of parsed) horizons[r.plb.time_horizon] = (horizons[r.plb.time_horizon]||0) + 1;
console.log(` Horizons: ${Object.entries(horizons).map(([h,n])=>`${h}:${n}`).join(' ')}`);
console.log(` Types: ${Object.entries(byType).map(([t,n])=>`${t}:${n}`).join(' ')}`);
}
console.log(`\n=== Grand Total: ${grandTotal} PLT trajectory tuples ===`);
console.log('Extensible. Add decisions/reflections as the library grows.\n');