def add_essay(self, essay_text, essay_score, essay_generated=<NUM_LIT:0>):
<EOL>if(len(self._id) > <NUM_LIT:0>):<EOL><INDENT>max_id = max(self._id)<EOL><DEDENT>else:<EOL><INDENT>max_id = <NUM_LIT:0><EOL><DEDENT>try:<EOL><INDENT>essay_text = essay_text.encode('<STR_LIT:ascii>', '<STR_LIT:ignore>')<EOL>if len(essay_text) < <NUM_LIT:5>:<EOL><INDENT>essay_text = "<STR_LIT>"<EOL><DEDENT><DEDENT>except:<EOL><INDENT>log.exception("<STR_LIT>")<EOL><DEDENT>try:<EOL><INDENT>essay_score = int(essay_score)<EOL>essay_text = str(essay_text)<EOL><DEDENT>except:<EOL><INDENT>log.exception("<STR_LIT>".format(type(essay_score), type(essay_text)))<EOL><DEDENT>if isinstance(essay_score, int) and isinstance(essay_text, basestring)and (essay_generated == <NUM_LIT:0> or essay_generated == <NUM_LIT:1>):<EOL><INDENT>self._id.append(max_id + <NUM_LIT:1>)<EOL>self._score.append(essay_score)<EOL>try:<EOL><INDENT>essay_text = str(essay_text.encode('<STR_LIT:ascii>', '<STR_LIT:ignore>'))<EOL><DEDENT>except:<EOL><INDENT>essay_text = (essay_text.decode('<STR_LIT:utf-8>', '<STR_LIT:replace>')).encode('<STR_LIT:ascii>', '<STR_LIT:ignore>')<EOL><DEDENT>cleaned_essay = util_functions.sub_chars(essay_text).lower()<EOL>if(len(cleaned_essay) > MAXIMUM_ESSAY_LENGTH):<EOL><INDENT>cleaned_essay = cleaned_essay[<NUM_LIT:0>:MAXIMUM_ESSAY_LENGTH]<EOL><DEDENT>self._text.append(cleaned_essay)<EOL>cleaned_text, spell_errors, markup_text = util_functions.spell_correct(self._text[len(self._text) - <NUM_LIT:1>])<EOL>self._clean_text.append(cleaned_text)<EOL>self._spelling_errors.append(spell_errors)<EOL>self._markup_text.append(markup_text)<EOL>self._tokens.append(nltk.word_tokenize(self._clean_text[len(self._clean_text) - <NUM_LIT:1>]))<EOL>self._pos.append(nltk.pos_tag(self._clean_text[len(self._clean_text) - <NUM_LIT:1>].split("<STR_LIT:U+0020>")))<EOL>self._generated.append(essay_generated)<EOL>porter = nltk.PorterStemmer()<EOL>por_toks = "<STR_LIT:U+0020>".join([porter.stem(w) for w in self._tokens[len(self._tokens) - <NUM_LIT:1>]])<EOL>self._clean_stem_text.append(por_toks)<EOL>ret = "<STR_LIT>" + self._text[len(self._text) - <NUM_LIT:1>] + "<STR_LIT>" + str(essay_score)<EOL><DEDENT>else:<EOL><INDENT>raise util_functions.InputError(essay_text, "<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>
Add new (essay_text,essay_score) pair to the essay set.
essay_text must be a string.
essay_score must be an int.
essay_generated should not be changed by the user.
Returns a confirmation that essay was added.