word2vec

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2022 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadEmbeddingMap

func LoadEmbeddingMap(f io.Reader) (embMap map[string][]float64, err error)

func LoadForCmd

func LoadForCmd(cmd *cobra.Command, opts *Options)

func New

func New(opts ...ModelOption) (model.Model, error)

func NewForOptions

func NewForOptions(opts Options) (model.Model, error)

Types

type EmbeddingMap

type EmbeddingMap map[string][]float64

func (*EmbeddingMap) Get

func (m *EmbeddingMap) Get(word string) ([]float64, bool)

type EmbeddingMap32 added in v0.3.0

type EmbeddingMap32 map[string][]float32

func (*EmbeddingMap32) Get added in v0.3.0

func (m *EmbeddingMap32) Get(word string) ([]float32, bool)

type ModelOption

type ModelOption func(*Options)

func BatchSize

func BatchSize(v int) ModelOption

func Dim

func Dim(v int) ModelOption

func DocInMemory

func DocInMemory() ModelOption

func Goroutines

func Goroutines(v int) ModelOption

func Initlr

func Initlr(v float64) ModelOption

func Iter

func Iter(v int) ModelOption

func LogBatch

func LogBatch(v int) ModelOption

func MaxCount

func MaxCount(v int) ModelOption

func MaxDepth

func MaxDepth(v int) ModelOption

func MinCount

func MinCount(v int) ModelOption

func MinLR

func MinLR(v float64) ModelOption

func Model

func Model(typ ModelType) ModelOption

func NegativeSampleSize

func NegativeSampleSize(v int) ModelOption

func Optimizer

func Optimizer(typ OptimizerType) ModelOption

func SubsampleThreshold

func SubsampleThreshold(v float64) ModelOption

func ToLower

func ToLower() ModelOption

func UpdateLRBatch

func UpdateLRBatch(v int) ModelOption

func Verbose

func Verbose() ModelOption

func Window

func Window(v int) ModelOption

type ModelType

type ModelType = string
const (
	Cbow     ModelType = "cbow"
	SkipGram ModelType = "skipgram"
)

type OptimizerType

type OptimizerType = string
const (
	NegativeSampling    OptimizerType = "ns"
	HierarchicalSoftmax OptimizerType = "hs"
)

type Options

type Options struct {
	BatchSize          int
	Dim                int
	DocInMemory        bool
	Goroutines         int
	Initlr             float64
	Iter               int
	LogBatch           int
	MaxCount           int
	MaxDepth           int
	MinCount           int
	MinLR              float64
	ModelType          ModelType
	NegativeSampleSize int
	OptimizerType      OptimizerType
	SubsampleThreshold float64
	ToLower            bool
	UpdateLRBatch      int
	Verbose            bool
	Window             int
}

func DefaultOptions

func DefaultOptions() Options

Jump to

Keyboard shortcuts

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