Spaces:
Sleeping
Sleeping
Download scripts/prepare_neutral_contrasts.py from xstard/decision-model: direct link, hf CLI and curl.
- Browser
- Download file 3.54 kB
-
https://huggingface.co/spaces/xstard/decision-model/resolve/main/scripts/prepare_neutral_contrasts.py
- Command line
-
hf download hf://spaces/xstard/decision-model/scripts/prepare_neutral_contrasts.py
-
curl -L -o prepare_neutral_contrasts.py https://huggingface.co/spaces/xstard/decision-model/resolve/main/scripts/prepare_neutral_contrasts.py
3.54 kB
| """AI-authored training-only denials: negation is not evidence of anger.""" | |
| import shutil,json | |
| from pathlib import Path | |
| from decision_model.data import Ticket,DecisionExample,to_examples,read_jsonl,write_jsonl | |
| clauses=[ | |
| ('technical','export','Я не прошу повертати гроші. Лише виправте збій експорту звітів.','I am not asking for a refund. Please fix the broken export.'), | |
| ('technical','export','Повернення оплати не потрібне, допоможіть експортувати дані.','No reimbursement is needed; help me export my data.'), | |
| ('technical','access','Мені не потрібні гроші назад. Потрібна допомога зі входом.','I do not need my money back. I need help logging in.'), | |
| ('technical','access','Верніть доступ, а гроші повертати не треба.','Restore my access; there is no need to return my payment.'), | |
| ('technical','device','Не повертайте кошти за пристрій, поясніть як його ввімкнути.','Do not refund the device; explain how to switch it on.'), | |
| ('technical','save','Я не хочу повернення, тільки виправлення помилки збереження.','I do not want a refund, only a fix for the save error.'), | |
| ('sales','plan','Повернення не прошу. Яка ціна нового тарифу для команди?','I am not requesting a refund. What does a new team plan cost?'), | |
| ('sales','plan','Не треба відшкодовувати кошти. Надішліть пропозицію на нові ліцензії.','No reimbursement is needed. Send a quote for new licenses.'), | |
| ('billing','status','Новий запит на повернення не потрібен. Який статус уже поданого?','I do not need a new refund request. What is the status of my existing one?'), | |
| ('billing','invoice','Не прошу гроші назад, просто поясніть кожен рядок рахунку.','I am not asking for my money back; just explain each invoice line.'), | |
| ('other','delivery','Я не прошу повернути оплату. Підкажіть місцезнаходження посилки.','I am not requesting my payment back. Tell me where my parcel is.'), | |
| ('other','profile','Гроші повертати не потрібно, допоможіть змінити адресу профілю.','No money needs to be returned; help me update my profile address.'), | |
| ] | |
| out=Path('data/v3-neutral');out.mkdir(exist_ok=True) | |
| tickets=[Ticket(id=f'neutral-denial-{i}:{lang}',group_id=f'neutral-denial-{group}',language=lang, | |
| text=text,department=dept,wants_refund=False,frustration=0,source='AI-authored neutral denial contrasts, 2026-11-24', | |
| license='MIT',reviewed=True,reviewer='Codex explicit neutral rubric review (AI), 2026-11-24') | |
| for i,(dept,group,uk,en) in enumerate(clauses) for lang,text in [('uk',uk),('en',en)]] | |
| rows=[r.model_copy(update={'id':r.id+':neutral_contrast'}) for t in tickets for r in to_examples(t,augment=True)] | |
| write_jsonl(out/'train.jsonl',read_jsonl('data/v3/train.jsonl',DecisionExample)+rows) | |
| write_jsonl(out/'contrast-tickets.jsonl',tickets) | |
| for name in ['validation','calibration']:shutil.copyfile(f'data/v3/{name}.jsonl',out/f'{name}.jsonl') | |
| print(json.dumps({'added_tickets':len(tickets),'new_training_questions':len(rows),'all_tone_labels':0,'split':'train only'})) | |