Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError for LIWC2007_English150202_STRESS.dic #10

Open
stevenlis opened this issue Feb 6, 2020 · 4 comments
Open

KeyError for LIWC2007_English150202_STRESS.dic #10

stevenlis opened this issue Feb 6, 2020 · 4 comments

Comments

@stevenlis
Copy link

I have a LIWC2007_English150202_STRESS.dic, which looks like the following:

%
1	stress
%
abandon*	1
abuse*		1
ache*		1
aching		1
afraid		1
...
worst		1
worthless* 	1
wrong*		1

When I do

parse, category_names = liwc.load_token_parser('./LIWC2007_English150202_STRESS.dic')

I get

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
c:\Users\liqia\Desktop\random-code.py in 
      8         yield match.group(0)
      9 
---> 10 parse, category_names = liwc.load_token_parser('./LIWC2007_English150202_STRESS.dic')

~\Anaconda3\lib\site-packages\liwc\__init__.py in load_token_parser(filepath)
     19       the lexicon
     20     """
---> 21     lexicon, category_names = read_dic(filepath)
     22     trie = build_trie(lexicon)
     23 

~\Anaconda3\lib\site-packages\liwc\dic.py in read_dic(filepath)
     42         category_mapping = dict(_parse_categories(lines))
     43         # read lexicon (a mapping from matching string to a list of category names)
---> 44         lexicon = dict(_parse_lexicon(lines, category_mapping))
     45     return lexicon, list(category_mapping.values())

~\Anaconda3\lib\site-packages\liwc\dic.py in _parse_lexicon(lines, category_mapping)
     24         line = line.strip()
     25         parts = line.split("\t")
---> 26         yield parts[0], [category_mapping[category_id] for category_id in parts[1:]]
     27 
     28 

~\Anaconda3\lib\site-packages\liwc\dic.py in (.0)
     24         line = line.strip()
     25         parts = line.split("\t")
---> 26         yield parts[0], [category_mapping[category_id] for category_id in parts[1:]]
     27 
     28 

KeyError: ''
@yuviabhi
Copy link

How to get access for LIWC2007_English150202_STRESS.dic ?
We need to purchase it from https://liwcsoftware.onfastspring.com/ ?

@stevenlis
Copy link
Author

I don't even think the 2015 version has a .dic file and they have their own api right now I think.

@yuviabhi
Copy link

You bought LIWC2007_English150202_STRESS.dic from them right ?
I'm asking specifically about STRESS related dic [ which may be now an API].

@stevenlis
Copy link
Author

Sorry. I can't remember that and no longer use it at all. You can contact their support. But if I remembered this correctly, they don't have a .dic file now but only a big pdf or xlsx file or something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants