我正在尝试将一组评论转换为ARFF格式,以便在WEKA中使用。不幸的是,要么我完全误解了该格式的工作原理,要么我必须为所有可能的单词设置一个属性,然后再设置出现指示器。有没有人知道更好的方法,或者最好有一个样本ARFF文件?
我正在尝试将一组评论转换为ARFF格式,以便在WEKA中使用。不幸的是,要么我完全误解了该格式的工作原理,要么我必须为所有可能的单词设置一个属性,然后再设置出现指示器。有没有人知道更好的方法,或者最好有一个样本ARFF文件?
经过一段时间的努力,我们终于解决了问题,并使用了这个input.arff文件:
@relation text_files
@attribute review string
@attribute sentiment {0, 1}
@data
"this is some text", 1
"this is some more text", 1
"different stuff", 0
而这个命令:
java -classpath "C:\\Program Files\\Weka-3-6\\weka.jar" weka.filters.unsupervised.attribute.StringToWordVector -i input.arff -o output.arff
@relation 'text_files-weka.filters.unsupervised.attribute.StringToWordVector-R1-W1000-prune-rate-1.0-N0-stemmerweka.core.stemmers.NullStemmer-M1-tokenizerweka.core.tokenizers.WordTokenizer -delimiters \" \\r\\n\\t.,;:\\\'\\\"()?!\"'
@attribute sentiment {0,1}
@attribute different numeric
@attribute is numeric
@attribute more numeric
@attribute some numeric
@attribute stuff numeric
@attribute text numeric
@attribute this numeric
@data
{0 1,2 1,4 1,6 1,7 1}
{0 1,2 1,3 1,4 1,6 1,7 1}
{1 1,5 1}
{0 1,2 1,4 1,6 1,7 1}
中用逗号分隔的类似于0 1
的元组代表什么吗?我认为这与传统的.arff格式不同。你有没有在WEKA中获得有意义的结果? - Zhubarb