[r] Refactor translator and word

- Apply best practice
- Improve performance