autocomplete

package
v0.0.0-...-9a18aee Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package autocomplete provides methods for interacting directly with auto complete models.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client provides methods for interacting directly with auto-complete models.

func New

func New(client *sajari.Client, name string) *Client

New creates a new client for interacting with auto complete models.

func (*Client) Complete

func (c *Client) Complete(ctx context.Context, phrase string, terms []string) ([]string, error)

Complete takes a phrase and its term components and returns an ordered array of potential completion matches. The terms are used to assist with spelling corrections and fuzzy matching, while the phrase is used as a prefix sequence.

func (*Client) TrainCorpus

func (c *Client) TrainCorpus(ctx context.Context, terms []string) error

TrainCorpus takes an array of terms and uses them to train an autocomplete model for spelling correction (i.e. these terms must correctly spelt).

func (*Client) TrainQuery

func (c *Client) TrainQuery(ctx context.Context, phrase string) error

TrainQuery takes a query phrase and uses it to train an autocomplete model for partial queries. The phrase should be a successful query (i.e. good spelling and return useful results).

Jump to

Keyboard shortcuts

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