Dictionary generation code