...in fn and fn.endswith(".txt"):
            path = os.path.join(root, fn)
            with open(path, "r", encoding="utf-8", errors="replace") as f:
                text = f.read()

            print("Analysiere:", fn)
            result = call_ollama(text)

            out_path = os.path.join(OUT_DIR, fn.replace(".txt", ".json"))
            with open(out_path, "w", encoding="utf-8") as out:
               ...