Skip to content

Latest commit

 

History

History
178 lines (128 loc) · 2.93 KB

API.md

File metadata and controls

178 lines (128 loc) · 2.93 KB

NaifJs API cheat sheet

⚠️ To be completed.

Up API (by caller program)

up(unitsFolder, replyCallback, endCallback, sessionsFilename, aLogFilename, verbose)

Start the run-time engine.

start(sessionid, stateid, argument)

Invoke a dialog unit initial state.

request(sessionid, sentence, asr)

Run the engine, processing the user utterance.

down()

Stop the run-time engine.

isSessionActive(sessionid)

there is a dialog running for current id? Alias: isDialogActive

setDefaultTimeoutTime(timeMsec)

Set the default timeout in msecs.

Down API

Dialog unit Domain Specific Language (DSL)

The table here below summarize all statements (function) that developer can use to build in a dialog:

State Transition

exec(stateid, sessionid=id, argument)

Transact to an output state. Aliases: goout, setOutputState, gotoOutputState, nextOutputState

next(stateid, sessionid=id)

Transact to an input state. Aliases: goto, setInputState, gotoInputState, nextInputState

end(sessionid=id)

End the dialog session.

Response Messages

response(data, timeoutDescriptor, sessionid)

Send a response to the user. Aliases: reply

say(data, sessionid)

simple statement (noi-wait response).

ask(data, timeoutDescriptor, sessionid)

response that wait feedback from the user.

Response prompt timeouts management

startTimeout(callback, milliseconds, params, sessionid=id)

Start a timeout handler.

stopTimeout(sessionid)

Stop the timeout handler.

getCounterTimeout(sessionid)

How many timeout are run?

State Machine Status

stateid()

Return the current state reference (the stateid). Aliases: currentState

chatid()

Get the current chat id.

setChat(sessionid)

Set the current chat id.

buildTags(unitStatesObj, unitName)

Return an object containing all dialog unit stateids.

Pattern Matching

take(sentence)

Save the pattern match info.

match(regex)

Match a pattern/intent.

equal(text)

Match sentence with a precise text.

slots()

Return the slots of a pattern matched. Aliases: entities

Dialog Unit Variables

setvar(name, value, unitid=unit, sessionid=id)

Write a dialog unit variable on the session storage.

getvar(name, unitid=unit, sessionid=id)

Read a dialog unit variable on the session storage.

delvar(name, unitid=unit, sessionid=id)

Delete a dialog unit variable on the session storage.

delvars(unitid=unit, sessionid=id)

Delete all dialog unit variables on the session storage.


top | home | index