SPELLING CORRECTOR/CHECKER The Spelling Corrector is a tool designed to provide users with the knowledge of errors in spelling within a document. A second feature is to provide the users with the ability to choose various modes of correction. The tool can function in batch mode or it can be run interactively. The following text gives a brief explanation of the functions of the tool and outlines the knowledge necessary to bring the tool online. The installation of this product must necessarily take place in various environments. The development of the Spelling Corrector tool was done using the Data General/Rolm Ada Development Environment. There are certain files included with the product that pertain to this environment and will have to be changed to allow for installation on any other system. OBTAINING PARAMETERS FROM THE ENVIRONMENT A command file is used under batch operation to enter the parameters into the Spelling Corrector tool. Two ways of entering the necessary data into the command file are provided under the Data General/Rolm environment. First, the parameters may be positionally entered on a line which is then parsed and the data entered into the command file for entry into the tool. The second method is to provide the parameters in a named association format which is also entered into a command file and entered into the tool. If a null command line is used at the time the tool is brought up, a default option is performed which places the tool in the interactive mode. The information normally provided by the command line is then obtained from the user through prompts to the terminal. The command file is created using the particular environment's command language. Parameters are input from the environment through the use of the Data General/Rolm Command Line Interpreter. The file SPELLER.CLI is written with the aid of the Data General/Rolm command language. When the SPELLER.CLI is executed with the command SPELLER the command file is created with the information contained on the command line. The file created is called COMMAND_LINE.TXT and is referenced in package COMMAND_LINE_HANDLER through the use of a string constant. After the creation of the command file the Speller tool is executed. If the command line contains information the command file is created otherwise an interactive mode is assumed. If this file is found to contain the necessary information at the start of the execution of the tool the parameters are read and the tool operates in the batch mode. This file is then deleted at the end of the execution of the Speller tool allowing the same environment to exist at the start of any given run. It should be noted that, although it is possible to enter various file names for the MASTER and/or ACRONYM dictionary files, these files are provided with the tool, and the default name is assumed if any MASTER and/or ACRONYM file is specified for a given batch run. In order to have this same type of facility for entry of parameters under a different environment it will be necessary to create a command Page 2 line interpreter that will store the input parameters in a file, one parameter per line, that is readable in that environment. The packages COMMAND_LINE_INTERFACE and COMMAND_LINE_HANDLER are used to read the information contained in the command line file and enter it into the tool. It is suggested that the documentation provided in the souce listing of the packages mentioned be read prior to the formation of a command file creator in any given environment. The HELP file also provides information as to the syntax necessary on the command line. It should also be noted that it is not necessary to have this file to execute the Speller tool. A simple execution command will bring the tool up in the interactive mode. In addition to the two special files mentioned above, a special package has been included that contains the parameters which are specific to most installations. This package is MACHINE_DEPENDENCIES. Information input to the program through this code includes the width of a line, the page size, the default file names (in string form), file name char- acteristics, screen dimensions and the dictionary file names. Any change from these file names in a given environment necessitates the changing of the name within the MACHINE_DEPENDENCIES package. A second package that could be of importance during installation is the TERMINAL_INTERFACE package. This package includes the renaming of TEXT_IO routines for interfacing with the terminal. In various environments the certain procedures included in TEXT_IO function differently. Under the Data General/Rolm environment it was necessary to create a NEW_PAGE routine to clear the screen rather than using the TEXT_IO.NEW_PAGE. There may be some ideosyncracies involved with any particular installation. Other system dependent information pertaining to the various packages that make up the tool can be found in the descriptions of the packages that follow this installation section. It is suggested that these descriptions be read prior to final installation of the tool. GETTING STARTED Upon entry into the Spelling Corrector tool a menu will be displayed on the screen if the interactive method of operation has been chosen. Various options are available to utilize the tool. The user must answer the questions and provide the filenames necessary for the tool to function. Once these filenames have been provided they are stored by the tool for future reference. In order to change these parameters an option is provided upon entry into the search and correct routine. When running under the batch option the parameters are provided by the input line as discussed previously. It is suggested that the user become familiar with this menu in order to avoid running the tool with a lack of dictionary data. The menu is self explanatory and simply provides the options that are necessary for the operation of the tool. FILES IN THIS RELEASE The files that are necessary for the installation of this product are listed as follows: Page 3 CHARACTER_SET.ADA COMMAND_LINE_HANDLER.ADA COMMAND_LINE_IFACE.ADA CORRECTOR_SPEC.ADA CORRECTOR_BODY.ADA COUNT_STATISTICS.ADA DH-BODY.ADA DH-SPEC.ADA EQUALITY_OPERATOR.ADA GET_USER_INFO_BODY.ADA GET_USER_INFO_SPEC.ADA HELP_BODY.ADA HELP_DIS_ALL.ADA HELP_EXIT.ADA HELP_FILE_BODY.ADA HELP_FILE_SPEC.ADA HELP_FIND.ADA HELP_GET.ADA HELPINFO_BODY.ADA HELPINFO_SPEC.ADA HELP_INIT.ADA HELP_ME.ADA HELP_MENU.ADA HELP_PROMPT.ADA HELP_RESET.ADA HELP_SPEC.ADA HELP_TEXT.ADA LINKED_LIST_BODY.ADA LINKED_LIST_SPEC.ADA MANAGER_BODY.ADA MANAGER_SPEC.ADA MACHINE_DEPEND_SPEC.ADA PROCESS_BODY.ADA PROCESS_SPEC.ADA README_FIRST.TXT RTS.ADA SPELLER.ADA SPELLER_ACRONYM.DCT SPELLER_MASTER.DCT TERMINAL_BODY.ADA TERMINAL_SPEC.ADA TOKEN_DEFINITION.ADA UTILITIES_BODY.ADA UTILITIES_SPEC.ADA WORD_LIST_BODY.ADA WORD_LIST_SPEC.ADA The files listed must be compiled in the following order: CHARACTER_SET.ADA EQUALITY_OPERATOR.ADA MACHINE_DEPEND_SPEC.ADA TOKEN_DEFINITION.ADA LINKED_LIST_SPEC.ADA LINKED_LIST_BODY.ADA Page 4 COUNT_STATISTICS.ADA TERMINAL_SPEC.ADA TERMINAL_BODY.ADA MANAGER_SPEC.ADA MANAGER_BODY.ADA DH_SPEC.ADA DH_BODY.ADA RTS.ADA WORD_LIST_SPEC.ADA WORD_LIST_BODY.ADA HELPINFO_SPEC.ADA HELPINFO_BODY.ADA HELP_SPEC.ADA HELP_BODY.ADA HELP_DIS_ALL.ADA HELP_EXIT.ADA HELP_FIND.ADA HELP_GET.ADA HELP_INIT.ADA HELP_ME.ADA HELP_MENU.ADA HELP_PROMPT.ADA HELP_RESET.ADA HELP_TEXT.ADA HELP_FILE_SPEC.ADA HELP_FILE_BODY.ADA HELP_USER_INFO_SPEC.ADA HELP_USER_INFO_BODY.ADA UTILITIES_SPEC.ADA UTILITIES_BODY.ADA CORRECTOR_SPEC.ADA CORRECTOR_BODY.ADA PROCESS_SPEC.ADA PROCESS_BODY.ADA COMMAND_LINE_HANDLER.ADA COMMAND_LINE_IFACE.ADA SPELLER.ADA THE HELP UTILITY The text file used by the HELP_UTILITY Package is required to have a particular format. If the file is not in this format, an exception will be raised. The following explains the required format. COMMENTS: Comments may be embedded in the text file. All comments are ignored when the file is read into memory. A text line is considered a comment if the first and second characters of the line are minus signs ( -- ). TOPICS: The first non-comment text line MUST begin with the digit 1 in column one. This number is the topic level. In other words, text (as defined below) cannot be found in the text file before a topic is found to which the text can be associated. Topics are those subjects for which information is being provided. A topic name may contain any printable character except blanks. Embedded blanks are NOT allowed in Page 5 a topic name. This will not be flagged as an error but the name will be truncated at the first blank. All letters in the name must be capitals. It is not required to have a space separating the topic level from the topic name. Any line beginning with a digit will be considered a topic line. SUBTOPICS: A topic may have subtopics. Subtopics are denoted by having a level exactly one greater than the associated topic level. Subtopics follow the same rules as topics in all other aspects. There is no constraint (other than a lack of memory) on the number of subtopic levels. TEXT: All text lines not beginning with two consecutive minus signs or a digit will be considered text. The text file is saved exactly as the user sees it (including blank lines) with the follow exceptions: o topic and subtopic names have leading blanks stripped off o if the topic or subtopic name is longer than one half the screen size, it may be truncated when a menu of information is output o if the text line is longer than the screen size, the text line is truncated before output o the text file lines are assumed to be eighty characters maximum. THE PACKAGES In the next section each package and the main procedure is outlined separately. Not all packages are outlined. Only those that make up the main portion of the SPELLER tool are included. The description includes information that will be of value in understanding the interaction of the software and the interfaces necessary for the software to function properly. This section should also serve as a guide for any future main- tenance that may become necessary or desired. Page 6 Package CORRECTOR This package is contained in the files: CORRECTOR_SPEC.ADA CORRECTOR_BODY.ADA This package contains the following program units: Procedures Functions CORRECT WAS_CORRECTED INSERT_WORD INITIALIZE Dependencies: This package is dependent upon the following library units: The specification depends on: TOKEN_DEFINITION, GET_USER_INFO The body depends on : TERMINAL_INTERFACE, MACHINE_DEPENDENCIES, EQUALITY_OPERATOR, TEXT_IO, RUN_TIME_STATISTICS, SINGLY_LINKED_LIST, DICTIONARY_MANAGER, DOCUMENT_HANDLER, HELP. System Dependencies: None Enhancements: None Page 7 Package UTILITIES This package is contained in the files: UTILITIES_SPEC.ADA UTILITIES_BODY.ADA This package contains the following program units: Procedures MERGE GET_DICTIONARY_NAME OPEN CREATE Dependencies: This package is dependent upon the following library units: The specification depends on: TEXT_IO. The body depends on : EQUALITY_OPERATOR, SINGLY_LINKED_LIST, MACHINE_DEPENDENCIES, TERMINAL_INTERFACE, TOKEN_DEFINITION. System Dependencies: None. Enhancements: None. Page 8 Package GET_USER_INFO This package is contained in the files: GET_USER_INFO_SPEC.ADA GET_USER_INFO_BODY.ADA This package contains the following program units: Procedures GET_INFO SAVE_INFO COLLECT_USER_INFO Dependencies: This package is dependent upon the following library units: The specification depends on: MACHINE_DEPENDENCIES, DICTIONARY_MANAGER. The body depends on : SEQUENTIAL_IO, TERMINAL_INTERFACE. System Dependencies: None. Enhancements: None. Page 9 Procedure SPELLER This procedure is contained in the file: SPELLER.ADA This procedure contains the following program units: Procedures Functions DISPLAY_TITLE_PAGE, "=" DISPLAY_COMMAND_CHOICES, BEGIN_DOCUMENT_CHECK, BEGIN_MERGE_OPERATIONS, BEGIN_DICTIONARY_LIST, Dependencies: This package is dependent upon the following library units: The specification depends on: None The body depends on : COMMAND_LINE_INTERFACE, MACHINE_DEPENDENCIES, TERMINAL_INTERFACE, TOKEN_DEFINITION, PROCESS_PACKAGE, GET_USER_INFO, UTILITIES, TEXT_IO, HELP. System Dependencies: None. Enhancements: None. Page 10 Package PROCESS_PACKAGE This package is contained in the files: PROCESS_SPEC.ADA PROCESS_BODY.ADA The package contains the following program units: Procedures BATCH_PROCESS INTERACTIVE_PROCESS Dependencies: This package is dependent upon the following library units: The specification depends on: MISSPELLED_WORD_LIST, MACHINE_DEPENDENCIES, DICTIONARY_MANAGER, DOCUMENT_HANDLER, GET_USER_INFO, TOKEN_DEFINITION. The body depends on : TERMINAL_INTERFACE, TEXT_IO, RUN_TIME_STATISTICS, CORRECTOR. Syetem Dependencies: None Enhancements: None Page 11 Package EQUALITY_OPERATOR This package is contained in the file EQUALITY_OPERATOR.ADA This package contains the package EQUALS which contains the single procedure "=" Dependencies: None. System Dependencies: None. Enhancements: None. Page 12 Package SINGLY_LINKED_LIST This package is contained in the files LINKED_LIST_SPEC.ADA LINKED_LIST_BODY.ADA This package contains the following program units: Functions Procedures EMPTY FIRST NULL_NODE NEXT HEAD_NODE INSERT_AFTER TAIL_NODE INSERT_BEFORE CURRENT_ELEMENT DELETE_ELEMENT MODIFY UPDATE Dependencies: This package is dependent on the following library units: The specification depends on : None. Additionally, the body depends on : UNCHECKED_DEALLOCATION System Dependencies: The generic procedure UNCHECKED_DEALLOCATION is used in this package and is not supported by some implementations. Enhancements: Add the LENGTH function to determine the number of elements in a list. Page 13 Package MISSPELLED_WORD_LIST This package is contained in the files WORD_LIST_SPEC.ADA WORD_LIST_BODY.ADA This package contains the following program units: INITIALIZE ADD_TOKEN PRINT Dependencies: This package is dependent on the following library units: The specification depends on : TEXT_IO TOKEN_DEFINITION Additionally, the body depends on : EQUALITY_OPERATOR SINGLY_LINKED_LIST System Dependencies: None. Enhancements: The list of words could be maintained as a binary tree. This would decrease execution time at the cost of additional storage. The words could be stored in the list as dynamically allocated arrays, thus possibly (depending on the compiler implementation) requiring less storage. Page 14 Package DICTIONARY_MANAGER This package is contained in the files: MANAGER_SPEC.ADA MANAGER_BODY.ADA This package contains the following program units: Procedures Functions CREATE_DICTIONARY GET_MASTER_DICTIONARY LIST_DICTIONARY GET_ACRONYM_DICTIONARY MERGE_DICTIONARY MORE ENABLE_DICTIONARY ALTER INSERT_WORD DELETE_WORD DELETE_DICTIONARY DISABLE TOKEN_IS_FOUND INITIATOR NEXT_WORD Dependencies: This package is dependent upon the following library units: The specification depends on: TEXT_IO, TOKEN_DEFINITION. The body depends on : MACHINE_DEPENDENCIES, CHARACTER_SET, TOKEN_DEFINITION, TERMINAL_INTERFACE, (And when included) UNCHECKED_DEALLOCATION. System Dependencies: A STORAGE_ERROR can occur and cannot be alleviated in environments that do not implement UNCHECKED_DEALLOCATION. The code to implement the reclamation is contained within the body of the package but at this time is contained in comments as UNCHECKED_DEALLOCATION is not imple- mented in the development environment. This code has not been tested. Enhancements: Install and test the storage reclamation facilities of the package. Development of a "cache memory" type of approach to storing the on-line dictionaries to eliminate the need for a large amount of main memory. This approach should would necessarily contain a file searching/swapping algorithm to maintain memory in both internal and external structures. Page 15 Package TERMINAL_INTERFACE This package is contained in the files: TERMINAL_SPEC.ADA TERMINAL_BODY.ADA This package contains the following library units: NEW_PAGE NEW_LINE END_OF_LINE GET(character) PUT(character) GET(string) PUT(string) GET_LINE PUT_LINE Dependencies: This package is dependent on the following library units: The specification depends on: TEXT_IO. The body depends on : MACHINE_DEPENDENCIES. System Dependencies: The routines supplied in this package are renames of TEXT_IO routines and are thus implemented in the same fashion as the TEXT_IO routines of a particular installation. The only routine not renamed from TEXT_IO is NEW_PAGE. Enchancements: The possibility of extending routines within this package to fit particular installations exists. This should be done using the MACHINE_DEPENDENCIES package for external information and the TERMINAL_INTERFACE package for the necessary code. Any tailoring of the terminal for a particular workstation could be accomplished in this package. Page 16 Package MACHINE_DEPENDENCIES This package is contained in the file: MACHINE_DEPEND_SPEC.ADA This package contains the following program units: This package contains no routines and is used to declare the various parameters that make the Spelling Corrector tool compatible with the particular environment in which is operating. Dependencies: None System Dependencies: The constants declared within the package generally pertain to the environment that the tool is installed under. Enhancements: Changes will be necessary to install the tool on a particular hardware installation. As enhancements are made to other parts of the tool there may be interfaces with the environment that will have to be added to this package. Page 17 Package COMMAND_LINE_INTERFACE This package is contained in one file: COMMAND_LINE_IFACE.ADA This package contains the following program units: FILE_NAME WORD_LIST MASTER_DICTIONARY ACRONYM_DICTIONARY USER_DICTIONARY BAD_WORD Dependencies: This package is dependent upon the following library units: The specification depends on: Nothing The body depends on : CHARACTER_SET, COMMAND_LINE_HANDLER System Dependencies: A maximum file name length of 80 characters is assumed. COMMAND_LINE_HANDLER defines a file containing the command line tail. Enhancements: COMMAND_LINE_INTERFACE is already using the software component COMMAND_LINE_HANDLER, which is a general-purpose tool. CLI can be modified to meet particular command line syntax other than that selected for this application. Page 18 Package COMMAND_LINE_HANDLER This package is contained in the files COMMAND_LINE_HANDLER.ADA This package contains the following library units: NEXT_WORD Dependencies: This package is dependent upon the following library units: The specification depends on: None The body withs in : TEXT_IO. System Dependencies: An operating-system command file surrounds the invocation of the target tool and generates a file named COMMAND_LINE.TXT (in the Data General implementation) which contains the parameters from the command line tail. These parameters are stored one parameter on each line of COMMAND_LINE.TXT. The package COMMAND_LINE_HANDLER returns these parameters in sequence each time NEXT_WORD is called; the exception NO_MORE_WORDS is raised when NEXT_WORD is called and there are no more parameters on the command line. Examples: 1. Command Line: SPELLER MYFILE A=ACRONYM COMMAND_LINE.TXT contains two lines: MYFILE A=ACRONYM 2. Command Line: SPELLER MYFILE WORD.LST U6=MYDICT COMMAND_LINE.TXT contains three lines: MYFILE WORD.LST U6=MYDICT A line is returned each time NEXT_WORD is called from COMMAND_LINE_HANDLER. Enhancements: This package is quite simple and straight-forward. It may have to be modified if the target operating system cannot support the creation of the COMMAND_LINE.TXT file. One such Page 19 modification may be to have it prompt the user for the command line tail the first time NEXT_WORD is called, and then continue processing from this point. Page 20 Package DOCUMENT_HANDLER This package is contained in the files: DH_SPEC.ADA DH_BODY.ADA This package contains the following program units: OPEN_SOURCE OPEN_DESTINATION CLOSE_SOURCE_AND_DESTINATION GET_WORD RESTORE_WORD CONTEXT_OF_LAST_GET_WORD Dependencies: This package is dependent upon the following library units: The specification depends on : TEXT_IO MACHINE_DEPENDENCIES TOKEN_DEFINITION The body depends on : CHARACTER_SET System Dependencies: MACHINE_DEPENDENCIES.FILE_LINE_LENGTH gives the max size of a line of a text file. This is the only restriction. All other support comes from TEXT_IO. Enhancements: Isolate the general definition of a word into an external package, and design this package to be altered with reasonable ease. This could form a very useful software component. Extend the "GET_WORD" concept to GET_TOKEN, and a software component can be designed to assist in parsing problems et al. Page 21 Package RUN_TIME_STATISTICS This package is contained in the file: RTS.ADA This package contains the following program units: INITIALIZE_COUNTERS INCREMENT_COUNTER COUNT Dependencies: This package is dependent upon the following library units: The specification depends on : COUNT_STATISTICS The body depends on : None System Dependencies: None Enhancements: COUNT_STATISTICS already provides a useful software component that RTS is built from. Page 22 Package HELP_INFO_SUPPORT This package is contained in the files: HELP_INFO_SPEC.ADA HELP_INFO_BODY.ADA This package contains the following program units: APPEND_TO_DISPLAY IDENTIFY_KEYWORD GET_NEXT_TOKEN PARSE Dependencies: This package is dependent on the following library units: The specification depends on: None. The body depends on : TEXT_IO. System Dependencies: None. Enhancements: None. Page 23 Package HELP_UTILITY This package is contained in the files: HELP_SPEC.ADA HELP_BODY.ADA HELP_DIS_ALL.ADA HELP_EXIT.ADA HELP_FIND.ADA HELP_GET.ADA HELP_INIT.ADA HELP_ME.ADA HELP_MENU.ADA HELP_PROMPT.ADA HELP_RESET.ADA HELP_TEXT.ADA Dependencies: This package is dependent on the following library units: The specification depends on: None. The body depends on : TEXT_IO, HELP_INFO_SUPPORT. System Dependencies: None. Enhancements: None. Page 24 Package HELP This package is contained in the files: HELP_FILE_SPEC.ADA HELP_FILE_BODY.ADA HELP_FILE.INI (Not a compiled unit, a text file) This package contains the following program units: HELP_SCREEN Dependencies: This package is dependent on the following library units: The specification depends on: None. The body depends on : MACHINE_DEPENDENCIES, TERMINAL_INTERFACE, HELP_UTILITY. System Dependencies: Any change of the name of the HELP_FILE.INI filename will require a change of the initialization filename constant in the MACHINE_ DEPENDENCIES routine. Enhancements: The help may be modified if more or less help information is desired. This is done through the editing of the HELP_FILE.INI file. The more complex and voluminous this file is the slower the initialization of the help utility will be.