当我尝试解压缩wikipedia转储以使用其.xml文件时,会出现此错误。我该如何解决?
filepath='/Data/nlp/ESA/Wiki-ESA-master'
file_name='enwiki-latest-pages-articles.xml.bz2'
zipfile = bz2.BZ2File(file_name) # open the file
DEFAULT_FILENAME = zipfile.read() # get the decompressed data
错误:
EOFError: compressed file ended before the logical end-of-stream was detected
正如错误所说,下载过程很可能提前结束,并且您有一个截断的文件。请再次尝试下载。
另一个原因可能是磁盘上的数据已损坏。再次下载可能也有帮助。