Learning with joint inference and latent linguistic structure in graphical models