I really like short programs that do useful things. I apologize that the current chatbot cannot say anything interesting or useful, just right now. But we're working on that.
--linas On Thu, Nov 24, 2016 at 2:09 PM, Andrew <[email protected]> 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/9eb1affb-7a79-44be-854f-c532c7b80ccf%40googlegroups.com > <https://groups.google.com/d/msgid/opencog/9eb1affb-7a79-44be-854f-c532c7b80ccf%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAHrUA37A0N40GyGSeVhgHTxt4b1UB3VZRiTgW%2BO2np8rwQ4aAQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
