This module is responsible for sorting and displaying corrections generated by Respell. The eponymous function receives a misspelling from the control module, calls Respell to generate respellings which are passed back to one of the callback functions in ListCorrections, optionally sorts the respellings by any of various criteria, then displays the respellings in order on standard output.
ListCorrections can be set to display guesses in the order that they are generated ( dump mode), but this is not necessarily the most desirable order. Even more importantly, different parses of a misspelling can result in the same respelling, which would therefore be printed multiple times. Therefore in any serious mode of operation, ListCorrections uses a callback which stores the unique respellings in a list, along with the number of times that respelling was generated, the word classes, and the best average frequency of the presumed sound-spelling correspondences for each unique respelling. When Respell returns after generating all of its guesses, that list can then be printed out directly, if it is only desired to suppress duplicates ( unique mode). It can also be sorted first, in any of various ways. One can sort by the number of different parses that generated each unique spelling ( paths mode), or by the average frequency of the correspondences ( ruleProb mode). It is also possible to calculate the Levenshtein distance (via Kruskal) and sort by that ( kruskal mode). Since that discrete measure results in many ties, this mode also does a minor sort by the correspondence frequencies.
The various modes of presentation are selected by the client module on a per-word basis when calling the ListCorrections function. The client can also choose which dictionary to use for each word, although this flexibility is not exploited by the current prototype.