You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in _generate_text(sentences, fname, threshold)
43 with open(fname, "w") as new_file:
44 for sentence in sentences:
---> 45 if _prob_block(sentence, tagger) < threshold:
46 new_file.write(sentence)
47
in prob_block(sentence, pos_tagger)
61 doc = pos_tagger(sentence)
62 verb_count = np.sum([token.pos != "VERB" for token in doc])
---> 63 return float(verb_count) / len(doc)
ZeroDivisionError: float division by zero
The text was updated successfully, but these errors were encountered:
This is happening because the text you provided doesnt have a . in it jaja.
AS you see it is spliting the text so you can try/catch that and wen it fails catch it with new_frame = fn[0] + _clean
It works for me.
ZeroDivisionError Traceback (most recent call last)
in
1 file = r"C:\Users\Sashankh\axaxaxax.txt"
----> 2 convert(file)
in convert(fname, threshold)
11 fn = fname.split(".")
12 new_fname = fn[0] + "_clean." + fn[1]
---> 13 _generate_text(sentences, new_fname)
14
15 def _read_email(fname):
in _generate_text(sentences, fname, threshold)
43 with open(fname, "w") as new_file:
44 for sentence in sentences:
---> 45 if _prob_block(sentence, tagger) < threshold:
46 new_file.write(sentence)
47
in prob_block(sentence, pos_tagger)
61 doc = pos_tagger(sentence)
62 verb_count = np.sum([token.pos != "VERB" for token in doc])
---> 63 return float(verb_count) / len(doc)
ZeroDivisionError: float division by zero
The text was updated successfully, but these errors were encountered: