recast

package
v0.0.0-...-a7eead2 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2018 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ActAssert  = "assert"
	ActCommand = "command"
	ActWhQuery = "wh-query"
	ActYnQuery = "yn-query"

	TypeAbbreviation = "abbr:"
	TypeEntity       = "enty:"
	TypeDescription  = "desc:"
	TypeHuman        = "hum:"
	TypeLocation     = "loc:"
	TypeNumber       = "num:"

	SentimentPositive     = "positive"
	SentimentVeryPositive = "vpositive"
	SentimentNegative     = "negative"
	SentimentVeryNegative = "vnegative"
	SentimentNeutral      = "neutral"
)

Variables

View Source
var (
	ErrNoMessageToSend = errors.New("No message to send")
	ErrNoRequestBody   = errors.New("The request's body is empty")
)
View Source
var (
	// ErrTokenNotSet is returned when the token for a client is empty
	ErrTokenNotSet = errors.New("Request cannot be made without a token set")
)

Functions

This section is empty.

Types

type Action

type Action struct {
	Slug  string `json:"slug"`
	Done  bool   `json:"done"`
	Reply string `json:"reply"`
}

Action represents a conversation action

type Attachment

type Attachment struct {
	// Type must be set according to the content sent
	// It can be either "text", "picture" or "video"
	Type    string `json:"type"`
	Content string `json:"content"`
}

Attachment holds data for both text, picture and video messages

attachment := Attachment{
	Type: "text",
	Content: "Hello World",
}

func NewTextMessage

func NewTextMessage(text string) Attachment

NewTextMessage returns a new text attachment

func (Attachment) IsComponent

func (c Attachment) IsComponent() bool

IsComponent marks Attachment as a valid messaging content

type Card

type Card struct {
	Type    string      `json:"type"`
	Content CardContent `json:"content"`
}

Card holds formats for a generic messaging card for Recast.AI botconnector

card := recast.NewCard("Do you like to code?").
	AddImage("https://unsplash.it/1920/1080/?random").
	AddButton("Yes", "postback", "I like to code").
	AddButton("No", "postback", "I don't like to code")

func NewCard

func NewCard(title, subtitle string) *Card

NewCard initializes a new card with the specified title It can be used to display informations and images to the user or to ask multiple choice question with actionable buttons

func (*Card) AddButton

func (c *Card) AddButton(title, typ, value string) *Card

AddButton adds a button with the specified title, type and value to a Card

func (*Card) AddImage

func (c *Card) AddImage(imageUrl string) *Card

AddImage sets the image that will be displayed in the message

func (*Card) IsComponent

func (c *Card) IsComponent() bool

IsComponent marks Card as a valid messaging content

type CardButton

type CardButton struct {
	Title string `json:"title"`
	Type  string `json:"type"`
	Value string `json:"value"`
}

CardButton holds data for a button in messaging channels formats

type CardContent

type CardContent struct {
	Title    string       `json:"title"`
	Subtitle string       `json:"subtitle"`
	ImageUrl string       `json:"imageUrl"`
	Buttons  []CardButton `json:"buttons"`
}

CardContent holds data for a card in messaging platforms

type Cardinal

