You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 6, 2025. It is now read-only.
This repository was archived by the owner on Aug 6, 2025. It is now read-only.
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (750,) + inhomogeneous part. #94
sent1 = np.array([s.split() for s in sent1])[not_empty_idx]
In this line, the element of [s.split() for s in sent1] is not the same len. It will report this error. Has anyone met the same one?
I change the code to
`sent1_lengths = [len(s.split()) for s in sent1]
sent2_lengths = [len(s.split()) for s in sent2]
max_length = max(max(sent1_lengths), max(sent2_lengths))
sent1 = np.array([s.split() + [''] * (max_length - len(s.split())) for s in sent1])[not_empty_idx]
sent2 = np.array([s.split() + [''] * (max_length - len(s.split())) for s in sent2])[not_empty_idx]
`
and then the code go right.
taofendenanhai, vthost, sarahESL, dburian, Ybakman and 7 more