Add files

Signed-off-by: András Schmelczer <andras@schmelczer.dev>
This commit is contained in:
Andras Schmelczer 2022-04-02 13:47:33 +02:00
commit 889e79174b
No known key found for this signature in database
GPG key ID: 39260B5B0614A13E
103 changed files with 24322 additions and 0 deletions

View file

@ -0,0 +1 @@
from .preprocess import preprocess

View 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)