Ai-detector-websterfly / scripts /analyze_scopes.py
Websterfly's picture
Deploy Websterfly educational AI detection workbench
97799b9 verified
Raw History Blame Contribute Delete
1.39 kB
"""Report full-text and body-before-REFERENCES scopes for every new candidate."""
import json,gc
from pathlib import Path
from app.detectors import Detector
root=Path('work/upgrade');text=Path('work/paper-analysis/normalized.txt').read_text();cut=text.index('REFERENCES')
results=[]
for key in ['fakespot','earlybird','vanguard']:
print('Body inference',key,flush=True)
d=Detector(key);d.load();r=d.analyze(text[:cut]);(root/(key+'-paper-body.json')).write_text(json.dumps(r,indent=2));full=json.loads((root/(key+'-paper.json')).read_text())
results.append({'key':key,'model_id':r['model_id'],'revision':r['revision'],'full_text_score':full['ai_score']*100,'body_score':r['ai_score']*100,'full_text_characters':len(text),'body_characters':cut,'body_coverage_complete':r['coverage']['complete']})
print(results[-1],flush=True);del d;gc.collect()
(root/'paper-comparison.json').write_text(json.dumps({'models':results,'scope_rule':'Body scope is all normalized extracted text before the first literal REFERENCES heading. Same rule applied to every candidate. It excludes 6,979 characters. Full scores are retained.','limitations':['Scores are uncalibrated outputs, not AI-authored proportions.','Document aggregation is a character-weighted window mean, not independently validated.','The exposed paper was excluded from fusion training; its true origin remains unverified.']},indent=2))