<commit_before># torch-word-emb
load word embeddings to Torch tensor.


## Install
Torch 7 required.
```
git clone https://github.com/iamalbert/torch-word-emb
luarocks install torch-word-emb/torch-word-emb-1.1-4.rockspec
```


## Usage

```lua
local wordemb = require 'wordemb'

local w2v = wordemb.load_word2vec_bin("/path/to/word2vec/model.bin")
```

`load_word2vec_bin` returns a table of two fields. `vec` is 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, repesenting the corresponding position of such word in `vec`.

```lua
print(w2v.vec:size())
print(w2v.vec[ w2v.words["apple"] )
```

<commit_msg>fix typo in readme<commit_after># torch-word-emb
load word embeddings to Torch tensor.


## Install
Torch 7 required.
```
git clone https://github.com/iamalbert/torch-word-emb
luarocks install torch-word-emb/torch-word-emb-1.1-4.rockspec
```


## Usage

```lua
local wordemb = require 'wordemb'

local w2v = wordemb.load_word2vec_bin("/path/to/word2vec/model.bin")
```

`load_word2vec_bin` returns a table of two fields. `vec` is 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, repesenting the corresponding position of such word in `vec`.

```lua
print(w2v.vec:size())
print(w2v.vec[ w2v.words["apple"] ] )
```


{'fraction_non_alphanumeric': 0.1386347642505278, 'fraction_numerical': 0.01688951442646024, 'mean_word_length': 4.533073929961089, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5116472', 'n_tokens_mistral': 527, 'n_tokens_neox': 505, 'n_words': 155}