这是一个Python脚本:
from zeugma import TextsToSequences
test = ['I am here to stay', 'Who are you', 'Hello World']
sequencer = TextsToSequences()
embedded_sequ = sequencer.fit_transform(test)
它返回此错误:
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.
如何解决这个问题? 谢谢
我尝试为测试的每个元素赋予相同的长度。
我希望有一份退货号码清单
将其转换为单词列表:
test = [['I', 'am', 'here', 'to', 'stay'], ['Who', 'are', 'you'], ['Hello', 'World']]
sequencer = TextsToSequences()
embedded_sequ = sequencer.fit_transform(test)