program to find pattern-matching words with optional synonyms and also anagrams
By David M. Balean
This describes wordmatch
for finding words which match a pattern. This version can also find
which may optionally match a pattern and the letters making the anagram
can have unknown characters. Also it can optionally provide
synonyms, auto-include hyphens and/or be case sensitive. It
requires Gtk 3 and by default it uses /usr/share/dict/words for the words and /usr/bin/aiksaurus for the synonyms. This is quite useful for those who get bogged down when solving a crossword puzzle!
To install in Fedora (64 bit, i.e. x86_64) use the following command as root:-
# rpm -Uvh wordmatch-1.0-1.fc14.x86_64.rpm
# yum localinstall wordmatch-1.0-1.fc14.x86_64.rpm
To install in Ubuntu or other Debian based systems, download the RPM and
convert it to DEB format using the command as root:-
# alien -d wordmatch-1.0-1.fc14.x86_64.rpm
from the command line assuming the system is x86_64. The resulting .deb file
can be installed by clicking on it with the mouse. To install on a
non-x86_64 compatible system such as i386 or sparc, the tar file will have to be
downloaded and compiled from scratch.
An .rpm spec file is included. To create an .rpm file for the current operating system, open a console window and change to the directory containing wordmatch-1.0.tar.gz and issue the following command as the normal user:-
$ rpmbuild -ta wordmatch-1.0.tar.gz
This should create an .rpm file in the directory rpmbuild in the user's directory. If you are using an i386 system, the resulting .rpm file should be wordmatch1.0-1.fc14.i386.rpm. This can be installed on an RPM based system using rpm -Uvh as above or on a DEB based system using alien -d as above.
When wordmatch starts the user is presented with the main window in search mode. Select Search for anagrams to change to anagram mode. Select Search for matches to return to search mode.
There are three check boxes in the Options frame, Append synonyms, Case sensitive and Auto-include hyphens. Select as required and enter a search pattern in the Search Pattern
entry area. Case sensitive means that upper and lower case are
treated as different letters and the words have to match the case of
the letters in the pattern. If Append synonyms is chosen then synonyms from the thesaurus are appended to each word in the output window. If Auto-include hyphens
had been selected then all hyphenated words would be included in the
output. There are a few characters reserved with special meanings for pattern-matching as follows:-
? question mark selects any single character.
f?r selects any single character for the ? so the output window should include far, for and fur.
* asterisk selects any string of characters including none.
f*r selects any string of characters for the * so the output window should include far, for, fur, feather, fair and many more.
[ ] All alternatives must be in square brackets
[abc] selects one of the characters between the square brackets, in this case the single character matches either a, b or c.
e.g. ch[aeiou]p should find chap, chip and chop.
( ) round brackets for alternative strings of characters .
[(abc)(de)] selects either string abc or string de as the pattern to be matched. The strings are within round brackets.
e.g. ?[(ex)(ot)]??r should find numerous words including bother, potter and sexier.
This is very similar to search mode. There is extra check box which appears in the options, With Search Pattern.
If this is left clicked the search pattern entry appears so that the
user can choose a pattern. Only anagrams fitting this pattern will be
displayed in the output, otherwise all anagrams will be
displayed. The user can choose to have synonyms displayed, hyphens can
be auto-included in the anagrams and the user can choose to
make the anagrams case sensitive. This is all very similar to the
search mode above. In addition the user can use ? for each unknown character.
Search, Preferences and Close
When the various selections have been made, the user should left click on the Search
button to commence the search for either matches or anagrams. The
results will be displayed in a separate window. If the user clicks the Preferences
button the user can select the sizes for the windows used by the
program. The user also has the opportunity to change the pathname of
the word list that is searched so that an alternative may be used
instead. The command for the synonyms program can also be
changed. The %s represents the word for which a synonym is being
sought. Left click the OK button to save the new choices and quit preferences or left click the CANCEL button to quit preferences without saving. The preferences are saved to the file .wordmatch in the user’s home directory. The defaults are /usr/share/dict/words and /usr/bin/aiksaurus %s. It should be noted that /usr/share/dict/words doesn’t include "words" which include white space e.g. "white elephant" although this would be found by wordmatch if present. I don’t know if there is a list which includes such words.
Screen Shots with Info
window, search mode
This is the main window in search mode when wordmatch starts. Select Search for anagrams to change to anagram mode.
Right click in the main window to obtain a very simple popup menu. All the items except About can be more easily obtained by clicking on the appropriate button.
Output window, pattern search
In this case, the pattern entered was chu?p and only one word, chump, was found. Also, Append synonyms was selected so various words with a similar meaning are displayed.
window, anagram mode
Here the user has selected anagram mode and also Auto-include hyphens.
Output window, anagram mode
This example shows the result of the above anagram search. There is one hyphenated word included, close-up.
Output window, anagram mode as above but with an unknown character
This example shows seven extra anagrams if the "s" is unknown. The "?" permits any character to replace it.
window, anagram mode with search pattern and an unknown character
It is also possible to search for anagrams that fit a pattern. In this case there was one unknown character "?".
This is the result of the above anagram search. There is only one anagram beginning with "c" and ending with "t".
Output window - bad pattern
This is an example shows what may happen if there is something wrong with the pattern.
The user can select preferred window sizes, where to obtain the words for matching and the command to obtain synonyms.
(size 234.3 KB - source files)
Download wordmatch-1.0-1.fc14.x86_64.rpm HERE
(size 41.0 KB - Fedora 14 binary for x86_64)