Hi Andrew,
I'm sure this will be helpful at some point in the future. Can you please
also mention the context of use... ?
On Thursday, November 24, 2016 at 1:09:11 AM UTC-5, Andrew wrote:
>
> Not sure if this is the right approach but I thought it might be of use to
> someone. Just need to startup the relex server first
>
> (use-modules (web server) (web request) (web response) (web uri) (opencog)
> (opencog nlp) (opencog nlp chatbot) (opencog nlp relex2logic) (ice-9
> pretty-print) (ice-9 iconv))
>
> (define (process-chat user body)
>
> (define result (process-query "user1" (bytevector->string body
> "iso-8859-1") ))
> (pretty-print result)
> (if (unspecified? result)
> (set! result "unspecified")
> )
> (if (null? result)
> (set! result "null")
> )
> (if (list? result)
> (set! result (car result))
> )
>
> (string-append "{result:" result "}")
> )
>
> (define (my-handler request body)
> (trace-msg "--------------- request -------------------\n")
> (pretty-print (bytevector->string body "iso-8859-1") )
> (display (request-content-type request))
> (values '((content-type . (application/json)))
> (process-chat "user1" body)
> )
> )
>
> (run-server my-handler 'http '(#:port 8093))
>
>
--
You received this message because you are subscribed to the Google Groups
"opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/opencog.
To view this discussion on the web visit
https://groups.google.com/d/msgid/opencog/3d9f9883-3142-4e26-afd2-a7df0bc36e81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.