chbrown / liwc-python

Linguistic Inquiry and Word Count (LIWC) analyzer
MIT License
193 stars 50 forks source link

Moral Foundations LIWC dictionary #4

Closed robertjoellewis closed 6 years ago

robertjoellewis commented 6 years ago

I am trying to use the moral foundations dictionary created for LIWC. I have used it in LIWC 2015 but it doesn't seem to work for me (although I get the other dics to work).

The moral foundations dictionary is available here: https://www.moralfoundations.org/sites/default/files/files/downloads/moral%20foundations%20dictionary.dic

I attached a screenshot of the error message below, which reads on the last line as: "IndexError: list index out of range"

screen shot 2018-10-03 at 9 59 16 pm

chbrown commented 6 years ago

Ooh, very nice bug report! Thanks for the link to the problematic dictionary and the screenshot of the full traceback.

The issue was that the standard LIWC dictionary I've worked with in the past always uses the tab character to separate category name and id, as well as string match and category id(s).

f06e5b5 splits on any/all whitespace instead, so upgrade to 0.4.1 (latest) and you should be good to go!