Skip to main content

Spatialize linear text into pictures you can read: walks, spirals, dotplots, and concordances

Project description

lexograph

lexograph

Spatialize linear text into pictures you can read — in pure Python, rendered with matplotlib.

lexograph is the visualization member of the corpus-lx family (alongside chronowords, kenon, and keyflux). It turns a text into a picture through one four-step spine — segment → layout → encode → render — and ships several presets that are each just a point on that spine:

  • Punctuation spiral — every non-alphanumeric mark, in order, along an Archimedean spiral, coloured by symbol class.
  • Text walk (2-D / 3-D) — each sentence steps forward and turns 90°, space-filling; size, colour, and glyph encode per-unit attributes. The 3-D variant lifts the walk into a corkscrew.
  • Recurrence dotplot — the only preset that plots a text against itself: a sentence × sentence self-similarity grid that exposes internal echo structure.
  • Concordance — a term's dispersion across the text (and across texts/time), with optional KWIC.

Every preset returns a matplotlib Figure and never calls show(), so it renders inline in Jupyter and saves cleanly with fig.savefig(...). The core is headless and dependency-light; heavy analysis (sentence embeddings, graph centrality, communities) lives behind an optional [graph] extra.

Installation

uv add lexograph

The core depends only on numpy, matplotlib, and nltk.

Quickstart

from lexograph import (
    load_demo_text, punctuation_spiral, text_walk, recurrence_plot, concordance,
)

text = load_demo_text()  # Chapter 1 of Pride and Prejudice (public domain)

punctuation_spiral(text)                              # marks on an Archimedean spiral
text_walk(text)                                      # the 2-D space-filling walk
text_walk(text, helix=True, z_step=4.0)              # the 3-D corkscrew
recurrence_plot(text)                                # the text against itself
concordance(text, ["Bennet", "Bingley", "wife"])    # term dispersion

Every call returns a matplotlib Figure. For PageRank-sized, community-coloured, or semantically-recurrent figures, install the [graph] extra and feed lexograph.analyze.analyze_text's arrays into any preset.

The data contract

Every visual channel is fed by a plain per-unit array — a scalar array for size, an array of labels or values for colour, an optional glyph/font. Nothing in the core knows where those numbers came from, so you can drive a spiral or a walk from length, frequency, or your own column with no analysis stack at all. The optional analyze layer and the [kenon] / [chronowords] integrations only produce arrays that satisfy this contract.

Documentation

Full documentation — quickstart, a tutorial per preset, troubleshooting, and the API reference — is at lexograph.readthedocs.io. The sources live in docs/.

Roadmap

Open modelling and packaging decisions are analysed in CHANGES_SUMMARY.md, and the failure modes in PRE-MORTEM.md. The main not-yet-built pieces:

  • Vendor the four OFL/Apache handwriting fonts so the handwriting walk works out of the box (the width-step already runs on any TTF).
  • integrations/ — thin [kenon] and [chronowords] adapters over the data contract.
  • Optional interactive HTML/WebGL export (render/html.py), ported from the source viewers and gated behind a stretch extra.
  • A space-filling / non-self-overlapping turn rule for very uniform texts.

Made by

lexograph is made by Crow Intelligence.

License

MIT

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

lexograph-0.1.0.tar.gz (33.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lexograph-0.1.0-py3-none-any.whl (49.1 kB view details)

Uploaded Python 3

File details

Details for the file lexograph-0.1.0.tar.gz.

File metadata

  • Download URL: lexograph-0.1.0.tar.gz
  • Upload date:
  • Size: 33.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lexograph-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bfd65479455b90ae4c8a6258af53f742e550191398c04e6e16d07a2949b74b74
MD5 4b3fb5068678facc2f5bdb0270654f57
BLAKE2b-256 b674f97aa66b3e95642b39b376eb5dfa899c751a5a6dd8b0dd5335fb26a031d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for lexograph-0.1.0.tar.gz:

Publisher: publish.yml on crow-intelligence/lexograph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lexograph-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lexograph-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 49.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lexograph-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 11f3dcc82e63ccc153cc10d0cb89c9eec233f324a181838e8e5f5e5241e814a6
MD5 50dc350a3706cf7899cc61cae2d04cc9
BLAKE2b-256 3720880716cd5481ee6cc2efd98bec121e3d79dfc7b1a55c5700eae78a8b1779

See more details on using hashes here.

Provenance

The following attestation bundles were made for lexograph-0.1.0-py3-none-any.whl:

Publisher: publish.yml on crow-intelligence/lexograph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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