from pathlib import Path
import csv

def save_results(results: dict, output_path: str) -> None:
    """保存结果到CSV"""
    Path(output_path).parent.mkdir(exist_ok=True)
    with open(output_path, 'w', newline='') as f:
        writer = csv.writer(f)
        writer.writerow(["word", "count"])
        writer.writerows(results.items())