(sentence)
return list_index
将一个句子转换成index的list，并截断
将一个句子转换成index的list，并截断
将一个句子转换成index的list，并截断
def sentence2index(sentence):
    """将一个句子转换成index的list，并截断"""
    sentence_list = sentence.strip().split()[:max_length]
    list_index = list(map(word2index, sentence_list))
    return list_index
def sentence2index ( sentence ) : sentence_list = sentence . strip ( ) . split ( ) [ : max_length ] list_index = list ( map ( word2index , sentence_list ) ) return list_index