Hi guys,
I'm in the process of learning PHP. I know the dribs and drabs and can kind of understand code when I read it, but I'm not to the point of being able to write an advanced script from scratch. I've been interested in chatbots and the concept AI for a long time and would love to develop a PHP/MySQL chat bot as a learning project for myself. I'd really appreciate some input as to how/where I should start and what potential limitations will be based on what I want to do:
1. I want to develop a simple back-end for myself, where I can manually input phrases and responses into the database. The Personality Forge UI comes to mind - where you have a form, input the phrase, and add 1 or more potential responses for the bot to display.
2. A "mood" can also be set for each response (an integer value, the lower the more grumpy the bot, the higher the happier) and a mood value can also be placed on each phrase a bot hears. The bot's mood is recalculated with each phrase it hears and it is more likely to display certain responses depending on its mood value. I want the bot's mood to be calculated globally - so if three people are talking to it at the same time, all three impact its global mood *to an extent*. However, it still recognizes all three people as different entities and can feel happier about talking to one IP address and grumpier with another.
3. I want people to be able to teach the bot. For example, teach it words. If the bot doesn't recognize something it might say "What is 'courageous'?". The user may say "Courageous is an adjective. It means brave", and the bot will store it as an adjective that's a synonym of brave. The bot would "screen" the word courageous in other conversations (for example, when someone else comes along to talk to it, it might say "Is corageous an adjective?" User gives a positive response. Then the bot may say "And it means brave, right?" User gives a positive response. If it's a negative response, the bot may ask it what courageous means to adjust its definition and continue the process.
4. I'd like to be able to manually create libraries (as well as automatically - for example the word "Courageous", once learned, would go into the Adjective library). Say create a library of postive adjectives and negative adjectives. Then in response phrases or when feeding input phrases into the bot's library I can say "This city is [postivie adjective here]". I'd also like to be able to use wildcards. Say insert "What does * taste like" and have the bot output a response no matter what the * is. This means that I'd also need to set an importance value for different input phrases. For example, if someone says "What do *green apples* taste like" - do I want the bot to deliver a response for the word apple or apples or green, or do I want it to deliver responses for the phrase with the wildcard? It will depend on the phrase and word, so I need to be able to define this on a phrase-by-phrase basis.
5. In terms of UI, I'd love to make it look like a live chat, but I don't mind doing page refreshes after each phrase if there's an issue with the former.
Is this at all possible with PHP and MySQL or am I getting in too deep here? I don't mind spending time on this - I just need to know that it's actually a realistic goal.