enlp.processing.stdtools.nltk_stem_no

enlp.processing.stdtools.nltk_stem_no(model, text)[source]

Return string of stemmed text using NLTK’s Norwegian snowball stemmer

Stemming is a technique to remove affixes from a word, ending up with the stem. For example, the stem of cooking is cook.

Parameters
modelspacy.lang

SpaCy language model

textstr

text string on which to remove stopwords

Returns
updated_textstr

Updated version of input string where words have been stemmed

Notes

String output is to allow piping between functions to return words as a list use: to_list(stem_norwegian(…))

Examples

>>> import spacy
>>> lang_mod = spacy.load('nb_dep_ud_sm')
>>> text = 'Den raske brune reven hoppet over den late hunden.'
>>> print (nltk_stem_no(lang_mod,text))
den rask brun rev hopp over den lat hund.