def compute_df(files):
    """
    Computes document frequency counts by processing a collection of files
    Returns a dictionary of the form {term: doc_freq}
    """
    df_dict = {}
    for file in files:
        term_seen = set()
        for line in file:
            for term in line.split():
                if term not in term_seen:
                    if term not in df_dict:
                        df_dict[term] = 0
                    df_dict[term] += 1
                    term_seen.add(term)
    return df_dict
