Python | Perform Sentence Segmentation Using Spacy Last Updated : 05 Sep, 2020 Comments Improve Suggest changes Like Article Like Report The process of deciding from where the sentences actually start or end in NLP or we can simply say that here we are dividing a paragraph based on sentences. This process is known as Sentence Segmentation. In Python, we implement this part of NLP using the spacy library. Spacy is used for Natural Language Processing in Python. To use this library in our python program we first need to install it. Command to install this library: pip install spacy python -m spacy download en_core_web_sm Here en_core_web_sm means core English Language available online of small size. Example: we have the following paragraph: "I Love Coding. Geeks for Geeks helped me in this regard very much. I Love Geeks for Geeks." here there are 3 sentences. 1. I Love Coding. 2. Geeks for Geeks helped me in this regard very much. 3. I Love Geeks for Geeks In python, .sents is used for sentence segmentation which is present inside spacy. The output is given by .sents is a generator and we need to use the list if we want to print them randomly. Code: python3 #import spacy library import spacy #load core english library nlp = spacy.load("en_core_web_sm") #take unicode string #here u stands for unicode doc = nlp(u"I Love Coding. Geeks for Geeks helped me in this regard very much. I Love Geeks for Geeks.") #to print sentences for sent in doc.sents: print(sent) Output: Now if we try to use doc.sents randomly then what happens: Code: To overcome this error we first need to convert this generator into a list using list function. Python3 #converting the generator object result in to list doc1 = list(doc.sents) #Now we can use it randomly as doc1[1] Output: Comment More infoAdvertise with us Next Article Python | Perform Sentence Segmentation Using Spacy A Akashkumar17 Follow Improve Article Tags : Python Practice Tags : python Similar Reads Python | Word Similarity using spaCy Word similarity is a number between 0 to 1 which tells us how close two words are, semantically. This is done by finding similarity between word vectors in the vector space. spaCy, one of the fastest NLP libraries widely used today, provides a simple method for this task. spaCy's Model - spaCy suppo 2 min read Python - Tokenize text using Enchant Enchant is a module in Python which is used to check the spelling of a word, gives suggestions to correct words. Also, gives antonym and synonym of words. It checks whether a word exists in dictionary or not. Enchant also provides the enchant.tokenize module to tokenize text. Tokenizing involves spl 3 min read Word Embedding using Universal Sentence Encoder in Python Unlike the word embedding techniques in which you represent word into vectors, in Sentence Embeddings entire sentence or text along with its semantics information is mapped into vectors of real numbers. This technique makes it possible to understand and process useful information of an entire text, 3 min read Extracting locations from text using Python In this article, we are going to see how to extract location from text using Python. While working with texts, the requirement can be the detection of cities, regions, states, and countries and relationships between them in the received text. This can be very useful for geographical studies. In this 3 min read Find most similar sentence in the file to the input sentence | NLP In this article, we will find the most similar sentence in the file to the input sentence. Example: File content: "This is movie." "This is romantic movie" "This is a girl." Input: "This is a boy" Similar sentence to input: "This is a girl", "This is movie". Approach: Create a list to store all the 2 min read Like