Skip to content

jayd2446/word-embedder

 
 

Repository files navigation

word-embedder

travis pypi

Get pretrained word embedding

Installation

Requirements

  • Linux
  • Python 3.6 and up

$ pip install word-embedder

Usage

Lookup all existed embedders

from word_embedder import lib

lib.list_all_embedders()  # returns a list of embedder name

Use an existed embedder

  1. load an embedder called OHOH
from word_embedder import lib

name = 'OHOH'  # embedder name
embedder = lib[name]
  1. 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.

About

Get pretrained word embedding

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.4%
  • Makefile 0.6%