bert

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TextEncoding

type TextEncoding struct {
	// Model is the model used to answer questions.
	Model *bert.ModelForSequenceEncoding
	// Tokenizer is the tokenizer used to tokenize questions and passages.
	Tokenizer *wordpiecetokenizer.WordPieceTokenizer
	// contains filtered or unexported fields
}

TextEncoding is a text encoding model.

func LoadTextEncoding

func LoadTextEncoding(modelPath string) (*TextEncoding, error)

LoadTextEncoding returns a TextEncoding loading the model, the embeddings and the tokenizer from a directory.

func (*TextEncoding) Encode

func (m *TextEncoding) Encode(_ context.Context, text string, poolingStrategy int) (textencoding.Response, error)

Encode returns the dense encoded representation of the given text.

Jump to

Keyboard shortcuts

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