code: def phrases_reduce(key, values):
    
    if len(values) < 10:
      return
    counts = {}
    for filename in values:
      counts[filename] = counts.get(filename, 0) + 1
  
    words = re.sub(r":", " ", key)
    threshold = len(values) / 2
    for filename, count in counts.items():
      if count > threshold:
        yield "%s:%s\n" % (words, filename)
docs: Phrases demo reduce function.