Spaces:
Runtime error
Runtime error
Download utils.py from shortform/chapter_summary_summvis: direct link, hf CLI and curl.
- Browser
- Download file 297 Bytes
-
https://huggingface.co/spaces/shortform/chapter_summary_summvis/resolve/main/utils.py
- Command line
-
hf download hf://spaces/shortform/chapter_summary_summvis/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/shortform/chapter_summary_summvis/resolve/main/utils.py
297 Bytes
| import re | |
| def clean_text(text): | |
| split_punct = re.escape(r'()') | |
| return ' '.join(re.findall(rf"[^\s{split_punct}]+|[{split_punct}]", text)) | |
| # Ensure parentheses are probably separated by spaCy tokenizer for CNN/DailyMail dataset. | |
| return text.replace("(", "( ").replace(")", ") ") | |