简体   繁体   English

为什么我在WEKA中读取该ARFF文件会导致EOF早熟?

[英]Why do I get premature EOF reading this ARFF File in WEKA?

Here's a reduced version I am using for testing that produces the error below 这是我用于测试的简化版本,产生以下错误

@RELATION documents

@ATTRIBUTE rnClass {r,n}
@ATTRIBUTE CONTAINS_EMAIL numeric
@ATTRIBUTE CONTAINS_PHONE numeric

@DATA
n,0.0,0.0
n,0.0,0.0
r,0.0,0.0
r,0.0,0.0
n,0.0,0.0
r,0.0,0.0
r,0.0,0.0


Caused by: java.io.IOException: premature end of file, read Token[EOF], line 1
    at weka.core.converters.ArffLoader$ArffReader.errorMessage(ArffLoader.java:258) ~[weka-dev-3.7.6.jar:na]
    at weka.core.converters.ArffLoader$ArffReader.readHeader(ArffLoader.java:678) ~[weka-dev-3.7.6.jar:na]
    at weka.core.converters.ArffLoader$ArffReader.<init>(ArffLoader.java:139) ~[weka-dev-3.7.6.jar:na]

However this previous version seems to be working without issues: 但是,此先前版本似乎可以正常工作:

@RELATION documents

@ATTRIBUTE rnClass {r,n}
@ATTRIBUTE text String

@DATA
r,'blah blah blah...'
r,'\n\n\n\n\t\n\nblah blah blah\n\n...'
n,'\n\n   \n\n\n \nblah blah blah \n\n\nblah blah \n \n\n\n \'

I tried creating an arff file with your input, and its working for me. 我尝试用您的输入创建一个arff文件,它对我有用。 It may be the case that you arff file is corrupted. 您的arff文件可能已损坏。 Can you create a new arff file and try ? 您可以创建一个新的arff文件并尝试吗?

I had exactly this problem when trying to generate some files using the Notepad++ to make a data mining experiment. 尝试使用Notepad ++进行数据挖掘实验时,我遇到了这个问题。 I suspected that could be an encoding problem that somehow corrupts the file and makes WEKA stop working. 我怀疑这可能是编码问题,以某种方式破坏了文件并使WEKA停止工作。 You should try to change the file encoding configuration: if you create the file with UTF- 8 encoding, you should change to ANSI or another one. 您应该尝试更改文件编码配置:如果您使用UTF-8编码创建文件,则应更改为ANSI或其他格式。 It worked. 有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM