Untitled
unknown
plain_text
2 years ago
448 B
3
Indexable
import spacy # Load the Spacy model for English language nlp = spacy.load('en_core_web_sm') def lemmatize_word(sentence): # Parse the sentence using Spacy doc = nlp(sentence) # Lemmatize each word in the sentence lemmatized_words = [token.lemma_ for token in doc] # Join back the lemmatized words into a sentence lemmatized_sentence = ' '.join(lemmatized_words) return lemmatized_sentence
Editor is loading...