Commit 7ed484b1 authored by Christos Christodoulopoulos's avatar Christos Christodoulopoulos
Browse files

Added the context id in the main window (next to the SRL id)

parent ede189dd
......@@ -4,4 +4,5 @@
## Additional for IntelliJ
out/
resource
system
\ No newline at end of file
system
jubilee.jar
\ No newline at end of file
......@@ -29,6 +29,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.List;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
......@@ -60,20 +61,22 @@ public class JDCTextAreaFrame extends JFrame implements ActionListener
setVisible(true);
}
public JDCTextAreaFrame(String title, String example, int lineNum)
public JDCTextAreaFrame(String title, List<String> context, int lineNum)
{
super(title);
mbar = new JDCTextAreaFrameMenuBar(this);
setJMenuBar(mbar);
JTextArea ta = new JTextArea(example);
String contextText = "";
for (String line : context) contextText += line+"\n";
JTextArea ta = new JTextArea(contextText);
int bId = 0, eId = -1;
for (int i=0; i<=lineNum; i++)
{
bId = eId + 1;
eId = example.indexOf("\n", bId);
eId = contextText.indexOf("\n", bId);
}
Highlighter h = ta.getHighlighter();
......
......@@ -34,6 +34,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.StringTokenizer;
/**
......@@ -70,7 +71,7 @@ public class PBReader
/** argument tag for relation */
static public String REL = "rel";
private ArrayList<PBInstance> ls_instance;
public ArrayList<PBInstance> ls_instance;
private TBReader tb_reader;
private TBTree p_tree;
private String s_treeDir;
......@@ -78,7 +79,7 @@ public class PBReader
private int i_lastEditIdx; // index of the last edited tree
// private HashMap<String,String> m_context;
// XXX We assume that context is constant for each task
private String m_context;
private List<String> ls_context;
private int i_prevTreeId;
private String s_prevTreePath;
......@@ -96,14 +97,14 @@ public class PBReader
*/
public PBReader(String annotationFile, String contextFile, String treebankDir)
{
ls_instance = new ArrayList<PBInstance>();
ls_instance = new ArrayList<PBInstance>();
ls_annotationTrees = new ArrayList<String>();
s_treeDir = treebankDir + File.separator;
i_currIdx = 0;
i_lastEditIdx= 0;
m_context = "";
i_prevTreeId = -1;
s_prevTreePath = "";
s_treeDir = treebankDir + File.separator;
i_currIdx = 0;
i_lastEditIdx = 0;
ls_context = new ArrayList<String>();
i_prevTreeId = -1;
s_prevTreePath= "";
try
{
......@@ -120,7 +121,7 @@ public class PBReader
index = 0;
while (scan.hasNextLine())
m_context += (index++) + " " + scan.nextLine() + "\n";
ls_context.add((index++) + " " + scan.nextLine());
scan.close();
......@@ -365,10 +366,10 @@ public class PBReader
return i_currIdx;
}
public String getContexts()
public List<String> getContexts()
{
// return m_context.get(getInstance().treePath);
return m_context;
return ls_context;
}
/**
......
......@@ -53,7 +53,7 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
// Treeview: top-pane
private JButton bt_prev, bt_next, bt_treeSurgeon, bt_treeSurgeonHelp, bt_tgrepHelp;
private JComboBox<Integer> cb_jump;
private JComboBox<String> cb_jump;
private JTextField tf_annotator;
private JTextArea ta_sentence, ta_tgrepPattern, ta_treeSurgeonScript;
private JList<String> ls_gold;
......@@ -144,7 +144,7 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
bt_next = new JButton("Next");
bt_next.addActionListener(this);
cb_jump = new JComboBox<Integer>();
cb_jump = new JComboBox<String>();
cb_jump.setMaximumRowCount(20);
cb_jump.addItemListener(this);
cb_jump.setFocusable(false);
......@@ -365,8 +365,11 @@ public class JBToolkit extends JFrame implements ActionListener, ItemListener, L
framesetPanel.initPBReader(pb_origin);
cb_jump.removeAllItems();
for (int i=0; i<pb_origin.getSize(); i++)
cb_jump.insertItemAt(i, i);
for (int i=0; i<pb_origin.getSize(); i++) {
int treeId = pb_origin.ls_instance.get(i).getTreeId();
String contextId = pb_origin.getContexts().get(treeId);
cb_jump.insertItemAt(i + " - \"" + contextId.substring(0, contextId.indexOf(":")) + "\"", i);
}
// Go to the last sentence that the user annotated
cb_jump.setSelectedIndex(pb_origin.getLastEditIndex());
......
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