skillfed

DAWG2-Python

Pure-python reader for DAWGs (DAFSAs) created by dawgdic C++ library or DAWG Python extension.

dawg2-python v0.9.0 400.6K downloads/30d#6,937 on PyPI0
Permissive license MIT Active released

What it is and what it does

DAWG2-Python is a pure-Python reader for DAWG (directed acyclic word graph) files, a space-efficient data structure for storing and querying large sets of strings with common prefixes. It provides read-only access to DAWGs built by the dawgdic C++ library or the DAWG Python extension, without requiring compiled dependencies. The package aims for API compatibility with the original DAWG module where feasible, making it a drop-in replacement for loading and querying pre-built DAWGs.

The main use case is accessing DAWG data structures in pure Python environments—particularly under PyPy, where it performs well—or when you want to avoid the compilation overhead of C extensions. It supports prefix-based lookups, key iteration, and membership testing. The package is read-only by design; DAWGs must be created externally using the DAWG or dawgdic libraries.

Use it for:

  • Load and query large word lists or dictionaries built as DAWGs without C extension dependencies.
  • Perform prefix-based searches on linguistic or dictionary data stored in DAWG format.
  • Run DAWG lookups under PyPy for better performance than CPython without recompiling.
  • Integrate DAWG-based data structures into pure-Python applications or libraries.
  • Check membership and iterate over keys in pre-built DAWG files for NLP or spell-checking tasks.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Read-only access to DAWG (directed acyclic word graph) files created by the dawgdic C++ library or DAWG Python package, without requiring compiled extensions.

Yes. The package is actively maintained, has no known vulnerabilities, installs with minimal friction, and solves a specific problem well: reading DAWG files in pure Python. Install it if you have pre-built DAWG data and want to query it without compiled extensions or C dependencies. Not suitable if you need to create DAWGs or require the fastest possible CPython performance.

Install

dawg2-python on PyPI

pip

pip install dawg2-python

uv

uv add dawg2-python

poetry

poetry add dawg2-python

Installing DAWG2-Python

Before you install

Low friction: single pure-Python dependency (typing-extensions), wheel distribution, and active maintenance with recent commits. Supports Python 3.8 through 3.13 and PyPy.

License in practice

MIT license is permissive; you may use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

Quickstart

pip install DAWG2-Python

from DAWG2-Python import DAWG

d = DAWG().load('words.dawg')
if 'word' in d:
    print(d['word'])

Requires a pre-built DAWG file created by the DAWG Python package or dawgdic C++ library; this package cannot create DAWGs.

Verify before relying

  • Whether performance under CPython (stated as ~50x slower than PyPy) is acceptable for your use case.
  • Compatibility with DAWG files created by specific versions of the dawgdic or DAWG libraries.
  • Exact API compatibility scope with the original DAWG module beyond what the description states.

Package facts

License MIT (permissive)
Python support supports the current Python release (<4.0,>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 1 — typing-extensions
Maintenance actively maintained — 543 days since the last release
Last repo commit
First released
Downloads 400,636/month — #6,937 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: dawg2_python-0.9.0-py3-none-any.whl

Development Status :: 4 - BetaIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Scientific/Engineering :: Information AnalysisTopic :: Software Development :: Libraries :: Python ModulesTopic :: Text Processing :: Linguistic

Tags

dawg reader pure pythondirected acyclic word graphtrie-like data structure lookupprefix search dictionarylinguistic data structureword graph file readerno-compile dawg access
data-structuresnlp-toolspure-python

More Python Modules packages