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-1.0.0.tar.gz
(7.9 kB
view details)
Built Distribution
File details
Details for the file word-embedder-1.0.0.tar.gz
.
File metadata
- Download URL: word-embedder-1.0.0.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc5fa5016fdaa2813debc0265794dd6cd76f9d1e479076c3293679500b901c0c |
|
MD5 | 7043898098830c5404b2feb09724d605 |
|
BLAKE2b-256 | 011e823d3c4e2b88534e0ae686e8d6e31d2c1678a1b58c5162f2158982e0674a |
File details
Details for the file word_embedder-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: word_embedder-1.0.0-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67b406105959ff4aeace8d6aefbc1f0bc7cac63b0dc198ab9d0000a8ae8ed2f1 |
|
MD5 | 601afdfdca07b80e4bd34a9c18b8d24b |
|
BLAKE2b-256 | 399c46e19a9ee67d95cca9658eb6c17e010ffa29faa9dc1c00be8001b12c9f11 |