diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9d52222 --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +# Ignore Python byte code files +__pycache__/ +*.pyc +*.pyo +*.pyd + +# Ignore virtual environment directories (if using venv) +venv/ + +# Ignore IDE-specific files and directories (e.g., for Visual Studio Code) +.vscode/ + +# Ignore project-specific files like log files or database files +logs/ +db.sqlite3 + +# Ignore user-specific settings or files +*.log +*.swp + +# Ignore system and temporary files +*.bak +*.tmp + +# Ignore any sensitive or secret information (e.g., API keys, credentials) +secrets.yml + +output/ \ No newline at end of file diff --git a/chatcoder.py b/chatcoder.py index 3cecf4c..c586a4f 100644 --- a/chatcoder.py +++ b/chatcoder.py @@ -18,6 +18,12 @@ class CodeConverterApp(tk.Tk): def __init__(self): super().__init__() + if not os.path.exists("output"): + os.mkdir("output") + print("Created output directory") + else: + print("Output directory already exists") + self.title("Natural Language to Code Converter") self.geometry("600x400") @@ -60,8 +66,9 @@ def convert_to_code(self): self.output_text.insert(tk.END, code) # Inserting new converted code def save_output(self): + filenames = os.listdir("output") code = self.output_text.get(1.0, tk.END) - with open("output.py", "w") as file: + with open(f'output/{len(filenames)}.py', "w") as file: file.write(code) if __name__ == "__main__": diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..6fa2de4 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +nltk \ No newline at end of file