Skip to content

padding_sentence的bug #12

@lstaroth

Description

@lstaroth

data_helper.py里面
padding_sentences函数并不能对过长的句子进行截断

bug出现在 sentence = sentence[:max_sentence_length]
这个只能修改sentence变量并不能把sentence的修改应用到sentences列表里
测试代码:
a=[
[1,2,3,4],
[1,2,3,4,5,6],
[1,2,3,4,5,6,7,8,9],
]

for s in a:
if len(s) > 5:
a=a[:5]
print(a)

[[1, 2, 3, 4], [1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6, 7, 8, 9]]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions