enlp.processing.stdtools.rm_punctuation

enlp.processing.stdtools.rm_punctuation(model, text)[source]

Return string free of punctuation

Parameters
modelspacy.lang

SpaCy language model

textstr

text string on which to remove stopwords

Returns
updated_textstr

Updated version of input string where punctuation has been removed

Notes

String output is to allow piping between functions to return words as a list use: to_list(remove_punctuation(…))

Examples

>>> import spacy
>>> lang_mod = spacy.load('en_core_web_md')
>>> text = 'I better have passed that test - it is 90 percent of the class grade.'
>>> print (rm_punctuation(lang_mod, text))
I better have passed that test it is 90 percent of the class grade