implementing ranked word sets