textacy.lexicon_methods.emotional_valence requires that you specify the download directory for depechemood otherwise it fails to work and throws misleading error messages.
nlp = spacy.load("en")
doc = nlp(document)
print(textacy.lexicon_methods.emotional_valence(doc)
# result - defaultdict(<class 'float'>, {'DONT_CARE': 0.1297936930869565, 'AFRAID': 0.09674656373913043, 'SAD': 0.1282719223913044, 'ANNOYED': 0.12152050326086958, 'ANGRY': 0.1012500840869565, 'HAPPY': 0.12262621060869566, 'INSPIRED': 0.1640221918695652, 'AMUSED': 0.13576883073913046})
## Current Behavior
>>> import textacy
>>> import spacy
>>> nlp = spacy.load("en")
>>> doc = nlp("hello there friends, how are you today?")
>>> textacy.lexicon_methods.emotional_valence(doc)
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/textacy/data.py", line 140, in load_depechemood
with io.open(fname, mode='rt') as csvfile:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.5/dist-packages/textacy/resources/DepecheMood_V1.0/DepecheMood_normfreq.txt'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.5/code.py", line 91, in runcode
exec(code, self.locals)
File "<console>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/textacy/lexicon_methods.py", line 37, in emotional_valence
dm = data.load_depechemood(data_dir=dm_data_dir, weighting=dm_weighting)
File "/usr/local/lib/python3.5/dist-packages/cachetools/__init__.py", line 50, in wrapper
v = func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/textacy/data.py", line 145, in load_depechemood
_download_depechemood(os.path.split(data_dir)[0])
File "/usr/local/lib/python3.5/dist-packages/textacy/data.py", line 182, in _download_depechemood
f.extractall(data_dir, members=members)
File "/usr/lib/python3.5/zipfile.py", line 1347, in extractall
self.extract(zipinfo, path, pwd)
File "/usr/lib/python3.5/zipfile.py", line 1335, in extract
return self._extract_member(member, path, pwd)
File "/usr/lib/python3.5/zipfile.py", line 1390, in _extract_member
os.makedirs(upperdirs)
File "/usr/lib/python3.5/os.py", line 231, in makedirs
makedirs(head, mode, exist_ok)
File "/usr/lib/python3.5/os.py", line 241, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/textacy/resources'
## Possible Solution
Make the download directory for depecheMood mandatory as a parameter and make downloading depechemood part of installing textacy or a method that installs it somewhere. This method would be similar to
`python -m spacy.en.download`
## Steps to Reproduce (for bugs)
run:
## Context
This issue is easily fixed but hard to debug.
## Your Environment
* Version used:
* Environment name and version: Python 3.5.2
* Server type and version: N/a
* Operating System and version: Ubuntu 16.04
* Link to your project: