本文整理汇总了Python中datamodel.DataModel.judgments方法的典型用法代码示例。如果您正苦于以下问题:Python DataModel.judgments方法的具体用法?Python DataModel.judgments怎么用?Python DataModel.judgments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datamodel.DataModel
的用法示例。
在下文中一共展示了DataModel.judgments方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CWR
# 需要导入模块: from datamodel import DataModel [as 别名]
# 或者: from datamodel.DataModel import judgments [as 别名]
class CWR(QtGui.QWidget):
def __init__(self):
self._dm = DataModel() # Primary data model.
self._topics = [] # All topics for which judgments have been loaded.
self._documents = [] # Documents for which we have a judgment for the
# currently selected topic.
self._selected_topic = None # Currently selected topic.
self._selected_document = None # Currently selected document.
self._rationales = [] # Rationales for the currently selected document.
self._display_text = None # Text of document being manipulated.
super(CWR, self).__init__()
self.init_UI()
# For testing WebView.
'''
test_url = 'https://en.wikipedia.org/wiki/The_Beatles'
content = requests.get(test_url).text
content
test_text = BeautifulSoup(content, "html.parser").get_text()
self._display_text = test_text
'''
def init_UI(self):
grid = QtGui.QGridLayout()
grid.setSpacing(10)
#####################################
# Summary of UI Elements #
#####################################
# These are UI elements that are updated after creation.
self._confusion_matrix = None # String form of confusion matrix for current view.
#####################################
# Topic View #
#####################################
# Contains Topic List.
topic_view = QtGui.QGroupBox("Topics")
topic_layout = QtGui.QVBoxLayout()
topic_view.setLayout(topic_layout)
grid.addWidget(topic_view, 0, 0)
# Topic List
self._topic_list = QtGui.QListWidget()
self._topic_list.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
self._topic_list.itemClicked.connect(self._topic_selected)
topic_layout.addWidget(self._topic_list)
#####################################
# Document View #
#####################################
# Contains Document List.
document_view = QtGui.QGroupBox("Documents")
document_layout = QtGui.QVBoxLayout()
document_view.setLayout(document_layout)
grid.addWidget(document_view, 0, 1)
# Document List
self._document_list = QtGui.QListWidget()
self._document_list.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self._document_list.itemClicked.connect(self._document_selected)
document_layout.addWidget(self._document_list)
#####################################
# Statistics View #
#####################################
# Below document view. Contains the confusion matrix, list of
# rationales, gold standard values, and user judgments.
#stat_label = QtGui.QLabel()
#stat_label.setText("<B>Statistics</B>")
#stat_layout = QtGui.QVBoxLayout()
#document_layout.addWidget(stat_label)
#self._stat_display.setLayout(stat_layout)
#self._stat_display.setSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
# Topic Display
topic = QtGui.QLabel("<b>Topic</b>: N/A")
document_layout.addWidget(topic)
narrative_label = QtGui.QLabel("<b>Narrative</b:")
document_layout.addWidget(narrative_label)
narrative_view = QtGui.QTextEdit()
document_layout.addWidget(narrative_view)
# Confusion Matrix for current Topic or Topic-Document Pair
confusion_matrix_label = QtGui.QLabel()
confusion_matrix_label.setText("Confusion Matrix")
document_layout.addWidget(confusion_matrix_label)
confusion_matrix = QtGui.QLabel()
confusion_matrix.setText(" - - - - \n"
" - - - - \n"
" - - - - \n")
document_layout.addWidget(confusion_matrix)
#.........这里部分代码省略.........