Skip to content
Snippets Groups Projects
cli.py 1.47 KiB
Newer Older
Michał Pogoda's avatar
Michał Pogoda committed
"""Script for running the anonymizer from the command line.

Example usage:
```bash
python3 cli.py input.ccl output.txt --replace-method tag --language pl \
    --configuration ccl
```
"""

import argparse

from src.worker import Worker

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="anonymizer")
    parser.add_argument("input_path", type=str, help="Path to the input file")
    parser.add_argument("output_path", type=str, help="Path to the output file")
    parser.add_argument(
        "--replace-method",
        type=str,
        default="tag",
        choices=["delete", "tag", "pseudo"],
        help="Method of replacing tokens",
    )
    parser.add_argument(
        "--language",
        type=str,
        default="pl",
        choices=["pl"],
        help="Language of the input text",
    )
    parser.add_argument(
        "--configuration",
        type=str,
        default="ccl",
Bartlomiej's avatar
Bartlomiej committed
        choices=["ccl", "wiktorner_jsonl", "wiktorner_jsonl_txt_output"],
        help="Configuration of the anonymizer",
    )
    parser.add_argument(
        "--deanonimizataion",
        type=bool,
        default=False,
        help="Create file to deanonimzation",
    )
    args = parser.parse_args()

    worker = Worker(configuration=args.configuration)
    worker.process(
        args.input_path,
        {"method": args.replace_method, "language": args.language,
         "deanonimizataion": args.deanonimizataion},
        args.output_path,
    )
    print("Done")