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.0.tar.gz
(6.2 kB
view details)
Built Distribution
File details
Details for the file word-embedder-0.1.0.tar.gz
.
File metadata
- Download URL: word-embedder-0.1.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bacb3f37b84dbdf47d56603b2a836e394a1470cc3b1ee3ee201126aa83f76928 |
|
MD5 | c626b3a4c0960cd7ab0b78eea516ffda |
|
BLAKE2b-256 | 786b555136998a84ffaa01b10351be47981776a44311ba79e7baf794ca24ef3f |
File details
Details for the file word_embedder-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: word_embedder-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2525584042d4de55a7b3a00cb9c115ee92f003a7173cda32bfd07908da4d61c2 |
|
MD5 | 594f4db7cc281b384756599edcc22fe6 |
|
BLAKE2b-256 | c5b426331203d37967e10f02e4ce51814c755850bc5fad78023fc5eb79a68c07 |