Closed yassineAlouini closed 4 years ago
I just added support for lexicons within Shifterator: https://github.com/ryanjgallagher/shifterator/tree/master/shifterator/lexicons
If you upgrade via pip
, then when you're doing something like a sentiment shift, you should just have to specify the name of a lexicon (the filename without the .tsv
) and it'll load that lexicon automatically.
For example:
rs = rs.SentimentShift(reference=type2freq_ref,
comparison=type2freq_comp,
sent_dict_ref='SocialSent-historical_1920',
sent_dict_comp='SocialSent-historical_1970')
If you run into any trouble, let me know!
In the
helper.py
script, theget_score_dictionary
function makes a type check for the input scores: if it is a dict, it will return the scores, otherwise, it will attempt to read from a hardcoded data folder.This is fine of course but it would be more robust to have it accept other dict-like types. One such type is
Collections.Counter.
Also, it would be nice to make the data path not hardcoded.Thanks in advance. :smiley_cat: