refactor WordCounter and Tokenizer