How to Implement a Beam Search Decoder for Natural Language Processing - Machine Learning Mastery