def test_make_verbose(self): in_string = "did George Washington cut down a cherry tree" returned_string = askfunc.makeVerbose(in_string) self.assertTrue( "According to the information given in the article, did George Washington cut down a cherry tree" == returned_string )
if ';' in question[j]: question[j]=question[j].replace(';','?') elif ',' in question[j]: question[j]=question[j].replace(',','?') elif ':' in question[j]: question[j]=question[j].replace(':','?') if j==len(question)-1: question[j]=question[j].replace('.','?') qstring = (qstring + question[j] + ' ') if '?' in question[j]: break randvar=random.random() vstring = askfunc.standardize(vstring) verbose = askfunc.makeVerbose(vstring) qtagged = nltk.pos_tag(question) inspos=-2 for k in range(len(qtagged)): if qtagged[k][1] != 'NNP' and qtagged[k] != 'PRP' and inspos==-2: inspos = k negarray=list(question) negarray.insert(inspos,'not') break negquestion='' for item in negarray: negquestion+= item + ' ' if '?' in item: