Skip to main content

Lexitron

A command-line regex search engine for the English language.

Requirements

The only requirement is Python 3.9 or later.

If you try to install Lexitron and something goes wrong, let me know what your system details are and I'll try to get it fixed.

Installation

Lexitron is available on the Python Package Index (pip). To install, simply type

$ pip install lexitron

at the command line.

Once the install is complete, you can access Lexitron with the lx command at the terminal.

Quick tour

  • lx '.*icide': words ending in "icide"
  • lx -s rdb: words containing "rdb" anywhere
  • lx 'b.a.k': five-letter words matching B?A?K
  • lx -a listen: anagrams of "listen"
  • lx -f aeilnrst: words you can spell from these letters
  • lx -f abcdef.: the same, with a blank tile
  • lx -l 4- -rf eihnglw -s h: today's Spelling Bee (center letter "h")
  • lx -n '.*tion': how many words end in "tion"

More in Examples.

Usage

Usage syntax is

$ lx [options] expression
$ lx -f|-a [options] letters [expression]

where expression is a regular expression and [options] are as follows.

The expression must match the whole word, so lx cat finds only "cat", and lx ".*cat" finds words ending in "cat". To match the expression anywhere within a word, use -s (so lx -s cat finds "cat", "catalog", "bobcat", etc).

Inflected forms (plurals, conjugations, etc, like "went" or "oxen") are searched along with base forms. Use -b to search base forms only. Phrases with spaces are listed in their base form only ("sperm whale", not "sperm whales").

Searches are case-insensitive unless you use -c. Options can go before or after the expression. Quote the expression ('...') so your shell doesn't interpret characters like *, ? and $.

zsh tip: add alias lx='noglob lx' to your ~/.zshrc and you can skip the quotes for * and ?: lx .*icide, lx -f abcdef?.

A little regex

pattern matches
. any one character: b.a.k is B?A?K
.* anything, including nothing: .*cake, un.*able
[aeiou] one of these letters
[^aeiou] any letter except these
x+, x? one or more x; zero or one x: colou?r
x{3}, x{2,4} exactly 3 x; 2 to 4 x
a|b a or b: cat|dog
(...)\1 a group, then the same text again: (...)\1 is "murmur"
(?=.*e) lookahead: "the word contains an e"

What to match

option function
-s Match anywhere within a word, rather than the whole word
-c Case-sensitive search
-l N Only words with this many letters: 5, 4-7, 5- (5 or more) or -7 (up to 7)
-f Only words spelled from the given letters, each used at most as often as given; ? or . is a blank
-a Only anagrams: words that use exactly the given letters
-r With -f or -a, letters may be used any number of times

With -f and -a, the letters come first, optionally followed by an expression: lx -a aerst finds all anagrams of "aerst", lx -a aerst 's.*' only the ones starting with "s". Lengths and letters count letters only, ignoring apostrophes, hyphens and spaces.

In the letters, ? or . is a blank tile that can stand for any one letter: lx -f 'abcdef?'. Quote it when using ?, or your shell may treat it as a filename wildcard (zsh says "no matches found"). . needs no quotes. With -a, blanks must be used, like the rest of the letters.

option function
-b Search only base forms, not inflected forms like plurals and conjugations
-L N Include words up to this obscurity level (see Word list); default 70
-p Include phrases and hyphenated entries, like "sperm whale"
-P Search only phrases and hyphenated entries
-u Include uppercase/proper words (like "France") in addition to lowercase/common words
-U Search only for uppercase/proper words

Output

option function
-i Print info header along with search results
-n Print only the number of matches
-o ORDER Sort by family (the default; see Output), alpha, length (shortest first) or common (most common first)
-x Print unformatted output, one word per line
-h Print help and exit
-v Print version and exit

Type $ lx -h for full help text.

If you aren't familiar with regular expressions, it isn't too hard to learn the basics. There are many resources online. A good starting point is the Wikipedia article.

Output

By default, Lexitron will output a well-formatted (potentially multi-column) list of words. Use -i to add a header describing the results.

Words are sorted alphabetically, except that inflected forms (plurals, conjugations and so on) come right after their base form when it's also in the results: "run ran running runs runabout". In a terminal, the inflected forms are dimmed, so each family stands out, and the other words are colored by how common they are: bold green for core vocabulary, then green, yellow and orange, to red for the most obscure (see Word list). -o alpha sorts strictly alphabetically, with the same styling. Set NO_COLOR in your environment to turn styling off.

The results are separated into "proper" words (containing capitals, like "France" or "USA") and "common" words (lowercase, like "boat").

Using the -x flag will return a more machine-readable output with one word per line. This is also what you get automatically when the output isn't a terminal (e.g. when piping into another command or redirecting to a file). In that case the -i header goes to stderr, so it doesn't get mixed in with the words.

