- COPYRIGHT AND LICENSE
Bot::Backbone::Service::Fact::Predicate - Keep track of statements of equivalence and the like
# in the bot configuration service predicate => ( service => 'Fact::Predicate', accepted_copula => [ qw( is says ) ], ); # In chat: alice> Zathras says "Can not run out of time, there is infinite time. You are finite, Zathras is finite. This is wrong tool. No. No. Not good. No. No. Never use this." alice> Zathras? bot> Zathras says "Can not run out of time, there is infinite time. You are finite, Zathras is finite. This is wrong tool. No. No. Not good. No. No. Never use this."
With this service configured, the bot will monitor the chat and whenever it encounters a statement that appears to be in the correct predicate nominative form, it will memorize that fact. Later one, if a question is issued for the memorize fact, the bot will return a memorized response for it. It can memorize multiple responses for the same fact, in which case, it returns any one of them at random.
This command will cause the bot to pick one of it's memorized facts and return it.
All other chats are memorized to see if they appear to be of the form:
<subject> <copula> <predicate>
In those cases, the fact is memorized.
At the same time, it checks to see if any chat message matches a known subject. If it does, the bot will return the original statement of the fact.
This is a list of acceptable copula. A "copula" is a connecting word in a sentence connecting a subject and complement. Depending on context, there are a lot of words that can be found in a statement of equivalence, but the default just includes these words:
is isn't are aren't
You can also put other words that aren't strictly words that define predicate nominative equivalence, such as "says" or "smells like" or whatever. Every time these words appear in a statement within a chat, though, it will be memorized.
This is a regular expression that is usually built from the "accepted_copula". It is used to identify and split chats that contain a statement of the form the bot is looking for.
Used by the Bot::Backbone::Service::Role::Storage to setup the
This is a helper function that saves a subject/predicate fact.
This is a helper used to retrieve a subject/predicate fact.
This is the method used to monitor all chats for facts to memorize or recall.
This implements the
Andrew Sterling Hanenkamp <email@example.com>
This software is copyright (c) 2014 by Qubling Software LLC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.