Skip to content

Commit a058bd6

Browse files
authored
Add text cleaning function to preprocess text
1 parent 593b331 commit a058bd6

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎nlp_model/text_preprocessor.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import re
2+
3+
4+
def clean_text(text):
5+
text = text.lower()
6+
text = re.sub(r"[^a-z\s]", "", text) # remove special chars
7+
return text

0 commit comments

Comments
 (0)