Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

TypeError: expected string or bytes-like object site:stackoverflow.com

import re
import nltk
from nltk.tokenize import word_tokenize
nltk.download('punkt')
sentences = word_tokenize("I love to learn NLP 
 'a :(")
#for i in range(len(sentences)):
sentences = [word.lower() for word in sentences if re.match('^[a-zA-Z]+', word)]  
sentences
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #expected #string #object
ADD COMMENT
Topic
Name
2+5 =