def main():
try:
with open('GOLD_WORDLIST.txt', 'r') as f:
words = [line.strip() for line in f if line.strip()]
print(f"Read {len(words)} words from GOLD_WORDLIST.txt")
subset = words[:16384]
if len(subset) < 16384:
print(f"Warning: GOLD_WORDLIST.txt has fewer than 16,384 words. The subset will have {len(subset)} words.")
with open('wordlist_16k.txt', 'w') as f:
f.write('\n'.join(subset))
f.write('\n')
print(f"Successfully created wordlist_16k.txt with {len(subset)} words.")
except FileNotFoundError:
print("Error: GOLD_WORDLIST.txt not found. Please ensure the main dictionary exists.")
if __name__ == "__main__":
main()