Download wtac.py from openright/tinyllamas-reversed: direct link, hf CLI and curl.
- Browser
- Download file 334 Bytes
-
https://huggingface.co/openright/tinyllamas-reversed/resolve/main/wtac.py
- Command line
-
hf download hf://openright/tinyllamas-reversed/wtac.py
-
curl -L -o wtac.py https://huggingface.co/openright/tinyllamas-reversed/resolve/main/wtac.py
334 Bytes
| #!/usr/bin/env python3 | |
| # reverses word and punctuation order. | |
| import re | |
| import sys | |
| lines = [] | |
| for line in sys.stdin: | |
| #line = " ".join(reversed(line.rstrip().split(" "))) | |
| line = ''.join(reversed(re.split('([\w\d\']+|\.|"|\?|\!|,)', line.rstrip()))) | |
| lines.append(line) | |
| lines.reverse() | |
| for line in lines: | |
| print(line) | |