cdimascio / py-readability-metrics

📗 Score text readability using a number of formulas: Flesch-Kincaid Grade Level, Gunning Fog, ARI, Dale Chall, SMOG, and more
https://py-readability-metrics.readthedocs.io/en/latest/
MIT License
359 stars 58 forks source link

Unable to use due to missing dale_chall_porterstem.txt #4

Closed michael-stevens closed 4 years ago

michael-stevens commented 5 years ago

Hi,

I'm trying to use this on python 2.7 from pip and failing because it doesn't install dale_chall_porterstem.txt:

Traceback (most recent call last): File "update_readability.py", line 85, in process_link(product_id, service_adgroup_id, None, apply_link) File "update_readability.py", line 22, in process_link rab = readability.Readability(text) File "/opt2/dev/bin/jobs/STATS-305/env/lib/python2.7/site-packages/readability/readability.py", line 9, in init self._statistics = self._analyzer.analyze(text) File "/opt2/dev/bin/jobs/STATS-305/env/lib/python2.7/site-packages/readability/text/analyzer.py", line 60, in analyze self._dale_chall_set = self._load_dale_chall() File "/opt2/dev/bin/jobs/STATS-305/env/lib/python2.7/site-packages/readability/text/analyzer.py", line 135, in _load_dale_chall with open(dale_chall_path) as f: IOError: [Errno 2] No such file or directory: '/opt2/dev/bin/jobs/STATS-305/env/lib/python2.7/site-packages/readability/text/../data/dale_chall_porterstem.txt'

cdimascio commented 5 years ago

Currently, py-readability-metrics supports python 3 only. Given python 2 end of life is coming soon, it’s unlikely this package will support it. If you can move to python 3 that should resolve the issue

cdimascio commented 5 years ago

Note python 2 will sunset in Jan 2020 https://www.python.org/dev/peps/pep-0373/#update https://python3statement.org/

cdimascio commented 5 years ago

^ fyi @michael-stevens

michael-stevens commented 5 years ago

Hi,

I guess that's not too unfair, but is there any way you can make it a little more obvious?

(it did actually work fine once I copied the file into place manually).

On Sat, 21 Sep 2019 at 01:34, Carmine DiMascio notifications@github.com wrote:

^ fyi @michael-stevens https://github.com/michael-stevens

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cdimascio/py-readability-metrics/issues/4?email_source=notifications&email_token=AEC2FIRVCFQ57E4QAN4G7TTQKVTYNA5CNFSM4IYJLHWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7IGTGA#issuecomment-533752216, or mute the thread https://github.com/notifications/unsubscribe-auth/AEC2FIXVZKVDPUC3OMND66LQKVTYNANCNFSM4IYJLHWA .

-- Michael Stevens Senior Developer UK Office +44 207 802 5530

--

The Native Ad Platform for Business and Finance dianomi.com https://www.dianomi.com/

This e-mail is for the sole use of the intended recipient and contains information that may be privileged and/or confidential. If you are not an intended recipient, please notify the sender by return e-mail and delete this e-mail and any attachments. Certain required legal entity disclosures can be accessed on our website.

cdimascio commented 5 years ago

Awesome! Glad to hear it. I will have a look.

Please share what you did to solve it. Perhaps I can bake it into the package or if not, at the least, I will provide the instructions in the readme.

Thanks so much for digging into this, @michael-stevens Much appreciated!

michael-stevens commented 5 years ago

The install wasn't copying dale_chall_porterstem.txt into the site-packages directory, I just found it and copied it in myself.

cdimascio commented 5 years ago

This issue is labeled for Hacktoberfest. The purpose of the issue is to ensure dale_chall_porterstem.txt is part of the installation package. once the change is made I will repackage and publish a new version

kmendler commented 5 years ago

Hi! Can I take this issue for hacktoberfest?

cdimascio commented 5 years ago

Sure thing. Thanks!

kmendler commented 5 years ago

Hi @cdimascio, dale_chall_porterstem.txt is included in the pip install for Python 3, but not Python 2.7. Previous comments in this thread suggest that you don't want to provide support for Python2.7. Is that still the case?

michael-stevens commented 5 years ago

As the original reporter I would be happy if this was closed for lack of python 2 support although I would request it be made a bit more obvious, perhaps a setup.py check and/or larger documentation note.

Although obviously my dream would be for it to work, and it does seem very close to doing so.

cdimascio commented 5 years ago

@kmendler i did punt on the 2.7 support given the sunset date is approaching fast, however, as @michael-stevens noted, it is certainly beneficial to those still using 2.7. if you're able to sort out the issue, i'll roll a version with your fix

goto99 commented 2 years ago

The install wasn't copying dale_chall_porterstem.txt into the site-packages directory, I just found it and copied it in myself.

I also had this error, which directory did you copy dale_chall_porterstem.txt to? I cannot create a directory named ".." in windows 10.