Skip to content

Latest commit

 

History

History
142 lines (107 loc) · 6.19 KB

README.md

File metadata and controls

142 lines (107 loc) · 6.19 KB

WordSiv

WordSiv is a Python library for generating proofing text for an incomplete typeface.

CI


Documentation: https://wordsiv.com

Source Code: https://github.com/tallpauley/wordsiv


Say you've drawn HAMBUGERFONTSIVhambugerfontsiv., and want a sentence with only those glyphs:

from wordsiv import WordSiv

wsv = WordSiv(vocab="en", glyphs="HAMBUGERFONTSIVhambugerfontsiv.,")
print(wsv.sent(rnd=0.03))  # rnd lets us turn up the randomness

This returns something like:

Bears run saint that fighting bargain remove, genre MA Barbara registration the bug it others entering Steven.

Key Features

  • Shaped Text: WordSiv generates text that is roughly the shape of text in the desired language using word/punctuation probabilities and capitalization.
  • Easy Word Filtering: WordSiv selects from words that can be spelled with your current glyph set, so you don't have to worry about .notdef. Add additional word requirements (substrings, patterns, word length, etc.) on top without having to wrangle regex.
  • Letter Case Aware: WordSiv has a simple case argument to set the desired case of words, and choose whether to transform letter case of the words in the Vocab. Words like "I", "Paris", "DDoS", "WWF" will by appear in their original letter case by default (if the Vocab has capitalization).

Installation

Installing in DrawBot

  1. In the DrawBot menu, click Python->Install Python Packages:

  2. Enter git+https://github.com/tallpauley/wordsiv and click Go!

Screenshot of DrawBot "Install Python Packages" Window

Updating WordSiv in DrawBot

DrawBot caches Python packages/modules, so I'd recommend this process for updating to the latest version of WordSiv:

  1. In the DrawBot menu, click Python->Install Python Packages.
    • Click the dropdown Install / Upgrade and select Uninstall.
    • Enter wordsiv and click Go!.
  2. Restart DrawBot.
  3. Follow the above instructions to install the latest version of WordSiv.

Installing Outside of DrawBot

You can also install WordSiv on your system and use it in any Python script. You'll probably want to use a virtual environment or a Python tool that manages these for you, but I'll leave that up to you!

First, make sure you have Python 3.9+. Then:

pip install git+https://github.com/tallpauley/wordsiv

Why Simple Word Probability?

Proofing text doesn't necessarily have to be syntactically correct or have meaning. It just needs the right amount of common and uncommon words to give it a "realistic" shape. Often, type designers do this manually, such as in Jonathan Hoefler's fantastic proof:

Finally, I wanted the text to have the visual cadences of my native English, in which words of variable but digestible length are punctuated by shorter ones.

If we simply select words randomly, out of a hat which contains many more duplicates of, say, "the" than "etymology", we'll get a string of words which visually resembles a sentence. This is how WordSiv works: sampling words from a probability distribution which is determined by the occurrence counts of words in a corpus of text.

Of course, the more we restrict our glyph set, the more we've tampered with the natural distribution of words, since most of the longer, less-common words aren't available (which make up the long tail of the Zipf Distribution). However, we can blend in a bit of randomness to make it look like real text at a glance!

This might be more fun with LLMs, because the glyph-limited text could potentially be both grammatically and semantically correct. However, it remains to be seen if stability can be achieved while filtering out the majority of tokens. And more importantly, why spend so much more compute for so little payoff?

Related Resources

Software Tools Comparison

Revocab Type Author Glyphs Filtering Algorithm Probability
WordSiv CLI Chris Pauley Yes word probability (for now) Yes
Galvanized Jets web tool Samarskaya & Partners No static text N/A
Adhesion Text web tool Miguel Sousa Yes random word No
Word-o-mat Plugin Nina Stössinger No random word No
Test Text Generator web tool, CLI Tim Ahrens Yes trigram character prediction Yes

Other Resources

Revocab Author Notes
Proof a Typeface Jonathan Hoefler A concise and comprehensive proof of illustrative English words, covering all round/flat spacing trigrams, including bigrams for sentence start/end and 4-grams for repeated letters. Made to look more text-like with joining phrases like "of the".
LLM Lipogram Guide Corey Hanson A really cool example of using LLMs for lipograms.
AI Writing Assistant Allen Roush, Sanjay Basu, Akshay Moorthy, Dmitry Dubovoy Another example of filtering the output of an LLM for lipogram generation and more.