Get pretrained word embedding
- Linux
- Python 3.6 and up
$ pip install word-embedder
from word_embedder import lib
lib.list_all_embedders() # returns a list of embedder name
- load an embedder called OHOH
from word_embedder import lib
name = 'OHOH' # embedder name
embedder = lib[name]
- extract a word vector
-
(1) given a word 'juice' (str)
word = 'juice' embedder[word] # returns the corresponding word vector # Note: if 'juice' is not in the vocabulary, # OOVError would be raised.
-
(2) given an index 3 (int)
index = 3 embedder[index] # returns the corresponding word vector # Note: if the index is out of range of vocabulary size, # OOVError would be raised.