senticnet.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:hoot 作者: CatalystOfNostalgia 项目源码 文件源码
def polarity(self, concept, parsed_graph=None):
        """
        Return the polarity of a concept.
        If you pass a parsed graph, the method do not load the rdf again.
        """
        concept_polarity_uri = self.concept_base_uri+concept+"/polarity"

        if parsed_graph is None:
            try:
                graph = rdflib.Graph()
                parsed_graph = graph.parse(concept_polarity_uri, format="xml")
                result, _ = self._output(concept_polarity_uri)
                return result[0]

            except Exception:
                return 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号