Documentation ¶
Index ¶
- Constants
- type Config
- type VectorMap
- func (m *VectorMap) AverageVectors(vecs [][]float64) []float64
- func (m *VectorMap) FlattenVectors(vecs [][]float64) []float64
- func (m *VectorMap) PadVectors(vecs [][]float64, length int) [][]float64
- func (m *VectorMap) SaveToFile(name string) error
- func (m *VectorMap) SumVectors(vecs [][]float64) []float64
- func (m *VectorMap) Vector(word string) (vector []float64, inVocabulary bool)
- func (m *VectorMap) Vectors(words []string) [][]float64
Constants ¶
View Source
const WordVectorsFile = "wv.gob"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // WordVectorsFile is the path to the word vectors file WordVectorsFile string `mapstructure:"file_name"` // Truncate is a number between 0 and 1, which represents how many // words will be used from the word vector Truncate float32 `mapstructure:"truncate"` // SkipOOV makes the out-of-vocabulary words to be omitted SkipOOV bool `mapstructure:"skip_oov"` }
Config contains configuration for fasttext word vectors
type VectorMap ¶
VectorMap contains a map of words and their vector, as well as the vector size
func NewVectorMap ¶
NewVectorMap loads word vector from a file, up to trunc percentage of words and returns a new VectorMap
func NewVectorMapFromFile ¶
func (*VectorMap) AverageVectors ¶
AverageVectors averages an array of vector
func (*VectorMap) FlattenVectors ¶
FlattenVectors converts an array of vector into an array of vector, one after the other
func (*VectorMap) PadVectors ¶
PadVectors pads an vector array to a length with zero vectors
func (*VectorMap) SaveToFile ¶
SaveToFile saves a serializableVectorMap to the wordVectorsFile
func (*VectorMap) SumVectors ¶
SumVectors sums an array of vector
Click to show internal directories.
Click to hide internal directories.