Skip to main content

No project description provided

Project description

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.

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

wordflow-0.2.5.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

wordflow-0.2.5-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file wordflow-0.2.5.tar.gz.

File metadata

  • Download URL: wordflow-0.2.5.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Darwin/24.6.0

File hashes

Hashes for wordflow-0.2.5.tar.gz
Algorithm Hash digest
SHA256 688c5dac4878632d893ab05944538bbc609ffe46fbbfe735f7b8eb433c140169
MD5 7ce6cde2c0617082690591e7b1c1d0e4
BLAKE2b-256 eb271d25fb90614d7b99fff3cba28b8d61e8ce2f6c537a1c7f838b59f4548267

See more details on using hashes here.

File details

Details for the file wordflow-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: wordflow-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Darwin/24.6.0

File hashes

Hashes for wordflow-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ce5f767872079299f1d95a6f6666688eab32ad80e29cc33219028f6355079b89
MD5 bfd9fd4e66483343184af3bbb517ad5a
BLAKE2b-256 ee38bdd9362f10c0e215c589c3c650c14b4cb521969b308d14b197e683d951fd

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