def set_end(context, text):
		
	canarr = []
	if(text == 'person'):
		canarr.append('On what date was ' + subject + ' born?')
		canarr.append('On what date did ' + subject + ' die?')
		canarr.append('How old was ' + subject + ' when he died?')
		canarr.append('Was ' + subject + ' ever married?')
	if(text == 'language'):
		canarr.append('Where is the ' + subject + ' spoken?')
		canarr.append('What language family is the ' + subject + ' a part of?')
		canarr.append('Approximately how many people speak the ' + subject + '?')
		canarr.append('Who speaks the ' + subject + '?')
	if(text == 'city'):
		canarr.append('What is the population of ' + subject + '?')
		canarr.append('In what country is ' + subject + '?')
		canarr.append('What is the population density of ' + subject + '?')
		canarr.append('What kind of transportation exists in ' + subject + '?')
	if(text == 'instrument'):
		canarr.append('What is the ' + subject + '?')
		canarr.append('How is the ' + subject + ' played?')
		canarr.append('How does one play the ' + subject + '?')
		canarr.append('Does the ' + subject + ' have strings?') 
	
	testarr = []
	holder = []
	holder = askfunc.getClassification(article, sentences)
	testarr = askfunc.printQuests(5,holder)
	
	for x in range(0,4):
		assert testarr[x] == canarr[x]
def set_end(context, d):
	canarr = []
	canarr = askfunc.getClassification(article,sentences)
	holdarr = []
	holdarr = askfunc.printQuests(int(number), canarr)

	assert len(holdarr) == int(d)
 def test_printQuests_over(self):
     testinput = ["String1", "String2", "String3"]
     testnum = 5
     testoutput = []
     testoutput = askfunc.printQuests(testnum, testinput)
     expectedoutput = ["String1", "String2", "String3"]
     self.assertEquals(testoutput, expectedoutput)
def set_end(context, text):
	holdarr = []
	if (text=="number"):
		holdarr = askfunc.printQuests(int(-1), [])
		assert holdarr[0] == "Invalid number of questions entered"
	elif (text=="sentences"):
		holdarr = askfunc.getClassification("", sentences)
		assert holdarr[0] == "There were no sentences found"
def set_end(context):
	sentences = []
	holder = []
	questarr = []
	ansarr = []
	sentences = open("pers_text.txt.sentences").read().split('\n')
	holder = askfunc.getClassification("pers_text.txt", sentences)
	questarr = askfunc.printQuests(5, holder)
	ansarr = askfunc.answerQuests(len(questarr))
	assert (len(ansarr) == len(questarr))
Exemplo n.º 6
0
import classify
import pronounce
import evaluate
import askfunc

article = sys.argv[1]
nquestions = int(sys.argv[2])

sentname = article + '.sentences'
sentfile = open(sentname)
sentences = sentfile.read().split('\n')
sentfile.close()
cannedarray=[]

cannedarray = askfunc.getClassification(article, sentences)
askfunc.printQuests(nquestions, cannedarray)

questionarray=[]

f = open(sentname)
text=f.read()
f.seek(0)
num=0
appos = []
current = ''
record = 0
scorearray=[]
citycount=0
for line in f:
  #print line
  size = len(line)