Interface NCDialogFlowItem

  • All Superinterfaces:
    NCMetadata

    public interface NCDialogFlowItem
    extends NCMetadata
    An item of the dialog flow. Dialog flow is a chronologically ordered list of dialog flow items. Each item represents a snapshot of winning intent's match and its associated data. List of instances of this interface is passed into a custom user-defined dialog flow match method.

    Read full documentation in Intent Matching section and review examples.

    • Method Detail

      • getIntentId

        String getIntentId()
        Gets ID of the matched intent.
        Returns:
        ID of the matched intent.
      • getResult

        NCResult getResult()
        Gets the winning intent's callback result.
        Returns:
        Winning intent's callback result.
      • getIntentTokens

        List<List<NCToken>> getIntentTokens()
        Gets a subset of tokens representing matched intent. This subset is grouped by the matched terms where a null sub-list defines an optional term. Order and index of sub-lists corresponds to the order and index of terms in the matching intent. Number of sub-lists will always be the same as the number of terms in the matched intent.

        Note that unlike getVariant() method this method returns only subset of the tokens that were part of the matched intent. Specifically, it will not return tokens for free words, stopwords or unmatched ("dangling") tokens.

        Returns:
        List of list of tokens representing matched intent.
        See Also:
        getVariant()
      • getVariant

        NCVariant getVariant()
        Gets sentence parsing variant that produced the matching for the winning intent. Returned variant is one of the variants provided by NCContext.getVariants() methods. Note that tokens returned by this method are a superset of the tokens returned by getIntentTokens() method, i.e. not all tokens from this variant may have been used in matching of the winning intent.
        Returns:
        Sentence parsing variant that produced the matching for the winning intent.
        See Also:
        getIntentTokens()
      • getUser

        NCUser getUser()
        Gets descriptor of the user on behalf of which the input request was submitted.
        Returns:
        User descriptor.
      • getCompany

        NCCompany getCompany()
        Gets descriptor of the user's company on behalf of which the input request was submitted.
        Returns:
        User company descriptor.
      • getServerRequestId

        String getServerRequestId()
        Gets globally unique server ID of the input request.

        Server request is defined as a processing of a one user input request. Note that the model can be accessed multiple times during processing of a single user request and therefore multiple instances of this interface can return the same server request ID. In fact, users of this interfaces can use this fact by using this ID, for example, as a map key for a session scoped storage.

        Returns:
        Server request ID.
      • getNormalizedText

        String getNormalizedText()
        Gets normalized text of the user input.
        Returns:
        Normalized text of the user input.
      • getReceiveTimestamp

        long getReceiveTimestamp()
        Gets UTC/GMT timestamp in milliseconds when user input was received.
        Returns:
        UTC/GMT timestamp in milliseconds when user input was received.
      • getRemoteAddress

        Optional<String> getRemoteAddress()
        Gets optional address of the remote client that made the initial REST request.
        Returns:
        Optional address of the remote client.
      • getClientAgent

        Optional<String> getClientAgent()
        Gets string representation of the user client agent that made the initial REST request .
        Returns:
        User agent string from user client (web browser, REST client, etc.).
      • getRequestData

        Map<String,​Object> getRequestData()
        Gets optional JSON data passed in with the user request.
        Returns:
        Optional JSON data, can be empty but never null.