Create _text.py
Browse files- rag/_text.py +5 -0
rag/_text.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import re
|
| 2 |
+
|
| 3 |
+
def clean_text(t: str) -> str:
|
| 4 |
+
t = re.sub(r"\s+"," ",t or " ").strip()
|
| 5 |
+
return t
|