[r] Refactor translator and word

- Apply best practice
- Improve performance

##### NOTE: #####
- I can not test this since there are no documentation about how to setup the project at all. Therefore, I can only refactor this using my experience.
- Please provide `database.yml.example` and the setup documentation for future contributions.