gohot

package module
v0.0.0-...-3f53088 Latest Latest
Warning

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

Go to latest
Published: May 8, 2018 License: MIT Imports: 1 Imported by: 0

README

gohot

gohot is a golang library that generates one hot encode vector.

gohot uses morphological analysis (kagome) to convert japanese text to tokens.

Requirement

Go 1.8

Installation

go get github.com/hlts2/gohot

Example

tokens := []string{"私", "は", "ブドウ", "が", "好き", "な", "ので", "、", "毎年", "秋", "が", "楽しみ", "だ"}
onehotvectors := gohot.CreateOneHotVectorFromTokens(tokens) //["私":"100000000000", "は": "010000000000", "ブドウ": "001000000000" ... etc]

for token, vector := range onehotvectors {
    fmt.Println(token, vector)
}

text := "私はブドウが好きなので、毎年秋が楽しみだ"
onehotvectors = gohot.CreateOneHotVectorFromText(text) //["私":"100000000000", "は": "010000000000", "ブドウ": "001000000000" ... etc]

for token, vector := range onehotvectors {
	fmt.Println(token, vector)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOneHotVectorFromText

func CreateOneHotVectorFromText(text string) map[string]string

CreateOneHotVectorFromText returns one hot vector of text

func CreateOneHotVectorFromTokens

func CreateOneHotVectorFromTokens(tokens []string) map[string]string

CreateOneHotVectorFromTokens returns one hot vector of tokens

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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