type Cardinal struct {
	Bearing    float64 `json:"bearing"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Cardinal Recast.AI entity

type Carousel struct {
	Type    string          `json:"type"`
	Content []*CarouselCard `json:"content"`
}

func NewCarousel

func NewCarousel() *Carousel

func (*Carousel) AddCard

func (c *Carousel) AddCard(card *CarouselCard) *Carousel

func (*Carousel) IsComponent

func (c *Carousel) IsComponent() bool

type CarouselCard

type CarouselCard struct {
	Title    string       `json:"title"`
	Subtitle string       `json:"subtitle"`
	ImageUrl string       `json:"imageUrl"`
	Buttons  []CardButton `json:"buttons"`
}

func NewCarouselCard

func NewCarouselCard(title, subtitle string) *CarouselCard

func (*CarouselCard) AddButton

func (c *CarouselCard) AddButton(title, typ, value string) *CarouselCard

func (*CarouselCard) AddImage

func (c *CarouselCard) AddImage(image string) *CarouselCard

type Color

type Color struct {
	Rgb        string  `json:"rgb"`
	Hex        string  `json:"hex"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Color Recast.AI entity

type Component

type Component interface {
	IsComponent() bool
}

Component interface is used as a marker for the connector message formats All data structure that can be sent as a message has to implement this interface

type ConnectClient

type ConnectClient struct {
	Token string
	// contains filtered or unexported fields
}

ConnectClient provides an interface to Recast.AI connector service It allows to send message to a particular user and broadcast message to all users of a bot

client := recast.ConnectClient{"YOUR_TOKEN"}
message := recast.NewTextMessage("Hello")
err := client.SendMessage("CONVERSATION_ID", message)

func NewConnectClient

func NewConnectClient(token string) *ConnectClient

NewConnectClient creates a new client with the provided API token.

func (*ConnectClient) BroadcastMessage

func (client *ConnectClient) BroadcastMessage(messages ...Component) error

BroadcastMessage sends messages to all users of a bot

card := recast.NewQuickReplies("").
	AddButton("Say hello", "Hello").
	AddButton("Say goodbyes", "Goodbye")
err := client.BroadcastMessage(card)

func (*ConnectClient) SendMessage

func (client *ConnectClient) SendMessage(conversationId string, messages ...Component) error

SendMessage send messages to Recast.AI botconnector service A message can either be a Card, a QuickReplies or an Attachment structure

card := recast.NewCard("Hi!").
	AddImage("https://unsplash.it/1920/1080/?random").
	AddButton("Say hello", "postback", "Hello").
	AddButton("Say goodbyes", "postback", "Goodbye")
err := client.SendMessage("CONVERSATION_ID", card)

func (*ConnectClient) ServeHTTP

func (client *ConnectClient) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*ConnectClient) UseHandler

func (client *ConnectClient) UseHandler(h MessageHandler)

UseHandler specify the handler when message are received. By default, the message are printed to stdout.

type Context

type Context struct {
	ConversationId string
	SenderId       string
}

Context holds the information about a conversation context

type Conversation

type Conversation struct {
	ConversationToken  string                 `json:"conversation_token"`
	UUID               string                 `json:"uuid"`
	Source             string                 `json:"source"`
	Replies            []string               `json:"replies"`
	Action             Action                 `json:"action"`
	NextActions        []Action               `json:"next_actions"`
	Memory             map[string]interface{} `json:"memory"`
	Intents            []Intent               `json:"intents"`
	Sentiment          string                 `json:"sentiment"`
	Entities           Entities               `json:"entities"`
	Language           string                 `json:"language"`
	ProcessingLanguage string                 `json:"processing_language"`
	Version            string                 `json:"version"`
	Timestamp          time.Time              `json:"timestamp"`
	Status             int                    `json:"status"`
	AuthorizationToken string
	CustomEntities     map[string][]CustomEntity
}

Conversation contains the response from the converse endpoint of the API

func (Conversation) IsNegative

func (conv Conversation) IsNegative() bool

IsNegative returns whether or not the sentiment is negative

func (Conversation) IsNeutral

func (conv Conversation) IsNeutral() bool

IsNeutral returns whether or not the sentiment is neutral

func (Conversation) IsPositive

func (conv Conversation) IsPositive() bool

IsPositive returns whether or not the sentiment is positive

func (Conversation) IsVeryNegative

func (conv Conversation) IsVeryNegative() bool

IsVeryNegative returns whether or not the sentiment is very negative

func (Conversation) IsVeryPositive

func (conv Conversation) IsVeryPositive() bool

IsVeryPositive returns whether or not the sentiment is very positive

func (*Conversation) Reset

func (conv *Conversation) Reset() error

Reset resets all the conversation (actions and variables)

func (*Conversation) ResetMemory

func (conv *Conversation) ResetMemory() error

ResetMemory empties all variables in the conversation

func (*Conversation) SetMemory

func (conv *Conversation) SetMemory(memory map[string]map[string]interface{}) error

SetMemory allows to change the conversation memory variables

type ConverseOpts

type ConverseOpts struct {
	ConversationToken string
	Memory            map[string]map[string]interface{}
	Language          string
	Token             string
}

ConverseOpts contains options for ConverseText method

type CustomEntity

type CustomEntity struct {
	// Raw string detected and extracted from the input
	Raw string `json:"raw"`

	// Value of the entity
	Value string `json:"value"`

	// Detection confidence
	Confidence float64 `json:"value"`

	// Name of the entity
	Name string
}

