-->

Previous | Table of Contents | Next

Page 1088

A single character-set statement can declare either a single character or a contiguous range of characters. A range is given as in egrep and the shell: [a-z] means lowercase alphabetics; [^a-z] means all but lowercase, and so on. All character-set statements are combined (unioned) to produce the final list of characters that may be part of a word. The collating order of the characters is defined by the order of their declaration; if a range is used, the characters are considered to have been declared in ASCII order. Characters that have case are collated next to each other, with the uppercase character first.

The character-declaration statements have a rather strange behavior caused by the need to match each lowercase character with its uppercase equivalent. In any given wordchars or boundarychars statement, the characters in each range are first sorted into ASCII collating sequence, then matched one-for-one with the other range. (The two ranges must have the same number of characters). Thus, for example, the two statements:


wordchars [aeiou] [AEIOU]

wordchars [aeiou] [UOIEA]

would produce exactly the same effect. To get the vowels to match up "wrong," you would have to use separate statements:


wordchars a U

wordchars e O

wordchars i I

wordchars o E

wordchars u A

which would cause uppercase e to be O, and lowercase 0 to be e. This should normally be a problem only with languages that have been forced to use a strange ASCII collating sequence. If your uppercase and lowercase letters both collate in the same order, you shouldn't have to worry about this "feature."

The prefixes and suffixes sections have exactly the same syntax, except for the introductory keyword:


prefixes : prefixes flagdef*

suffixes : suffixes flagdef*

flagdef : flag [*jÚ] char : repl *

A prefix or suffix table consists of an introductory keyword and a list of flag definitions. Flags can be defined more than once, in which case the definitions are combined. Each flag controls one or more repls (replacements), which are conditionally applied to the beginnings or endings of various words.

Flags are named by a single character char. Depending on a configuration option, this character can be either any uppercase letter (the default configuration) or any 7-bit ASCII character. Most languages should be able to get along with just 26 flags.

A flag character may be prefixed with one or more option characters. (If you wish to use one of the option characters as a flag character, simply enclose it in double quotes.)

The asterisk (*) option means that this flag participates in cross-product formation. This only matters if the file contains both prefix and suffix tables. If so, all prefixes and suffixes marked with an asterisk will be applied in all cross-combinations to the root word. For example, consider the root fix with prefixes pre and in, and suffixes es and ed. If all flags controlling these prefixes and suffixes are marked with an asterisk, then the single root fix would also generate prefix, prefixes, prefixed, infix, infixes, infixed, fix, fixes, and fixed. Cross-product formation can produce a large number of words quickly, some of which may be illegal, so watch out. If cross-products produce illegal words, munchlist will not produce those flag combinations, and the flag will not be useful.


repl : condition* > [ - strip-string , ] append-string

The ~ option specifies that the associated flag is only active when a compound word is being formed. This is useful in a language like German, in which the form of a word sometimes changes inside a compound.

A repl is a conditional rule for modifying a root word. Up to eight conditions may be specified. If the conditions are satisfied, the rules on the rightside of the repl are applied, as follows:

  1. If a strip-string is given, it is first stripped from the beginning or ending (as appropriate) of the root word.
  2. The append-string is added at that point.

Previous | Table of Contents | Next