==============================================================================
[   THE KAY*FOG RBBS  |  CPM-CC07.ART  |  posted 01/18/86  |  218 lines 12k  ]

          The CP/M Connection                   Originally published in    
                  by                               Computer Currents       
             Ted Silveira                           2550 9th Street        
  (copyright and all rights reserved)             Berkeley, CA  94710      


                                June 18, 1985
                          MORE UTILITIES FOR WRITERS


     I can still hear my high school English teacher saying "An essay must 
have an organizing idea."  I tried, but I just couldn't do it this time.  
What I have here is public domain hash:  some miscellaneous writer's 
utilities, including one that got left out of the WordStar utilities I 
covered a few issues back.



[Spelling Checkers]

     Bundled software has become so common in the CP/M world that most 
people already have a spelling checker.  If you don't, you're missing one 
of the real joys of writing by computer.  

     A spelling checker can't really spell, of course; it can only check 
the words in your text against the words in its "dictionary" and mark the 
ones it finds no match for.  These words aren't necessarily misspelled, 
just unrecognized; you still must check each one yourself and decide 
whether to correct it, leave it alone, or add it to your dictionary.  Also, 
a spelling checker won't catch mistakes like "there" for "their" or 
"camped" for "cramped."  But it will do much of the brute work of 
proofreading, and it's as accurate at the end of a long piece as at the 
beginning, unlike human proofreaders.

     There are two spelling checkers in the CP/M public domain--SPELLM20 
and SPELL-11.  SPELLM20, sometimes called SPELL20, works with any word 
processor but works especially well with WordStar.  It comes with a 56K 
dictionary (in a special condensed form that saves space and speeds up 
searches) and allows you to build supplementary dictionaries of your own.

     SPELLM20 doesn't do any correcting itself; it just marks the 
unrecognized words in your text.  You then have to find and check the 
marked words using your word processor, a tedious process.  If you're using 
WordStar, however, you can check your text file with WordStar's built-in 
^QL command, which automatically takes you from one marked word to the 
next, letting you correct the word, leave it as is, or add it to a 
supplementary dictionary (so that SPELLM20 will recognize it from then on).  

     Even though SPELLM20 comes with a dictionary, you'll be madly adding 
words to your supplementary dictionary for the first few weeks.  I used 
SPELLM20 to check a 30K text file containing 1438 different words (over 
3500 words total), and it failed to recognize 835 of them, all correctly 
spelled, including elementary words like "they."  (What did they put in 
that dictionary?)

     SPELL-11, which also works with any word processor, has three parts:  
SPELL-11.COM, SPELL-ED.COM, and CMPRLEX.COM.  SPELL-11.COM reads your text 
file and lists all the words it didn't recognize, sending them to the 
screen, to the printer, or to a disk file.  SPELL-ED.COM then takes each 
word listed by SPELL-11 and asks whether you want to mark it (for later 
correction), leave it alone, or add it to a supplementary dictionary.  Once 
SPELL-ED has finished, you still must call up the text file with your word 
processor, locate the marked words, and correct them.  CMPRLEX.COM lets you 
compile any dictionaries you build into a space-saving condensed form.

     SPELL-11 comes with no dictionary at all; you have to build one by 
running text files through the checker, verifying words in a good printed 
dictionary, and then adding the correctly-spelled ones to SPELL-11's 
dictionary.  You'll find this process boring and time-consuming, but once 
you reach 7500-10,000 words, you should have most of your working 
vocabulary covered.  (No, you can't use SPELLM20's already-compiled 
dictionary with SPELL-11.)

     Both SPELLM20 and SPELL-11 are slow and a bit primitive.  SPELLM20 is 
slightly easier to use if you have WordStar, while SPELL-11 is better if 
you don't, though both will require a lot of dictionary-building at first.  
Neither program is any threat to The Word Plus, the reigning champion of 
CP/M spelling checkers, but either one is better than no spelling checker 
at all.



[Word Counters]

     Professional writers, of course, are often obsessive about counting 
words, but even normal people find it mildly interesting to know how many 
words they've written.  To count the words in a text file, you can use any 
one of several public domain programs--WRDCOUNT, WCOUNT, WC, and others 
with similar names.  All do a fairly good job, though WC seems to me to be 
the fastest, but no word counting program, even the commercial one that 
comes with The Word Plus, is totally accurate.  They all get thrown off by 
things like word processor format commands, numerals, and extra carriage 
returns, so they give only an approximate word count.  Still, that's 
usually all you need.

     MUCHTEXT counts lines and characters, but not words, in a text file.  
I rarely need that information, but some people do.  Some typesetters, for 
example, may prefer a character count to a word count.

     TXTSTAT counts lines, words, and characters, but the last time I tried 
to use my copy, it gave such a wildly inaccurate count that I erased it.  
Maybe my copy was damaged--it's hard to believe that anyone released a 
program that far out of whack--but I haven't yet found another copy so that 
I can check it.