CustomEntity represents a Recast.AI user-defined entity

type Datetime

type Datetime struct {
	Formatted  string  `json:"formatted"`
	Iso        string  `json:"iso"`
	Accuracy   string  `json:"accuracy"`
	Chronology string  `json:"chronology"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Datetime Recast.AI entity

type Dialog

type Dialog struct {
	Messages           []Component        `json:"-"`
	DialogConversation DialogConversation `json:"conversation"`
	Nlp                Response           `json:"nlp"`
}

Dialog contains the response from the /dialog endpoint of the API

type DialogConversation

type DialogConversation struct {
	Id              string                 `json:"id"`
	Language        string                 `json:"language"`
	Skill           string                 `json:"skill"`
	SkillOccurences int                    `json:"skill_occurences"`
	SkillStack      []string               `json:"skill_stack"`
	Memory          map[string]interface{} `json:"memory"`
}

type DialogOpts

type DialogOpts struct {
	Language       string
	ConversationId string
	Token          string
}

DialogOpts contains options for DialogText method

type Distance

type Distance struct {
	Scalar     float64 `json:"scalar"`
	Unit       string  `json:"unit"`
	Meters     float64 `json:"meters"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Distance Recast.AI entity

type Duration

type Duration struct {
	Chrono     string  `json:"chrono"`
	Years      float64 `json:"years"`
	Months     float64 `json:"months"`
	Days       float64 `json:"days"`
	Hours      float64 `json:"hours"`
	Minutes    float64 `json:"minutes"`
	Seconds    float64 `json:"seconds"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Duration Recast.AI entity

type Email

type Email struct {
	Local      string `json:"local"`
	Tag        string `json:"tag"`
	Domain     string `json:"domain"`
	Raw        string `json:"raw"`
	Confidence string `json:"confidence"`
}

Email Recast.AI entity

type Emoji

type Emoji struct {
	Formatted   string   `json:"formatted"`
	Feeling     string   `json:"feeling"`
	Tags        []string `json:"tags"`
	Unicode     string   `json:"unicode"`
	Description string   `json:"description"`
	Raw         string   `json:"raw"`
	Confidence  float64  `json:"confidence"`
}

Emoji Recast.AI entity

type Entities

type Entities struct {
	Cardinal     []Cardinal     `json:"cardinal"`
	Color        []Color        `json:"color"`
	Datetime     []Datetime     `json:"datetime"`
	Distance     []Distance     `json:"distance"`
	Duration     []Duration     `json:"duration"`
	Email        []Email        `json:"email"`
	Emoji        []Emoji        `json:"emoji"`
	Ip           []Ip           `json:"ip"`
	Interval     []Interval     `json:"interval"`
	Job          []Job          `json:"job"`
	Language     []Language     `json:"language"`
	Location     []Location     `json:"location"`
	Mass         []Mass         `json:"mass"`
	Money        []Money        `json:"money"`
	Nationality  []Nationality  `json:"nationality"`
	Number       []Number       `json:"number"`
	Ordinal      []Ordinal      `json:"ordinal"`
	Organization []Organization `json:"organization"`
	Percent      []Percent      `json:"percent"`
	Person       []Person       `json:"person"`
	Phone        []Phone        `json:"phone"`
	Pronoun      []Pronoun      `json:"pronoun"`
	Set          []Set          `json:"set"`
	Sort         []Sort         `json:"sort"`
	Speed        []Speed        `json:"speed"`
	Temperature  []Temperature  `json:"temperature"`
}

Entities holds the entity hashmap returned by a call to Recast.AI Natural Language Processing service

type Intent

type Intent struct {
	Slug       string  `json:"slug"`
	Confidence float64 `json:"confidence"`
}

Intent defines the details which define a single intent

type Interval

type Interval struct {
	Begin           string  `json:"begin"`
	End             string  `json:"end"`
	BeginChronology string  `json:"begin_chronology"`
	EndChronology   string  `json:"end_chronology"`
	BeginAccuracy   string  `json:"begin_accuracy"`
	EndAccuracy     string  `json:"end_accuracy"`
	Timespan        float64 `json:"timespan"`
	Raw             string  `json:"raw"`
	Confidence      float64 `json:"confidence"`
}

Interval Recast.AI entity

type Ip

type Ip struct {
	Formatted  string  `json:"formatted"`
	Lat        float64 `json:"lat"`
	Lng        float64 `json:"lng"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Ip Recast.AI entity

type Job

type Job struct {
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Job Recast.AI entity

type Language

type Language struct {
	Short      string `json:"short"`
	Long       string `json:"long"`
	Raw        string `json:"raw"`
	Confidence string `json:"confidence"`
}

Language Recast.AI entity

type List

type List struct {
	Type    string      `json:"type"`
	Content ListContent `json:"content"`
}

List hold formats for a list of the Recast.AI botconnector

func NewList

func NewList() *List

NewList initializes an empty list with the given title and subtitle

func (*List) AddButton

func (l *List) AddButton(title, typ, value string) *List

AddButton adds a button to a list

func (*List) AddElement

func (l *List) AddElement(e *ListElement) *List

AddElement adds a list element to a list A list can hold a maximum of 4 elements

func (*List) IsComponent

func (l *List) IsComponent() bool

IsComponent marks Card as a valid messaging content

type ListButton

type ListButton CardButton

ListButton has the same content as a card button

type ListContent

type ListContent struct {
	Elements []*ListElement `json:"elements"`
	Buttons  []ListButton   `json:"buttons"`
}

ListContent holds data for the list content

type ListElement

type ListElement struct {
	Title    string       `json:"title"`
	ImageUrl string       `json:"imageUrl"`
	Subtitle string       `json:"subtitle"`
	Buttons  []ListButton `json:"buttons"`
}

ListElement holds data for one list item

func NewListElement

func NewListElement(title, subtitle string) *ListElement

NewListElement initializes an empty list element with the given title and subtitle

func (*ListElement) AddButton

func (e *ListElement) AddButton(title, typ, value string) *ListElement

AddButton adds a button to a list element Each element can hold only one button

func (*ListElement) AddImage

func (e *ListElement) AddImage(image string) *ListElement

AddImage adds an image to a list element

type Location

type Location struct {
	Formatted  string  `json:"formatted"`
	Lat        float64 `json:"lat"`
	Lng        float64 `json:"lng"`
	Place      string  `json:"place"`
	Type       string  `json:"type"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Location Recast.AI entity

type Mass

type Mass struct {
	Scalar     float64 `json:"scalar"`
	Unit       string  `json:"unit"`
	Grams      float64 `json:"grams"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Mass Recast.AI entity

type Message

type Message struct {
	ConversationId string     `json:"conversation"`
	Attachment     Attachment `json:"attachment"`
	SenderId       string
	ChatId         string
}

Message contains data sent by Recast.AI connector.

func ParseConnectorMessage

func ParseConnectorMessage(r *http.Request) (Message, error)

ParseConnectorMessage handles a request coming from BotConnector API. It parses the request body into a MessageData struct

type MessageData

type MessageData struct {
	Message  Message `json:"message"`
	SenderId string  `json:"senderId"`
	ChatId   string  `json:"chatId"`
}

MessageData contains the Message and messaging informations about the message

type MessageHandler

type MessageHandler interface {
	ServeMessage(w MessageWriter, m Message)
}

MessageHandler is implemented by any element that would like to receive a message.

type MessageHandlerFunc

type MessageHandlerFunc func(w MessageWriter, m Message)

MessageHandlerFunc simpler wrapper for function.

func (MessageHandlerFunc) ServeMessage

func (f MessageHandlerFunc) ServeMessage(w MessageWriter, m Message)

ServeMessage implements the MessageHandler interface.

type MessageWriter

type MessageWriter interface {
	Reply(messages ...Component) error
	Broadcast(messages ...Component) error
}

MessageWriter is the structure allowing you to respond.

type Money

type Money struct {
	Amount     float64 `json:"amount"`
	Currency   string  `json:"currency"`
	Dollars    float64 `json:"dollars"`
	Raw        string  `json:"raw"`
	Confidence string  `json:"confidence"`
}

Money Recast.AI entity

type Nationality

type Nationality struct {
	Short      string  `json:"short"`
	Long       string  `json:"long"`
	Country    string  `json:"country"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Nationality Recast.AI entity

type Number

type Number struct {
	Scalar     float64 `json:"scalar"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Number Recast.AI entity

type Ordinal

type Ordinal struct {
	Rank       int32   `json:"rank"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Ordinal Recast.AI entity

type Organization

type Organization struct {
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Organization Recast.AI entity

type Percent

type Percent struct {
	Scalar     float64 `json:"scalar"`
	Unit       string  `json:"unit"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Percent Recast.AI entity

type Person

type Person struct {
	Fullname   string  `json:"fullname"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Person Recast.AI entity

type Phone

type Phone struct {
	Number     string  `json:"number"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Phone Recast.AI entity

type Pronoun

type Pronoun struct {
	Person     int32   `json:"person"`
	Number     string  `json:"number"`
	Gender     string  `json:"gender"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Pronoun Recast.AI entity

type QuickReplies

type QuickReplies struct {
	Type    string              `json:"type"`
	Content QuickRepliesContent `json:"content"`
}

QuickReplies holds format for generic quick replies for Recast.AI botconnector It allows the user to quickly choose a response that will be sent back as a text message to the bot

quickReplies := recast.NewQuickReplies("Do you like to code?").
	AddButton("Yes", "I like to code").
	AddButton("No", "I don't like to code")

func NewQuickReplies

func NewQuickReplies(title string) *QuickReplies

NewQuickReplies initializes a new QuickReply structure with the specified title

func (*QuickReplies) AddButton

func (q *QuickReplies) AddButton(title, value string) *QuickReplies

AddButton adds a button to replies choices proposed to the user the title parameter will be displayed in the messaging app and the value will be sent back as a text message if the user chooses it

func (*QuickReplies) IsComponent

func (q *QuickReplies) IsComponent() bool

IsComponent marks QuickReplies as a valid messaging content

type QuickRepliesButton

type QuickRepliesButton struct {
	Title string `json:"title"`
	Value string `json:"value"`
}

QuickRepliesButton holds format for a generic quickreply

type QuickRepliesContent

type QuickRepliesContent struct {
	Title   string               `json:"title"`
	Buttons []QuickRepliesButton `json:"buttons"`
}

QuickRepliesContent holds data for QuickReplies

type ReqOpts

type ReqOpts struct {
	Token    string
	Language string
}

ReqOpts are used to overwrite the client token and language on a per request baises if a user wises to do so

type RequestClient

type RequestClient struct {
	Token    string
	Language string
}

RequestClient provides an interface to interact with Recast.AI Natural Language Processing API

func (*RequestClient) AnalyzeFile

func (c *RequestClient) AnalyzeFile(filename string, opts *ReqOpts) (Response, error)

AnalyzeFile handles voice file request to Recast.Ai and returns a Response opts can be used to specify a token and/or language to use for this request Set opts to nil if you want the request to use the client's token and language

client := recast.RequestClient{
	Token: "YOUR_AUTHORIZATION_TOKEN",
	Language: "fr",
}
opts := recast.ReqOpts{Language: "en"}
// This request will be processed in english
response, err := client.AnalyzeFile("audio_file.wav", &opts)

func (*RequestClient) AnalyzeText

func (c *RequestClient) AnalyzeText(text string, opts *ReqOpts) (Response, error)

AnalyzeText processes a text request to Recast.AI API and returns a Response opts can be used to specify a token and/or language to use for this request Set opts to nil if you want the request to use the client's token and language

client := recast.RequestClient{
	Token: "YOUR_AUTHORIZATION_TOKEN",
	Language: "fr",
}
opts := recast.ReqOpts{Language: "en"}
// This request will be processed in english
response, err := client.AnalyzeText("Hello what is the weather in London?", &opts)

func (*RequestClient) ConverseText

func (c *RequestClient) ConverseText(text string, opts *ConverseOpts) (Conversation, error)

ConverseText processes a text request to Recast.AI API and returns a Response ConverseOpts can be used to specify a conversation token, an authorization token, a memory state and a language to use for this request Set opts to nil if you want the request to use the client's token and language If a conversation token is present in the options, the request will be processed in this conversation, othewise a new conversation is created and the token is returned

client := recast.RequestClient{
	Token: "YOUR_AUTHORIZATION_TOKEN",
	Language: "fr",
}
opts := recast.ReqOpts{Language: "en"}
// This request will be processed in english
conversation, err := client.ConverseText("Hello what is the weahter in London?", &opts)

func (*RequestClient) DialogText

func (c *RequestClient) DialogText(text string, opts *DialogOpts) (Dialog, error)

type Response

type Response struct {
	UUID               string    `json:"uuid"`
	Source             string    `json:"source"`
	Intents            []Intent  `json:"intents"`
	Act                string    `json:"act"`
	Type               string    `json:"type"`
	Sentiment          string    `json:"sentiment"`
	Entities           Entities  `json:"entities"`
	Language           string    `json:"language"`
	ProcessingLanguage string    `json:"processing_language"`
	Version            string    `json:"version"`
	Timestamp          time.Time `json:"timestamp"`
	Status             int       `json:"status"`
	CustomEntities     map[string][]CustomEntity
}

Response is the HTTP response from the Recast.AI Natural Language Processing API

func (Response) Intent

func (r Response) Intent() (Intent, error)

Intent returns the first matched intent, or an error if no intent where matched

func (Response) IsAbbreviation

func (r Response) IsAbbreviation() bool

IsAbbreviation returns whether or not the sentence is asking for an abbreviation

func (Response) IsAssert

func (r Response) IsAssert() bool

IsAssert returns whether or not the sentence is an assertion

func (Response) IsCommand

func (r Response) IsCommand() bool

IsCommand returns whether or not the sentence is a command

func (Response) IsDescription

func (r Response) IsDescription() bool

IsDescription returns whether or not the sentence is asking for an description

func (Response) IsEntity

func (r Response) IsEntity() bool

IsEntity returns whether or not the sentence is asking for an entity

func (Response) IsHuman

func (r Response) IsHuman() bool

IsHuman returns whether or not the sentence is asking for an human

func (Response) IsLocation

func (r Response) IsLocation() bool

IsLocation returns whether or not the sentence is asking for an location

func (Response) IsNegative

func (r Response) IsNegative() bool

IsNegative returns whether or not the sentiment is negative

func (Response) IsNeutral

func (r Response) IsNeutral() bool

IsNeutral returns whether or not the sentiment is neutral

func (Response) IsNumber

func (r Response) IsNumber() bool

IsNumber returns whether or not the sentence is asking for an number

func (Response) IsPositive

func (r Response) IsPositive() bool

IsPositive returns whether or not the sentiment is positive

func (Response) IsVeryNegative

func (r Response) IsVeryNegative() bool

IsVeryNegative returns whether or not the sentiment is very negative

func (Response) IsVeryPositive

func (r Response) IsVeryPositive() bool

IsVeryPositive returns whether or not the sentiment is very positive

func (Response) IsWhQuery

func (r Response) IsWhQuery() bool

IsWhQuery returns whether or not the sentence is a wh query

func (Response) IsYnQuery

func (r Response) IsYnQuery() bool

IsYnQuery returns whether or not the sentence is a yes-no question

type Set

type Set struct {
	Next       string  `json:"next"`
	Frequency  string  `json:"frequency"`
	Interval   string  `json:"interval"`
	Rrule      string  `json:"rrule"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Set Recast.AI entity

type Sort

type Sort struct {
	Order      string  `json:"order"`
	Criterion  string  `json:"criterion"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Sort Recast.AI entity

type Speed

type Speed struct {
	Scalar     float64 `json:"scalar"`
	Unit       string  `json:"unit"`
	Mps        float64 `json:"mps"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Speed Recast.AI entity

type Temperature

type Temperature struct {
	Scalar     float64 `json:"scalar"`
	Unit       string  `json:"unit"`
	Celsius    float64 `json:"celsius"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Temperature Recast.AI entity

type Url

type Url struct {
	Scheme     string  `json:"scheme"`
	Host       string  `json:"host"`
	Path       string  `json:"path"`
	Param      string  `json:"param"`
	Query      string  `json:"query"`
	Fragment   string  `json:"fragment"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Url Recast.AI entity

type Volume

type Volume struct {
	Scalar     float64 `json:"scalar"`
	Unit       string  `json:"unit"`
	Liters     float64 `json:"liters"`
	Raw        string  `json:"raw"`
	Confidence float64 `json:"confidence"`
}

Volume Recast.AI entity

Jump to

Keyboard shortcuts

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