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.
For more options, visit https://groups.google.com/d/optout.