本文整理匯總了Python中extractor.Extractor.getDisambiguationLinks方法的典型用法代碼示例。如果您正苦於以下問題:Python Extractor.getDisambiguationLinks方法的具體用法?Python Extractor.getDisambiguationLinks怎麽用?Python Extractor.getDisambiguationLinks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類extractor.Extractor
的用法示例。
在下文中一共展示了Extractor.getDisambiguationLinks方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: add_disambiguation
# 需要導入模塊: from extractor import Extractor [as 別名]
# 或者: from extractor.Extractor import getDisambiguationLinks [as 別名]
def add_disambiguation(self, a):
ex = Extractor()
ls = ex.getDisambiguationLinks(a + '_(disambiguation)')
if ls:
anode = self.graphdb.get_or_create_indexed_node(self.DISAMBIGUATION, 'name', a, {'name': a, 'class': self.DISAMBIGUATION})
for l in ls:
print "disambiguation link:", l
lnode = self.graphdb.get_indexed_node('NODE', 'name', l)
if lnode:
print "creating disamb relation betn", a, ", ", l
self.graphdb.create((anode, self.DISAMBIGUATION, lnode, {'class': self.DISAMBIGUATION, 'weight': 1}))