golangvectorspace

package module
v0.0.0-...-466a786 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2018 License: MIT Imports: 2 Imported by: 0

README

README

An implementation of the VectorSpace model in Golang. Pass in two strings and get back a number indicating how similar they are.

Build Status

Usage like so,

var concordance1 = Concordance("Go has a lightweight test framework composed of the go test command and the testing package.")
var concordance2 = Concordance("Package testing provides support for automated testing of Go packages. It is intended to be used in concert with the go test command, which automates execution of any function of the form.")

// value of got will be 0.48211825989991874   
got := Relation(concordance1, concordance2)

See tests for other examples.

To benchmark,

go test -bench .

On a late 2013 Macbook Pro 2.6 GHz Intel Core i5

BenchmarkRelation-4   	 1000000	      2364 ns/op
BenchmarkRelation-4   	 1000000	      2396 ns/op
BenchmarkRelation-4   	 1000000	      2318 ns/op

Coverage

go test -cover .
ok  	github.com/boyter/golangvectorspace	0.006s	coverage: 95.7% of statements

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Relation

func Relation(con1 Concordance, con2 Concordance) float64

Types

type Concordance

type Concordance map[string]float64

func BuildConcordance

func BuildConcordance(document string) Concordance

func (Concordance) Magnitude

func (con Concordance) Magnitude() float64

Jump to

Keyboard shortcuts

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