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
评论列表
文章目录