[BISHOW31]

     Suppose you're looking for some information and want to scan several 
text files without editing them.  You can use CP/M's built-in TYPE command, 
which is fast--but it only allows you to scroll forward through a file, so 
you can't back up to look at something you've already passed.  Or you can 
use your word processor, which will allow you to scroll both forward and 
back--but word processors are usually slow to load (my modified WordStar 
takes 12-15 seconds, and that's faster than normal).  If neither 
alternative appeals to you, try BISHOW31.

     BISHOW31 is a small program (4K) that lets you view text files on your 
screen.  It loads very quickly (3-4 seconds) and lets you scroll forward 
and backward through a file, either by screen or by line.  It can also 
scroll horizontally, if the text lines are wider than your screen, and can 
be set for screen widths other than 80 columns.

     Better yet, BISHOW31 lets you scan squeezed text files as well as 
normal ones, something that CP/M's TYPE and your word processor can't do.  
You can even scan squeezed files contained in a library file (several files 
grouped together so that CP/M sees them as one large file with the filetype 
LBR).  Because of these features, I can now squeeze all my "archive" 
files--program documentation, master copies of articles, and so forth--to 
save space and still browse through them whenever I need to.

     If you handle a lot of text files, BISHOW31 is very useful.  If you 
squeeze your text files, it's almost essential.  (And for your own sake, 
rename it to something less clumsy, like SHOW.)


[DF]

     If you've ever wasted your time trying to trace minor differences 
between two text files, you'll want DF.  It compares two text files and 
displays their differences on the screen, line by line.  

     DF has three features that set it apart from other file comparison 
programs and make it ideal for text files.  First, when it finds a 
difference between two files, it displays the appropriate sections from 
both files on the screen, one above the other, so that you can easily 
compare them yourself.  Second, at the same time, it displays the line 
numbers of the differing sections so that you know approximately where in 
your files the differences are.  

     Third, and most important, DF can "resynchronize" itself after finding 
a difference in the two files.  Some file comparison programs can only work 
character by character--that is, the first character of one file must match 
the first character of the other, the second must match the second, the 
twelfth must match the twelfth, and so on.  If you have even one extra 
character in one of the files being compared, these simple programs will 
think the two files are completely different from that point on.  DF, 
however, is smarter than that.  After finding a difference, it 
resynchronizes the two files, juggling them until it finds a new pair of 
matching lines, and then continues its comparison.

     I don't use DF very often, but it comes in handy at times.


[GRAB]

     With a little work and imagination, you can use GRAB as a sort of text 
database.  GRAB will search through a series of files, locate the 
occurrences of keywords you specify, and copy the block of text it finds 
the keyword in to a separate file.  

     GRAB thinks a block of text is any string of characters ending with a 
normal carriage return (what WordStar users know as a "hard" carriage 
return), so you'd expect it to find only the individual line of text that a 
keyword occurs in.  But GRAB ignores the "soft" carriage returns that 
WordStar uses at the end of every line so it treats a WordStar document-
mode paragraph as a single block of text (a very long "line").  
Consequently, GRAB will show you the entire WordStar paragraph a keyword 
occurs in--much more useful than just one line.  And it will work the same 
way with any other word processor, like Perfect Writer, that doesn't insert 
a hard carriage return at the end of every line.

     In practice, you can use GRAB to search a batch of text files (your 
old love letters, for example), extract every paragraph containing a 
reference to "eyes," "smile," or "ducks on a pond," and save them all in a 
separate file for future reference.  (No sense overworking your 
imagination.)

     GRAB will search more than one file at a time if you use wildcards in 
the file name (*.LTR or CHAPTER?.???), and it will search squeezed text 
files as well as normal ones.  You can also specify more than one search at 
a time so that GRAB will scour the same group of files first for one set of 
keywords, then another, and so on.

     GRAB has some limitations.  Most important, though it will accept a 
list of keywords to search for, it will pull out every paragraph that 
contains any keyword in the list (a logical OR search).  You can't direct 
GRAB to locate only those paragraphs that contain a combination of keywords 
("eyes" and "limpid pools," say)--a pity, since that's a more useful kind 
of search (called a logical AND).  You can get around this problem by first 
searching for one keyword and then searching the resulting file of 
references for the second keyword.  It's awkward but possible.

     Also, you must put your list of keywords in a text file; you can't 
just specify them on the command line when you run the program.  I find 
this a real bother, especially when I just want to do a quick search for 
one keyword.  

------------------------------------------------------------------------------
      Ted Silveira is a freelance writer and contributing editor to several
   computer-oriented publications.  He appreciates suggestions or feedback
   and can be reached through the KAY*FOG RBBS (415)285-2687 and CompuServe
   (72135,1447) or by mail to 2756 Mattison Lane, Santa Cruz, CA 95065.

-------------------------  End of CPM-CC07.ART Text  -------------------------