partition

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: MIT Imports: 5 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NotFoundError

type NotFoundError struct {
	Word string
}

NotFoundError is an error returned from Partition functions when an input word can not be found.

func (NotFoundError) Error

func (e NotFoundError) Error() string

type Partition

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

Partition represents an arrangement of words from a word2vec model into a partition of equivalency classes.

func NewPartition

func NewPartition(r io.Reader) (*Partition, error)

NewPartition returns a Partition instance which is loaded with data from r (assumed to be of the output format from the word2vec command with -classes arg).

func (*Partition) Class

func (p *Partition) Class(w string) (int, error)

Class returns the internal index used to represent he equivalence class for w.

func (*Partition) Classes

func (p *Partition) Classes() int

Classes returns the number of classes in the partition.

func (*Partition) Equiv

func (p *Partition) Equiv(w, v string) (bool, error)

Equiv returns true iff w and v are equivalent.

func (*Partition) EquivClass

func (p *Partition) EquivClass(w string) ([]string, error)

EquivClass returns the equivalence class of w as the list of strings which are equivalent to it.

func (*Partition) EquivClassIndex

func (p *Partition) EquivClassIndex(i int) ([]string, error)

func (*Partition) Size

func (p *Partition) Size() int

Size returns the number of words in the partition.

Jump to

Keyboard shortcuts

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