Answers for "python code to split the sentences into words"

10

python split sentence into words

sentence = 'Hello world a b c'
split_sentence = sentence.split(' ')
print(split_sentence)
Posted by: Guest on October-12-2020
1

python split string to sentences

import spacy
nlp = spacy.load('en_core_web_sm') # Load the English Model

string1 = "This is the first sentence. This is the second sentence. This is the third sentence."
doc = nlp(string1)

list(doc.sents)
    
 # Output: ["This is the first sentence.", "This is the second sentence.", "This is the third sentence."]
Posted by: Guest on November-22-2021

Code answers related to "python code to split the sentences into words"

Python Answers by Framework

Browse Popular Code Answers by Language