Skip to main content

WordFlow

WordFlow provides several simplified command-line utilities meant to be composed with UNIX pipes. This package is part of Making With Code, a Constructionist introductory CS curriculum. Most of these utilities duplicate existing functionality of built-in shell commands, but our goal is to provide the cleanest, simplest possible interface to maximize expressivity while minimizing cognitive load for beginners.

These utilities read lines of space-separated tokens from stdin and write to stdout. Several commands have an optional position argument (default=0) specifying which token to use on each line.

Usage examples

First, get ahold of a file containing a list of words. A word list is [built in to Unix and Linux](https://en.wikipedia.org/wiki/Words_(Unix). Or here's a list you can download.

Get the 1000 most common words

$ cat words.txt | frequency | order | pluck 1 | head -n 1000

How many words contain two vowels in a row

$ cat words.txt | match "aa|ee|ii|oo|uu" | count

What's the shortest word containing all five vowels?

$ cat words.txt | match "a" | match "e" | match "i" | match "o" | match "u" | length | order | head

What are the most common ten-letter words?

$ cat words.txt | length | put 10 | equal | frequency 2 | order -r | pluck 3 | head

What's the longest word which contains no repeated letters?

$ cat words.txt | length | unique 1 | length | lessthan 0 1 -e | lessthan 1 0 -e | 

Filter

  • match [pattern] [position=0]: Allows lines where the specified word matches regular expression pattern. Regular expressions often need to be in quotation marks.
  • lessthan [position0=0] [position1=1] [-e --equal]: Allows lines where the number at position 0 is less than the number at position 1. When --equal, lines are also allowed when the two numbers are equal.
  • equal [position0=0] [position1=1]: Allows lines where the number at position 0 is equal to the number at position 1.

Map

  • put [value] Prepends the value to each line.
  • length [position=0] Prepends the length of the specified word to the line.
  • frequency [position=0] Prepends the frequency of the specified word (approximate number of occurrences per billion words) to the line.
  • pluck [position=0] Replaces each line with the specified token.

Sort

  • order [position=0] [-r --reverse] Sorts lines according to the specified token. When the specified token is a number, sorts numerically, otherwise lexically.

Reduce

  • count counts the number of lines sent to stdin.

Metadata

Release files for wordflow 0.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wordflow 0.2.6
File Size Uploaded
wordflow-0.2.6.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wordflow 0.2.6
File Interpreter ABI Platform
wordflow-0.2.6-py3-none-any.whl Python 3 none any Details

Total release size: 13.1 kB

Release files / wordflow-0.2.6.tar.gz

Download URL wordflow-0.2.6.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3d2d57fb96f0373215c6275342f432773c1b2874763704f1a31c208a6659956b
BLAKE2b-256 checksum
How to use checksums
d47d84a8f432962f084678e7813c0e443431e2578dac319c60dbf0fdd1451c30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.4 {"installer":{"name":"uv","version":"0.11.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / wordflow-0.2.6-py3-none-any.whl

Download URL wordflow-0.2.6-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5efc591fb213f4fc7063949410e2539ada07b2b2fc04b6b00201b51c0335e24f
BLAKE2b-256 checksum
How to use checksums
6354d7e71002d5bb04214b8fbee36a0840f4dafebc1e46fd86a3178d2c904831
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.4 {"installer":{"name":"uv","version":"0.11.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.2.6 This release

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page