chartbeat-labs / textacy

NLP, before and after spaCy
https://textacy.readthedocs.io
Other
2.22k stars 250 forks source link

ZeroDivisionError on empty network #196

Closed medecau closed 6 years ago

medecau commented 6 years ago

https://github.com/chartbeat-labs/textacy/blob/12fbf10e8ac5758330b68477c72d57212e304249/textacy/keyterms.py#L576

Expected Behavior

Don't raise exception for division by zero when network is empty

Current Behavior

Exception raised for division by zero when network is empty

Possible Solution

Try catch that division or pre check the network is not empty

Steps to Reproduce (for bugs)

Not entirely sure. Try to use a one sentence doc. Sorry.

Context

I'm going through a bunch of documents and trying to get some representative sentences. In this one sentence doc it breaks.

Your Environment

It's in a different machine but it's pretty much whatever comes down the wir from ´´´pip3 install -U textacy´´´ as of 02/05/2018