Abstract:
A system is provided for spelling correction in which the context of a wordn a sentence is utilized to determine which of several alternative or possible words was intended. The probability that a particular alternative was the word that was intended is determined through Bayesian analysis utilizing multiple kinds of features of the context of the target word, such as the presence of certain characteristic words within some distance of the target word, or the presence of certain characteristic patterns of words and part-of-speech tags around the target word. The system successfully combines multiple types of features via Bayesian analysis through means for resolving egregious interdependencies among features. The system first recognizes the interdependencies, and then resolves them by deleting all but the strongest feature involved in each interdependency, thereby allowing it to make its decisions based on the strongest non-conflicting set of features. In addition, the robustness of the system&#39;s decisions is enhanced by the pruning or deletion from consideration of certain features, in one case by deleting features for which there is insufficient evidence in the training corpus to support reliable decision-making, and secondly by deleting features which are uninformative at discriminating among the alternative spellings of the target word under consideration.

Description:
BACKGROUND OF THE INVENTION 
     Conventional spell checkers work by looking up each word in the target document in a dictionary. If a word is not found in, or morphologically derivable from, the dictionary, then it is declared a spelling error. For example, consider the sentence: &#34;I would like teh chocolate cake for dessert.&#34; A conventional spell checker would notice that &#34;teh&#34; is not in the dictionary, and thus would flag it as an error. 
     However, a large class of spelling errors are not detectable by conventional spell checkers; namely, errors in which the misspelled word happens to be a valid word in English. Consider, for example, the sentence: &#34;I would like the chocolate cake for desert.&#34; In this sentence, the word &#34;dessert&#34; was intended, but &#34;desert&#34; was typed. Because &#34;desert&#34; can be found in the dictionary, this error will go undetected by conventional spell checkers. This type of error will be referred to as a &#34;context-sensitive&#34; spelling error, because the offending word is a correct word when considered in isolation, but it is incorrect in the context of the sentence in which it occurred. 
     Several methods have been developed for detecting and correcting context-sensitive spelling errors. The method of Mays et al., as described in Eric Mays, Fred J. Damerau, and Robert L. Mercer, Context based spelling correction, Information Processing &amp; Management, 27(5):517-522, 1991, starts by hypothesizing, for a given sentence, the set of possible sentences that the user may have intended to type. It then determines the probability that each such sentence was in fact the one that was intended. It selects as its answer the sentence with the highest probability of being intended. For example, suppose the method is given the sentence above, &#34;I would like the chocolate cake for desert.&#34;, as the target sentence to correct. It generates a large number of possible intended sentences by inserting up to one typo in each word of the given sentence. Its resulting set of possible sentences includes, among others: &#34;A would like the chocolate cake for desert.&#34;; &#34;I could pike the chocolate cake far desert.&#34;; &#34;I would like the chocolate cake for dessert.&#34;; and &#34;I would like the chocolate cake for desert.&#34;. Note that the last sentence is the same as the original sentence, and thus represents the possibility that the original sentence, as typed, was the one that was intended. 
     Determining the probability that each candidate sentence was the one that was intended involves calculating the a priori probability of each sentence; that is, the probability of that sentence appearing as a sentence in English. These a priori probabilities are calculated using a word trigram model. The model estimates the a priori probability of a sentence in terms of the probability of each consecutive 3-word sequence, or word trigram, in the sentence. For instance, for the sentence above, &#34;I would like the chocolate for desert.&#34;, the word trigrams would be: ( -- ,  -- , &#34;I&#34;); ( -- , &#34;I&#34;, &#34;would&#34;); (&#34;I&#34;, &#34;would&#34;, &#34;like&#34;); (&#34;would&#34;, &#34;like&#34;, &#34;the&#34;); (&#34;like&#34;, &#34;the&#34;, &#34;chocolate&#34;); (&#34;the&#34;, &#34;chocolate&#34;, &#34;cake&#34;); (&#34;chocolate&#34;, &#34;cake&#34;, &#34;for&#34;); (&#34;cake&#34;, &#34;for&#34;, &#34;desert&#34;); (&#34;for&#34;, &#34;desert&#34;, &#34;.&#34;); (&#34;desert&#34;, &#34;.&#34;,  -- ); and (&#34;.&#34;,  -- ,  -- ). The probability of a word trigram (w 1 , w 2 , w 3 ) is the probability that, given that words w 1  and w 2  occur consecutively in a sentence, the next word in the sentence will be w 3 . For instance, the probability of the word trigram (&#34;the&#34;, &#34;chocolate&#34;, &#34;cake&#34;) is the probability of seeing the word &#34;cake&#34; after the word sequence &#34;the chocolate&#34;. 
     The method of Mays et al. needs an enormous corpus of training sentences in order to learn these trigram probabilities. To measure each trigram probability reliably, it needs enough sentences to have seen every triple of words that can occur in the English language a statistically significant number of times. The difficulty of obtaining and processing such a huge training corpus is known as a sparse data problem. This problem has led others to develop alternative methods of context-sensitive spelling correction. 
     Schabes et al., in U.S. patent application Ser. No. 08/252,572, filed Jun. 1, 1994 by Yves Schabes, Emmanuel Roche, and Andrew R. Golding, entitled, &#34;System for correcting grammar based on part-of-speech probabilities&#34; incorporated herein by reference, developed a method that is related to that of Mays et al. However, Schabes et al. use part-of-speech trigrams, rather than word trigrams. For instance, while Mays et al. would use the word trigram (&#34;the&#34;, &#34;chocolate&#34;, &#34;cake&#34;), Schabes et al. would use the corresponding part-of-speech trigram (ARTICLE, ADJ, NOUN). 
     Instead of needing sentences illustrating every triple of words that can occur in English, Schabes et al. only need illustrations of every triple of parts of speech, i.e., VERB, ARTICLE, NOUN, etc. This drastically reduces the size of the training corpus that is needed, thereby solving the aforementioned sparse-data problem. 
     The method of Schabes et al. introduces a new problem, however. Because it analyzes sentences in terms of their part-of-speech sequences, it has trouble with errors in which the offending word has the same part of speech as the intended word. For example, consider again the two sentences: &#34;I would like the chocolate cake for dessert.&#34; and &#34;I would like the chocolate cake for desert.&#34;. Schabes et al. analyze these sentences in terms of their part-of-speech sequences, namely: PRONOUN MODAL VERB ARTICLE ADJ NOUN PREP NOUN PUNC and PRONOUN MODAL VERB ARTICLE ADJ NOUN PREP NOUN PUNC. Here the intended word, &#34;dessert&#34;, and the offending word, &#34;desert&#34;, have the same part of speech, i.e., NOUN. Moreover, the entire part-of-speech sequence is the same for the two sentences. Thus the two sentences are essentially indistinguishable to the method of Schabes et al., which analyzes the sentences at the level of their part-of-speech sequences. In general, the method of Schabes et al. is ineffective at correcting context-sensitive spelling errors whenever the offending word and the intended word have the same part of speech. 
     A third method for context-sensitive spelling correction was developed by Yarowsky and is presented in David Yarowsky, A comparison of corpus-based techniques for restoring accents in Spanish and French text, in Proceedings of the Second Annual Workshop on Very Large Corpora, Kyoto, Japan, 1994. Yarowsky&#39;s method uses neither word trigrams nor part-of-speech trigrams, and is thus immune from both problems mentioned earlier, i.e., sparse data, and the inability to discriminate among words with the same part of speech. Yarowsky applied his method not to the task of context-sensitive spelling correction, but to the related task of accent restoration in Spanish and French. This task is to take a word that has been stripped of any accent, such as &#34;terminara&#34; in Spanish, and to decide whether the intended word is the accented version &#34;terminara&#34; or the unaccented version &#34;terminara&#34;. Note that this is a special case of context-sensitive spelling correction, in which the spelling errors always take the form of accent deletion. 
     To decide which was the intended spelling of the word, e.g., &#34;terminara&#34; or &#34;terminara&#34;, Yarowsky&#39;s method analyzes the context in which the word occurred. In particular, it tests two kinds of features of the context: context-word features, and collocation features. A context-word feature is the presence of a particular word within ±k words of the target word. For instance, suppose Yarowsky&#39;s method is used to decide which word was intended, &#34;desert&#34; or &#34;dessert&#34;, in the sentence: &#34;I would like the chocolate cake for desert.&#34;. One possible context-word feature would be the presence of the word &#34;chocolate&#34; within ±20 words of &#34;desert&#34;. The presence of &#34;chocolate&#34; would tend to suggest that &#34;dessert&#34; was intended. On the other hand, a different context-word feature, the presence of the word &#34;sand&#34; within ±20 words, would tend to suggest that &#34;desert&#34; was intended. 
     The second type of feature used by Yarowsky&#39;s method is collocation features. A collocation feature is the presence of a particular pattern of words and/or part-of-speech tags around the target word. For example, the pattern &#34;for --  &#34; specifies that the word &#34;for&#34; occurs directly before the target word, whose position is symbolized by an underscore. The presence of this pattern would tend to suggest that &#34;dessert&#34; was intended, as in the sentence above. On the other hand, the pattern &#34;PREP the --  &#34; would tend to suggest that &#34;desert&#34; was intended, as in: &#34;He wandered aimlessly in the desert.&#34;. 
     Yarowsky&#39;s method combines these two types of features, context words and collocations, via the method of decision lists. A decision list is an ordered list of features that are used to make a decision in favor of one option or another. The features are ordered such that the most reliable discriminators appear first in the list. For example, suppose Yarowsky&#39;s method is used to decide which word was intended, &#34;desert&#34; or &#34;dessert&#34;. It might use the following decision list: (1) &#34;for --  &#34;&#34;dessert&#34;; (2) &#34;PREP the 13  &#34;&#34;desert&#34;; (3) &#34;chocolate&#34; within ±20&#34;dessert&#34;; (4) &#34;sand&#34; within ±20&#34;desert&#34;. This decision list is used by testing whether each feature in the list in turn matches the target context. The first feature that matches is used to make a decision about the intended spelling of the target word. 
     Consider, for example, the application of this procedure to the sentence: &#34;I would like the chocolate cake for desert.&#34;. The method first tests whether feature (1) matches the context around the target word &#34;desert&#34;. This involves checking for the presence of the word &#34;for&#34; before &#34;desert&#34;. The test succeeds, and so the method suggests that the target word should be changed to &#34;dessert&#34;. 
     Now consider the application of the method to &#34;desert&#34; in the sentence: &#34;He wandered aimlessly in the desert.&#34;. The method tries to match feature (1), but fails, because the word &#34;for&#34; is not found before &#34;desert&#34;. It tries to match feature (2), which succeeds, since &#34;in&#34; is a PREP and the word &#34;the&#34; appears before &#34;desert&#34;. Because feature (2) suggests &#34;desert&#34;, the method accepts the given sentence as correct. 
     Yarowsky&#39;s method uses decision lists to take advantage of two types of knowledge: context words and collocations. For any given target problem, it applies the single strongest piece of evidence, whichever type that happens to be. This is implemented by applying the first feature that matches, where &#34;first&#34; corresponds to &#34;strongest&#34; because the features have been sorted in order of decreasing reliability. While this is a powerful approach, its drawback is that it only brings a single piece of evidence to bear on any one decision. This is disadvantageous when either the method is mistaken in its evaluation of which piece of evidence is strongest, or the strongest piece of evidence is outweighed by several weaker pieces of evidence that together suggest an alternative decision. What is necessary is a new method for context-sensitive spelling correction that bases its decisions not on the single strongest piece of evidence, but on all of the available evidence, thereby avoiding the abovementioned disadvantages of decision lists. 
     SUMMARY OF THE INVENTION 
     In the subject invention, a new method for context-sensitive spelling correction uses Bayes&#39; rule to combine evidence from multiple types of features; in particular, from context-word features and collocation features. The subject method differs from Yarowsky&#39;s method involving decision lists in that the subject method makes use of all available evidence when making a decision, whereas Yarowsky&#39;s method uses only the single strongest piece of evidence. 
     Bayes&#39; rule provides a way of evaluating different hypotheses given some body of evidence. In the case of context-sensitive spelling correction, the hypotheses suggest various words that could have been intended when the target word was typed. The body of evidence that is used to decide among these hypotheses consists of two types of features about the context of the target word: context-word features and collocation features. In essence, Bayes&#39; rule gives a way of calculating the probability that each word under consideration is in fact the word that was intended for the target word, given some observed set of features about the target word&#39;s context. While Bayes&#39; rule has previously been used to obtain probabilities that various words were intended for the target word, it has only been used with a single type of feature, namely, context-word features; it has never been used to combine evidence from multiple types of features. 
     The difficulty of utilizing multiple types of features lies in combining the probabilities associated with the features. If the features can be assumed independent, then the probabilities can simply be multiplied. However, the features are generally not independent when there are multiple types of features. The subject method is based on the following ideas that allow the features to be combined nonetheless: First, means are provided for determining when two features are egregiously interdependent, and thus incompatible for multiplicative combination in Bayes&#39; rule. Two features are said to be egregiously interdependent if the presence of one feature has a very strong influence on the presence of the other feature. In particular, two context-word features are never egregiously interdependent; two collocation features are egregiously interdependent if and only if they test overlapping portions of the context of the target word; and a context-word feature and a collocation feature are egregiously interdependent if and only if the context word appears explicitly in the pattern tested by the collocation. 
     Secondly, means are provided for deleting features from the set of features that are used for making a decision, such that egregious interdependencies are avoided. This deletion is accomplished by processing the features in order of decreasing strength, detecting egregious interdependencies as described above, and deleting a feature if it is found to be egregiously interdependent on any previously-accepted feature. In this way, egregious conflicts are resolved by retaining the strongest feature involved in the conflict, and deleting the others, thereby preserving the strongest set of non-conflicting features as the set on which decisions will be based. 
     Finally, means are provided for pruning inappropriate features from consideration so as to increase the robustness of the decisions made by the method. In particular, feature is pruned if it is found to have an insufficient number of examples in the training corpus, as it therefore provides unreliable evidence. A feature is also pruned if it is found to be uninformative in discriminating among the different possible intended spellings of the target word. The informativeness of a feature is ascertained by running a chi-square test to measure the association between the presence of the feature and the choice of the target word. If the association is not found to be significant at the 0.05 level, then the feature is pruned. Note that uninformative features would only introduce noise into the decision-making process. 
     In summary, a system is provided for spelling correction in which the context of a word in a sentence is utilized to determine which of several alternative or possible words was intended. The probability that a particular alternative was the word that was intended is determined through Bayesian analysis utilizing multiple kinds of features of the context of the target word, such as the presence of certain characteristic words within some distance of the target word, or the presence of certain characteristic patterns of words and part-of-speech tags around the target word. The system successfully combines multiple types of features via Bayesian analysis through means for resolving egregious interdependencies among features. The system first recognizes the interdependencies, and then resolves them by deleting all but the strongest feature involved in each interdependency, thereby allowing it to make its decisions based on the strongest non-conflicting set of features. In addition, the robustness of the system&#39;s decisions is enhanced by the pruning or deletion from consideration of certain features, in one case by deleting features for which there is insufficient evidence in the training corpus to support reliable decision-making, and secondly by deleting features which are uninformative at discriminating among the alternative spellings of the target word under consideration. 
    
    
     BRIEF DESCRIPTION OF THE DRAWING 
     These and other features of the subject invention will be better understood taken in conjunction with the Detailed Description in combination with the drawings of which: 
     FIGS. 1a and 1b are block diagrams respectively of the training phase and the run-time phase of the subject invention in which a training corpus, confusion set, and dictionary are used to generate an ordered list of features and in which this ordered list of features, a dictionary, a confusion set for a target word, and the target word in a sentence are utilized to determine the intended spelling of the target word from context; 
     FIG. 2 is an expanded block diagram illustrating the training phase of the subject system in which all possible features are proposed as candidate features, in which occurrences of each candidate feature in the training corpus are counted, and in which features are pruned that either have insufficient data or are not informative, with the remaining features being sorted in order of decreasing strength; and, 
     FIG. 3 is an expanded block diagram and flowchart illustrating the operation of the system for determining the intended spelling of the target word from context for the run-time phase of FIG. 1b, illustrating a first step for initializing the probability for each word in the confusion set to its prior probability, followed by retrieving features from an ordered set of features, matching of features to the context of the target word in the sentence, followed by detecting conflicts with previously accepted features, illustrating the utilization of Bayes&#39; rule to update the probabilities for each word in the confusion set for the matching feature. 
    
    
     DETAILED DESCRIPTION 
     Referring now to FIG. 1a, in the subject system, a system 10 is provided which learns the usage of each word in a confusion set and provides an ordered list of features 12. In order to provide the ordered list of features which will be utilized to analyze words in context for purposes of spelling correction, a training corpus 14 is provided, which in one embodiment constitutes a raw or unannotated set of correct sentences of English. Such a training corpus is available as an unannotated version of the Brown corpus. 
     A confusion set 16 is also provided, with the confusion set constituting a list of possible words that could have been intended for the target word. In one embodiment, the confusion sets were derived from a listing of &#34;Words Commonly Confused&#34; appearing in Flexner, ed., Random House Unabridged Dictionary, Random House, New York, 1983, second edition. Additionally, a dictionary 18 is provided to look up the set of possible part-of-speech tags of words in the training corpus and in the test sentence, herein referred to as the target sentence. It will be noted that each target sentence has a target word the spelling of which is to be verified. 
     It is the purpose of system 10 to learn the usage of each word in the confusion set and to provide an ordered list of features. In general, system 10 learns the usage of a word by learning a set of context-word and collocation features that characterize the contexts in which that word tends to occur, and that thereby discriminate that word from the other words in the confusion set. By so doing, one gets a list of features that can be used to discriminate among the words in the confusion set, and correct instances in which one word in the confusion set has been incorrectly substituted for another. 
     Referring now to FIG. 1b, during the run-time phase, a system 20 is utilized to determine the intended spelling of the target word from context. The system is provided with a target word in a sentence, as illustrated at 22, as well as a confusion set for the target word, as illustrated at 24. The confusion set contains a list of the possible words that could have been intended for the target word. A dictionary 18 and an ordered list of features 12 are then utilized to determine the intended spelling of the target word through the utilization of Bayes&#39; rule as will be seen hereinafter. The result of the analysis is the indication of the intended spelling of the target word as illustrated at 26. 
     Referring now to FIG. 2, system 10 is comprised of a number of subsystems, with the first of which, subsystem 30, proposing all possible features as candidate features to be utilized in the context-sensitive spelling correction. These features are proposed by scanning the training corpus for instances of any word in the confusion set, and proposing a context-word or collocation feature whenever it occurs for one or more such instances. Thereafter, as illustrated at 32, a count of occurrences of each candidate feature in the training corpus is derived. It will be appreciated that this count provides statistical data which will be used in following steps to assist in the pruning subsystem and to perform the probability updates as required by Bayes&#39; rule. 
     As illustrated at 34, a subsystem prunes features that have insufficient data. This is done by comparing the total number of occurrences of each feature to a &#34;minimum occurrences&#34; threshold. If the total number of occurrences of the feature is below the threshold value, it is said that there are insufficient data to measure the feature&#39;s presence. In addition, if the total number of instances of all words in the confusion set minus the total number of occurrences of the feature is below the threshold value, it is said that there are insufficient data to measure the feature&#39;s absence. In either case, the feature is deleted by reason of insufficient data. In one embodiment, the &#34;minimum occurrences&#34; threshold is set at 10. 
     As illustrated at 36, a subsystem prunes features that are uninformative at discriminating among the words in the confusion set. A chi-square test is run to ascertain the degree of association between the presence of the feature and the choice of word in the confusion set. If the association is not found to be significant, the feature is pruned by reason of its not being relevant to the discrimination being performed. In one embodiment, the significance level is set to 0.05. 
     As illustrated at 38, a sort of the remaining features in order of decreasing strength is performed so as to provide ordered list of features 12. The strength of a feature reflects the feature&#39;s reliability for decision-making. As will be discussed below, in one embodiment, strength is defined by the following formula: ##EQU1## where f is the feature at issue, n is the number of words in the confusion set, w i  is the ith word in the confusion set, and p(w i  |f) is the probability that, given that feature f is present for some word in the confusion set, that word is w i . 
     What is accomplished by the provision of an ordered list of features is that features that do not supply reliable evidence for deriving the intended spelling of the target word are removed. The list is ordered in the sense of decreasing strength to facilitate the extraction of the strongest non-conflicting set of features for purposes of deriving the intended spelling of the target word. Having thus culled and pruned the features which are to be utilized in analyzing a target word, in the run-time phase, features in this ordered list of features are used in the analysis, with the ability to use multiple features provided through the use of Bayes&#39; rule. 
     Referring now to FIG. 3, it will be appreciated that the overall structure of the algorithm is to maintain a set of running probabilities, namely p(w 1 ), . . . , p(w n ), which give the probability that each word in the confusion set was the word that was intended for the target word. System 20 incorporates a subsystem 40 which initializes each probability p(w i ) to the prior probability of word w i . The word &#34;prior&#34;, as referring to probability, refers to the probability of the word in the training corpus, prior to gathering any additional evidence on which to base the probability. 
     The system operates to update the running probability for each word through the use of Bayes&#39; rule. This is accomplished by obtaining the next feature from the ordered list of features as illustrated at 42. As illustrated at 44, it is determined whether the end of the list has been reached. If not, as illustrated at 46, a determination is made as to whether the feature matches the context of the target word in the sentence. If it does not match, another feature is obtained from the ordered list of features. If it does match, as illustrated at 48, a determination is made as to whether the feature conflicts with a previously accepted feature. If it does, then another feature is obtained from the ordered list of features. 
     By &#34;conflicting&#34; is meant there is an egregious interdependency between the present feature and a previously accepted feature. An egregious interdependency is defined as follows: if both features at issue are context-word features, then the two features are said not to conflict. If both features are collocation features, then the two features are said to conflict if and only if there is an overlap between the portion of context that they test. If one feature is a collocation feature, and the other is a context-word feature, then the two features are said to conflict if and only if the collocation feature explicitly tests for the presence of the context word. 
     If there are no feature conflicts, then Bayes&#39; rule is utilized, as illustrated at 50, to update the running probabilities for each word in the confusion set for the matching feature. What has been accomplished is that with a pruned list of features, further processing has established that the features to be utilized are only those features which match the context of the target word in the sentence, and only those features which do not conflict with a previously accepted feature. Bayes&#39; rule allows the system to calculate the probability of each word from multiple pieces of evidence, namely the various features which are finally utilized. Having done feature matching and conflict resolution, the system has selected a list of features with no egregious interdependencies among any of the features. It is therefore possible, utilizing Bayes&#39; rule, to multiply the probabilities associated with the individual features to provide a single probability that a given word in the confusion set was intended for the target word. 
     Bayes&#39; rule permits ascertaining the probability of each word in the confusion set, but it requires estimating the joint probability of all features of interest being simultaneously present for each word in the confusion set. In general, it would require a massive training corpus to be able to estimate these joint probabilities accurately. However, if it is possible to assume that there are no egregious interdependencies among the features, then each joint probability can be calculated merely by multiplying the conditional probabilities of the individual features of interest. 
     What makes possible the above is the utilization of only features which have previously been determined to not be egregiously interdependent, as determined by subsystem 48. It will be appreciated that subsystem 46 improves the robustness of the decisions made by ensuring that each feature is supported by an adequate number of examples in the training corpus. 
     The output of the run-time phase is the suggestion of the word in the confusion set that has the highest probability as computed above and as illustrated at 52. The suggested word therefore represents the likely intended spelling of the target word as illustrated at 54. 
     More particularly, as to the top level of the subject algorithm, FIG. 1 shows the overall operation of the subject method. It consists of a training-phase module and a run-time module. The training-phase module learns the correct usage of each word in a given confusion set from a training corpus. The confusion set is a set of words that the user may confuse with each other; that is, he may type one word in the confusion set when he intended to type another. For example, the confusion set might be {&#34;desert&#34;, &#34;dessert&#34;}. This means that the user may type &#34;desert&#34; when he really meant &#34;dessert&#34;, or &#34;dessert&#34; when &#34;desert&#34; was intended. Confusion sets may capture common typographical errors, as in the confusion set {&#34;out&#34;, &#34;our&#34;}; homonym errors, as in {&#34;peace&#34;, &#34;piece&#34;}; errors of grammatical usage, as in {&#34;between&#34;, &#34;among&#34;}; or the user&#39;s idiosyncratic spelling errors, as in {&#34;being&#34;, &#34;begin&#34;}. 
     The training corpus is a set of sentences including, crucially, sentences that illustrate the correct usage of the words in the confusion set. From these examples of correct usage, the training-phase module infers the contexts in which each word in the confusion set tends to occur. The corpus can consist of raw text; no annotations, such as part-of-speech tags, are needed. 
     The last input to the training phase is a dictionary. The dictionary is used only to look up the set of possible part-of-speech tags of a word. For instance, given &#34;walk&#34;, the dictionary would return {NOUN, VERB}. 
     The training phase returns as its output an ordered list of features that can then be used to discriminate among the words in the confusion set. Two types of features are currently supported: context-word features and collocation features. A context-word feature tests for the presence of a particular word within ±k words of the target word. A collocation feature tests for the presence of a particular pattern of words and part-of-speech tags around the target word. The features are sorted in order of decreasing reliability. 
     Once the training phase is complete, the run-time module may be invoked any number of times to correct errors in which the user types one word in the confusion set when another word in the confusion set was intended; for example, &#34;desert&#34; when &#34;dessert&#34; was intended. The run-time module takes as input a target word in a sentence and a confusion set. The target word must be one of the words in the confusion set. The run-time module then uses the context of the target word to decide which word in the confusion set was intended. In particular, it tests the context for each feature in the list that was learned in the training phase. In the process of testing for features, it may use the dictionary to look up the set of possible tags for a word. 
     As to the training phase, FIG. 2 shows this phase in more detail. The overall purpose of the training phase is to learn an ordered list of features to be used later, by the run-time module, to discriminate among the words in the confusion set. The training phase starts, as illustrated at 30, by proposing all possible features as candidate features. In one embodiment, the set of all possible features includes two types: context-word features and collocation features. A feature is proposed if and only if it occurs for at least one example in the training corpus. 
     The next step, as illustrated at 32, is to count occurrences of each candidate feature in the training corpus. In particular, let f be a feature in the training corpus. Also, let the confusion set contain n words, where n≧2, and let the words be denoted by w 1 , . . . , w n . Then m 1 , . . . , m n , and M 1 , . . . , M n  are counted, where M i  is the number of times w i  occurs in the training corpus, and m i  is the number of occurrences of w i  for which feature f matches. 
     As illustrated at 34, features that have insufficient data are pruned. This is done to avoid making unjustified conclusions about features that occur very few times in the training corpus. The pruning is based on a &#34;minimum occurrences&#34; threshold, T min , which in one embodiment is set to 10. Feature f is pruned if the following condition holds: ##EQU2## In other words, feature f is pruned if it occurs for practically no instances of any word in the confusion set, or if it occurs for practically all instances of every word in the confusion set. In the former case, there are insufficient data to measure its presence; in the later, its absence. 
     A feature f is also pruned, as illustrated at 36, if it is not informative at discriminating among the words in the confusion set. The reason for this pruning step is to remove features that are not helpful at doing the discrimination, and may in fact introduce noise into the process. For example, suppose the confusion set is {&#34;desert&#34;, &#34;dessert&#34;}. Consider the context-word feature: &#34;then&#34; within ±20. This feature tests whether the word &#34;then&#34; occurs within 20 words of the target word. However, the presence of &#34;then&#34; within 20 words of the target word is unlikely to provide any useful indication of whether the target word should be &#34;desert&#34; or &#34;dessert&#34;. To prune such features, a chi-square test is run to check for an association between the presence of the feature and the choice of word in the confusion set. If the observed association is not judged to be significant, then the feature is pruned. In one embodiment, the significance level is set to 0.05. 
     As illustrated at 38, the set of features that remain, after the preceding pruning steps, are sorted in order of decreasing strength. The strength of a feature is a measure of its reliability as a discriminator among the words in the confusion set. The strength of a feature f is calculated as: ##EQU3## The strength of f is essentially the extent to which its presence is unambiguously correlated with one particular w i . For instance, if f occurs only in the presence of w 1 , but never in the presence of any other w i , then the strength of f will be 1.0, the highest possible strength value. 
     As to the run-time phase, the purpose of this phase is to detect and correct spelling errors in which one word in the confusion set was mistakenly substituted for another. The run-time phase works by calculating, for each w i  in the confusion set, the probability that that w i  was the word that was intended for the target word. This is done by first looking for features in the context of the target word that are indicative of one word or another in the confusion set. The set of features to look for is just the list of features that were learned in the training phase. Let the set of features that match the context of the target word be denoted by f 1 , . . . , f h . The probability that w i  was intended is then calculated as the quantity p(w i  |f 1 , . . . , f h ); that is, the probability that w i  was intended, given that the target context has features f 1  through f h . The calculation is done using Bayes&#39; rule: ##EQU4## By choosing the f j  judiciously, it can be guaranteed that there are no egregious interdependencies among features. It is then a good approximation to assume independence among the features, which allows the above joint probability of the f j  to be decomposed into a product of individual probabilities: ##EQU5## The preceding two equations enable the calculation of the probability, p(w i  |f 1 , . . . , f h ), that each w i  was intended. The system provides as its final answer the w i  whose probability of being intended was highest. 
     FIG. 3 shows how the procedure just described is embodied in the run-time phase of the method. As illustrated at 40, each p(w i  |f 1 , . . . , f h ) is initialized to the &#34;prior probability&#34; term, namely p(w i ). 
     As illustrated at 42, the algorithm proceeds to loop through each feature in the list that was learned in the training phase. 
     A test is performed at 44 to ascertain whether all features in the list have been processed. If so, the final values for the p(w i  |f 1 , . . . , f h ) have been calculated. Technically, there could be one more step: each p(w i  |f 1 , . . . , f h ) could be divided by p(f 1 , . . . , f h ). However, this just divides each probability by the same constant, which does not affect the comparison of the p(w i  |f 1 , . . . , f h ). This step is therefore omitted. The system gives its final answer at 52 as the w i  with the highest p(w i  |f 1 , . . . , f h ). 
     If there is another feature f in the list to process, control proceeds to 46, where a test is performed to see whether f matches the context of the target word. If it does not match, then f does not furnish any information about the identity of the target word; hence control proceeds to the next feature. 
     If f does match the context of the target word, control proceeds to 48, where a test is performed to ascertain whether f conflicts with, i.e., is egregiously interdependent on, any feature that was already used in the calculation. If so, control proceeds to the next feature, as the inclusion of f would violate the assumption of independence among the f h . Note that this strategy eliminates egregiously interdependent features by accepting the stronger of two interdependent features, and rejecting the weaker of the two. This property is guaranteed by working through the list of features in order of decreasing strength. The determination of which word was intended for the target word is therefore based on the strongest non-conflicting evidence available. This is the reason for sorting the features in order of decreasing strength in the training phase. 
     An egregious interdependency between two features is defined as follows: if both features are context-word features, then the two features are said not to be egregiously interdependent. If both features are collocation features, then they are egregiously interdependent if and only if their patterns overlap; that is, they both test context on the left-hand side of the target word, or they both test context on the right-hand side. The interdependence between the collocations is represented by the parts of their patterns that overlap. If one feature is a context word, and the other is a collocation, then they are egregiously interdependent if and only if the context word appears explicitly in the pattern of the collocation. For instance, suppose the confusion set is {&#34;peace&#34;, &#34;piece&#34;}, the context word is &#34;corps&#34;, and the collocation is &#34; --  corps&#34;. Then the context word and collocation are egregiously interdependent, because the context word &#34;corps&#34; appears explicitly in the pattern tested by the collocation. 
     If the new feature f j  is not found to be egregiously interdependent on any previously-accepted feature, then it is used as one of the features f 1 , . . . , f h  in the calculation. As illustrated at 50, it is incorporated into the calculation of each w i  by multiplying the probability for that w i  by p(f j  |w i ). Control proceeds by looping back to 42 to process the next feature. 
     One example of the program, written in C, follows, which describes the major operation of the system without the utilities, but including the top-level routines for the training phase and the run-time phase: ##SPC1## 
     Having above indicated several embodiments of the Subject Invention, it will occur to those skilled in the art that modifications and alternatives can be practiced within the spirit of the invention. It is accordingly intended to define the scope of the invention only as indicated in the following claims: