Esempio n. 1
0
def respondToQuestion(question):
  global lastQuestionGlobal, lastStlGlobal, lastStlFileGlobal
  lastQuestionGlobal = None
  stl = queriesToSTL(question)
  lastStlGlobal = stl
  conf = stlToGraderConf.stlToGraderConf(stl,filename)
  response, stlFile = respondToQuery.respondToQueryContents(conf)
  lastStlFileGlobal = stlFile
  lastQuestionGlobal = question
  return response, stl
Esempio n. 2
0
	else: 
		result = query[iStart+len("THE_FORMULA_IS_")]
		return result=='T'

def respondToQueryContents(stlFileContents):
	stlFile = "stlFileTemp.stl"
	with open(stlFile,"w") as FILE:
		FILE.write(stlFileContents)
	return respondToQuery(stlFile), stlFile

def respondToQuery(stlFile):
	response = runSTL(stlFile)
	answer = parseForAnswer(response)
	return answer


if __name__ == '__main__':
	import stlToGraderConf
	import tokenizer
	import sys


	#tokens = tokenizer.tokenizeQuery(sys.argv[2])
	#stl = tokenizer.tokenToSTL(tokens)
	#print 'stl=',stl
	stlFileContents = stlToGraderConf.stlToGraderConf(('F',('G_(0,6)', ('>','spe',9))), 'testRun_After.txt')
	stlFile = "stlFileTemp.stl"
	with open(stlFile,"w") as FILE:
		FILE.write(stlFileContents)
	print respondToQuery(stlFile)