Skip to main content

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:

  1. Character
  2. Word
  3. 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:

  1. Pure python implementation that is easy to modify anything to try new ideas. (other implementations require c++/rust expertise to modify the core)
  2. An easily shareable and inspectable model file. It is a simple text that can be inspected with less or cut. It includes info on which pieces were put together and what frequencies etc.
  3. 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.
  4. 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 as python -m nlcodec
  • nlcodec-learn -- CLI for learn BPE, with PySpark backend. Same as python -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

Authors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nlcodec-0.3.1.tar.gz (37.8 kB view details)

Uploaded Source

Built Distribution

nlcodec-0.3.1-py3-none-any.whl (51.3 kB view details)

Uploaded Python 3

File details

Details for the file nlcodec-0.3.1.tar.gz.

File metadata

  • Download URL: nlcodec-0.3.1.tar.gz
  • Upload date:
  • Size: 37.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.7.7

File hashes

Hashes for nlcodec-0.3.1.tar.gz
Algorithm Hash digest
SHA256 2a0dc18941c4ab9aafc8aea0c168851e9778c3ac75e3e79409eb7d6d76f593ff
MD5 c63be841ce01b6cf4f32220dbe397831
BLAKE2b-256 a5bb475b141623d2ccfab636f23a16177b3c7f63435e196272257f5fd4b65931

See more details on using hashes here.

File details

Details for the file nlcodec-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: nlcodec-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 51.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/53.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.7.7

File hashes

Hashes for nlcodec-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6e7636b605b87afb3b66e1d8f4bd7f9998889374b41a8b02bdaf3ae4aed035e2
MD5 32c6a8663f2b080a6c0280b1cfc30327
BLAKE2b-256 f3e8e631817f032a14f4afdd0b0b764e96bd6090c850ce480426f7d99d4852c9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page