public class Dictionary
extends java.lang.Object
NB: this class wraps an instance of HashedSpellingDictionary and is constrained by the contracts of that class. The main issue to be aware of is the way that words are compared with those stored in the dictionary. The word being tested is compared with the words in the dictionary capitalised as it is provided to the function, and then compared again after being normalised to lower case if there is no match. The words in the dictionary are not normalised. In other words, the word being tested is tested first case sensitive, then case insensitive, but the capitalisation of the reference word remains constant. Consequently, proper nouns are only marked as correct when their capitalisation matches that used in the dictionary. This is the expected behaviour of a spell checker, but might not always be what is wanted by the user of this class. The class NormalisedDictionaryManager implements a dictionary that matches strings regardless of case, either in the dictionary or the string being tested.
| Modifier and Type | Method and Description |
|---|---|
Result |
checkSpelling(java.lang.String word)
Checks the spelling of a word in this dictionary.
|
Result |
checkSpelling(java.lang.String word,
int costThreshold)
Checks the spelling of a word in this dictionary.
|
java.lang.String |
description()
Retrieves the description.
|
java.lang.String |
name()
Retrieves the dictionary's name.
|
public final java.lang.String name()
String containing the dictionary's name.public final java.lang.String description()
String containing the description of the dictionarypublic Result checkSpelling(java.lang.String word, int costThreshold)
uk.ac.open.crc.mdsc.engine
package.
NB The threshold value does not currently work as described. The threshold set in the constructor is used, and the value passed is ignored. There are two reasons: (1) this mechanism was not implemented in the underlying Jazzy engine classes, and (2) the constructor set threshold seems adequate, so any fix is low-priority.
word - a word to be testedcostThreshold - the maximum cost of any suggested alternative spellingResult containing the results of the test
including a list of any alternative spellings.public Result checkSpelling(java.lang.String word)
word - a word to be testedResult containing the results of the test
including a list of any alternative spellings.