تگ: Learning with Latent Structures