Refactor text_snippet finder method in helper