def _compute_doc_freq(self, crefs):
        """Compute term frequency for reference data. This will be used to compute idf
        (inverse document frequency later). The term frequency is stored in the object"""
        document_frequency = defaultdict(float)
        for refs in crefs:
            for ngram in set([ngram for ref in refs for (ngram, count) in ref.items()]):
                document_frequency[ngram] += 1

        return document_frequency
Compute term frequency for reference data. This will be used to compute idf
        (inverse document frequency later). The term frequency is stored in the object
torchmm/datasets/preprocess/n_grams.py