[FIX] raise error for empty text
@@ -175,6 +175,10 @@ def remove_stopwords(
singletons_to_keep = []
if custom_stopwords:
stopwords += custom_stopwords
+ if not text:
+ raise ValueError(
+ f"Found empty text. Please fix it before using this function."
+ )
if lang in ["fr", "en"]:
lang_module = {"fr": "fr_spacy", "en": "en_spacy"}[lang]
tokens = tokenize(text, lang_module)
