Imported from https://github.com/alexander-rakhlin/CNN-for-Sentence-Classification-in-Keras