added canonical word logic
Merge pull request #1 from abukurov/tast/add-canonical-word-logic

added canonical word logic