'merges corpora and computes probabilities'

def buildCache(self):

    self.cache = {}
    for (pname, pool) in self.pools.items():
        if (pname == '__Corpus__'):
            continue
        poolCount = pool.tokenCount
        themCount = max((self.corpus.tokenCount - poolCount), 1)
        cacheDict = self.cache.setdefault(pname, self.dataClass(pname))
        for (word, totCount) in self.corpus.items():
            thisCount = float(pool.get(word, 0.0))
            if (thisCount == 0.0):
                continue
            otherCount = (float(totCount) - thisCount)
            if (not poolCount):
                goodMetric = 1.0
            else:
                goodMetric = min(1.0, (otherCount / poolCount))
            badMetric = min(1.0, (thisCount / themCount))
            f = (badMetric / (goodMetric + badMetric))
            if (abs((f - 0.5)) >= 0.1):
                cacheDict[word] = max(0.0001, min(0.9999, f))
