Bot Libre provides several mechanisms for NLP.
- you can train a bot using "response list" files that include questions/responses, and tags for keywords, required, topics, previous, onrepeat, condition, think
-- the AI engine will use a heuristic to find the best matching responses for any question
-- use can also use patterns and templates
-- see, https://www.botlibre.com/forum-post?id=483549
- you can also use AIML or Self scripts
-- Self can use either patterns or state machines to process language (or anything really)
-- there are many examples Self scripts that can parse common language, or mathematical expressions
-- see, https://www.botlibre.com/script?category=Self
- bots can also learn language on their own
bots can learn from,
-- chat logs
-- chat rooms
-- Twitter feeds
The symbol #self refer to the object that represents the bot, so a chat with a target of #self means it is a message to the bot. For chat rooms the target can be any user connected to the chat room, having a message target lets the bot know when someone is talking to it vs someone else.
You can classify any word you want as a #keyword, just set its #type to #keyword. A #keyquestion is a keyword that is part of a question that has a keyword response. This is how the heuristic finds matches. The bot's brain is a big graph/object database.
The word value heuristic is complicated you can view the code in the Language class. It scores keyword higher, and nouns and adjective higher than verbs, and articles as low.
A word may be involved in patterns that have a response. This is how the heuristic finds matching patterns.
state machines are created when you import/compile Self or AIML.
The understanding state is compiled from the Understanding.self script, and can understand common language.
Please give a context to the code.