Spaces:
No application file
No application file
Create preprocess.py
Browse files- utils/preprocess.py +6 -0
utils/preprocess.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import re
|
| 2 |
+
|
| 3 |
+
def preprocess_text(text: str) -> str:
|
| 4 |
+
text = text.strip()
|
| 5 |
+
text = re.sub(r"\s+", " ", text)
|
| 6 |
+
return text
|