Word list

Lexitron's dictionary comes from the English Speller Database (SCOWL), which grades every word by how well known it is:

level roughly lowercase words
35 core vocabulary 41,000
50 words in a small dictionary 65,000
60 a standard dictionary (what spellcheckers use) 84,000
70 a large dictionary (the default) 134,000
80 obscure words 198,000
95 everything 253,000

All spellings are included: American, British, Canadian and Australian ("color" and "colour", "organize" and "organise"). Accents are removed ("café" becomes "cafe"). Possessives, abbreviations and Roman numerals are left out.

Examples

Word games

NYT Spelling Bee. Words of 4 or more letters, using only the seven letters (each as often as you like), that contain the center letter "h" (-s h). Spelling Bee doesn't accept contractions like "he'll".

$ lx -i -l 4- -rf eihnglw -s h
38 matches for /h/ from 'eihnglw'

ghee         high         wheelie
ghillie      hill         wheen
he'll        hinge        when
heel         hinging      whew
heeling      neigh        while
heinie       neighing     whiling
hell         nigh         whin
henge        nihil        whine
hewing       weigh        whining
hewn         weighing     whinge
hieing       whee         whingeing
higgle       wheel        whinging
higgling     wheeling

Spelling Bee pangrams. -ra finds words that use every one of the letters, each as often as you like.

$ lx -ra eihnglw
wheeling

Wordle. "r" is second and "n" is fourth, there's an "e" somewhere, and "o", "s" and "t" are out. (?=.*e) is a lookahead: "contains an e".

$ lx '(?=.*e)[^ost]r[^ost]n[^ost]'
arena
brine
crane
crine
frena
prune
urine

Crossword fill. Five letters, B?A?K, most common first.

$ lx -o common 'b.a.k'
black
blank

Scrabble bingos. Every anagram of a rack.

$ lx -a retains
antsier
nastier
retains
retinas
retsina
stainer
stearin

Words from a rack. Five-letter words from "aeilnrst", most common first.

$ lx -o common -l 5 -f aeilnrst | head
aisle
alert
alien
aline
alter
aren't
arise
earls
earns
inert

Blank tiles. ? stands for any one letter. Six-letter words or longer from "abcdef" plus a blank:

$ lx -l 6- -f 'abcdef?'
abduce
bached
backed
barfed
braced
cabbed
cabled
chafed
decaff
decafs
deface
fabled
facade

and the anagrams that use every tile:

$ lx -a 'zebr?'
braze
zebra

Exploring English

Words ending in "icide".

$ lx ".*icide"
aborticide      herbicide       patricide
acaricide       homicide        pesticide
algicide        infanticide     regicide
bactericide     insecticide     rodenticide
deicide         larvicide       sororicide
feticide        liberticide     spermicide
filicide        matricide       suicide
foeticide       menticide       tyrannicide
fratricide      miticide        uxoricide
fungicide       parasiticide    vaticide
germicide       parricide       vermicide

Words containing "rdb", with the info header.

$ lx -is rdb
18 matches for /rdb/

birdbath       hardbitten
birdbaths      hardboard
birdbrain      hardbound
birdbrains     swordbill
birdbrained    swordbills
cardboard      wordbook
hardback       wordbooks
hardbacks      yardbird
hardball       yardbirds

All five vowels, in order.

$ lx '[^aeiou]*a[^aeiou]*e[^aeiou]*i[^aeiou]*o[^aeiou]*u[^aeiou]*'
abstemious
abstemiously
arsenious
facetious
facetiously

The longest words you can type on the top row of a keyboard.

$ lx -o length '[qwertyuiop]+' | tail -3
proprietor
repertoire
typewriter

How many words end in "tion"?

$ lx -n ".*tion"
2299

(Take this with a grain of salt: it depends on what you count as a word, and which technical or niche jargons are included. Try -L 95 to include obscure words.)

Words ending in "woman" versus words ending in "man" but not "woman". (?<!wo) is a lookbehind: "not preceded by wo".

$ lx -n ".*woman"
72
$ lx -n '.*(?<!wo)man'
323

The same double letter twice, except vowels and "s" (to skip "-lessness"), including proper words. \1 repeats whatever (...) matched, and -b leaves out plurals like "hillbillies".

$ lx -ibus "([^aeious])\1.*\1\1"
50 matches for /([^aeious])\1.*\1\1/ (8 proper, 42 common)

Allhallowmas
Allhallows
Allhallowtide
Boccaccio
Chancellorsville
Connellsville
Llewellyn
Ulladulla

