According to step b
, c
and l
, the first character is retain as a letter, while the entire word is processed to completion, and then affixed in the end.
Characters dropped in step f
and g
are to be stored and processed in in step m
. This is the "ending sounds" which are used to asses the likelihood of a candidate when searching. So phonix must return the key as a touple.
Algorithm as outlined in T.N. Gadd, (1990),"PHONIX: The algorithm", Program, Vol. 24 Iss 4 pp. 363 - 366
a) Perform phonetic substitutions (see Appendix);
- only the specified characters are dropped, eg. the V or vowel is not dropped in the substitution of 'N' for 'PN' when 'PNv' is true;
- the parameters are applied in the specified order;
- process all occurrences of one substitution before proceeding to the next
- the result of a substitution may create new target strings for substitution by subsequent parameters.
b) Retain the first character for the retrieval code.
c) Replace by 'v' if A, E, I, O, U or Y.
d) Where names end in ES, drop the E.
e) Append an E where names end in A,I,O,U or Y.
0 Drop the last character regardless.
g) Drop the new last character if not A,E,I,O,U or Y.
h) Repeat g) until a vowel (including Y) is found. This results in a word or name without its ending-sound.
i) Strip all occurrences of A,E,I,O,U,Y,H and W.
j) Remove one of all duplicate successive consonants.
k) Replace ALL consonants by their numeric values.
- Prefix the retrieval code with the retained first character (may be a 'v'[lowercase - see above]).
m) Repeat i), j) and k) on the characters removed as stripped ending-sounds