Last active
June 27, 2025 13:03
-
-
Save AWtnb/d8721a07ec82b2fed93ed7076de0b700 to your computer and use it in GitHub Desktop.
skk dict chaos handler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| from pathlib import Path | |
| def main(bigger_dict_path, smaller_dict_path): | |
| smaller_set = set( | |
| Path(smaller_dict_path).read_text(encoding="utf-16-le").splitlines() | |
| ) | |
| output_path = Path(bigger_dict_path).with_stem("sieved") | |
| with Path(bigger_dict_path).open(encoding="utf-16-le") as infile, output_path.open( | |
| "w", encoding="utf-8" | |
| ) as outfile: | |
| for line in infile: | |
| counter += 1 | |
| line = line.strip() | |
| if line not in smaller_set: | |
| outfile.write(line + "\n") | |
| if __name__ == "__main__": | |
| main(sys.argv[1], sys.argv[2]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment