"""Authored message labels and policy comparison; no classifier/model execution."""
MESSAGES=[('M1','Please send the invoice copy.',{'billing'}),('M2','I cannot log in.',{'access'}),('M3','I cannot log in and I was charged twice.',{'access','billing'}),('M4','Please cancel and refund this order.',{'cancellation','billing'}),('M5','Can I change the delivery address?',{'delivery'}),('M6','Please cancel: I gave the wrong delivery address.',{'cancellation','delivery'})]
PRIORITY=['cancellation','access','billing','delivery']
primary={mid:next(k for k in PRIORITY if k in labels) for mid,_,labels in MESSAGES}
issues=sum(len(labels) for _,_,labels in MESSAGES)
lost=[(mid,sorted(labels-{primary[mid]})) for mid,_,labels in MESSAGES if len(labels)>1]
assert len(MESSAGES)==6
assert issues==9
assert sum(len(labels-{primary[mid]}) for mid,_,labels in MESSAGES)==3
assert len(lost)==3
assert primary['M4']=='cancellation' and 'billing' in MESSAGES[3][2]
for mid,text,labels in MESSAGES:print(mid,text,'issues=',sorted(labels),'primary=',primary[mid])
print('5/5 taxonomy assertions passed:6messages,9issues,3issues omitted if a primary label is treated as the complete task.')
