Exemplo n.º 1
0
def analyze(filename):
	'''Analyze a voice file.

	Example:
		python analyze 'myfile'
	Return:
		The detailed infomation and the mood prediction result if success.
	The file should use its full path, and will be mood_predict by our program.
	The prediction is processed by svm-machine , model file and scale file should
	be generated by the script train.py, and no need to indicate. All you need is 
	to tell us which file or directory you want to predict.'''
	#print 'Analyzing %s'%filename
	m = Voice()
	try:
		m.analyze(filename)
		m.calFeatures()
		m.mood_predict()
		m.callInfo()
		m.report()
		print 'Analyze success'
	except Exception as e:
		print 'Analyze failed:'+ repr(e)