word.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:tensorflow_end2end_speech_recognition 作者: hirofumi0810 项目源码 文件源码
def __call__(self, index_list, padded_value=-1):
        """
        Args:
            index_list (np.ndarray): list of word indices.
                Batch size 1 is expected.
            padded_value (int): the value used for padding
        Returns:
            word_list (list): list of words
        """
        # Remove padded values
        assert type(index_list) == np.ndarray, 'index_list should be np.ndarray.'
        index_list = np.delete(index_list, np.where(index_list == -1), axis=0)

        # Convert from indices to the corresponding words
        word_list = list(map(lambda x: self.map_dict[x], index_list))

        return word_list
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号