⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.java

📁 Machine Learning Weka 数据变换
💻 JAVA
字号:
/*
 * Main.java
 *
 * Created on 2007年8月25日, 下午1:11
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package xrffconverter;

import java.io.FilenameFilter;
import weka.core.converters.ConverterUtils.DataSource;
import weka.core.converters.XRFFSaver;
import weka.core.Instances;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import xrffconverter.Converter;

/**
 *
 * @author Peng
 */
public class Main {
    
    /** Creates a new instance of Main */
    public Main() {
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Converter aConverter = new Converter(args); // get an instance of Converter class
        if(args.length==0){ //if no argument here, convert files in current dir
            File home = new File(".");
            String currentDir = home.getAbsolutePath().substring(0,home.getAbsolutePath().length()-1); //get absolute current dir
            System.out.println("Current home directory is "+ currentDir);
            System.out.println("");
            
            try {
                aConverter.convertDirs(currentDir, currentDir, currentDir); //invode method in aConverter to convert files in the current dir
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }else if (args.length==3){ // if 3 arguments here
            File arg1= new File(args[0]);
            File arg2= new File(args[1]);
            File arg3= new File(args[2]);
            
            if(arg1.isFile() && arg2.isFile()){ //if they are files, then convert these files
                try {
                    aConverter.convertFiles(args[0],args[1],args[2]);
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }else if(arg1.isDirectory() && arg2.isDirectory() && arg3.isDirectory()){ // if they are dirs, then check the dirs and convert files in these dirs
                try {
                    aConverter.convertDirs(args[0], args[1], args[2]);
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }else{
                System.out.println("Error");
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -