當前位置: 首頁>>代碼示例>>Python>>正文


Python DataModel.judgments方法代碼示例

本文整理匯總了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)
#.........這裏部分代碼省略.........
開發者ID:tylermcdonnell,項目名稱:cwr,代碼行數:103,代碼來源:cwr.py


注:本文中的datamodel.DataModel.judgments方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。