Sprog!

Solving Crossword Puzzles

This machine allows you to find words that fit a particular spot in a crossword puzzle. For example, to solve 3 down in the puzzle below, we need to find a word that matches the pattern:

something A something A something Y something T

A crossword puzzle

The Completed Machine

Completed machine

This machine works by applying a pattern match to the contents of a dictionary file. Unix/Linux systems will typically have a suitable dictionary file (one word per line) at /usr/share/dict/words. If you don't have a one, there are a number available for download from wordlist.sourceforge.net.

The machine is made a little more complex by the need to filter out things that occur in dictionary files, but not in crosswords:

This extra filtering is achieved with more pattern matching.

Step-by-Step

Read File properties

The data source for this machine is the system dictionary file, accessed via a Read File gear. Just select the name of the file to read.

Because the dictionary file contains one word on each line, gears which operate a-line-at-a-time also operate a-word-at-a-time.

Pattern Match 1 properties

The Pattern Match gear allows you use a Perl Regular Expression (or 'regex') to specify the pattern of letters in the word you want to match. Right-click on the gear and select Help, to read An Introduction to Perl Regular Expressions. The bare basics:

  • '^' matches the start of the line
  • '$' matches the end
  • '.' matches any character
  • a letter matches itself
Pattern Match 2 properties

A second Pattern Match gear is used to filter out lines containing apostrophes. The 'pattern' is just a single apostrophe.

Remember to check the box to 'Pass all lines except matches'. It doesn't really matter whether you leave 'Ignore case' on or off.

Since the machine contains multiple Pattern Match gears, you might like to rename this one to: Skip Apostrophes.

Pattern Match 3 properties

The third Pattern Match gear eliminates proper nouns by matching lines that start with a capital letter. This will only work if you untick 'Ignore case' and untick 'Pass all lines except matches'.

You might like to rename this gear to: Skip Proper Nouns.

Text Window properties The Text Window gear displays the matching words. The default property values are all fine.

Variations

If you're solving lots of crosswords, it's a little inefficient to filter out the apostrophes and the proper nouns every time you run the machine. A better solution would be to create your own dictionary file that does not include those lines. You can adapt this machine for that purpose by removing the initial Pattern Match gear and replacing the Text Window gear with a Write File gear.