refactor phrase ranker