String trainFileString; StringBuffer text = new StringBuffer(); PredictiveApriori apriori = new PredictiveApriori(); Reader reader;  try { text.append("\n\nPredictiveApriori options:\n\n"); text.append("-t <training file>\n"); text.append("\tThe name of the training file.\n"); Enumeration enu = apriori.listOptions(); while (enu.hasMoreElements()) { Option option = (Option)enu.nextElement(); text.append(option.synopsis()+'\n'); text.append(option.description()+'\n'); } trainFileString = Utils.getOption('t', args); if (trainFileString.length() == 0) throw new Exception("No training file given!"); apriori.setOptions(args); reader = new BufferedReader(new FileReader(trainFileString)); if(!apriori.getCar()) apriori.buildAssociations(new Instances(reader)); else apriori.mineCARs(new Instances(reader)); System.out.println(apriori); } catch(Exception e) { e.printStackTrace(); System.out.println("\n"+e.getMessage()+text); }
runAssociator(new PredictiveApriori(), args);
  public static void main(String[] args) {    String trainFileString;    StringBuffer text = new StringBuffer();    PredictiveApriori apriori = new PredictiveApriori();    Reader reader;    try {      text.append("\n\nPredictiveApriori options:\n\n");      text.append("-t <training file>\n");      text.append("\tThe name of the training file.\n");      Enumeration enu = apriori.listOptions();      while (enu.hasMoreElements()) {	Option option = (Option)enu.nextElement();	text.append(option.synopsis()+'\n');	text.append(option.description()+'\n');      }      trainFileString = Utils.getOption('t', args);      if (trainFileString.length() == 0) 	throw new Exception("No training file given!");      apriori.setOptions(args);      reader = new BufferedReader(new FileReader(trainFileString));      if(!apriori.getCar())        apriori.buildAssociations(new Instances(reader));      else        apriori.mineCARs(new Instances(reader));      System.out.println(apriori);    } catch(Exception e) {      e.printStackTrace();      System.out.println("\n"+e.getMessage()+text);    }  }