Commit 21f0acd3 authored by Christos Christodoulopoulos's avatar Christos Christodoulopoulos
Browse files

Added ability to pre-approve w/o changes

-If checked, the annotation will be marked with annotator's name (instead of auto/babySRL)
parent cadfbe17
......@@ -30,6 +30,7 @@ The **Help** menu (`F1`) will provide the same list of shortcuts
| Next annotation | `.` |
| Previous annotation | `,` |
| Jump to annotation | `cmd/ctrl` + `j` |
| Show incremental IDs| `cmd/ctrl` + `i` |
| Frameset Information| |
|---------------------|------------------|
......@@ -37,10 +38,11 @@ The **Help** menu (`F1`) will provide the same list of shortcuts
| Previous roleset | `[` |
| See examples | `cmd/ctrl` + `e` |
| Annotation/Editing | |
|---------------------|------------------|
| Edit tree | `cmd/ctrl` + `t` |
| Add predicate | `=` |
| Add Arg[0-5] | `0-5` |
| Add ArgP-Gov | `x` |
| Add ArgP-Obj | `y` |
\ No newline at end of file
| Annotation/Editing | |
|---------------------|---------------------------|
| Edit tree | `cmd/ctrl` + `t` |
| Add predicate | `=` |
| Add Arg[0-5] | `0-5` |
| Add ArgP-Gov | `x` |
| Add ArgP-Obj | `y` |
| Approve annotation | `cmd/ctrl` + `shift` + `a`|
\ No newline at end of file
No preview for this file type
......@@ -154,20 +154,25 @@ public class JBCorpus {
lastEditIndex = index;
}
public void setCurrentAnnotationIndex(int currentAnnotationIndex) {
public void setCurrentAnnotationIndex(int annotationIndex, boolean approved) {
// Before moving on, confirm that we want to keep the changes to the current annotation
if (getCurrentAnnotation() != null && getCurrentAnnotation().isChanged())
confirmChanges();
this.currentAnnotationIndex = currentAnnotationIndex;
// However, even if the annotation hasn't changed but the user chose to approve it, we should mark it as done
if (getCurrentAnnotation() != null)
if (getCurrentAnnotation().isChanged() || approved)
confirmChanges(approved);
this.currentAnnotationIndex = annotationIndex;
}
private void confirmChanges() {
private void confirmChanges(boolean approved) {
boolean save = false;
int response = JOptionPane.showConfirmDialog(null, "Do you want to keep the changes to the annotation?",
"Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (response == JOptionPane.NO_OPTION) save = false;
else if (response == JOptionPane.YES_OPTION) save = true;
else if (response == JOptionPane.CLOSED_OPTION) save = false;
if (approved) save = true;
else {
int response = JOptionPane.showConfirmDialog(null, "Do you want to keep the changes to the annotation?",
"Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (response == JOptionPane.NO_OPTION) save = false;
else if (response == JOptionPane.YES_OPTION) save = true;
else if (response == JOptionPane.CLOSED_OPTION) save = false;
}
if (!save) {
try {
revertChanges();
......
......@@ -41,7 +41,7 @@ public class JBMenuBar extends JMenuBar {
private JMenu mn_args;
JMenuItem fileOpen, fileSave, fileSaveAs, fileQuit;
JCheckBoxMenuItem shownIncrementalIDs;
JCheckBoxMenuItem shownIncrementalIDs, approveChanges;
JMenuItem tbPrev, tbNext, tbJump, tbView;
JMenuItem fsPrev, fsNext, fsViewExample, fsViewArgument, fsViewRolesetComment;
JMenuItem[] argArgs, argFunc;
......@@ -137,7 +137,13 @@ public class JBMenuBar extends JMenuBar {
private void initMenuTreebank() {
JMenu mTreebank = new JMenu("Treebank");
mTreebank.setMnemonic(KeyEvent.VK_T);
approveChanges = new JCheckBoxMenuItem("Approve Annotation");
approveChanges.setMnemonic(KeyEvent.VK_A);
approveChanges.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, menuShortcutKeyMask+KeyEvent.SHIFT_MASK));
approveChanges.addActionListener(jbtk);
mTreebank.add(approveChanges);
mTreebank.addSeparator();
tbPrev = getJMenuItem("Previous Tree", KeyEvent.VK_P, KeyEvent.VK_COMMA, 0);
mTreebank.add(tbPrev);
tbNext = getJMenuItem("Next Tree", KeyEvent.VK_N, KeyEvent.VK_PERIOD, 0);
......
......@@ -78,6 +78,7 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
static public String s_sysDir = null;
private static JBToolkit instance;
private JCheckBox checkboxApprove;
public JBToolkit(final String title, String sysDir, String userID, final int maxAnn) {
super(title);
......@@ -155,6 +156,10 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
bt_next = new JButton("Next");
bt_next.addActionListener(this);
checkboxApprove = new JCheckBox("Approve annotation");
checkboxApprove.addActionListener(this);
checkboxApprove.setToolTipText("Check this box to approve the annotation \neven if no changes were made");
buttonTreeEdit = new JButton("Edit Tree");
buttonTreeEdit.addActionListener(this);
......@@ -199,11 +204,35 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
top.setLayout(new BorderLayout());
JPanel top1 = new JPanel();
top1.setLayout(new GridLayout(0,4));
top1.add(bt_prev);
top1.add(bt_next);
top1.add(comboJump);
top1.add(tf_annotator);
top1.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 0;
c.gridy = 0;
c.weightx = .5;
top1.add(bt_prev, c);
c.gridx = 1;
c.gridy = 0;
c.weightx = .5;
top1.add(bt_next, c);
c.gridx = 2;
c.gridy = 0;
top1.add(checkboxApprove);
c.gridx = 3;
c.gridy = 0;
c.weightx = .7;
c.fill = GridBagConstraints.BOTH;
c.insets = new Insets(0,5,0,5);
top1.add(tf_annotator, c);
c.gridx = 4;
c.gridy = 0;
c.weightx = .5;
c.insets = new Insets(0,0,0,0);
top1.add(comboJump, c);
top.add(top1, BorderLayout.NORTH);
if (isGold()) {
......@@ -310,7 +339,8 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
else if (e.getSource() == mbar.fileSaveAs) menuFileSaveAs();
else if (e.getSource() == mbar.fileQuit) System.exit(0);
else if (e.getSource() == mbar.shownIncrementalIDs) toggleShowIDs();
else if (e.getSource() == mbar.tbPrev || e.getSource() == bt_prev) actionBtPrev();
else if (e.getSource() == mbar.approveChanges) checkboxApprove.setSelected(mbar.approveChanges.isSelected());
else if (e.getSource() == mbar.tbPrev || e.getSource() == bt_prev) actionBtPrev();
else if (e.getSource() == mbar.tbNext || e.getSource() == bt_next) actionBtNext();
else if (e.getSource() == mbar.tbJump) menuTbJump();
else if (e.getSource() == mbar.tbView || e.getSource() == buttonTreeEdit) actionButtonTreeEdit();
......@@ -330,7 +360,8 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
public void itemStateChanged(ItemEvent e) {
if (e.getSource() == comboJump && comboJump.getSelectedIndex() >= 0) {
corpus.setCurrentAnnotationIndex(comboJump.getSelectedIndex());
corpus.setCurrentAnnotationIndex(comboJump.getSelectedIndex(), checkboxApprove.isSelected());
checkboxApprove.setSelected(false);
corpus.backup(corpus.getCurrentAnnotation());
updateAll();
updateGoldList();
......@@ -590,7 +621,8 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
if (isGold())
corpus.getCurrentAnnotation().setAnnotator(DataManager.GOLD_ID);
for (int i=corpus.getCurrentAnnotationIndex(); i>0; i--) {
corpus.setCurrentAnnotationIndex(i - 1);
corpus.setCurrentAnnotationIndex(i - 1, checkboxApprove.isSelected());
checkboxApprove.setSelected(false);
if (!isGold() || !isGoldSame()) break;
}
comboJump.setSelectedIndex(corpus.getCurrentAnnotationIndex());
......@@ -600,7 +632,8 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
if (isGold())
corpus.getCurrentAnnotation().setAnnotator(DataManager.GOLD_ID);
for (int i=corpus.getCurrentAnnotationIndex(); i<corpus.getSize()-1; i++) {
corpus.setCurrentAnnotationIndex(i + 1);
corpus.setCurrentAnnotationIndex(i + 1, checkboxApprove.isSelected());
checkboxApprove.setSelected(false);
if (!isGold() || !isGoldSame()) break;
}
comboJump.setSelectedIndex(corpus.getCurrentAnnotationIndex());
......@@ -684,6 +717,7 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
msg += "Next annotation .\n";
msg += "Previous annotation ,\n";
msg += "Jump to annotation cmd/ctrl + j \n";
msg += "Show incremental IDs cmd/ctrl + i \n";
msg += "\n";
msg += "#### Frameset information\n";
msg += "Next roleset ]\n";
......@@ -696,6 +730,7 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
msg += "Add Arg[0-5] 0-5 \n";
msg += "Add ArgP-Gov x \n";
msg += "Add ArgP-Obj y \n";
msg += "Approve annotation cmd/ctrl+shift + a \n";
JOptionPane.showMessageDialog(this, msg, "Help", JOptionPane.INFORMATION_MESSAGE);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment