Skip to content

This is a Go lib that helps converting a slice of strings into a slice of vectors

License

Notifications You must be signed in to change notification settings

dmitriitimoshenko/govectorize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

govectorize

This is a Go lib that helps converting a slice of strings into a slice of vectors.

Function Generate([]string) will collect all tokens from all the provided strings and return a slice of vectors (i.e. map[string]float64). Order of the vectors and the same as the order of input strings.

Example of usage:

import (
    "fmt"

    "github.com/example/dataprovider"
    "github.com/dmitriitimoshenko/govectorize"
)

func main() {
    strings := dataprovider.GetStringSlice()
    vectors := govectorize.Generate(strings)
    
    // vectors.Map() returns map[string]float64
    for _, vector := range vectors.Map() {
        fmt.Printf("\n\tkey\tvalue\n\n")
        for key, value := range vector {
            fmt.Printf("\t%s\t%f\n", key, value)
        }
        fmt.Printf("\n***********************************\n")
    }
}

About

This is a Go lib that helps converting a slice of strings into a slice of vectors

Topics

Resources

License

Stars

Watchers

Forks

Languages