Efficient inference for trees and alignments: Modeling monolingual and bilingual syntax with hard and soft constraints and latent variables