Edinburgh Research Explorer Piecewise training for structured prediction