Skip to content

Commit

Permalink
Generalized handling for sources to ignore.
Browse files Browse the repository at this point in the history
Just mark these sources with score=0 in bibscores.tsv, no need to
hardcode.

Cf. faustedition/faust-xml#466
  • Loading branch information
thvitt committed Sep 25, 2018
1 parent 8367726 commit 6039402
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,10 @@ def macrogenesis_graphs() -> MacrogenesisInfo:


def cleanup_graph(A: nx.MultiDiGraph) -> nx.MultiDiGraph:
logger.info('Removing hertz and temp-syn')
logger.info('Removing edges to ignore')

def is_hertz(u, v, attr):
return 'source' in attr and 'hertz' in attr['source'].uri
def zero_weight(u, v, attr):
return attr.get('weight', 1) == 0

def is_syn(u, v, attr):
return attr['kind'] == 'temp-syn'
Expand All @@ -377,7 +377,7 @@ def is_ignored(u, v, attr):
return attr.get('ignore', False)

for u, v, k, attr in A.edges(keys=True, data=True):
if is_hertz(u, v, attr) or is_syn(u, v, attr):
if zero_weight(u, v, attr) or is_syn(u, v, attr):
attr['ignore'] = True

return remove_edges(A, is_ignored)

0 comments on commit 6039402

Please sign in to comment.