def METHOD_NAME():
    args = get_args()
    out_dir = args.out_dir
    os.makedirs(out_dir, exist_ok=True)
    lang = None
    if args.lang is not None:
        lang = lang2lang_id[args.lang]
    # get a list of all CHAT files
    files = []
    for file in os.listdir(args.transcript_dir):
        if os.path.isfile(os.path.join(args.transcript_dir, file)) and file.endswith(
            ".cha"
        ):
            files.append(file)
    all_chars = set()
    with open(os.path.join(out_dir, "text"), "w", encoding="utf-8") as text, open(
        os.path.join(out_dir, "utt2spk"), "w", encoding="utf-8"
    ) as utt2spk:
        for file in files:
            spk = file.split(".cha")[0]
            path = os.path.join(args.transcript_dir, file)
            chat: pla.Reader = pla.read_chat(path)
            utts = chat.utterances(participants="PAR")
            n_utts = len(utts)
            for i in range(n_utts):
                time_marks = utts[i].time_marks
                # skipping utterances without time marks
                if time_marks is None:
                    continue
                start, end = utts[i].time_marks
                utt_id = get_utt(spk, start, end)
                trans = clean_trans(utts[i].tiers["PAR"])
                if len(trans) == 0:
                    continue
                # gather all unique chars
                for c in trans:
                    all_chars.add(c)
                # add aphasia type and/or language annotation to the front if needed
                if args.tag_insertion != "none":
                    aphasia_type = spk2aphasia_label[spk]
                    if args.tag_insertion == "append":
                        trans = f"{trans} [{aphasia_type}]"
                    elif args.tag_insertion == "prepend":
                        trans = f"[{aphasia_type}] {trans}"
                    elif args.tag_insertion == "both":
                        trans = f"[{aphasia_type}] {trans} [{aphasia_type}]"
                    else:
                        assert False
                if lang is not None:
                    trans = f"[{lang}] {trans}"
                text.write(f"{utt_id}\t{trans}\n")
                utt2spk.write(f"{utt_id}\t{spk}\n")
    print(all_chars)