Text this: Top-down and bottom-up attention for joint pattern classification and reconstruction