add-spell-rule - Add a new spelling rule to the dictionary
n add-spell-rule [ "rule-letter" "base-ending" "remove" "derive-ending" ]
add-spell-rule adds a new spelling rule to the speller. The rules effectively define the prefix and suffix character replacements of words, which is given an alphabetical identifier used within the speller , in conjunction with the language dictionary. The letter conventions are defined by the Free Software Foundation GNU ispell(1) package.
add-spell-rule is used in the MicroEmacs '06 dictionary initialization files called <language>r.emf, e.g. americar.erf, britishr.erf supplied in the MicroEmacs macros directory.
The command takes a single numeric argument n to control the addition of a rule to the speller, as follows:-
-1 add-spell-rule "rule-letter" "base-ending" "" "deriv-ending"
-2 add-spell-rule "rule-letter" "base-ending" "" "deriv-ending"
"rule-letter" is any character in the range A-z except '_', all rules of the given letter must be a prefix rule of the same type (i.e. same argument). The start of a base word must match the given "base-ending" regular expression string for the rule to be applied, the "remove" string must be empty for a prefix and the "deriv-ending" is the prefix string. Example, for the American language;-
-2 add-spell-rule "I" "" "" "in" ; As in disposed > indisposed
A prefix rule of type 'I' can be applied to any base word which has rule 'I' enabled, and it prefixes "in" to the word.
1 add-spell-rule "rule-letter" "base-ending" "remove" "deriv-ending"
2 add-spell-rule "rule-letter" "base-ending" "remove" "deriv-ending"
"rule-letter" is any character in the range A-z, all rules of the given letter must be a suffix rule of the same type (i.e. same argument). The end of a base word must match the given "base-ending" regular expression string for the rule to be applied, the "remove" string must be a fixed string and the "deriv-ending" must also be a fixed string which is appended to the base-word after "remove" has been removed. Example, for the American language;-
2 add-spell-rule "N" "e" "e" "ion" ; As in create > creation 2 add-spell-rule "N" "y" "y" "ication" ; As in multiply > multiplication 2 add-spell-rule "N" "[^ey]" "" "en" ; As in fall > fallen
A suffix rule of type 'N' can be applied to any base word which has rule 'N' enabled, and it can be used with prefixes, e.g. with rule;-
-2 add-spell-rule "A" "" "" "re" ; As in enter > reenter
to derive "recreation" from "create". A rule which cannot be used with prefixes, i.e.:
1 add-spell-rule "V" "e" "e" "ive" ; As in create > creative 1 add-spell-rule "V" "[^e]" "" "ive" ; As in prevent > preventive
While some prefix words are legal, such as "recreative" but some are not, such as "collect" where "recollect" is correct, so is "collective" but "recollective" is not.
Following are special forms of add-spell-rule used for tuning the spell support, note that an argument can not be given:-
add-spell-rule "-" "<y|n>"
Enables and disables the acceptance of hyphens joining correct words. By default the phrase "out-of-date" would be accepted in American even though the phrase does not exist in the American dictionary. This is because the three words making up the phrase are correct and by default hyphens joining words are allowed. Some Latin language such as Spanish do not use this concept so this feature can be disable.
add-spell-rule "#" "score"
Sets the maximum allowed error score when creating a spelling guess list. When comparing a dictionary word with the user supplied word, spell checks for differences, each difference or error is scored in the range of 20 to 27 points, once the maximum allowed score has been exceeded the word is ignored. The default guess error score is 60, allowing for 2 errors.
add-spell-rule "*" "regex"
Adds a correct word in the form of a regex if a word being spell checked is completely matched by the regex the word is deemed to be correct. For example, the following rule can be used to make the spell-checker allow all hex numbers:
add-spell-rule "*" "0[xX][[:xdigit:]]+"
This will completely match the words "0x0", "0xff" etc but not "0x00z" as the whole word is not matched, only the first 4 letters.
The format of the dictionary is a list of base words with each word having a list of rules which can be applied to that word. Therefore the list of words and the rules used for them are linked e.g.
aback abaft abandon/DGRS abandonment/S abase/DGRS abasement/S abash/DGS abashed/U abate/DGRS
where the "/..." is the valid list of rules for that word.
The '_' character is used to separate different rule lists for a single word.
The format of the dictionary word list and the rule list is compatible with ispell(1).
Copyright (c) 1998-2006 JASSPA
Last Modified: 2002/01/11
Generated On: 2006/10/07