codec

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveReverseToFile added in v0.0.3

func SaveReverseToFile(filename string, reverse Reverse)

func SaveVocabToFile added in v0.0.3

func SaveVocabToFile(filename string, vocab Vocab)

Types

type Codec

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

func New

func New(name string, vocabulary Vocab, reverse Reverse, splitRegexp *regexp2.Regexp, specialTokens map[string]int32) *Codec

func (*Codec) Decode

func (c *Codec) Decode(tokens []int32) (string, error)

func (*Codec) Encode

func (c *Codec) Encode(input string) ([]int32, []string, error)

func (*Codec) GetName

func (c *Codec) GetName() string

type Reverse

type Reverse map[int32]string

func GetReverse added in v0.0.3

func GetReverse(vocab Vocab) Reverse

func LoadReverseFromByteArr added in v0.0.3

func LoadReverseFromByteArr(data []byte) Reverse

type Vocab

type Vocab map[string]int32

func LoadVocab added in v0.0.3

func LoadVocab(filename string) Vocab

func LoadVocabFromByteArr added in v0.0.3

func LoadVocabFromByteArr(data []byte) Vocab

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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