moved the get_phrases function from recpt/querytools to here, so that colservr and recpt can share it