1 """Chart inspector for the tag rank parser.
2
3 Some small extensions to the CKY chart inspector for the tag rank
4 parser.
5
6 See L{jazzparser.parsers.cky.inspector} for details.
7
8 """
9 """
10 ============================== License ========================================
11 Copyright (C) 2008, 2010-12 University of Edinburgh, Mark Granroth-Wilding
12
13 This file is part of The Jazz Parser.
14
15 The Jazz Parser is free software: you can redistribute it and/or modify
16 it under the terms of the GNU General Public License as published by
17 the Free Software Foundation, either version 3 of the License, or
18 (at your option) any later version.
19
20 The Jazz Parser is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with The Jazz Parser. If not, see <http://www.gnu.org/licenses/>.
27
28 ============================ End license ======================================
29
30 """
31 __author__ = "Mark Granroth-Wilding <mark.granroth-wilding@ed.ac.uk>"
32
33 from jazzparser.parsers.cky.inspector import ChartInspectorThread, \
34 ChartInspectorWindow, CellInspectorWindow
35
36 import gtk, gobject
37
40 """
41 Override to add extra column to the cell inspector.
42
43 """
44 liststore = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
45
46 for sign in reversed(sorted(self.signs, key=lambda s: s.probability)):
47 liststore.append(["%f" % sign.probability, "%s" % sign])
48 return liststore
49
51 """
52 Override to add extra column.
53
54 """
55
56 prob_column = gtk.TreeViewColumn("Probability")
57 self.treeview.append_column(prob_column)
58
59 prob_renderer = gtk.CellRendererText()
60 prob_column.pack_start(prob_renderer, True)
61 prob_column.add_attribute(prob_renderer, "text", 0)
62
63
64 sign_column = gtk.TreeViewColumn("Signs on edge (%d,%d)" % (self.from_node, self.to_node))
65 self.treeview.append_column(sign_column)
66
67 sign_renderer = gtk.CellRendererText()
68 sign_renderer.set_property('family', 'monospace')
69 sign_column.pack_start(sign_renderer, True)
70 sign_column.add_attribute(sign_renderer, "text", 1)
71
72
73 self.treeview.set_search_column(1)
74
77
80