domain

package
v0.0.0-...-bbd4997 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InputOutput

type InputOutput struct {
	AiCol      int64   `gorm:"column:ai_col"`
	ResultType int64   `gorm:"column:result_type"`
	Input      string  `json:"pc_input" gorm:"column:pc_input"`
	Output     string  `json:"gm_response" gorm:"column:gm_response"`
	RoomID     int64   `json:"room_id"`
	VoteScore  float64 `gorm:"column:vote_score"`
	// contains filtered or unexported fields
}

InputOutput used to map the database structure to the input output pair used by the program.

func NewInputOutput

func NewInputOutput(input, output string, room int64, voteScore float64) InputOutput

NewInputOutput returns a new input output object.

func SoftMatch

func SoftMatch(input string, pairs []InputOutput) (InputOutput, float64)

SoftMatch is the actual algorithm that is used to match two inputs. it takes the user's input string and a slice of the InputOutput pairs it should match against.

func (InputOutput) TableName

func (i InputOutput) TableName() string

TableName setting this function satisfies the gorm interface and changes the table name.

type InputOutputStore

type InputOutputStore interface {
	SaveInputOutput(InputOutput) error
	Response(string, int64) (InputOutput, float64)
}

InputOutputStore is the interface that needs to be fulfilled by other store implementations.

Jump to

Keyboard shortcuts

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