func init() {
	var err error
	model, err = sentiment.Restore()
	if err != nil {
		panic(fmt.Sprintf("ERROR: error restoring sentiment model!\n\t%v\n", err))
	}
}
Example #2
0
func init() {
	var err error
	model, err = sentiment.Restore()
	if err != nil {
		panic(fmt.Sprintf("ERROR: error restoring sentiment model!\n\t%v\n", err))
	}

	http.Handle("/analyze", Post(HandleSentiment))
	http.Handle("/task", Post(HandleHookedRequest))
	http.Handle("/", Get(HandleStatus))
}
Example #3
0
func init() {
	// Output to stderr instead of stdout, could also be a file.
	log.SetOutput(os.Stderr)
	log.SetFormatter(&log.TextFormatter{})

	var err error
	model, err = sentiment.Restore()
	if err != nil {
		panic(fmt.Sprintf("ERROR: error restoring sentiment model!\n\t%v\n", err))
	}

	http.Handle("/analyze", Post(HandleSentiment))
	http.Handle("/review", Post(HandleGetProductReview))
	http.Handle("/task", Post(HandleHookedRequest))
	http.Handle("/", Get(HandleStatus))
}