13 lines
326 B
Python
Executable File
13 lines
326 B
Python
Executable File
#!/usr/bin/python3
|
|
|
|
import spacy
|
|
|
|
nlp = spacy.load('en', disable=['parser', 'ner'])
|
|
|
|
sentence = "The striped bats are hanging on their feet for best"
|
|
|
|
# Parse the sentence using the loaded 'en' model object `nlp`
|
|
doc = nlp(sentence)
|
|
|
|
# Extract the lemma for each token and join
|
|
print(" ".join([token.lemma_ for token in doc])) |