def node_fn(unused_span_begin, unused_span_end, rule, children):
    """Represent nodes as (target string, int count of possible derivations)."""
    target_strings = [target_string for target_string, _ in children]
    new_target_string = qcfg_rule.apply_target(rule, target_strings)

    child_counts = [child_count for _, child_count in children]

    count = _aggregate_counts(child_counts)

    return (new_target_string, count)
Represent nodes as (target string, int count of possible derivations).
language/compgen/nqg/model/induction/codelength_utils.py