API

Raven Bot Component Api

Input

class raven.input.abstract_input.BaseInput(txObject)[source]
get_access_keys()[source]

Which return the current object access keys which will be used internally by input object class.

processed()[source]

This method must be implemented on each new sub class. return must of dict type with key: ‘PROCESSED_INPUT’.

class raven.input.cli_input.CLIInput(txObject=None)[source]

CLIInput class is used to intergating with command line interface.

processed()[source]

This method must be implemented on each new sub class. return must of dict type with key: ‘PROCESSED_INPUT’.

toBotText(text)[source]

Extra step for handling the input to the bot with custom method.

class raven.input.rest_input.RESTInput(txObject)[source]

RESTInput is used to communication using REST operation.

processed()[source]

This method must be implemented on each new sub class. return must of dict type with key: ‘PROCESSED_INPUT’.

toBotText(text)[source]

Extra step for handling the input to the bot with custom method.

Engine

class raven.engine.abstract_engine.AbstractEngine(*args, **kwarg)[source]
class raven.engine.abstract_engine.BaseEngine(input_object, output_object, engine_param=None)[source]

Base engine will be mother of all its sub-class. As major lifting is taken in inside the BaseEngine. Just use the sub-class to handline the case which Mother’s class can’t be handling.

go()[source]

Running the go function which will be used to run. Return is layer, will handling the input sentence.

..notes

sub class must return `self.return_object` itself.
Returning to ` OutPut` module must decised by ` Engine`.
next()[source]

@depreacted :meth::BasedEngine.next are recommenced to be called after the end of engine.

subscribe_tobreak(sender)[source]

Get the event signal and return true(for now).

class raven.engine.default_engine.DefaultEngine(input_object, output_object, engine_param=None)[source]

Default Engine module will be used for managing the NLU engine.

add(layer)[source]

Add the layer function into the engine’s list for executing of the layer function.

Param:raven.layer.abstract_layer layer the object

of function are added as layer into the engine for concurrency exection.

command_success_response(txObject)[source]

Find if there the given user’s text is related to command request. if then change the scope intent name as commandsIntent_command.

go(pretty='base.html')[source]
Param:pretty is the name of the file where the meta data or base line of html are saved and it is parsed along with return result. Currently base.html and json.html is taken as parameter.
parse(request_text)[source]

Parser the given user’s text using the the Snip NLU engine.

response(scope)[source]

Get the Dict status from NLU or command execution successfully, the one response class raven.response imported.

train_model(path)[source]

Train the NLU JSON format by SNIP NLU.

Parameters:path (str) – path of the dataset.json

Layer

class raven.layer.abstract_layer.AbstractLayer(*args, **kwargs)[source]
class raven.layer.abstract_layer.BaseLayer(params)[source]
on_fails(txObject)[source]

Wraper function for passing response() on the event of fails.

on_success(txObject)[source]

Wraper function for passing response() on the event of success.

response(txObject=None)[source]

response() must be defined by each sub class. Every subclass response must return txObject object

Command Request

class raven.layer.cmd.cmd_base_layer.CMDBaseLayer(param=None)[source]
response(txObject)[source]

response() must be defined by each sub class. Every subclass response must return txObject object

class raven.layer.cmd.wiki.WikiLayer(param=None)[source]

Getting the Summary for the give keyword if it available in the wikipedia.

response(txObject)[source]

response() must be defined by each sub class. Every subclass response must return txObject object

Ouput

Helper class that provides a standard way to create an ABC using inheritance.

Global Utils

Utils function for global usage.

utils.env_bool(env_name: str, default: bool) → bool[source]

Get the environment variable’s value convert into :Class:Boolearn

utils.env_float(env_name: str, default: float) → float[source]

Get the environment variable’s value convert into :Class:Float

utils.env_int(env_name: str, default: int) → int[source]

Get the environment variable’s value convert into :Classs:Init

utils.env_str(env_name: str, default: str) → str[source]

Get the environment variable’s value convert into string

utils.import_class(path)[source]

Import the give class based on the given path

utils.import_module(path)[source]

Import the give module based on the given path

utils.render_template_file(file_name: str, **kwargs)[source]

Higher level api for rendering templates.