home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / TEXT / UTILITY / SSPELL11.ZIP / README < prev    next >
Encoding:
Text File  |  1992-01-26  |  7.7 KB  |  189 lines

  1.              sspell - similar to Unix spell                       
  2.                         version 1.1                               
  3.                                                                   
  4.  Author: Maurice Castro                                           
  5.  Release Date: 26 Jan 1992                                        
  6.  Bug Reports: maurice@bruce.cs.monash.edu.au                      
  7.                                                                   
  8.  This code has been placed by the Author into the Public Domain.  
  9.  The code is NOT covered by any warranty, the user of the code is 
  10.  solely responsible for determining the fitness of the program    
  11.  for their purpose. No liability is accepted by the author for    
  12.  the direct or indirect losses incurred through the use of this   
  13.  program.                                                         
  14.                                                                   
  15.  Segments of this code may be used for any purpose that the user  
  16.  deems appropriate. It would be polite to acknowledge the source  
  17.  of the code. If you modify the code and redistribute it please   
  18.  include a message indicating your changes and how users may      
  19.  contact you for support.                                         
  20.                                                                   
  21.  The author reserves the right to issue the official version of   
  22.  this program. If you have useful suggestions or changes for the  
  23.  code, please forward them to the author so that they might be    
  24.  incorporated into the official version                           
  25.                                                                   
  26.  Please forward bug reports to the author via Internet.           
  27.  
  28. * Introduction
  29.  
  30. The program SSPELL was written by the author to provide a Unix like
  31. spell checker on a PC. There are several utilities of this type already
  32. available, however, most lacked at least one of the following:
  33.  
  34.     1. Public Domain
  35.     2. Source Code
  36.     3. Simple, editable word list structure
  37.     4. Configurable prefix and suffix list.
  38.     5. To use minimal memory
  39.     6. To have an unlimited word list length
  40.     7. Reasonable speed
  41.     8. Portable
  42.  
  43. The SSPELL program provides all these features. The program currently
  44. compiles under Turbo C++ (Borland) for MS-DOS and cc for Unix (OSx for
  45. Pyramid, SunOS for Sun 3/50, Ultrix for Decstation 2100). Minor 
  46. modification will be required to compile under other Unix variants. 
  47.  
  48. * Features
  49.  
  50. The SSPELL program uses a sorted plain ASCII word list for its dictionary.
  51. This makes adding new words to the list easy. Simply add the words and
  52. re-sort the list. 
  53.  
  54. To gain speed, without loading the complete list into memory, a cache 
  55. of words recently recovered from the word list is maintained, the disk
  56. is only searched if the word is not found in the cache.
  57.  
  58. A suffix/prefix list is used to allow a smaller dictionary to be used.
  59.  
  60. * Operation
  61.  
  62. Edit the config.h file to set up the required default locations and 
  63. compile the code. Place the dictionary in the file specified in the 
  64. config.h and make sure that the index file is writable. SSPELL should 
  65. now be ready for use.
  66.  
  67. Performance gains may be had by altering the parameters found in the 
  68. config.h file. Increasing CACHESIZE increases the memory usage of the
  69. program, but decreases disk search time. IDXSIZ and HASHWID control
  70. the size of the index to the disk file. HASHWID determines the maximum
  71. number of characters compared to determine if an item occurs in a given
  72. slot. IDXSIZ determines the number of slots. 
  73.  
  74. A typical IBM-PC implementation could be written as:
  75.  
  76.     #define DICTIONARY "c:\\utility\\dict\\main.dct"
  77.     #define INDEX "c:\\utility\\dict\\main.idx"
  78.     #define RULE "c:\\utility\\dict\\rule.lst"
  79.     #define CACHESIZE 1000
  80.     #define ROOTNAME "c:\\tmp\\sspell"
  81.     #define SORT "c:\\dos\\sort"
  82.     
  83.     #define MAXSTR 128
  84.     #define SEPSTR " \n\r\t!@#$%^&*(),.<>~`\":;|/\\{}[]"
  85.  
  86.     /* HASHWID must always be 2 or greater */
  87.     #define HASHWID 8
  88.     #define IDXSIZ 1000
  89.  
  90. * Command Line
  91.  
  92. SSPELL has the following command line options:
  93.  
  94.     sspell [-v] [-x] [-D dict] [-I index] [-R rule] 
  95.            [-C cachesize] [file] ...
  96.  
  97. -v    all words not actually in the word list are printed and plausible
  98.     derivations from the word list are indicated
  99.  
  100. -x     all plausible stems are output
  101.  
  102. -D    `dict' is the pathname of an alternate dictionary
  103.  
  104. -I    `index' is the pathname of an alternate index. This should be
  105.     used if using a personalised dictionary or if the index file is 
  106.     unwriteable.
  107.  
  108. -R    `rule' is the pathname of an alternate rule list
  109.  
  110. -C    `cachesize' is the size of the cache of words found in the 
  111.     dictionary.
  112.  
  113. SSPELL will take input from a list of files on the command line or from
  114. stdin if no files are supplied.
  115.  
  116. The dictionary must be in sorted order with the capital letters folded onto
  117. the small letters. (Using Unix sort: sort -fu). The case of words in the 
  118. dictionary is significant. Any letter appearing as a capital in the 
  119. dictionary must appear as a capital in the text to be regarded as spelled
  120. correctly.
  121.  
  122. The format of the rule list is fixed. `#' in the first column indicates a 
  123. comment. All other lines are of the form:
  124.  
  125.       pre|post <prefix/suffix> <required> <forbiden> <delete> 
  126.  
  127. Any field not used must be filled with a `-'. The following examples
  128. illustrate the features of the rules.
  129.  
  130.     pre un - - -
  131.     post ive - e -
  132.     post ive e - e
  133.     post ied y ay,ey,iy,oy,uy y
  134.  
  135. The prefix rules are simple, their are no required or forbidden sequences
  136. and nothing to delete. Prefixes must not be more complex.
  137.  
  138. The suffix rules are more complex. These rule specify the ending to be
  139. added to the root after the deletion of the delete field, provided that
  140. the word has a required ending, provided that the combination is not 
  141. forbidden. For example: carried.
  142.  
  143.     root:         carry
  144.     required `y': carry           the last letter is a `y'
  145.     forbidden:                    the word does not end in a 
  146.                                   forbidden sequence
  147.     delete `y':   carr
  148.     suffix `ied': carried
  149.  
  150. * Overview of Internal Operation
  151.  
  152. SSPELL creates an index file which speeds access to the main dictionary,
  153. the index is a simple list of the first part of words evenly spaced through 
  154. the dictionary, the number of significant letters and the number of slots
  155. are set using hash defines in the config.h file.
  156.  
  157. The index file is only created if: No index file exists or the dictionary
  158. has been modified since the index was created. The Dictionary is checked
  159. for correct ordering during the creation of the index file. 
  160.  
  161. Words are checked for correct spelling by initially checking the cache. The
  162. cache is a move to front list, so more recently used words are at the 
  163. front of the cache. The cache size is bounded by a limit set in the config.h
  164. file. If the word is not found in the cache then an exact match is checked
  165. for in the file. If no exact match is found then a derivation is checked
  166. for in the cache and subsequently in the file. If a word in the dictionary
  167. matches either a derivation or the original then the dictionary word is 
  168. inserted at the head of the cache list.
  169.  
  170. Hyphenation and number identification have been left out of the above
  171. description. The output of the search process is put in a file, the
  172. file is then sorted using the local operating system sorting utility.
  173. The result is then listed on standard out such that duplicated lines 
  174. appear only once.
  175.  
  176. * Acknowledgments 
  177.  
  178. My thanks to people who have contributed to this program:
  179.  
  180. Michael Oldfield (mao@physics.su.OZ.AU) for a number of bug fixes
  181.  
  182. * Conclusion
  183.  
  184. I hope that this program proves useful. Comments and suggestions welcomed;
  185. I can be contavcted via E-Mail at maurice@bruce.cs.monash.edu.au
  186.  
  187.         Maurice Castro
  188.  
  189.