NCModelClient

class NCModelClient(mdl: NCModel) extends LazyLogging with AutoCloseable

Client API to issue requests again given model. This the primary method of interacting with NLPCraft from the user perspective.

Value parameters:
mdl

A data model to issue requests against.

Source:
NCModelClient.scala
trait AutoCloseable
trait LazyLogging
class Object
trait Matchable
class Any

Value members

Concrete methods

def ask(txt: String, usrId: String, data: Map[String, AnyRef]): NCResult

Passes given input text to the model's pipeline for processing.

Passes given input text to the model's pipeline for processing.

This method takes given text, passes it to the pipeline for parsing and enrichment, then tries to match it against declared intents. If the winning intent match is found, its callback is called and result is returned here.

Value parameters:
data

Optional data container that will be available to the intent matching IDL.

txt

Text of the request.

usrId

ID of the user to associate with this request.

Returns:

Callback result from the winning intent match. This method never returns null.

Throws:
NCException

Thrown in case of any internal errors processing the user input.

NCRejection

An exception indicating a rejection of the user input. This exception is thrown automatically by the processing logic as well as can be thrown by the user from the intent callback.

Source:
NCModelClient.scala
def clearDialog(usrId: String): Unit

Removes all previously matched intents from the memory associated with given user ID.

Removes all previously matched intents from the memory associated with given user ID.

Value parameters:
usrId

User ID for which to clear dialog history.

Source:
NCModelClient.scala

Removes previously matched intents satisfying given filter from the memory associated with given user ID.

Removes previously matched intents satisfying given filter from the memory associated with given user ID.

Value parameters:
filter

Dialog flow item filter.

usrId

User ID for which to clear dialog history.

Source:
NCModelClient.scala
def clearStm(usrId: String): Unit

Removes all entities from the short-term-memory (STM) associated with given user ID.

Removes all entities from the short-term-memory (STM) associated with given user ID.

Value parameters:
usrId

User ID for which to clear STM.

Source:
NCModelClient.scala
def clearStm(usrId: String, filter: NCEntity => Boolean): Unit

Removes entities satisfying given filter from the short-term-memory (STM) associated with given user ID.

Removes entities satisfying given filter from the short-term-memory (STM) associated with given user ID.

Value parameters:
filter

Entity filter.

usrId

User ID for which to clear STM.

Source:
NCModelClient.scala
override def close(): Unit

Closes this client releasing its associated resources.

Closes this client releasing its associated resources.

Definition Classes
AutoCloseable
Source:
NCModelClient.scala
def debugAsk(txt: String, usrId: String, saveHist: Boolean, data: Map[String, AnyRef]): NCMatchedCallback

Passes given input text to the model's pipeline for processing.

Passes given input text to the model's pipeline for processing.

This method differs from NCModelClient.ask method in a way that instead of calling a callback of the winning intent this method returns the descriptor of that callback without actually calling it. This method is well suited for testing the model's intent matching logic without automatically executing the actual intent's callbacks.

Value parameters:
data

Optional data container that will be available to the intent matching IDL.

saveHist

Whether or not to store matched intent in the dialog history.

txt

Text of the request.

usrId

ID of the user to associate with this request.

Returns:

Processing result. This method never returns null.

Throws:
NCException

Thrown in case of any internal errors processing the user input.

NCRejection

An exception indicating a rejection of the user input. This exception is thrown automatically by the processing logic as well as can be thrown by the user from the intent callback.

Source:
NCModelClient.scala

Inherited fields

lazy protected val logger: Logger
Inherited from:
LazyLogging
Source:
Logging.scala