Files
t6_mem0/embedchain/utils.py
Taranjeet Singh 468db83337 Add simple app functionality
This commit enables anyone to create a app and add 3 types of data
sources:

* pdf file
* youtube video
* website

It exposes a function called query which first gets similar docs from
vector db and then passes it to LLM to get the final answer.
2023-06-20 14:42:55 +05:30

11 lines
312 B
Python

import re
def clean_string(text):
text = text.replace('\n', ' ')
cleaned_text = re.sub(r'\s+', ' ', text.strip())
cleaned_text = cleaned_text.replace('\\', '')
cleaned_text = cleaned_text.replace('#', ' ')
cleaned_text = re.sub(r'([^\w\s])\1*', r'\1', cleaned_text)
return cleaned_text