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: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ID2Label

func ID2Label(value map[string]string) []string

Types

type TextClassification

type TextClassification struct {
	// Model is the model used to answer questions.
	Model *bert.ModelForSequenceClassification
	// Tokenizer is the tokenizer used to tokenize questions and passages.
	Tokenizer *wordpiecetokenizer.WordPieceTokenizer
	// Labels is the list of labels used for classification.
	Labels []string
	// contains filtered or unexported fields
}

TextClassification is a text classification model.

func LoadTextClassification

func LoadTextClassification(modelPath string) (*TextClassification, error)

LoadTextClassification returns a TextClassification loading the model, the embeddings and the tokenizer from a directory.

func (*TextClassification) Classify

Classify returns the classification of the given text.

Jump to

Keyboard shortcuts

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