cmorg789 Posted June 21, 2013 Share Posted June 21, 2013 Ok so I have an idea I want to do just for Grins and Giggles with my buds. I want to Make a sort of call and response "game" if you will. Basicly You type something in and it will respond with something either pre-determined or the best match for what they typed. My problem is I can't figure out how to Make the Interface, I wanted to useConsole.logbut i cant figure out how to make it show on the page.Another problem is the input, I can't figure out how to have it take the input and look through the code for the right response Link to comment Share on other sites More sharing options...
justsomeguy Posted June 21, 2013 Share Posted June 21, 2013 The console methods don't affect the page, they are for debugging only. They send data to the browser's development console. The console object in Javascript represents the developer console of the browser. If you want to update the page the best way is to use getElementById to target the specific element you want to change, and then maybe set the innerHTML property to change the HTML inside the element, or use DOM methods to create new elements and append them to the target element. Figuring out the response would be easy for a basic version with limited intelligence, but you can go pretty far and do quite a lot of work with that algorithm to make it more intelligent (e.g., words that sound like each other, identifying potential misspelled words, etc). A basic version of a response would be an array of responses where each response would list the words that would trigger that response. That's basically just a normal search, there's not a lot of intelligence there, but it's the most basic way to do something like that. Link to comment Share on other sites More sharing options...
cmorg789 Posted June 21, 2013 Author Share Posted June 21, 2013 I can make the arrays and such I'm having trouble with the interface.. I want it to be similar to clever bots.. I don't know anything about getElementById.. Link to comment Share on other sites More sharing options...
justsomeguy Posted June 21, 2013 Share Posted June 21, 2013 The interface for cleverbot is just a text field with a few buttons, and it uses ajax to send requests to the server and receive the response. That's just a couple input elements with some Javascript to handle the button press and send the request. If you're not familiar with targeting elements in Javascript then I would suggest that you start with the Javascript tutorial. Note that cleverbot is an entire AI, building something of that scope is not practical for a beginner. I would start with the basics and go from there, the interface is pretty basic. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now