An Actor-Critic Algorithm for Structured Prediction