(nodes)
return spanning_leaves
Get the leaves that each node in nodes can reach.

  The number of leaves that a node can reach, i.e. that a node 'spans', provides
  an estimate of how 'high' in the DAG that node is, with nodes representing
  more general concepts spanning more leaves and being 'higher' than nodes
  representing more specific concepts.
  A leaf node spans exactly one leaf: itself.

  Args:
    nodes: A set of Synsets

  Returns:
    spanning_leaves: a dict mapping Synset instances to the set of leaf Synsets
      that are their descendants.
Get the leaves that each node in nodes can reach.
Get the leaves that each node in nodes can reach .
def get_spanning_leaves(nodes):
  """Get the leaves that each node in nodes can reach.

  The number of leaves that a node can reach, i.e. that a node 'spans', provides
  an estimate of how 'high' in the DAG that node is, with nodes representing
  more general concepts spanning more leaves and being 'higher' than nodes
  representing more specific concepts.
  A leaf node spans exactly one leaf: itself.

  Args:
    nodes: A set of Synsets

  Returns:
    spanning_leaves: a dict mapping Synset instances to the set of leaf Synsets
      that are their descendants.
  """
  # First find the leaves
  leaves = get_leaves(nodes)

  # dict mapping WordNet id's to the list of leaf Synsets they span
  spanning_leaves = {}
  for n in nodes:
    spanning_leaves[n] = set()
    for l in leaves:
      if is_descendent(l, n) or l == n:
        spanning_leaves[n].add(l)
  return spanning_leaves
def get_spanning_leaves ( nodes ) : # First find the leaves leaves = get_leaves ( nodes ) # dict mapping WordNet id's to the list of leaf Synsets they span spanning_leaves = { } for n in nodes : spanning_leaves [ n ] = set ( ) for l in leaves : if is_descendent ( l , n ) or l == n : spanning_leaves [ n ] . add ( l ) return spanning_leaves