GithubHelp home page GithubHelp logo

vseledkin / torch-word-emb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from iamalbert/torch-word-emb

0.0 2.0 0.0 25 KB

load word embeddings to Torch.Tensor

License: BSD 3-Clause "New" or "Revised" License

Makefile 13.55% C 86.45%

torch-word-emb's Introduction

#torch-word-emb Load your word embeddings (Word2Vec and GloVe) into Torch tensor.

Install

Torch 7 required.

luarocks install torch-word-emb

or

git clone https://github.com/iamalbert/torch-word-emb
cd torch-word-emb && luarocks make

Usage

local wordemb = require 'wordemb'

wordemb.load_word2vec_bin(path)

read word2vec binary-format model from path.

returns a table of two fields.

  • vec is a torch FloatTensor of size V x D, where V is the vocabulary size and D is the dimension of word2vec.
  • words is a table of (word,offset) pairs, each of which represents the corresponding index of such word in vec.
local w2v = wordemb.load_word2vec_bin("/path/to/word2vec/model.bin")
print(w2v.vec:size())
print(w2v.vec[ w2v.words["apple"] ] )

wordemb.load_word2vec_text(path)

read word2vec text-format model from path.

wordemb.load_glove_text(path)

read GloVe text-format model from path.

torch-word-emb's People

Contributors

iamalbert avatar

Watchers

Viacheslav Seledkin avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.