Download runtime/native_runtime/use_feedback.py from r1234chen/PuzzleMixEscape: direct link, hf CLI and curl.
- Browser
- Download file 533 Bytes
-
https://huggingface.co/datasets/r1234chen/PuzzleMixEscape/resolve/main/runtime/native_runtime/use_feedback.py
- Command line
-
hf download hf://datasets/r1234chen/PuzzleMixEscape/runtime/native_runtime/use_feedback.py
-
curl -L -o use_feedback.py https://huggingface.co/datasets/r1234chen/PuzzleMixEscape/resolve/main/runtime/native_runtime/use_feedback.py
533 Bytes
| import re | |
| def reference(value, fallback): | |
| text = ' '.join(str(value or '').split()) | |
| if not text or re.fullmatch('(?:s[123]_.+|R\\d+|L\\d+-\\d+|H1-\\d+)', text): | |
| return fallback | |
| text = re.sub('#\\d+\\s*', '', text).strip() | |
| if not text: | |
| return fallback | |
| return text if text.lower().startswith(('the ', 'this ', 'that ', 'your ')) else 'the ' + text | |
| def rejection(item=None, target=None): | |
| return 'You cannot use ' + reference(item, 'this item') + ' on ' + reference(target, 'this object') + '.' | |