View Single Post
Old 07-10-08, 01:25 PM   #5
fizzleborth
Registered User
 
Join Date: Jul 2008
Posts: 1
Default Re: I want to make a simple parser that I can teach more every day.

You're looking to write a copy of ELIZA? That didn't actually have "feelings," or any sort of "memory" at all from one response to the next, so I suppose that means you'll be advancing the state of the art .

I think Prolog is made for exactly this sort of thing, though I've never used it myself. But your example of how you imagine the code looking is pretty declarative, if you ignore the if/then/else boilerplate. No idea of how you'd go about learning Prolog though, and I imagine it isn't a great first language, if you've never programmed before.

On the other hand, you seem to have a grasp of basic imperative control structures (if/then/else) already (although in most imperative languages, you'd be assigning the "Hello"/"Yes"/etc. responses to a variable, as in if happiness < 10 and responses_given > 5: response = "Go away", and then have a step of explicitly printing the response, not to mention a step before all that of parsing the user's reply and adjusting the "feelings" variables based on what was typed). So sticking with an imperative language would probably have you up and running the fastest, not to mention that any given imperative language will probably be easier to learn (with many more tutorials and helpful communities) than Prolog (or any other declarative language).

I'll recommend Python since you don't say if/what programming language(s) you know. In python, you can just load up the interpreter and try code out interactively to see what works and what it returns, right away, which really accelerates prototyping and learning. It also has a ton of tutorials on the net and tons of books for sale about learning python. It's pretty easy to get running on whatever sort of system you're using (just download and run a singler installer on Windows, and it registers itself to run all .py files, and includes the GUI interpreter in your start menu, and you're ready to go), and there's no extra setup (like getting a web server running locally to do PHP development). Especially for a console-based program like you're describing, it should be well-suited.

There are also a great many third-party "modules" for it, so it is pretty simple to add, say, a PyGame-based graphical component if you want, or a couple of XMPP modules if you want to turn it into an IM bot/twitter bot. And I'm sure it's possible to link it into Vista's speech recognition (though it might not be easy or pretty to do so; also, does Vista do general speech-to-text, or only recognize a set of commands?). Plus if Python becomes your general everyday hammer, that won't be too bad, since it's pretty good at hitting most nails (scripts to do file management, a program to gather statistics on your MP3s' ID3 tags, a webapp for managing your schedule, it's pretty versatile).

On the other hand, if having it on the web so that anyone with a web browser can use your program sounds like a fun idea (and many more people will visit a web page than will be willing to download and install a program), I'd recommend PHP too. Nothing beats PHP for a first-time web programmer, and (if it includes what you want) HTML is the easiest way to add a GUI that there is. Also it's super easy to find cheap hosting with PHP support. Python does have web programming, but it's more complicated, most packages are aimed more at database-driven sites, and it's not so easy to find a host for a python script. There is Google's App Engine of course, and that has the added advantage of being free, but it's still just not as easy and quick as PHP.

That said, if all you want is a pre-made ELIZA, a google search should get you one pretty quickly. There's also an example of ELIZA written in python, but it's pretty... concise, and not so easy to understand for a Python beginner (in part because it's trying to include the responses in a declarative manner).
fizzleborth is offline   Reply With Quote