A Unifying Framework for Robust and Efficient Inference with Unstructured Data