acciaccatura        hullaballoo         pralltriller
allegorically       idyllically         razzamatazz
allergically        illegally           razzmatazz
ballistically       illiberally         riffraff
bellpull            illogically         rollerball
chiffchaff          intellectually      scuttlebutt
collaterally        jellyroll           skillfully
colloquially        kinnikinnick        syllabically
dillydally          metallically        syllogistically
dullsville          millennially        unskillfully
elliptically        monosyllabically    villanelle
flibbertigibbet     pellmell            volleyball
granddaddy          phallically         whippersnapper
hillbilly           pizzazz             willfully

Acronyms of five or more letters: proper words only (-U), in capitals (-c).

$ lx -Uc '[A-Z]{5,}' | head
ALGOL
ANZUS
ASCII
ASEAN
ASPCA
AWACS
BAFTA
BASIC
BOGOF
CAPTCHA

Phrases and compounds ending in "cake".

$ lx -p ".*cake" | head
angel cake
angel food cake
beefcake
buckwheat cake
cake
cheesecake
coffee cake
coffeecake
cotton cake
cupcake

Only phrases. -P leaves out single words.

$ lx -P 'sperm.*'
sperm bank
sperm cell
sperm oil
sperm whale
spermatic cord

Using Lexitron from Python

>>> from lexitron import search
>>> search('.*icide', sort='common')['common'][:3]
['fungicide', 'germicide', 'homicide']

search() takes the same options as the command line; see its docstring.

Changes in version 3.3.1

  • Long option names are consistent: --only-phrases and --only-uppercase are now --phrases-only and --uppercase-only, like --base-only and --number-only. The old names still work.

Changes in version 3.3

  • Phrases with spaces are listed in their base form only: "sperm whale" but not "sperm whales". SCOWL lists inflected forms for only a few phrases, so they're left out for consistency. Hyphenated words keep theirs ("x-rayed").

Changes in version 3.2

  • New option -P searches only phrases and hyphenated entries, like "sperm whale"; -p still adds them to the usual results.

Changes in version 3.1

  • New default sort, family: alphabetical, with inflected forms right after their base form ("run ran running runs"). -o alpha gives the old order.
  • Terminal output is styled: inflected forms listed under their base form are dimmed, and other words are colored by how common they are, from bold green to red. Set NO_COLOR to turn this off; piped output is never styled.

Changes in version 3.0

  • New word list: SCOWL replaces AGID, adding everyday words AGID was missing ("a", "of", "from"), British and other spellings, and obscurity levels (-L). The default level leaves out very obscure words; use -L 95 to search everything.
  • Expressions now match the whole word by default. In 2.x, lx cat matched any word containing "cat"; to get that behavior now, use lx -s cat.
  • Inflected forms (plurals, conjugations, etc) are now searched too; use -b to search base forms only, as in 2.x.
  • New options: letters (-f, -a, -r, with ? blank tiles), length (-l), sorting (-o), phrases (-p) and case-sensitive search (-c).
  • Options can go anywhere on the command line.
  • Output no longer crashes when piped or redirected; it falls back to one word per line.
  • -i with -n prints the header line; -u and -U can no longer be combined.
  • Invalid regular expressions give a short error message instead of a traceback.
  • Quotation marks in the expression are no longer stripped, so you can search for words containing apostrophes.
  • Lexitron can be used as a Python library.
  • Requires Python 3.9 or later.

Acknowledgements

For its dictionary, Lexitron uses the English Speller Database (ESDB, previously known as SCOWL) by Kevin Atkinson. See wordlist.aspell.net and lexitron/SCOWL-Copyright.txt for its copyright and license.

Versions before 3.0 used the Automatically Generated Inflection Database (AGID), also by Kevin Atkinson.

License

Lexitron is licensed under GNU GPL Version 2.

Contact

Questions, bug reports, and feature requests can be filed on the Github issues tracker.

Metadata

Release files for Lexitron 3.3.1

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

Source distribution (sdist)

Source distribution for Lexitron 3.3.1
File Size Uploaded Provenance
lexitron-3.3.1.tar.gz 1.5 MB With provenance Details

Built distribution (wheel)

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

Total release size: 2.9 MB

Release files / lexitron-3.3.1.tar.gz

Download URL lexitron-3.3.1.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
5e56b66161c4e2ef3a0221e5b6d2ad888c06a80be90442bed4dcd90030c778ff
BLAKE2b-256 checksum
How to use checksums
febc6b312d6ea9ce0354a9ac99b1f1511f99b2af708758f16997348906f3b61c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / lexitron-3.3.1-py3-none-any.whl

Download URL lexitron-3.3.1-py3-none-any.whl
Size 1.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
294ec563b8a7c1d44feec64fe19a66e3714a93eb51a97fb602469ed524ab3b5e
BLAKE2b-256 checksum
How to use checksums
c4a355d28eb3f97ce7f03fd823a0dcc2bc799fef7723a2d37a0009326db7bb40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for Lexitron 3.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for lexitron-3.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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