Skip to main content

Pure-python reader for DAWGs (DAFSAs) that were created by dawgdic C++ library or the DAWG Python library. Optimized to run on CircuitPython.

Project description

Circuit DAWG

This pure-python package provides read-only access for files created by the dawgdic C++ library and the DAWG python package. It has been forked from DAWG-Python in order to provide support for Circuit Python.

This package is not capable of creating DAWGs. It works with DAWGs built by the dawgdic C++ library or the DAWG Python extension module. The main purpose of Circuit DAWG is to provide access to DAWGs on a microcontroller without requiring compiled extensions.

Installation

Clone this repository, or install with pip:

pip install circuit-dawg

Usage

The aim of circuit-dawg is to be API compatible with DAWG when it is possible.

First, you have to create a dawg using DAWG module:

import dawg
d = dawg.DAWG(data)
d.save('words.dawg')

And then this dawg can be loaded without requiring C extensions:

import circuit_dawg
d = circuit_dawg.DAWG().load('words.dawg')

Please consult DAWG docs for detailed usage. Some features (like constructor parameters or save() method) are intentionally unsupported.

Changes from DAWG Python

Circuit Python has a subset of the functionality of a full Python distribution. There were some built-in array methods from Python used for loading in the DAWG files that aren't present in Circuit Python, so they needed to be re-written.

Future Goals

Interact with DAWGs from file without loading into memory

Since Circuit Python is run on microcontrollers, memory is a commodity in very short supply. Loading a large DAWG into memory in order to interact with it is entirely unfeasible. Thus, I plan to make modifications to allow the DAWG to be read directly from the binary file without needing to load it all in.

Contributions are welcome!

Contributing

Check out the source code Submit an issue or suggestion

Feel free to submit ideas, bugs or pull requests.

Authors & Contributors

Forked from DAWG-Python by Mikhail Korobov - kmike84@gmail.com

The algorithms are from dawgdic C++ library by Susumu Yata & contributors.

License

This package is licensed under MIT License.

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

circuit-dawg-1.0.1.tar.gz (8.8 kB view details)

Uploaded Source

File details

Details for the file circuit-dawg-1.0.1.tar.gz.

File metadata

  • Download URL: circuit-dawg-1.0.1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for circuit-dawg-1.0.1.tar.gz
Algorithm Hash digest
SHA256 2a376d2de1e0d4eb7376be649f42ee6f99c4f13ecbbad5be8d3b697f76c33c38
MD5 2ac31b3453e6b2e4b2638547a3cdbb7c
BLAKE2b-256 31e20e031507adf65a2a1fcd95c874e64f802993214eedf62b11e7324bf0c622

See more details on using hashes here.

Supported by

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