//Interpret will interpret a given natural language query
Interpret will interpret a given natural language query
// Interpret will interpret a given natural language query
func Interpret(ctx context.Context, w http.ResponseWriter, r *http.Request) {
	rq := &Query{}
	dec := json.NewDecoder(r.Body)
	err := dec.Decode(rq)
	if err != nil {
		response.WriteError(w, response.Error{Err: err.Error()}, http.StatusBadRequest)
		return
	}
	toks, err := interpreter.Tokenize(dict.TestUser, []rune(rq.NL))
	if err != nil {
		response.WriteError(w, response.Error{Err: err.Error()}, http.StatusBadRequest)
		return
	}
	ins, err := interpreter.Interpret(toks)
	if err != nil {
		response.WriteError(w, response.Error{Err: err.Error()}, http.StatusBadRequest)
		return
	}
	response.Write(w, ins)
}
func Interpret ( ctx context . Context , w http . ResponseWriter , r * http . Request ) { rq := & Query { } dec := json . NewDecoder ( r . Body ) err := dec . Decode ( rq ) if err != nil { response . WriteError ( w , response . Error { Err : err . Error ( ) } , http . StatusBadRequest ) return } toks , err := interpreter . Tokenize ( dict . TestUser , [ ] rune ( rq . NL ) ) if err != nil { response . WriteError ( w , response . Error { Err : err . Error ( ) } , http . StatusBadRequest ) return } ins , err := interpreter . Interpret ( toks ) if err != nil { response . WriteError ( w , response . Error { Err : err . Error ( ) } , http . StatusBadRequest ) return } response . Write ( w , ins ) }
Interpret will interpret a given natural language query
Interpret will interpret a given natural language query
//error while decoding the request param //error while tokenizing the user query //error while interpreting the user query