input preprocessor for rare words