1
votes

I'm having a data set composed of 100 txt files all contained in one folder " named Z " & I want to convert them into ARFF format. I'm using Weka tool.

I have done that in 2 ways but in both ways I got an empty ARFF file.

1st way : through Simple CLI contained in weka by using the below :

java weka.core.converters.TextDirectoryLoader -dir D:\Z > D:\ss.arff

2nd way : through the GUI by trying to load the files using the same above convertor.

========================== Note : the files are in text format " .txt " but they actually contain numbers not characters


Is there any way to get through that problem, if anyone can help or support I would be much appreciated.

Thanks & Best regards, Mohamed

2
How are your text files formatted?ali
please state clearly, whether you want to merge all the files in the directory to create a single ARFF file of make separate ARFF files for each txt file?abhinna11
The files are in the text format ( .txt) , inside each file, i can't tell exactly how they are organized as it's a captured data set " EEG data set " - i want to merge all the files in the directory to create a single ARFF file.mohamed salem
Are those text files containing attribute values or are they documents?Rushdi Shams

2 Answers

0
votes

I was getting the same problem. I used CLI for conversion using the command: java weka.core.converters.TextDirectoryLoader -dir A:\train > A:\train. I got the empty .arff file. I had the content ready in .txt file. I copied the content from .txt file to the .arff file and saved it. it worked for me.

0
votes

Checkout the github repository

https://github.com/jeroenjanssens/data-science-at-the-command-line

and use the csv2arff tool.

Example:

< /home/knut/R/x86_64-pc-linux-gnu-library/3.1/knitr/misc/tweak_bib.csv 
csv2arff  
> tweak_bib.csv.arff

csv2arff is a very simple bash script. I recommend to check out the repository because you should also use csv2arff in conjunction with the loading script data-science-at-the-command-line/tools/weka supplied with this book/repo. The script then loads weka.jar.

Last time I checked, the csv2arff, or rather the class core.converters.CSVLoader did not work properly with weka 3.7.

....

just checking

....

OK. It works with weka 3.8.

You should set an environment variable WEKAPATH to the directory which contains your weka.jar.