Esempio n. 1
0
        quote*=-1
      if quote == 1:
        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:
 def test_standardize_both(self):
     input_str = "    The first letter of the first word of this test input should be lower case"
     ret_str = askfunc.standardize(input_str)
     self.assertTrue(ret_str[0] == "t")
 def test_standardize_standardized(self):
     input_str = "this sentence is already standardized so standardize() should have no effect"
     ret_str = askfunc.standardize(input_str)
     self.assertTrue(input_str == ret_str)
 def test_standardize_whitespace(self):
     input_str = "   test input with leading and trailing whitespace       "
     ret_str = askfunc.standardize(input_str)
     self.assertTrue(ret_str == input_str.strip())