Also cache, if a wikipage does not exist

This commit is contained in:
Dominik Moritz Roth 2022-02-11 12:28:03 +01:00
parent 558b9d4eba
commit e8871f823e

View File

@ -789,11 +789,13 @@ def genScores(G, books, calcPagerank=True):
def addImageToNode(node, cache, shape='circularImage'): def addImageToNode(node, cache, shape='circularImage'):
name = node['label'].split(' (')[0] name = node['label'].split(' (')[0]
if not name in cache: if not name in cache or (cache[name]==False and random.random()<0.05):
term = name term = name
img = getWikiImage(term) img = getWikiImage(term)
if img: if img:
cache[name] = img cache[name] = img
else:
cache[name] = False
else: else:
img = cache[name] img = cache[name]
if img: if img: