def process_file(input_file, output_file): unique_terms = set() # Read the input file and collect unique terms with open(input_file, 'r', encoding='utf-8') as f: for line in f: terms = line.strip().split() unique_terms.update(terms) # Sort the unique terms alphabetically sorted_terms = sorted(unique_terms) # Write the unique terms to the output file with open(output_file, 'w', encoding='utf-8') as f: for term in sorted_terms: f.write(f"{term}\n") print(f"Processed {len(unique_terms)} unique terms.") # Process the file input_file = 'dictionary_reviewed.txt' # Replace with your input file name output_file = 'dictionary_reviewed_rows.txt' process_file(input_file, output_file)