repl

package
v0.0.2-rkk Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

README

REPL

Similarity search between word vectors with REPL mode.

Usage

Search similar words with REPL mode

Usage:
  wego repl [flags]

Examples:
  wego repl -i example/word_vectors.txt
  >> apple + banana
  ...

Flags:
  -h, --help               help for repl
  -i, --inputFile string   input file path for trained word vector (default "example/word_vectors.txt")
  -r, --rank int           how many the most similar words will be displayed (default 10)

Example

Now, it is able to use +, - for arithmetic operations.

$ go run wego.go repl -i example/word_vectors_sg.txt
>> a + b
  RANK |  WORD   | SIMILARITY
+------+---------+------------+
     1 | phi     |   0.907975
     2 | q       |   0.904593
     3 | mathbf  |   0.903066
     4 | cdot    |   0.902205
     5 | b       |   0.901952
     6 | becomes |   0.900346
     7 | int     |   0.898680
     8 | z       |   0.897895
     9 | named   |   0.896480
    10 | v       |   0.895456

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(v1, v2 []float64) []float64

func Sub

func Sub(v1, v2 []float64) []float64

Types

type Operator

type Operator func(float64, float64) float64

type Repl

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

func NewRepl

func NewRepl(f io.Reader, k int) (*Repl, error)

func (*Repl) Run

func (r *Repl) Run() error

Jump to

Keyboard shortcuts

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