APPLICATION NOTE #193 TIPS AND TRICKS WITH THE SPELLING CHECKER Rev. 01 XyWrite's Spelling Checker is a flexible tool that you can customize to meet your needs. This application note describes some helpful techniques for using the Spelling Checker. RELEASING MAIN MEMORY The main spelling dictionary, DICT.SPL, requires 108K of memory; it is automatically loaded the first time you perform a spelling function. If you are using XyWrite III Plus, Version 3.54 or later, you have the option of loading only part of the dictionary into main memory and leaving the balance either on disk or loading it into expanded memory if available (see Note #1). The MX default setting lets you specify how much of DICT.SPL is put into main memory. The obvious advantage to using MX is that is frees memory for other uses; the disadvantage is that the response time of the Spelling Checker is slowed--the degree varies, depending on how much of the file you put into main memory. Like all default settings, you can enter MX from the command line, in the printer file, or in STARTUP.INT. The format is: default mx=n where n is the amount (in kilobytes) of the dictionary that is loaded into main memory. You must load at least 10K, and no more than 64K, when you are using the MX setting. Refer to Chapter 6 of the XyWrite III Plus Reference Guide for more information about the Default command. Whether you have loaded all or only part of DICT.SPL into main memory, you can release it when you are through with the Spelling Checker. XyWrite will automatically reload it the next time you perform a spelling function. To release DICT.SPL from main memory: 1. Press: Ctrl M (to display the memory menu) 2. Press:  (to select UNLOAD FILE) 3. Press: - (to unload DICT.SPL) While you are at it, you can also unload personal spelling dictionaries or the spelling program itself to free additional memory. (You will have to manually reload the personal dictionaries when you want to use them again.) ALPHABETIZING PERSONAL DICTIONARIES You can add words to a personal dictionary through the spelling menu or by calling the dictionary file and typing the words you want to add. The order in which the words appear in the dictionary doesn't matter to XyWrite, because it searches the entire file when it checks spelling. However, as your dictionary grows, you may start to lose track of what is in it. That may lead to entering duplicate words or different upper- and lowercase combinations of the same word, especially if you have multiple personal dictionaries that you load at the same time. It is easier to review the words in the dictionary if they are alphabetized. There are two XyWrite features that allow you to create an alphabetized list of the words in your personal dictionary: STSPELL and SORT. Both methods are described below. The STSPELL command stores the current contents of the temporary dictionary in a file on disk. The temporary dictionary contains the words in all the personal dictionaries currently loaded, plus any words you have entered through the spelling menu. STSPELL eliminates duplicate entries, including those that have different capitalization (e.g., it would not store "TOM" and "Tom"). The purpose of STSPELL is to allow you to reload the words from the temporary dictionary after quitting XyWrite. Since STSPELL automatically stores the words in alphabetical order, you can use it to sort the words currently in the temporary dictionary. For example: Type: F5stspell today.spl Result: TODAY.SPL contains an alphabetical list of the words contained in all personal dictionaries loaded into memory, plus any words you entered through the spelling menu. To use this command to alphabetize just the words in a personal dictionary, not all those stored in memory: 1. Unload the words currently in the temporary dictionary. Press: Ctrl M (to display the memory menu) Press:  (to select UNLOAD FILE) Type: 3 (to unload the temporary dictionary) 2. Load the personal dictionary you want to alphabetize. For example: Type: F5load pers.spl 3. Issue the STSPELL command. Type: F5stspell alpha.spl Result: ALPHA.SPL contains all the words in PERS.SPL in alphabetical order. You may want to replace PERS.SPL with the sorted version. The SORT command allows you to rearrange the entries in a file into alphabetical order; unlike STSPELL, it does not eliminate duplicate entries (see Note #2). To use the SORT command to alphabetize the words in the personal spelling dictionary TECH.SPL: Type: F5sort tech.spl,tech.srt Result: A new file, TECH.SRT, contains an alphabetical list of the words in TECH.SPL. CREATING AN INDEX A special option of the Spelling Checker lets you mark keywords in your document for indexing. This is a two-step process: first you create a list of keywords and then you issue the CORRECT command. Creating the List of Keywords Lets say you want to index a cookbook. 1. Create a file for the keywords. For example: Type: F5new cook.ind 2. Switch to reverse mode. Press: Ctrl 4 3. On the first line of the file, type the name of the file that contains the cookbook. For example: Type: COOKBOOK 4. Switch to prevailing mode. Press: Ctrl 0 5. Type a carriage return. 6. Type the keyword entries. Each entry must be a single word, followed by a carriage return. 7. Store the file. Issuing the CORRECT Command The CORRECT command is typically used to fix a list of misspellings found by the SPELL command. You can also use it to append a string of text or commands to the words listed in a file. To mark words for an index, you append the X1 (or X2, etc.) command to the keyword list created in the previous procedure. Using the files from the previous example, the CORRECT command would be: Type: F5correct cook.ind,<> Result: CORRECT searches the file COOKBOOK for every occurrence of the keywords listed in COOK.IND. When it finds a keyword, it appends the string <> to it. You can now use XyWrite's index extracting procedures (described in Chapter 5 of the XyWrite III Plus Reference Guide) to create an index of your cookbook. MAKING MULTIPLE CHANGES Suppose you have a document in which you want to change all occurrences of "Massachusetts" to "Connecticut"; all occurrences of "tea" to "nutmeg"; and all occurrences of "Harvard" to "Yale." You could issue three separate Change commands, or one CORRECT command. To use the CORRECT command to make the multiple changes: 1. Create a new file for the corrections. 2. On the first line, type the name of the file you want to change in reverse mode, followed by a carriage return in normal mode. 3. In normal mode, type the word you want to change (see Note #3), followed by a space, the replacement word, and a carriage return. 4. Repeat step 3 for every change you want to make. 5. Issue the CORRECT command. For example, if the name of the file you created in step 1 is CHANGES: Type: F5correct changes Note #1 Expanded Memory. When we refer to expanded memory, we mean a computer that is equipped in accordance with the LIM Expanded Memory Specification. Note #2 Sort Key Setting. By default, the SORT command keeps duplicate entries. If you prefer, you can use the SK default setting to tell XyWrite to eliminate exact duplicates. Refer to Application Note #122 for more information. Note #3 Single-Word Entries. You can only change single-word entries with the CORRECT command, although the replacement string can contain multiple words. Right: Ohio State of Connecticut Wrong: Commonwealth of Massachusetts Hawaii