Matching sentiment lexicons#
HuSpaCy is shipped with two sentiment lexicons. The component loads up a lexicon and match words with it. The module can use two sentiment lexicons, the default one is the PolText Lab's resource while one can also load the PrecoSenti lexicon.
Load the component#
Load the default sentiment lexicon (poltext
)
Or you can specify the lexicon to be used by passing addition configuration during initialization nlp.add_pipe("sentiment_lexicon", config={"lexicon_id": "precognox"})
.
Then you can start discovering sentiment values of spans and tokens: