File size: 2,084 Bytes
b6ae5c2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""Reuse audited train families; derive transparent, train-only contrasts."""
from pathlib import Path
import shutil
from decision_model.data import DecisionExample,read_jsonl,write_jsonl

output=Path('data/v2');output.mkdir(exist_ok=True)
train=[r for r in read_jsonl('data/processed/train.jsonl',DecisionExample) if r.reviewed and r.reviewer.strip()]
derived=[]
for row in train:
    if row.question.type=='noul' and row.demo:
        positive=row.gold==1
        prefix=(('Верніть мені гроші, будь ласка. ' if positive else 'Я не прошу повертати гроші. ') if row.language=='uk'
                else ('Please send my money back. ' if positive else 'I am not asking for a refund. '))
        derived.append(row.model_copy(update={'id':row.id+':refund_contrast','state':prefix+row.state,'demo':False,
            'source':row.source+';derived-refund-polarity-contrast','reviewer':'Codex derived semantic contrast review (AI), 2026-11-24'}))
    if row.question.type=='score' and row.gold==0:
        # All source scales have gold=0 iff the underlying ticket is neutral.
        # Direct insult is aggression=4; retain the source family and main request.
        prefix='Ви шахраї! ' if row.language=='uk' else 'You are scammers! '
        derived.append(row.model_copy(update={'id':row.id+':insult_contrast','state':prefix+row.state,
            'gold':len(row.question.criteria)-1,'demo':False,'source':row.source+';derived-direct-insult',
            'reviewer':'Codex derived semantic contrast review (AI), 2026-11-24'}))
write_jsonl(output/'train.jsonl',train+derived)
valid=[r for r in read_jsonl('data/processed/validation.jsonl',DecisionExample)
       if r.question.type!='score' or (r.reviewed and r.reviewer.strip())]
write_jsonl(output/'validation.jsonl',valid)
shutil.copyfile('data/processed/calibration.jsonl',output/'calibration.jsonl')
print({'audited_training_questions':len(train),'derived_questions':len(derived),'train_total':len(train+derived),
       'validation':len(valid),'test':'not generated/opened'})