Dynamic Programming Encoding for Subword Segmentation in Neural Machine Translation