how to use spacy lemmatizer to get a word into basic form

后端 未结 5 1319
青春惊慌失措
青春惊慌失措 2021-02-02 08:25

I am new to spacy and I want to use its lemmatizer function, but I don\'t know how to use it, like I into strings of word, which will return the string with the basic form the w

5条回答
  •  无人及你
    2021-02-02 08:55

    I use Spacy version 2.x

    import spacy
    nlp = spacy.load('en_core_web_sm', disable=['parser', 'ner'])
    doc = nlp('did displaying words')
    print (" ".join([token.lemma_ for token in doc]))
    

    and the output :

    do display word
    

    Hope it helps :)

提交回复
热议问题