From Unstructured Data to Demand Counterfactuals: Theory and Practice