"""How do workers name the items a chunk takes, unasked? Counts, per verdict kind, the cases whose worker states an item with its L and E + I, and those stating more than one, and prints a few of the latter.""" import collections import re from cases import cases, worker_texts STATED = re.compile(r"item (\d+)\b[^.\n]{0,60}?\bL (\d)\b[^.\n]{0,40}?E \+ I (\d+)", re.IGNORECASE) table = collections.Counter() shown = 0 for outcomes, (stamp, kind, block), entries in cases(): found = [match for text in worker_texts(entries) for match in STATED.finditer(text)] ids = sorted({int(match[1]) for match in found}) table[(kind, bool(found), len(ids) > 1)] += 1 if len(ids) > 1 and shown < 12: shown += 1 print(outcomes.parent.parent.name, stamp, ids, [match[0][:120] for match in found[:4]]) for (kind, stated, several), count in sorted(table.items()): print(f"{kind}: states an item {stated}, more than one {several}: {count}")