bothub

package
v1.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

func NewService(httpClient *http.Client, httpRetries *httpx.RetryConfig, classifier *flows.Classifier, accessToken string) flows.ClassificationService

NewService creates a new classification service

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a basic Bothub client

func NewClient

func NewClient(httpClient *http.Client, httpRetries *httpx.RetryConfig, accessToken string) *Client

NewClient creates a new client

func (*Client) Parse

func (c *Client) Parse(text, language string) (*ParseResponse, *httpx.Trace, error)

Parse does a parse of the given text in the given language (e.g. pt_br)

type EntityMatch

type EntityMatch struct {
	Value      string          `json:"value"`
	Entity     string          `json:"entity"`
	Confidence decimal.Decimal `json:"confidence"`
}

type IntentMatch

type IntentMatch struct {
	Name       string          `json:"name"`
	Confidence decimal.Decimal `json:"confidence"`
}

type ParseResponse

type ParseResponse struct {
	Intent        IntentMatch              `json:"intent" validate:"required"`
	IntentRanking []IntentMatch            `json:"intent_ranking" validate:"required"`
	LabelsList    []string                 `json:"labels_list"`
	EntitiesList  []string                 `json:"entities_list"`
	Entities      map[string][]EntityMatch `json:"entities"`
	Text          string                   `json:"text"`
	UpdateID      int                      `json:"update_id"`
	Language      string                   `json:"language"`
}

ParseResponse is the response from a /parse request

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL