spacy clean text and split by sentences code example
Example 1: remove punctuation from string python
import re
s = "string. With. Punctuation?"
s = re.sub(r'[^\w\s]','',s)
s = "string. With. Punctuation?"
s.translate(str.maketrans('', '', string.punctuation))
Example 2: spacy tokenize
from spacy.tokenizer import Tokenizer
from spacy.lang.en import English
nlp = English()
tokenizer = Tokenizer(nlp.vocab)
from spacy.lang.en import English
nlp = English()
tokenizer = nlp.Defaults.create_tokenizer(nlp)