当前位置: 首页>>代码示例>>Python>>正文


Python DataModel.topic_information方法代码示例

本文整理汇总了Python中datamodel.DataModel.topic_information方法的典型用法代码示例。如果您正苦于以下问题:Python DataModel.topic_information方法的具体用法?Python DataModel.topic_information怎么用?Python DataModel.topic_information使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在datamodel.DataModel的用法示例。


在下文中一共展示了DataModel.topic_information方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CWR

# 需要导入模块: from datamodel import DataModel [as 别名]
# 或者: from datamodel.DataModel import topic_information [as 别名]

#.........这里部分代码省略.........
        overlap_color = QtGui.QColor(255, 255, 102) # Light Yellow
        for string in result.overlap:
            display.highlight(string, overlap_color)
        '''

        # Re-enable rationale selection.
        for this_rationale in self._rationales:
            this_rationale.display.setEnabled(True)

    def update_statistics(self, topic=None, document=None):
        self.update_gold_standard_view(topic, document)
        self.update_topic_view(topic)
        self.update_rationale_list()
        self.update_judgment_list()
        self.update_confusion_matrix(topic, document)
        self.update_agreement_view(topic, document)

    def update_confusion_matrix(self, topic=None, document=None):
        cm = self._dm.confusion_matrix(topic, document)
        self._confusion_matrix.setText(cm)

    def update_gold_standard_view(self, topic, document):
        '''
        Updates the current gold standard view.
        '''
        if topic and document:
            value = self._dm.gold_standard(topic, document)
            self._gold_standard_view.setText("Gold Standard: %s" % value)

    def update_topic_view(self, topic):
        '''
        Updates the current topic and rationale display.
        '''
        (topic, narrative) = self._dm.topic_information(topic)
        self._topic_view.setText("<b>Topic</b>: %s" % topic)
        self._narrative_view.setText("%s" % narrative)
        
    def update_agreement_view(self, topic, document):
        '''
        Computes and updates the agreement for currently selected Topic or Document.
        '''
        d1_agree = self._dm.agreement(1, topic, document)
        self._d1_agreement_view.setText("D1 Agreement: %f" % d1_agree)
        d2_agree = self._dm.agreement(2, topic, document)
        self._d2_agreement_view.setText("D2 Agreement: %f" % d2_agree)
        

    def update_rationale_list(self):
        '''
        Updates the worker rationale list. If one or more worker IDs is 
        selected, this will display only the rationales by the selected 
        workers. Otherwise, this will display all rationales for the 
        selected Topic and Document.
        '''
        display_text = ''
        selected = [r for r in self._rationales if r.display.isChecked()]
        # If none are selected, display all.
        selected = selected if selected else self._rationales
        for r in selected:
            display_text += ('%s\n\n%s\n\n' % (r.rationale.label, r.rationale.rationale.rationale))
        self._worker_rationales.setText(display_text)

    def update_judgment_list(self, topic=None, document=None):
        '''
        Updates the worker judgment list. If one or more worker IDs is
        selected, this will display only the judgments of those selected
开发者ID:tylermcdonnell,项目名称:cwr,代码行数:70,代码来源:cwr.py


注:本文中的datamodel.DataModel.topic_information方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。