Word Embedder
Project description
# 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.
```
[![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.
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
word-embedder-0.1.1.tar.gz
(7.6 kB
view details)
Built Distribution
File details
Details for the file word-embedder-0.1.1.tar.gz
.
File metadata
- Download URL: word-embedder-0.1.1.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f745f7728b67a7f7fca98fd83cd25f039d7a502686007dac73461e06bb295ce2 |
|
MD5 | 123ea8a5e260cabecd8f342fe6a7abc8 |
|
BLAKE2b-256 | dec9567c8d39ab05421075437ec684e9f447f92841a2085c47e568085979f17a |
File details
Details for the file word_embedder-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: word_embedder-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0ca030d1e1836bb8ba7c10e93b495951319d66167d7010467cbd1f6f6c4658e |
|
MD5 | d5a3af930a9c306fbc286eef8c935ca8 |
|
BLAKE2b-256 | 3c41a97854fde38983f6b1b544191d8591da3ad6ead6d6f2cee91f4b5889045e |