Lookup a word in the thesaurus. If the name appears in the thesaurus,
return its equivalent. If #canonical_names# is true, pass the string
#name# or its equivalent through a filter to replace all characters
that are not alphanumerics with the underscore. Sequences matching
`%[0-9][0-9a-fA-F]' are considered to be hex escape codes and are
replaced by a single underscore.
Returns:
The string #name#, its equivalent or its canonicalized
equivalent.