Word Embedding in Golang

Posted Golang语言社区

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Word Embedding in Golang相关的知识,希望对你有一定的参考价值。

This is the implementation of word embedding (a.k.a word representation) models in Golang.

Word Embedding

Word embedding makes word's meaning, structure, and concept mapping into vector space with low dimension. For representative instance:

1Vector("King") - Vector("Man") + Vector("Woman") = Vector("Queen")

Like this example, the models generate the vectors that could calculate word meaning by arithmetic operations for other vectors.

Models

  •  Word2Vec

    • Distributed Representations of Words and Phrases and their Compositionality [pdf]

  •  GloVe

    • GloVe: Global Vectors for Word Representation [pdf]

and more...

Installation

1$ go get -u github.com/ynqa/wego
2$ bin/wego -h

Usage

 1tools for embedding words into vector space
2
3Usage:
4  wego [flags]
5  wego [command]
6
7Available Commands:
8  distance    Estimate the distance between words
9  glove       GloVe: Global Vectors for Word Representation
10  help        Help about any command
11  word2vec    Word2Vec: Continuous Bag-of-Words and Skip-gram model
12
13Flags:
14  -h, --help   help for wego
15
16Use "wego [command] --help" for more information about a command.

For more information about each sub-command, see below:

  • distance

  • word2vec

    • In code-based, refer to the example.

  • glove

Demo

Downloading text8 corpus, and training by Skip-Gram with negative sampling.

1$ sh demo.sh

Output

Output a file is subject to the following format:

1<word> <value1> <value2> ...

References

  • Just see it for more deep comprehension:

    • Improving Distributional Similarity with Lessons Learned from Word Embeddings [pdf]

    • Don’t count, predict! A systematic comparison of context-counting vs. context-predicting semantic vectors [pdf]




版权申明:内容来源网络,版权归原创者所有。除非无法确认,我们都会标明作者及出处,如有侵权烦请告知,我们会立即删除并表示歉意。谢谢。



Golang语言社区

ID:Golangweb

www.bytedancing.com

游戏服务器架构丨分布式技术丨大数据丨游戏算法学习


以上是关于Word Embedding in Golang的主要内容,如果未能解决你的问题,请参考以下文章

Word Embedding的生成

Word Embedding理解

万物皆可Embedding,从word2vec到item2vec、node2vec

PyTorch学习笔记之初识word_embedding

对于 word.zip 文件的 word/embedding 中的文件,将 .bin 转换为 .png

详细讲解word embedding