Adds a menu item to the GUIChooser's main menu for converting command-lines into code snippets (under Extensions).
- Instantiation -- instantiates an object specified by the command-line
and sets its options (if a
weka.core.OptionHandler
). - Instantiation (with TryCatch) -- same as Instantiation, but guards the setting of the options with a try-catch block.
- Java String -- simply escapes the command-line and generates a statement using a String.
- String Array -- fills a String array with the options from the command.
- Test class -- generates a little test class that instantiates the command including the necessary imports.
Click on one of the following links to download the corresponding Weka package:
For more information on how to install the package, see:
https://waikato.github.io/weka-wiki/packages/manager/
Use the following dependency to include it in your Maven project:
<dependency>
<groupId>com.github.fracpete</groupId>
<artifactId>command-to-code-weka-packae</artifactId>
<version>2017.10.9</version>
</dependency>
You can use the following class (derived from javax.swing.JPanel
) in your
Swing GUI:
weka.gui.CommandToCodePanel
You can use a converter to generate code on the fly:
import weka.core.code.StringArray;
...
String cmd = "..."; // command from somewhere
StringArray conv = new StringArray();
if (conv.handles(cmd)) {
String code = conv.convert(cmd);
System.out.println(code);
}