package ir.ac.iust.nlp.dependencyparser.utility.parsing;
import ir.ac.iust.nlp.dependencyparser.utility.enumeration.Flowchart;
import javax.swing.SpinnerNumberModel;
/**
*
* @author Mojtaba Khallash
*/
public class MateSettingsPanel extends javax.swing.JPanel {
/**
* Creates new form MateSettingsPanel
*/
public MateSettingsPanel() {
this(Flowchart.Train);
}
public MateSettingsPanel(Flowchart chart) {
initComponents();
SpinnerNumberModel num_model = new SpinnerNumberModel(0.3, 0.0, 1.0, 0.1);
spNPThreshold.setModel(num_model);
num_model = new SpinnerNumberModel(10, 1, 10000, 1);
spTrainingIter.setModel(num_model);
Runtime runtime = Runtime.getRuntime();
int THREADS = runtime.availableProcessors();
num_model = new SpinnerNumberModel(THREADS, 1, THREADS, 1);
spCoreNo.setModel(num_model);
if (chart == Flowchart.Parse) {
lblTrainingIter.setVisible(false);
spTrainingIter.setVisible(false);
}
}
public int getTrainingIterations() {
return Integer.parseInt(spTrainingIter.getValue().toString());
}
public double getNonProjectivityThreshold() {
return Double.parseDouble(spNPThreshold.getValue().toString());
}
public String getDecodeType() {
return cboDecodeType.getSelectedItem().toString();
}
public String getFeatureCreation() {
return cboFeatureCreation.getSelectedItem().toString();
}
public int getNumberOfCores() {
return Integer.parseInt(spCoreNo.getValue().toString());
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
lblDecodeType = new javax.swing.JLabel();
cboDecodeType = new javax.swing.JComboBox();
lblTrainingIter = new javax.swing.JLabel();
spTrainingIter = new javax.swing.JSpinner();
cboFeatureCreation = new javax.swing.JComboBox();
lblFeatureCreation = new javax.swing.JLabel();
lblCoreNo = new javax.swing.JLabel();
spCoreNo = new javax.swing.JSpinner();
lblNPThreshold = new javax.swing.JLabel();
spNPThreshold = new javax.swing.JSpinner();
lblDecodeType.setText("Decode Type:");
cboDecodeType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "proj", "non-proj" }));
cboDecodeType.setSelectedIndex(1);
lblTrainingIter.setText("Training Iterations:");
cboFeatureCreation.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "multiplicative", "shift" }));
lblFeatureCreation.setText("Feature Creation:");
lblCoreNo.setText("Number of Cores:");
lblNPThreshold.setText("Non-Projective Threshold:");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblFeatureCreation)
.addComponent(lblDecodeType))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(cboDecodeType, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblNPThreshold)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spNPThreshold, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(cboFeatureCreation, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 32, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblTrainingIter)
.addComponent(lblCoreNo))
.addGap(37, 37, 37)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spTrainingIter, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spCoreNo, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblNPThreshold)
.addComponent(spNPThreshold, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblDecodeType)
.addComponent(cboDecodeType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblFeatureCreation)
.addComponent(cboFeatureCreation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblTrainingIter)
.addComponent(spTrainingIter, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblCoreNo)
.addComponent(spCoreNo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JComboBox cboDecodeType;
private javax.swing.JComboBox cboFeatureCreation;
private javax.swing.JLabel lblCoreNo;
private javax.swing.JLabel lblDecodeType;
private javax.swing.JLabel lblFeatureCreation;
private javax.swing.JLabel lblNPThreshold;
private javax.swing.JLabel lblTrainingIter;
private javax.swing.JSpinner spCoreNo;
private javax.swing.JSpinner spNPThreshold;
private javax.swing.JSpinner spTrainingIter;
// End of variables declaration//GEN-END:variables
}