texthero.preprocessing.replace_punctuation¶
-
replace_punctuation
(input: pandas.core.series.Series, symbol: str = ' ') → pandas.core.series.Series¶ Replace all punctuation with a given symbol.
replace_punctuation replace all punctuation from the given Pandas Series and replace it with a custom symbol. It consider as punctuation characters all
string.punctuation
symbols !”#$%&’()*+,-./:;<=>?@[]^_`{|}~).- Parameters
- inputPandas Series
- symbolstr (default single empty space)
Symbol to use as replacement for all string punctuation.
Examples
>>> import texthero as hero >>> import pandas as pd >>> s = pd.Series("Finnaly.") >>> hero.replace_punctuation(s, " <PUNCT> ") 0 Finnaly <PUNCT> dtype: object