Вот мой код:
Код: Выделить всё
from texthero import preprocessing
custom_pipeline = [preprocessing.fillna # Remplacez les valeurs non affectées par des espaces vides
, preprocessing.lowercase # transforme tout le texte en minuscules
, preprocessing.remove_digits # Supprimez tous les blocs de chiffres
, preprocessing.remove_punctuation # supprimez tous les string.punctuation (! "# $% & '() * +, -. / :; ? @ [\] ^ _` {|} ~)
, preprocessing.remove_diacritics # Supprimez tous les accents des chaînes
, preprocessing.remove_stopwords # Supprimez tous les mots vides
, preprocessing.remove_whitespace # Supprimez tout espace blanc entre les mots
, preprocessing.remove_html_tags # supprimer toutes les balises HTML d’une chaîne
, preprocessing.remove_brackets] # supprimer les crochets de la chaîne
# custom_pipeline à l'argument pipeline
df_biens_cons_variable_pertinentes['clean_description'] = hero.clean(df_biens_cons_variable_pertinentes['description'], pipeline = custom_pipeline)
df_biens_cons_variable_pertinentes['clean_product_name'] = hero.clean(df_biens_cons_variable_pertinentes['product_name'], pipeline = custom_pipeline)
display(df_biens_cons_variable_pertinentes.head(2))
index = 1000
text=df_biens_cons_variable_pertinentes.description[index]
print('#text brut #:',text)
text_clean =df_biens_cons_variable_pertinentes['clean_description'][index]
print('#text_clean# :',text_clean)
Он также имел ошибку for preprocessing.remove_html_tags
Я искал в Интернете, и кажется, что никто не сталкивался с такими проблемами с texthero, так что я немного растерялся. Есть ли у вас идеи, почему это происходит?
У меня есть еще один вопрос: почему texthero не отображается в разделе тегов stackoverflow?
Подробнее здесь: https://stackoverflow.com/questions/787 ... tribute-re