Datasets:
Download code/dynamic_dataset/conditions.py from Heiheihaha17/MESH-Benchmark: direct link, hf CLI and curl.
- Browser
- Download file 1.27 kB
-
https://huggingface.co/datasets/Heiheihaha17/MESH-Benchmark/resolve/main/code/dynamic_dataset/conditions.py
- Command line
-
hf download hf://datasets/Heiheihaha17/MESH-Benchmark/code/dynamic_dataset/conditions.py
-
curl -L -o conditions.py https://huggingface.co/datasets/Heiheihaha17/MESH-Benchmark/resolve/main/code/dynamic_dataset/conditions.py
1.27 kB
| """Absent wake phrases come from real positive prefixes in OTHER matched groups.""" | |
| from .common import tokens,uid | |
| def finalize(groups): | |
| bank={} | |
| for group in groups: | |
| for target,phrase in group['scenes'][0]['keywords'].items(): | |
| if target.startswith('H'):bank.setdefault(phrase,[]).append(dict(group_id=group['group_id'],target_id=target)) | |
| for group in groups: | |
| scene=group['scenes'][0];emissions=scene['humans']+scene['playback_sources'] | |
| candidates=[phrase for phrase in bank if any(d['group_id']!=group['group_id'] for d in bank[phrase]) | |
| and not any(tokens(e['text'])[:len(tokens(phrase))]==tokens(phrase) for source in emissions for e in source['events'])] | |
| if not candidates:raise ValueError('No real held-out absent prefix exists for this group') | |
| phrase=min(candidates,key=lambda p:uid(group['seed'],'absent_wake_phrase',p)) | |
| donor=next(d for d in bank[phrase] if d['group_id']!=group['group_id']) | |
| for scene in group['scenes']: | |
| scene['keywords']['no_match']=phrase | |
| scene['absent_keyword_provenance']=dict(policy='positive real-speech prefix from another matched group; absent from all current human/robot utterance beginnings',**donor) | |
| return groups | |