Greedy Inference Algorithms For Structured And Neural Models