#!/usr/bin/python

import codecs,os,sys

def load_list(filename):
	words = set([])
	for line in codecs.open(filename, 'r', 'utf8'):
		line = line.strip()
		if len(line):
			words.add(line)
	return words



def main(ext_words_file, cluster_dir):
	ext_words = load_list(ext_words_file)

	for filename in os.listdir(cluster_dir):
		if filename.endswith('.txt'):
			words = load_list(os.path.join(cluster_dir, filename) )
			if len(words.intersection(ext_words) ) == 0:
				print filename


if __name__ == '__main__':
	if len(sys.argv) == 3: #python find_unused_clusters.py ext_file cluster_dir
		main(sys.argv[1], sys.argv[2])
	else:
		print ("Usage:\n\tpython find_unused_clusters.py ext_file cluster_dir")

