AI-ExpertSystem-Simple
view release on metacpan or search on metacpan
lib/AI/ExpertSystem/Simple.pm view on Meta::CPAN
The constructor takes no arguments and just initialises a few basic variables.
=back
=head2 Public methods
=over 4
=item reset( )
Resets the system back to its initial state so that a new consoltation can be run
=item load( FILENAME )
This method takes the FILENAME of an XML knowledgebase and attempts to parse it to set up the data structures
required for a consoltation.
=item process( )
Once the knowledgebase is loaded the consultation is run by repeatedly calling this method.
It returns four results:
=over 4
=item "question"
The system has a question to ask of the user.
The question and list of valid responses is available from the get_question( ) method and the users response should be returned via the answer( ) method.
Then simply call the process( ) method again.
=item "continue"
The system has calculated some data but has nothing to ask the user but has still not finished.
This response will be removed in future versions.
Simply call the process( ) method again.
=item "finished"
The consoltation has finished and the system has an answer for the user which is available from the answer( ) method.
=item "failed"
The consoltation has finished and the system has failed to find an answer for the user. It happens.
=back
=item get_question( )
If the process( ) method has returned "question" then this method will return the question to ask the user
and a list of valid responses.
=item answer( VALUE )
The user has been presented with the question from the get_question( ) method along with a set of
valid responses and the users selection is returned by this method.
=item get_answer( )
If the process( ) method has returned "finished" then the answer to the users query will be
returned by this method.
=item log( )
Returns a list of the actions undertaken so far and clears the log.
=item explain( )
Explain how the given answer was arrived at. The explanation is added to the log.
=back
=head2 Private methods
=over 4
=item _goal
A private method to get the goal data from the knowledgebase.
=item _rule
A private method to get the rule data from the knowledgebase.
=item _question
A private method to get the question data from the knowledgebase.
=item _add_to_log
A private method to add a message to the log.
=item _explain_this
A private method to explain how a single attribute was set.
=back
=head1 ENVIRONMENT
None
=head1 DIAGNOSTICS
=over 4
=item Simple->new() takes no arguments
When the constructor is initialised it requires no arguments. This message is given if
some arguments were supplied.
=item Simple->reset() takes no arguments
When the method is called it requires no arguments. This message is given if
some arguments were supplied.
( run in 0.479 second using v1.01-cache-2.11-cpan-677af5a14d3 )