natural

package
v0.0.0-...-0dfd57a Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Service natural provides a conversational interface to the sarif network.

Index

Constants

This section is empty.

Variables

View Source
var Module = &services.Module{
	Name:        "natural",
	Version:     "1.0",
	NewInstance: NewService,
}

Functions

func ParseSimple

func ParseSimple(ctx *natural.Context) (*natural.ParseResult, error)

Types

type Actionable

type Actionable struct {
	Action  *schema.Action   `json:"action"`
	Actions []*schema.Action `json:"actions"`
}

func (Actionable) IsAction

func (a Actionable) IsAction() bool

type Annotator

type Annotator struct {
	Enabled  bool
	LastSeen time.Time `json:"-"`
}

type Config

type Config struct {
	Address    string
	Rules      natural.SentenceRuleSet
	Parsers    map[string]*Parser
	Annotators map[string]*Annotator
}

type Conversation

type Conversation struct {
	Device            string
	LastTime          time.Time
	LastMessage       sarif.Message
	LastMessageAction Actionable

	LastUserTime    time.Time
	LastUserText    string
	LastUserMessage sarif.Message
	// contains filtered or unexported fields
}

func (*Conversation) HandleClientMessage

func (cv *Conversation) HandleClientMessage(msg sarif.Message)

func (*Conversation) PublishForClient

func (cv *Conversation) PublishForClient(msg sarif.Message)

func (*Conversation) SendToClient

func (cv *Conversation) SendToClient(msg sarif.Message)

type Dependencies

type Dependencies struct {
	Config services.Config
	Client sarif.Client
}

type MsgErrNatural

type MsgErrNatural struct {
	Original string               `json:"original"`
	Type     string               `json:"-"`
	Action   interface{}          `json:"action"`
	Result   *natural.ParseResult `json:"result"`
}

func (MsgErrNatural) String

func (pl MsgErrNatural) String() string

type Parser

type Parser struct {
	Weight   float64
	LastSeen time.Time `json:"-"`
}

type Service

type Service struct {
	Config services.Config
	Cfg    Config
	sarif.Client

	ParserKeepAlive time.Duration
	// contains filtered or unexported fields
}

func NewService

func NewService(deps *Dependencies) *Service

func (*Service) AnnotateReply

func (s *Service) AnnotateReply(msg sarif.Message) sarif.Message

func (*Service) Enable

func (s *Service) Enable() error

func (*Service) Parse

func (s *Service) Parse(ctx *natural.Context) (*natural.ParseResult, error)

func (*Service) ParseRegular

func (s *Service) ParseRegular(ctx *natural.Context) (*natural.ParseResult, error)

func (*Service) TransformReply

func (s *Service) TransformReply(text string) string

Jump to

Keyboard shortcuts

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