Closed sherwinhlee closed 3 years ago
Can I second this question?
I've been following the "as_key" code example* but to no avail. Have been trying to add a few words that the dictionary doesn't give a value to "learns", "learned", but don't know how to apply changes. If you've figured it out, I'd love some help.
Figured it out. If you want to add onto the dictionary, you have to use update_key()
with the default lexicon as your first parameter and set the x
parameter to your new additions. Store that as a new object and that will be passed into the polarity_dt
argument.
@sherwinhlee how did you look at what the default lexicon was? I'd like to see it before i make amendments! Thanks
@GabriellaS-K If you look at the source code by typing sentiment
you're see the arguments for the dictionaries or type ?sentiment
. That leads you to lexicon::hash_sentiment_jockers_rinker
.
@sherwinhlee & @MsPhotonUIUC You can definitiely make your own and update existing _dt
tables but this can be tricky business with out the helper functions as you run into problems if you have duplicated words or words in polarity that are also in valence_shifters. The update_key
helps with this process. Glad you figured it out.
If I customize my own dictionary with
polarity_dt
/valence_shifters_dt
in dataframe and specify that as arguments tosentiment()
orsentiment_by()
, does that replace the default dictionary? If so and I want to add to the existing lexicons, how do I go about doing that?