0

I tried to use AI::ExpertSystem::Advanced. I read in documentation that I can use another viewers. You can see it there:

viewer
Is the object AI::ExpertSystem::Advanced will be using for printing what is happening and for interacting with the user (such as asking the asked_facts).

This is practical if you want to use a viewer object that is not provided by AI::ExpertSystem::Advanced::Viewer::Factory.

viewer_class
Is the the class name of the viewer. use the viewers AI::ExpertSystem::Advanced::Viewer::Factory offers, in this case you can pass the object or only the name of your favorite viewer.

or in this module I find this:

Offers different views, so user can interact with the expert system via a terminal or with a friendly user interface.

example of source is:

my $ai = AI::ExpertSystem::Advanced->new(
                    viewer_class => 'terminal',
                    knowledge_db => $yaml_kdb,
                    initial_facts => ['I'],
                    verbose => 1);

Can I use as viewer_class my browser or some CGI interface??? When yes how to use it??? I didnt find any example.

Tomas Kocian
  • 83
  • 1
  • 7
  • possible duplicate of [How to use other viewer class than terminal in AI::ExpertSystem::Advanced](http://stackoverflow.com/questions/16656369/how-to-use-other-viewer-class-than-terminal-in-aiexpertsystemadvanced) – innaM May 25 '13 at 12:51
  • 1
    How long are you planning to keep asking this question? Maybe the awful truth is that SO cannot help you. Maybe you should finally try to contact the author of that module and get some expert advice that way. – innaM May 25 '13 at 12:53
  • I deleted it. It has less informations – Tomas Kocian May 25 '13 at 12:53
  • Author didnt answered me. I wrote him. But I dont know if the email I have is his. – Tomas Kocian May 25 '13 at 12:55
  • I dont want to ask anything... I edit it only to answer me goals that causes is in initial_facts. When some causes isnt in initial_facts this goal is not printed. – Tomas Kocian May 25 '13 at 12:59

1 Answers1

1

You will have to write your own "Viewer" class. Create a new module that extends from AI::ExpertSystem::Advanced::Viewer::Base and implement each method that has a stub in that base class. The source and documentation of `AI::ExpertSystem::Advanced::Viewer::Base' will prove to be helpful in this task.

Update

To write your own viewer class, create a file that looks something like this:

package My::AI::Viewer;
use Moose;
extends 'AI::ExpertSystem::Advanced::Viewer::Base';

sub debug {
    # your implementation goes here
}

... When you are done with that class, I suppose you can pass its name to the constructor of the expert system module under the viewer_class key.

innaM
  • 47,505
  • 4
  • 67
  • 87
  • something like this? my $viewer = AI::ExpertSystem::Advanced::Viewer::Base->new(); my $ai = AI::ExpertSystem::Advanced->new( viewer_class => $viewer, knowledge_db => $yaml_kdb, initial_facts => $text, verbose => 1 ); – Tomas Kocian May 25 '13 at 13:33
  • 1
    There are no parameters you need to pass to Viewer::Base::new because you will not call that method. See my updated answer. – innaM May 25 '13 at 13:55
  • could you help me with it? I dont have a lot of experience with it... I tried something... – Tomas Kocian May 25 '13 at 14:06
  • 1
    No, I cannot. Please do yourself a favor and try to learn perl first. There is no way around that. Read the [Modern Perl Book](http://onyxneon.com/books/modern_perl/), it's free and really good. Try not to think too much about any ExpertSystems running in a CGI evnironment while you do. – innaM May 25 '13 at 14:12
  • Can't locate object method "new" via package "AI::ExpertSystem::Advanced::Viewer::Expert" at C:/Perl/site/lib/AI/ExpertSystem/Advanced/Viewer/Factory.pm line 29. – Tomas Kocian May 25 '13 at 14:14
  • but how can i execute expert system and the result of it print on CGI website??? There is a need to run it in other viewer class or it can run via terminal? – Tomas Kocian May 25 '13 at 14:16