https://github.com/yoctol/word-embedder
Get pretrained word embedding
https://github.com/yoctol/word-embedder
Last synced: about 1 year ago
JSON representation
Get pretrained word embedding
- Host: GitHub
- URL: https://github.com/yoctol/word-embedder
- Owner: Yoctol
- License: mit
- Created: 2018-09-12T09:00:18.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-11-15T06:57:03.000Z (over 7 years ago)
- Last Synced: 2025-04-05T09:11:12.786Z (about 1 year ago)
- Language: Python
- Size: 53.7 KB
- Stars: 3
- Watchers: 8
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# word-embedder
[![travis][travis-image]][travis-url]
[![pypi][pypi-image]][pypi-url]
[travis-image]: https://img.shields.io/travis/Yoctol/word-embedder.svg?style=flat
[travis-url]: https://travis-ci.org/Yoctol/word-embedder
[pypi-image]: https://img.shields.io/pypi/v/word-embedder.svg?style=flat
[pypi-url]: https://pypi.python.org/pypi/word-embedder
Get pretrained word embedding
## Installation
### Requirements
* Linux
* Python 3.6 and up
`$ pip install word-embedder`
## Usage
### Lookup all existed embedders
```python
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
```python
from word_embedder import lib
name = 'OHOH' # embedder name
embedder = lib[name]
```
2. extract a word vector
- (1) given a word 'juice' (str)
```python
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)
```python
index = 3
embedder[index] # returns the corresponding word vector
# Note: if the index is out of range of vocabulary size,
# OOVError would be raised.
```