build dict for token count and id