man megahal_interfaces (Fonctions bibliothèques) - C, Python and Tcl interfaces to Megahal
NAME
megahal interfaces - C, Python and Tcl interfaces to Megahal
SYNOPSIS
#include <megahal.h>
void megahal_setnoprompt(void); void megahal_setnowrap(void); void megahal_setnobanner(void); void megahal_seterrorfile(char *filename); void megahal_setstatusfile(char *filename); void megahal_initialize(void); char *megahal_initial_greeting(void); int megahal_command(char *input); char *megahal_do_reply(char *input, intlog); void megahal_output(char *output); char *megahal_input(char *prompt); void megahal_cleanup(void);
DESCRIPTION
Initialization
Megahal is initialized with the megahal_initialize() function.
megahal_setnoprompt eliminates the prompt from interactive
sessions. megahal_setnowrap() stops output from being wrapped.
megahal_setnobanner() prevents megahal from printing out the
initial 'banner'.
Files
megahal_seterrorfile and megahal_setstatusfile set which
files megahal will use for error and status reporting, respectively.
User interaction
megahal_initial_greeting returns an initial greeting for the
user, such as "hello", "ciao", etc... megahal_command checks
its input for a Megahal command (like QUIT), and acts upon it, if
found. If it finds nothing, it returns 0. megahal_do_reply is
the core of megahal. It takes a string as input, and calculates a
reply, which it returns. meghal_output is for outputting text
to stdout, such as megahal's replies. Input may be obtained with
megahal_input, which takes a prompt string as an argument, and
returns a string input by the user.
Example
main.c in the source distribution is a good example of how to
use Megahal's C API.
TCL INTERFACE
load libmh_tcl.so
Load the Tcl interface shared object into the Tcl interpreter.
mh_init
Initialize megahal brain.
mh_doreply text
Takes some text as input and returns a megahal reply.
mh_cleanup
Save megahal brain to disk. You will lose your changes if this does
not occur.
PYTHON INTERFACE
import mh_python
Import the Megahal Python interface into the Python interpreter.
mh_python.initbrain()
Initialize megahal brain.
mh_python.doreply(text)
Takes some text as input and returns a megahal reply.
mh_python.learn(text)
Takes some text as input and updates the model without generating a reply.
mh_python.cleanup()
Save megahal brain to disk. You will lose your changes if this does
not occur.
REFERENCES
More information can be found about megahal at http://megahal.sourceforge.net
Jason Hutchens, the original author of Megahal can be found at: http://www.amristar.com.au/~hutch/
BUGS
The C library is not yet ready.
AUTHOR
Man page written by David N. Welton <davidw@dedasys.com>, modified by Laurent Fousse <laurent@komite.net>.