List of usage examples for weka.core Option numArguments
public int numArguments()
From source file:com.rapidminer.tools.WekaTools.java
License:Open Source License
/** * Tries to guess the type of the given option. If the number of arguments * is zero, than a boolean type is assumed. In other cases it will be tried * to parse the default value in the options array as a number and on * success a Double type is returned. If this fails, a ParameterTypeString * is returned./*from ww w .j av a2 s.c o m*/ */ public static ParameterType guessParameterType(Option option, String[] options) { if (option.numArguments() == 0) { String defaultString = getStringDefault(option.name(), options); if (defaultString == null) { return new ParameterTypeBoolean(option.name(), option.description(), getBooleanDefault(option.name(), options)); } else { return new ParameterTypeString(option.name(), option.description(), defaultString); } } else { String defaultString = getStringDefault(option.name(), options); if (defaultString == null) { return new ParameterTypeString(option.name(), option.description()); } else { try { double defaultValue = Double.parseDouble(defaultString); return new ParameterTypeDouble(option.name(), option.description(), Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, defaultValue); } catch (NumberFormatException e) { return new ParameterTypeString(option.name(), option.description(), defaultString); } } } }
From source file:put.semantic.fcanew.ml.WekaClassifier.java
@Override public String getConfigurationHelp() { String result = ""; result += "<html><ul>"; Enumeration e = classifier.listOptions(); while (e.hasMoreElements()) { Option o = (Option) e.nextElement(); result += String.format("<li>%s (%d arguments)<br><pre>%s</pre></li>", o.synopsis(), o.numArguments(), o.description().replace("\n", "<br>")); }//from w w w .ja v a 2s .c o m result += "</ul></html>"; return result; }