old-www/LDP/LG/issue27/ayers4.html

161 lines
7.4 KiB
HTML

<!--startcut ==========================================================-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<title>Words Within Words</title>
</head>
<body bgcolor="#FFFFFF">
<!--endcut ============================================================-->
<H4>
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center><h1>Words Within Words, New Phrases From Old</h1></center>
<center>
<h4>By <a href="mailto: layers@marktwain.net">Larry Ayers</a></h4>
</center>
<hr>
<center><h3>Introduction</h3></center>
<p>Sometimes after a long stint of putting words together it can be amusing
and relaxing to play with them for a while. Recently I discovered an anagram
search program for Linux which has some interesting capabilities not found in
other anagram programs I've seen. I'll also discuss an XEmacs mode called
Conx which does much the same sort of transformation on sentences or blocks of
text.
<center><h3>agm and xagm</h3></center>
<p>Fraser McCrossan is the author of <b>agm</b> and its Tcl/Tk interface
<b>xagm</b>. Like WordNet's <b>wn</b> (reviewed elsewhere in this issue)
<b>agm</b> is a command-line program, with <b>xagm</b> displaying its output
in an X window. I appreciate programs with this sort of dual nature because
they tend to be more portable. If Tcl/Tk isn't available the output could be
formatted and displayed using another GUI toolkit, or simply used as a console
program.
<p>I found this release (1.3.1) of <b>agm</b> in Sunsite's incoming directory,
but the archive was truncated. The included sample dictionary file was
incomplete, but this file isn't needed to use the program (a corrected version
was later uploaded which contains the complete dictionary file). Agm has the
useful ability to make use of any text file as a source of words, and if you
have <b>ispell</b> installed the dictionary file (in /usr/dict or
/usr/lib/ispell) can be a good collection of words for <b>agm</b>. Just
symlink it to <kbd>/usr/local/lib/words</kbd>. Several files can be
concatenated on the command line and used simultaneously; the (incomplete)
included dictionary file was created by combining several Project Gutenberg
files, including a 1913 edition of Webster's Dictionary, a Shakespeare play, a
couple of Mark Twain's works, the Jargon File, and three thesauri. This can
be done temporarily, i.e. for a single search, or a new word file can be
created; the default location is shown above, but this can be changed in the
Makefile. The ability to select input files would be especially useful for
non-English-speaking users.
<p>Here are screenshots of two <b>xagm</b> windows:<br>
<p>
<img alt="Main agm window" src="./gx/ayers/agm.gif">
<p>
<img alt="agm's output window" src="./gx/ayers/agm_out.gif">
<hr>
<p>A simple anagram search just takes a couple of seconds, but the time needed
grows exponentially as the input words or phrases grow longer.
Luckily there is an abort button in the Tcl version, and of course a
command-line <b>agm</b> search can be aborted with <kbd>control-c</kbd>.
Restricting the number of words in the output anagrams speeds the process up
considerably, as there are so many combinations with multiple
two-and-three-letter words. These anagrams tend to be less interesting, so a
search with the switch <b>-c2</b> is a good choice to start with.
<p>The supplied man-page will tell you everything you need to know and more
about <b>agm</b>, but the Tcl/Tk <b>xagm</b> interface is easy enough to use
that the man-page shouldn't even be needed unless you want to compile a custom
word-list. You might want to take a look at the <b>xagm</b> script and make
sure the first line points to your preferred Tk <i>wish</i> interpreter.
<p>The only source I know of for the program is the Sunsite
<a href="ftp://sunsite.unc.edu/pub/Linux/Incoming">incoming</a> directory; the
filename is <b>agm-1.3.1.tar.gz</b>. It will be moved eventually but shouldn't
be too hard to find.
<hr>
<center><h3>Conx-ing Text</h3></center>
<p>Buried in one of the directories of LISP files in any XEmacs installation
is an odd and interesting word amusement called Conx. Based on an earlier
implementation by Skef Wholey, Conx was rewritten in Emacs Lisp by Jamie
Zawinski in 1991, and was last modified in 1994.
<p>Conx is similar to the older Emacs mode Dissociated Press (accessed with
the command <kbd>alt-x dissociated-press</kbd>). Dissociated Press acts on
the current buffer, scrambling words and sentences to produce odd and
sometimes humorous juxtapositions. Conx-mode takes this concept further,
allowing a series of either selected regions or entire files to be loaded into
a sort of word database, then releasing scrambled output into an ever-growing
buffer; the process is terminated with <kbd>Control-g</kbd>.
<p>There are just a few commands for controlling this mode:<br>
<ul>
<li><kbd>alt-x conx-region</kbd>&nbsp;&nbsp;reads a selected area into the
database
<li><kbd>alt-x conx-buffer</kbd>&nbsp;&nbsp;reads in an entire buffer (these
commands are cumulative when repeated)
<li><kbd>alt-x conx-init</kbd>&nbsp;&nbsp;clears the database for a fresh
start
<li><kbd>alt-x conx</kbd>&nbsp;&nbsp;begins the conx process, outputting
scrambled text
into a new temporary buffer
<li><kbd>alt-x conx-save</kbd>&nbsp;&nbsp;saves the current database to a
file
<li><kbd>alt-x conx-load</kbd>&nbsp;&nbsp;reads a saved database, which is
faster than starting from scratch with the same text.
</ul>
<p>Conx-mode reminds me of the novelist William Burroughs' "scissors and
paste" method of combining text from various sources; he used this technique
in some of his published works. Semi-random text generation can be useful as
well as amusing. Sometimes it can help lift you out of verbal ruts and
provide a new view of familiar text and usage.
<p>In conclusion, here is an example of conx-mode applied to several
paragraphs from two sources: Sir Thomas Browne's seventeenth-century work
<cite>Religio Medici</cite> and Mark Twain's <cite>Huckleberry Finn</cite>.
<blockquote>Place where a hair ball would belch a community. Schism,
lonesomeness. Men away all the bullfrogs councils, and riddles of Tertullian.
Hurry, sparks was the sandy bottom where truth, to t'other side of the
cottonwoods and an old man hove a mile of one single heresy it to confirm and
an article to know by trade. Tar and cool and things we paddled over again
meant morning about knee deep, and confirmed opinion of the rule of the
church, or another, time. Pagans first cast at a spelling book. </blockquote>
<!--===================================================================-->
<P> <hr> <P>
<center><H5>Copyright &copy; 1998, Larry Ayers <BR>
Published in Issue 27 of <i>Linux Gazette</i>, April 1998</H5></center>
<!--===================================================================-->
<P> <hr> <P>
<A HREF="./index.html"><IMG ALIGN=BOTTOM SRC="../gx/indexnew.gif"
ALT="[ TABLE OF CONTENTS ]"></A>
<A HREF="../index.html"><IMG ALIGN=BOTTOM SRC="../gx/homenew.gif"
ALT="[ FRONT PAGE ]"></A>
<A HREF="./ayers3.html"><IMG SRC="../gx/back2.gif"
ALT=" Back "></A>
<A HREF="./ayers5.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
<P> <hr> <P>
<!--startcut ==========================================================-->
</BODY>
</HTML>
<!--endcut ============================================================-->