nlcodec is a collection of encoding schemes for natural language sequences. nlcodec.db is a efficient storage and retrieval layer for integer sequences of varying lengths.
Project description
NLCodec
NOTE: The docs are available at https://isi-nlp.github.io/nlcodec
A set of (low level) Natural Language Encoder-Decoders (codecs), that are useful in preprocessing stage of NLP pipeline. These codecs include encoding of sequences into one of the following:
- Character
- Word
- BPE based subword
It provides python (so embed into your app) and CLI APIs (use it as stand alone tool).
There are many BPE implementations available already, but this one provides differs:
- Pure python implementation that is easy to modify anything to try new ideas. (other implementations require c++/rust expertise to modify the core)
- An easily shareable and inspectable model file. It is a simple text that can be inspected with
less
orcut
. It includes info on which pieces were put together and what frequencies etc. - Reasonably faster than the other pure python implementations. Under the hood tries, doubly linked lists, max-heaps, hash maps etc data-structures to boost performance.
- PySpark backend for extracting term frequencies from large datasets.
Installation
Please run only one of these
# Install from pypi (preferred)
$ pip install nlcodec --ignore-installed
# Clone repo for development mode
git clone https://github.com/isi-nlp/nlcodec
cd nlcodec
pip install --editable .
pip installer registers these CLI tools in your PATH:
nlcodec
-- CLI for learn, encode, decode. Same aspython -m nlcodec
nlcodec-learn
-- CLI for learn BPE, with PySpark backend. Same aspython -m nlcodec.learn
nlcodec-db
-- CLI for bitextdb.python -m nlcodec.bitextdb
nlcodec-freq
-- CLI for extracting word and char frequencies using spark backend.
Docs are available at
- HTML format: https://isi-nlp.github.io/nlcodec (recommended)
- Locally at docs/intro.adoc
Citation
Refer to https://arxiv.org/abs/2104.00290
@misc{gowda2021manytoenglish,
title={Many-to-English Machine Translation Tools, Data, and Pretrained Models},
author={Thamme Gowda and Zhao Zhang and Chris A Mattmann and Jonathan May},
year={2021},
eprint={2104.00290},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
Authors
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
Built Distribution
File details
Details for the file nlcodec-0.3.2.tar.gz
.
File metadata
- Download URL: nlcodec-0.3.2.tar.gz
- Upload date:
- Size: 39.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.25.1 setuptools/54.0.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67b38189f8d2ec053d74a7497ebd46175e5d397ce5e8b3e636418d4562504d60 |
|
MD5 | 31850beac5c428fe9e4056433e65feb4 |
|
BLAKE2b-256 | 289e194158bd7b179ed2070f905b62ed53c9f5738f95b5cec79568abbf8e3bf3 |
File details
Details for the file nlcodec-0.3.2-py3-none-any.whl
.
File metadata
- Download URL: nlcodec-0.3.2-py3-none-any.whl
- Upload date:
- Size: 52.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.25.1 setuptools/54.0.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59f946547efac15acec371fb6a761e8cf87983290ece5370a64a51de9d09b916 |
|
MD5 | a9ed8a15789cecf9fe82219be5e21f52 |
|
BLAKE2b-256 | 019f845a47819ed9827791e74b9c3a3ec5dd101b74826d541cb9de97404a60fc |