A Semantic Parsing Algorithm to Solve Linear Ordering Problems