openedx-unsupported / ease

EASE (Enhanced AI Scoring Engine) is a library that allows for machine learning based classification of textual content. This is useful for tasks such as scoring student essays.
GNU Affero General Public License v3.0
216 stars 96 forks source link

ZeroDivisionError: integer division or modulo by zero #32

Closed kern3020 closed 11 years ago

kern3020 commented 11 years ago

Hello,

This exception was thrown.

[2013-06-04 09:52:46,550: ERROR/MainProcess] feature extraction and model creation failed.
Traceback (most recent call last):
  File "/opt/edx/local/lib/python2.7/site-packages/ease-0.1-py2.7.egg/ease/create.py", line 64, in create
    feature_ext, classifier, cv_error_results = model_creator.extract_features_and_generate_model(e_set, type=type)
  File "/opt/edx/local/lib/python2.7/site-packages/ease-0.1-py2.7.egg/ease/model_creator.py", line 168, in extract_features_and_generate_model
    f.initialize_dictionaries(essays)
  File "/opt/edx/local/lib/python2.7/site-packages/ease-0.1-py2.7.egg/ease/feature_extractor.py", line 60, in initialize_dictionaries
    good_pos_tags,bad_pos_positions=self._get_grammar_errors(e_set._pos,e_set._text,e_set._tokens)
  File "/opt/edx/local/lib/python2.7/site-packages/ease-0.1-py2.7.egg/ease/feature_extractor.py", line 131, in _get_grammar_errors
    good_pos_tags.append((len(pos_ngrams)-len(overlap_ngrams))/divisor)
ZeroDivisionError: integer division or modulo by zero

What about adding a check to confirm the divisor variable isn't zero?

-jk

VikParuchuri commented 11 years ago

Will look into it, thanks.

VikParuchuri commented 11 years ago

Fixed.