All Projects → sajari → Word2vec

sajari / Word2vec

Licence: mit
Go library for performing computations in word2vec binary models

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Word2vec

Sensegram
Making sense embedding out of word embeddings using graph-based word sense induction
Stars: ✭ 209 (+46.15%)
Mutual labels:  word, word2vec
Lmdb Embeddings
Fast word vectors with little memory usage in Python
Stars: ✭ 404 (+182.52%)
Mutual labels:  word, word2vec
Ngram2vec
Four word embedding models implemented in Python. Supporting arbitrary context features
Stars: ✭ 703 (+391.61%)
Mutual labels:  word, word2vec
Pytorch neg loss
NEG loss implemented in pytorch
Stars: ✭ 116 (-18.88%)
Mutual labels:  word2vec
Dna2vec
dna2vec: Consistent vector representations of variable-length k-mers
Stars: ✭ 117 (-18.18%)
Mutual labels:  word2vec
Scattertext Pydata
Notebooks for the Seattle PyData 2017 talk on Scattertext
Stars: ✭ 132 (-7.69%)
Mutual labels:  word2vec
Word2vec
对 ansj 编写的 Word2VEC_java 的进一步包装,同时实现了常用的词语相似度和句子相似度计算。
Stars: ✭ 136 (-4.9%)
Mutual labels:  word2vec
Nlp
兜哥出品 <一本开源的NLP入门书籍>
Stars: ✭ 1,677 (+1072.73%)
Mutual labels:  word2vec
Npoi
A .NET library for reading and writing Microsoft Office binary and OOXML file formats.
Stars: ✭ 1,751 (+1124.48%)
Mutual labels:  word
Fasttext.js
FastText for Node.js
Stars: ✭ 127 (-11.19%)
Mutual labels:  word2vec
Ml Projects
ML based projects such as Spam Classification, Time Series Analysis, Text Classification using Random Forest, Deep Learning, Bayesian, Xgboost in Python
Stars: ✭ 127 (-11.19%)
Mutual labels:  word2vec
Scattertext
Beautiful visualizations of how language differs among document types.
Stars: ✭ 1,722 (+1104.2%)
Mutual labels:  word2vec
Pytorch word2vec
Use pytorch to implement word2vec
Stars: ✭ 133 (-6.99%)
Mutual labels:  word2vec
Text rnn attention
嵌入Word2vec词向量的RNN+ATTENTION中文文本分类
Stars: ✭ 117 (-18.18%)
Mutual labels:  word2vec
Turkish Word2vec
Pre-trained Word2Vec Model for Turkish
Stars: ✭ 136 (-4.9%)
Mutual labels:  word2vec
An Array Of English Words
List of ~275,000 English words
Stars: ✭ 114 (-20.28%)
Mutual labels:  word
Role2vec
A scalable Gensim implementation of "Learning Role-based Graph Embeddings" (IJCAI 2018).
Stars: ✭ 134 (-6.29%)
Mutual labels:  word2vec
Etherpad Lite
Etherpad: A modern really-real-time collaborative document editor.
Stars: ✭ 11,937 (+8247.55%)
Mutual labels:  word
Docx
Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.
Stars: ✭ 2,150 (+1403.5%)
Mutual labels:  word
Bibword
Microsoft Word and Bibliography Styles extender.
Stars: ✭ 131 (-8.39%)
Mutual labels:  word

word2vec

Build Status GoDoc

word2vec is a Go package which provides functions for querying word2vec models (see https://code.google.com/p/word2vec). Any binary word2vec model file can be loaded and queried.

Requirements

Installation

If you haven't setup Go before, you need to first set a GOPATH (see https://golang.org/doc/code.html#GOPATH).

To fetch and build the code:

$ go get code.sajari.com/word2vec/...

This will build the command line tools (in particular word-calc, word-server, word-client) into $GOPATH/bin (assumed to be in your PATH already).

Usage

word-calc

The word-calc tool is a quick way to perform basic word calculations on a word2vec model. For instance: vec(king) - vec(man) + vec(woman) would be equivalent to:

$ word-calc -model /path/to/model.bin -add king,woman -sub man

See word-calc -h for full more details. Note that word-calc first loads the model every time, and so can appear to be quite slow. Use word-server and word-client to get better performance when running multiple queries on the same model.

word-server and word-client

The word-server tool (see cmd/word-server) creates an HTTP server which wraps a word2vec model which can be queried from Go using a Client, or using the word-client tool (see cmd/word-client).

$ word-server -model /path/to/model.bin -listen localhost:1234

A simple code example using Client:

c := word2vec.Client{Addr: "localhost:1234"}

// Create an expression.
expr := word2vec.Expr{}
expr.Add(1, "king")
expr.Add(-1, "man")
expr.Add(1, "woman")

// Find the most similar result by cosine similarity.
matches, err := c.CosN(expr, 1)
if err != nil {
	log.Fatalf("error evaluating cosine similarity: %v", err)
}

API Example

Alternatively you can interact with a word2vec model directly in your code:

// Load the model from an io.Reader (i.e. a file).
model, err := word2vec.FromReader(r)
if err != nil {
	log.Fatalf("error loading model: %v", err)
}

// Create an expression.
expr := word2vec.Expr{}
expr.Add(1, "king")
expr.Add(-1, "man")
expr.Add(1, "woman")

// Find the most similar result by cosine similarity.
matches, err := model.CosN(expr, 1)
if err != nil {
	log.Fatalf("error evaluating cosine similarity: %v", err)
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].