spladego

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

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

func NewModel

func NewModel(opts ...ModelOption) (*Model, error)

func (*Model) Close

func (m *Model) Close() error

func (*Model) Compute

func (m *Model) Compute(sentence string, addSpecialTokens bool) ([]float32, error)

func (*Model) ComputeBatch

func (m *Model) ComputeBatch(sentences []string, addSpecialTokens bool) ([][]float32, error)

func (*Model) ComputeBatchFromEncodings

func (m *Model) ComputeBatchFromEncodings(encodings []tokenizer.Encoding) ([][]float32, error)

func (*Model) ComputeFromEncoding

func (m *Model) ComputeFromEncoding(encoding tokenizer.Encoding) ([]float32, error)

func (*Model) EncodeDocument

func (m *Model) EncodeDocument(documents []string) ([][]float32, error)

EncodeDocument encodes documents using SPLADE

func (*Model) EncodeQuery

func (m *Model) EncodeQuery(queries []string) ([][]float32, error)

EncodeQuery encodes queries using SPLADE

func (*Model) Similarity

func (m *Model) Similarity(queryEmbeddings [][]float32, docEmbeddings [][]float32) [][]float32

Similarity computes cosine similarity between query and document embeddings

type ModelOption

type ModelOption = func(*Model)

func WithRuntimePath

func WithRuntimePath(path string) ModelOption

type Tokenizer

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

func NewTokenizer

func NewTokenizer() (*Tokenizer, error)

func (*Tokenizer) Decode

func (tk *Tokenizer) Decode(ids []int, skipSpecialTokens bool) string

func (*Tokenizer) Encode

func (tk *Tokenizer) Encode(s string, addSpecialTokens bool) (*tokenizer.Encoding, error)

Jump to

Keyboard shortcuts

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