This function writes the spelling checker’s suggested spelling corrections to an output buffer pointed to by the pwszOut member of the SPLSUGGEST structure. It also can provide a score for each suggestion that indicates the likelihood that the suggestion is correct.
At a Glance
Header file: | Splapi.h |
Windows CE versions: | 2.10 and later |
Syntax
int SplSuggest( HSPL hspl, SPLBUFFER * psb );
Parameters
hspl
Handle to the spelling session. An application initiates a spelling session by calling the SplInit function, which then generates this handle.
psb
Pointer to the SPLBUFFER structure in which the application locates the suggestions.
Return Values
1 indicates success. 0 indicates failure.
Remarks
The suggested words in the output buffer are null-terminated and ordered from the most likely to be correct to the least likely to be correct. An additional NULL character indicates the end of the output buffer. The size of the output buffer needs to be large enough for eight suggestions of a reasonable length; 128 characters is usually sufficient.
To score suggestions, set the SPL_SCORE_SUGGESTIONS flag in the dw parameter of the SplOptionSet function.
The score for a suggestion is based on the error types, as described in the following table. The score of each error type is determined by subtracting its value as defined in Splapi.h from 256. The higher the score, the more severe the error.
Error Type | Score | Description |
SPL_LIMIT_NONE | 0 | The only spelling suggestion returned is for a word that is correctly spelled one way. For example, the suggestion for “i” is “I,” and the suggestion for “thier” is “their.” |
SPL_LIMIT_CAPITAL | 1 | An error is corrected by capitalizing the initial letter of the word. |
SPL_LIMIT_DROP_DOUBLE_CONSONANT | 14 | An error is corrected by substituting a double consonant for a single consonant. |
SPL_LIMIT_ADD_DOUBLE_CONSONANT | 14 | An error is corrected by substituting a single consonant for a double consonant. |
SPL_LIMIT_TRANSPOSE_VOWEL | 15 | An error is corrected by transposing two vowels. |
SPL_LIMIT_DROP_DOUBLE_VOWEL | 16 | An error is corrected by substituting a single vowel for a double vowel. |
SPL_LIMIT_ADD_DOUBLE_VOWEL | 16 | An error is corrected by substituting a double vowel for a single vowel. |
SPL_LIMIT_TRANSPOSE_CONSONANT | 18 | An error is corrected by transposing two consonants. |
SPL_LIMIT_TRANSPOSE | 19 | An error is corrected by transposing any two letters. |
SPL_LIMIT_SUBSTITUTE_VOWEL | 21 | An error is corrected by substituting a vowel for another vowel. |
SPL_LIMIT_DROP | 31 | An error is corrected by dropping a letter. |
SPL_LIMIT_ADD | 35 | An error is corrected by adding a letter. |
SPL_LIMIT_SUBSTITUTE_CONSONANT | 41 | An error is corrected by substituting a consonant for another consonant. |
SPL_LIMIT_SUBSTITUTE | 43 | An error is corrected by substituting a letter for another letter. |
For each suggestion, the error type describes what the spelling checker changed in the misspelled word to produce the suggestion. If the spelling checker capitalized the word to produce the suggestion, the score is 1. If the spelling checker substituted a double vowel for a single vowel to produce the suggestion, the score is 16. An application can use scores to determine whether to present suggestions to a user.
When the spelling checker corrects more than one error to arrive at a suggestion, the score is the sum of the error types. For example, a suggestion for the inputted word “monduy” is “Monday,” with a score of 22. The spelling checker capitalized the word—the SPL_LIMIT_CAPITAL error value is1—and changed “u” to “a”—the SPL_LIMIT_SUBSTITUTE_VOWEL error is 21.
The SplLimitSet function uses the same error types to set an error tolerance for an application that implements an inline spelling checker with an automatic replacement feature.
See Also