Add files
Signed-off-by: András Schmelczer <andras@schmelczer.dev>
This commit is contained in:
commit
d79a75d352
102 changed files with 24317 additions and 0 deletions
12
example/helper/preprocess.py
Normal file
12
example/helper/preprocess.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from sus.clean import clean
|
||||
from sus.lemmatize_text import lemmatize_text
|
||||
import re
|
||||
|
||||
|
||||
def preprocess(text: str) -> str:
|
||||
cleaned = clean(text, convert_to_ascii=True)
|
||||
lemmas = [
|
||||
re.sub(r'\d+', 'NUM', lemma)
|
||||
for lemma in lemmatize_text(cleaned)
|
||||
]
|
||||
return " ".join(lemmas)
|
||||
Loading…
Add table
Add a link
Reference in a new issue