File size: 382 Bytes
1bfe7f5 |
1 2 3 4 5 6 7 8 9 10 11 12 |
import re
def remove_bold_formatting(text: str) -> str:
"""
Remove bold formatting from the text.
When processing long texts with LLMs, the token count is a limiting factor.
This function removes the bold formatting from the text to reduce the token count.
"""
text = re.sub(r'\*\*([^*]+)\*\*', r'\1', text)
return re.sub(r'__([^_]+?)__', r'\1', text)
|