replacing non-word characters in class names with '_' (except in relation
class names).