这可能是一个简单的问题,但是显然,我在CountVectorizer()中收到了适合的空词汇。
代码:
a = [[], []]
b = [[[], [], [], [], [], [], []], [[], [], [], [], [], [], [], []]]
try:
CountVectorizer().fit(chain.from_iterable(a))
return doing(b)
value = []
for x in b:
bb = [" ".join(fx) for fx in x]
test = self.CountVectorizer().transform(bb)
value.append(test)
return value
except ValueError:
print("Value Error: Empty Vocabulary", file=sys.stderr)
***what to include here so that they will continue doing the next process and output nothing for the vectors?***