{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [] }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" } }, "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "dSJG6OEazaWm", "outputId": "300bae8f-42ee-48d0-83ba-80ed9b31e92f" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "رزومه حرفه‌ای و منظم شما به شرح زیر است:\n", "\n", "---\n", "\n", "### مشخصات شخصی:\n", "- **نام:** مریم نوری\n", "- **وضعیت تاهل:** مجرد\n", "- **سن:** 38 سال\n", "- **جنسیت:** خانم\n", "- **محل اقامت:** تهران\n", "\n", "### تحصیلات:\n", "- **مدرک تحصیلی:** لیسانس و زبان انگلیسی\n", "- **رشته تحصیلی:** مهندسی نرم افزار\n", "\n", "### تجربیات کاری:\n", "1. **برنامه‌نویس و متخصص هوش مصنوعی**\n", " - اشتغال آزاد\n", " - سابقه کار از سال 1393 تا کنون\n", " - تخصص در توسعه برنامه‌های وب و موبایل\n", " - تجربه کار با زبان‌های برنامه‌نویسی Python، C#، C و Delphi\n", " - آشنایی با Net Core، Microsoft One Note، Microsoft Access و Microsoft Powerpoint\n", "\n", "### تحصیلات تکمیلی:\n", "- **مدرک دوره‌های آموزشی:**\n", " - توسعه نرم‌افزارهای هوش مصنوعی\n", " - توسعه نرم‌افزارهای تحت وب\n", " - توسعه نرم‌افزارهای موبایل\n", "\n", "### اطلاعات تماس:\n", "- **تلفن:** 09132177559\n", "- **ایمیل:** maryam_nourii@yahoo.com\n", "- **پیوند GitHub:** [GitHub Profile](https://github.com/MaryamNour\n" ] } ], "source": [ "#!pip install openai==0.28\n", "import openai\n", "\n", "# کلید API خود را وارد کنید (مطمئن شوید که این کلید را مخفی نگه دارید)\n", "openai.api_key = 'sk-proj-bC6H6QrP6DUqHkn5vOkYT3BlbkFJsSyvL4Bc9c3UEbHrsPMj'\n", "\n", "def create_optimized_resume(info):\n", " prompt = f\"\"\"\n", " من اطلاعات زیر را به شما می‌دهم، لطفاً یک رزومه حرفه‌ای و منظم برای من ایجاد کنید.\n", " اطلاعات:\n", " {info}\n", "\n", " رزومه حرفه‌ای و منظم:\n", " \"\"\"\n", "\n", " response = openai.ChatCompletion.create(\n", " model=\"gpt-3.5-turbo\",\n", " messages=[\n", " {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n", " {\"role\": \"user\", \"content\": prompt}\n", " ],\n", " max_tokens=500,\n", " n=1,\n", " stop=None,\n", " temperature=0.5,\n", " )\n", "\n", " return response.choices[0].message['content'].strip()\n", "\n", "# اطلاعات ورودی رزومه\n", "info = \"\"\"ﻧﻮری ﻣﺮﯾﻢ\n", "ﺳ\u0002ﺎﻫﺎن ﺗﻮاﺗﺮ ﻣﻬﻨﺪﺳﯽ ﺷﺮﮐﺖ در ﻧﻮﯾﺲ\n", "برنامه\n", "رﺑﺎﺗﯿﮏ و ﻣﺼﻨﻮﻋﯽ ﻫﻮش ارﺷﺪ ﮐﺎرﺷﻨﺎﺳﯽ\n", "اﺳﻼﻣﯽ آزاد داﻧﺸﮕﺎه\n", "ﻓﺮدی ﻣﺸﺨﺼﺎت\n", "ﺳﺎل 38\n", ":ﺳﻦ\n", "زن:ﺟﻨﺴﯿﺖ\n", "ﻣﺠﺮد:ﺗﺎﻫﻞ وﺿﻌﯿﺖ\n", "ﺗﻤﺎس اﻃﻼﻋﺎت\n", "-\n", "-\n", "-\n", "-\n", "-\n", ":ﺗﻠﻔﻦ\n", "09132177559\n", ":ﻣﻮﺑﺎ;ﻞ\n", "maryam_nourii@yahoo.com\n", ":اﯾﻤﯿﻞ\n", "اﻟﺪوﻟﻪ ﺣﺸﻤﺖ\n", "-\n", " ﺟﻤﺎﻟﺰاده\n", "-\n", " ﺗﻬﺮان\n", ":ﺳﮑﻮﻧﺖ ﻣﺤﻞ\n", ":ﻟﯿﻨﮑﺪ;ﻦ\n", "-\n", "ﮐﺎری ﺳﺎﺑﻘﻪ و ﺣﻘﻮق\n", "ﺳﺎل 11\n", ":ﮐﺎری ﺳﺎﺑﻘﻪ ﻣﯿﺰان\n", "ﺗﻮﻣﺎن ﻣﯿﻠﯿﻮن 15\n", "-\n", " 20\n", ":ﺣﻘﻮق\n", "ﮐﺎر ﻧﻤﻮﻧﻪ\n", " https://github.com/MaryamNourii?tab=repos…\n", "www.jobvision.ir\n", ":رزوﻣﻪ رﺳﺎﻧﯽ\n", "\u0018ﺮوز1402 دی 20\n", ":ﮐﺎر\u0018ﺮی ﺷﻨﺎﺳﻪJV-16905476\n", "ﺷﻐﻠﯽ ﺳﻮاﺑﻖ\n", "ﺗﺤﺼﯿﻠﯽ ﺳﻮاﺑﻖ\n", "ﺧﺎرﺟﯽ ﻫﺎی\n", "زﺑﺎن\n", "اﻓﺰارﻫﺎ ﻧﺮم\n", "(ﻣﺎه 9 و ﺳﺎل 10) 1398 ﺧﺮداد ﺗﺎ 1387 ﺷﻬﺮ;ﻮر\n", "ﻧﻮﯾﺲ\n", "Dﺮﻧﺎﻣﻪ\n", "ﺳ\u0002ﺎﻫﺎن ﺗﻮاﺗﺮ ﻣﻬﻨﺪﺳﯽ ﺷﺮﮐﺖ\n", "ﺗﻬﺮان ا;ﺮان\n", "1393 - 1396رﺑﺎﺗﯿﮏ و ﻣﺼﻨﻮﻋﯽ ﻫﻮش\n", "-\n", " ارﺷﺪ ﮐﺎرﺷﻨﺎﺳﯽ\n", "اﺳﻼﻣﯽ آزاد داﻧﺸﮕﺎه\n", "1383 - 1387ﮐﺎﻣﭙﯿﻮﺗﺮ ﻣﻬﻨﺪﺳﯽ\n", "-\n", " ﮐﺎرﺷﻨﺎﺳﯽ\n", "اﺳﻼﻣﯽ آزاد داﻧﺸﮕﺎه\n", "٪۵۰ ﻣﺘﻮﺳﻂ | اﻧﮕﻠﯿﺴﯽ\n", "ﻣﻘﺪﻣﺎﺗﯽ | Microsoft One Note ﻣﻘﺪﻣﺎﺗﯽ | Microsoft Access ﻣﻘﺪﻣﺎﺗﯽ | Delphi\n", "ﻣﺘﻮﺳﻂ | Net Core / .Net. ﻣﺘﻮﺳﻂ | +\n", "+ C ﻣﺘﻮﺳﻂ | C ﻣﺘﻮﺳﻂ | Microsoft Powerpoint\n", "gﯿﺸﺮﻓﺘﻪ | #C\n", "gﯿﺸﺮﻓﺘﻪ | Python ﻣﺘﻮﺳﻂ | OpenCV ﻣﺘﻮﺳﻂ | Keras\n", "gﯿﺸﺮﻓﺘﻪ | Microsoft Visual Studio\n", "\n", "\"\"\"\n", "\n", "# ایجاد رزومه بهینه\n", "optimized_resume = create_optimized_resume(info)\n", "print(optimized_resume)" ] }, { "cell_type": "code", "source": [ "#!pip install openai==0.28\n", "import openai\n", "\n", "# کلید API خود را وارد کنید (مطمئن شوید که این کلید را مخفی نگه دارید)\n", "openai.api_key = 'sk-proj-bC6H6QrP6DUqHkn5vOkYT3BlbkFJsSyvL4Bc9c3UEbHrsPMj'\n", "\n", "def create_optimized_resume(info):\n", " prompt = f\"\"\"\n", " من اطلاعات زیر را به شما می‌دهم، لطفاً یک رزومه حرفه‌ای و منظم برای من ایجاد کنید.\n", " اطلاعات:\n", " {info}\n", "\n", " رزومه حرفه‌ای و منظم:\n", " \"\"\"\n", "\n", " response = openai.ChatCompletion.create(\n", " model=\"gpt-3.5-turbo\",\n", " messages=[\n", " {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n", " {\"role\": \"user\", \"content\": prompt}\n", " ],\n", " max_tokens=500,\n", " n=1,\n", " stop=None,\n", " temperature=0.5,\n", " )\n", "\n", " return response.choices[0].message['content'].strip()\n", "\n", "# اطلاعات ورودی رزومه\n", "info = \"\"\"ﻧﻮری ﻣﺮﯾﻢ\n", "ﺳ\u0002ﺎﻫﺎن ﺗﻮاﺗﺮ ﻣﻬﻨﺪﺳﯽ ﺷﺮﮐﺖ در ﻧﻮﯾﺲ\n", "برنامه\n", "رﺑﺎﺗﯿﮏ و ﻣﺼﻨﻮﻋﯽ ﻫﻮش ارﺷﺪ ﮐﺎرﺷﻨﺎﺳﯽ\n", "اﺳﻼﻣﯽ آزاد داﻧﺸﮕﺎه\n", "ﻓﺮدی ﻣﺸﺨﺼﺎت\n", "ﺳﺎل 38\n", ":ﺳﻦ\n", "زن:ﺟﻨﺴﯿﺖ\n", "ﻣﺠﺮد:ﺗﺎﻫﻞ وﺿﻌﯿﺖ\n", "ﺗﻤﺎس اﻃﻼﻋﺎت\n", "-\n", "-\n", "-\n", "-\n", "-\n", ":ﺗﻠﻔﻦ\n", "09132177559\n", ":ﻣﻮﺑﺎ;ﻞ\n", "maryam_nourii@yahoo.com\n", ":اﯾﻤﯿﻞ\n", "اﻟﺪوﻟﻪ ﺣﺸﻤﺖ\n", "-\n", " ﺟﻤﺎﻟﺰاده\n", "-\n", " ﺗﻬﺮان\n", ":ﺳﮑﻮﻧﺖ ﻣﺤﻞ\n", ":ﻟﯿﻨﮑﺪ;ﻦ\n", "-\n", "ﮐﺎری ﺳﺎﺑﻘﻪ و ﺣﻘﻮق\n", "ﺳﺎل 11\n", ":ﮐﺎری ﺳﺎﺑﻘﻪ ﻣﯿﺰان\n", "ﺗﻮﻣﺎن ﻣﯿﻠﯿﻮن 15\n", "-\n", " 20\n", ":ﺣﻘﻮق\n", "ﮐﺎر ﻧﻤﻮﻧﻪ\n", " https://github.com/MaryamNourii?tab=repos…\n", "www.jobvision.ir\n", ":رزوﻣﻪ رﺳﺎﻧﯽ\n", "\u0018ﺮوز1402 دی 20\n", ":ﮐﺎر\u0018ﺮی ﺷﻨﺎﺳﻪJV-16905476\n", "ﺷﻐﻠﯽ ﺳﻮاﺑﻖ\n", "ﺗﺤﺼﯿﻠﯽ ﺳﻮاﺑﻖ\n", "ﺧﺎرﺟﯽ ﻫﺎی\n", "زﺑﺎن\n", "اﻓﺰارﻫﺎ ﻧﺮم\n", "(ﻣﺎه 9 و ﺳﺎل 10) 1398 ﺧﺮداد ﺗﺎ 1387 ﺷﻬﺮ;ﻮر\n", "ﻧﻮﯾﺲ\n", "Dﺮﻧﺎﻣﻪ\n", "ﺳ\u0002ﺎﻫﺎن ﺗﻮاﺗﺮ ﻣﻬﻨﺪﺳﯽ ﺷﺮﮐﺖ\n", "ﺗﻬﺮان ا;ﺮان\n", "1393 - 1396رﺑﺎﺗﯿﮏ و ﻣﺼﻨﻮﻋﯽ ﻫﻮش\n", "-\n", " ارﺷﺪ ﮐﺎرﺷﻨﺎﺳﯽ\n", "اﺳﻼﻣﯽ آزاد داﻧﺸﮕﺎه\n", "1383 - 1387ﮐﺎﻣﭙﯿﻮﺗﺮ ﻣﻬﻨﺪﺳﯽ\n", "-\n", " ﮐﺎرﺷﻨﺎﺳﯽ\n", "اﺳﻼﻣﯽ آزاد داﻧﺸﮕﺎه\n", "٪۵۰ ﻣﺘﻮﺳﻂ | اﻧﮕﻠﯿﺴﯽ\n", "ﻣﻘﺪﻣﺎﺗﯽ | Microsoft One Note ﻣﻘﺪﻣﺎﺗﯽ | Microsoft Access ﻣﻘﺪﻣﺎﺗﯽ | Delphi\n", "ﻣﺘﻮﺳﻂ | Net Core / .Net. ﻣﺘﻮﺳﻂ | +\n", "+ C ﻣﺘﻮﺳﻂ | C ﻣﺘﻮﺳﻂ | Microsoft Powerpoint\n", "gﯿﺸﺮﻓﺘﻪ | #C\n", "gﯿﺸﺮﻓﺘﻪ | Python ﻣﺘﻮﺳﻂ | OpenCV ﻣﺘﻮﺳﻂ | Keras\n", "gﯿﺸﺮﻓﺘﻪ | Microsoft Visual Studio\n", "\n", "\"\"\"\n", "\n", "# ایجاد رزومه بهینه\n", "optimized_resume = create_optimized_resume(info)\n", "print(optimized_resume)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "ba9_tGedzezw", "outputId": "e3509291-65b0-48dd-e6ab-81727739b18b" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "رزومه حرفه‌ای شما به شرح زیر است:\n", "\n", "نام: مریم نوری\n", "تاریخ تولد: ۳۸ سال\n", "جنسیت: خانم\n", "وضعیت تاهل: مجرد\n", "آدرس: تهران\n", "\n", "تحصیلات:\n", "- دیپلم رشته تجربی\n", "- فوق دیپلم برنامه نویسی و مهندسی نرم افزار\n", "\n", "تجربه‌های کاری:\n", "- برنامه نویس و متخصص هوش مصنوعی، ۵ سال\n", "- توسعه دهنده نرم افزار، ۳ سال\n", "\n", "مهارت‌ها:\n", "- آشنایی با Net Core / .Net و C#\n", "- تجربه در استفاده از Microsoft One Note و Microsoft Access\n", "- مسلط به زبان‌های برنامه‌نویسی C و Python\n", "- توانایی کار با OpenCV و Keras\n", "- تجربه استفاده از Microsoft Visual Studio\n", "\n", "اطلاعات تماس:\n", "تلفن: ۰۹۱۳۲۱۷۷۵۵۹\n", "ایمیل: maryam_nourii@yahoo.com\n", "\n", "پروفایل GitHub: https://github.com/MaryamNourii?tab=repos…\n", "وب‌سایت شخصی: www.jobvision.ir\n", "\n", "تاریخ آخرین به‌روزرسانی رزومه: ۲۰ دی ۱۴۰۲\n", "شماره رزومه: JV-16905476\n", "\n", "توضیحات تکمیلی:\n", "- دارای مهارت‌های خوب در حوزه هوش مصنوعی\n" ] } ] }, { "cell_type": "code", "source": [ "from google.colab import drive\n", "drive.mount('/content/drive')" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "QuZdeTmhTXTe", "outputId": "6777f3b3-4b84-4d98-e896-05749f5e46d8" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount(\"/content/drive\", force_remount=True).\n" ] } ] }, { "cell_type": "code", "source": [ "!pip install openai==0.28\n" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "qgxyfMypKQEr", "outputId": "e5ba2be5-1835-45f6-ec42-714eacb3d232" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Collecting openai==0.28\n", " Downloading openai-0.28.0-py3-none-any.whl (76 kB)\n", "\u001b[?25l \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/76.5 kB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m76.5/76.5 kB\u001b[0m \u001b[31m2.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: requests>=2.20 in /usr/local/lib/python3.10/dist-packages (from openai==0.28) (2.31.0)\n", "Requirement already satisfied: tqdm in /usr/local/lib/python3.10/dist-packages (from openai==0.28) (4.66.4)\n", "Requirement already satisfied: aiohttp in /usr/local/lib/python3.10/dist-packages (from openai==0.28) (3.9.5)\n", "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests>=2.20->openai==0.28) (3.3.2)\n", "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests>=2.20->openai==0.28) (3.7)\n", "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests>=2.20->openai==0.28) (2.0.7)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests>=2.20->openai==0.28) (2024.6.2)\n", "Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (1.3.1)\n", "Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (23.2.0)\n", "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (1.4.1)\n", "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (6.0.5)\n", "Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (1.9.4)\n", "Requirement already satisfied: async-timeout<5.0,>=4.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (4.0.3)\n", "Installing collected packages: openai\n", "Successfully installed openai-0.28.0\n" ] } ] }, { "cell_type": "code", "source": [ "!pip install openai==0.28\n", "import openai\n", "import os\n", "import pandas as pd\n", "\n", "# کلید API خود را وارد کنید (مطمئن شوید که این کلید را مخفی نگه دارید)\n", "openai.api_key = 'sk-proj-bC6H6QrP6DUqHkn5vOkYT3BlbkFJsSyvL4Bc9c3UEbHrsPMj'\n", "\n", "def extract_names_from_text(text):\n", " prompt = f\"\"\"\n", " از متن زیر، فقط شغل افراد را استخراج کنید.\n", " متن:\n", " {text}\n", " \"\"\"\n", " response = openai.ChatCompletion.create(\n", " model=\"gpt-3.5-turbo\",\n", " messages=[\n", " {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n", " {\"role\": \"user\", \"content\": prompt}\n", " ],\n", " max_tokens=500,\n", " n=1,\n", " stop=None,\n", " temperature=0.5,\n", " )\n", " names = response.choices[0].message['content'].strip()\n", " # Assuming names are separated by new lines\n", " return names.split('\\n')\n", "\n", "# مسیر پوشه‌ای که فایل‌های متنی در آن قرار دارند\n", "directory_path = '/content/drive/MyDrive/Resume_txt'\n", "\n", "# لیستی برای ذخیره نام‌ها\n", "all_names = []\n", "\n", "# برای هر فایل در پوشه\n", "for filename in os.listdir(directory_path):\n", " if filename.endswith('.txt'):\n", " file_path = os.path.join(directory_path, filename)\n", " # خواندن محتوای فایل\n", " with open(file_path, 'r', encoding='utf-8') as file:\n", " text = file.read()\n", " # استخراج نام‌ها از متن\n", " names = extract_names_from_text(text)\n", " # اضافه کردن نام‌ها به لیست کلی\n", " all_names.extend(names)\n", "\n", "# ایجاد DataFrame از نام‌ها\n", "df = pd.DataFrame(all_names, columns=['Name'])\n", "\n", "# ذخیره DataFrame به عنوان فایل اکسل\n", "output_file = '/content/drive/MyDrive/job_output.xlsx'\n", "df.to_excel(output_file, index=False)\n", "\n", "print('Names have been extracted and saved to Excel file.')" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "KNd8lqq3TX5j", "outputId": "452ee8d0-e4d5-420c-dc09-e84dbb0b415a" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Requirement already satisfied: openai==0.28 in /usr/local/lib/python3.10/dist-packages (0.28.0)\n", "Requirement already satisfied: requests>=2.20 in /usr/local/lib/python3.10/dist-packages (from openai==0.28) (2.31.0)\n", "Requirement already satisfied: tqdm in /usr/local/lib/python3.10/dist-packages (from openai==0.28) (4.66.4)\n", "Requirement already satisfied: aiohttp in /usr/local/lib/python3.10/dist-packages (from openai==0.28) (3.9.5)\n", "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests>=2.20->openai==0.28) (3.3.2)\n", "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests>=2.20->openai==0.28) (3.7)\n", "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests>=2.20->openai==0.28) (2.0.7)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests>=2.20->openai==0.28) (2024.6.2)\n", "Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (1.3.1)\n", "Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (23.2.0)\n", "Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (1.4.1)\n", "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (6.0.5)\n", "Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (1.9.4)\n", "Requirement already satisfied: async-timeout<5.0,>=4.0 in /usr/local/lib/python3.10/dist-packages (from aiohttp->openai==0.28) (4.0.3)\n", "Names have been extracted and saved to Excel file.\n" ] } ] }, { "cell_type": "code", "source": [ "import openai\n", "import os\n", "\n", "# کلید API خود را وارد کنید\n", "openai.api_key = 'sk-proj-bC6H6QrP6DUqHkn5vOkYT3BlbkFJsSyvL4Bc9c3UEbHrsPMj'\n", "\n", "def parse_response(response_text):\n", " data = {}\n", " lines = response_text.split('\\n')\n", " for line in lines:\n", " key_value = line.split(':')\n", " if len(key_value) == 2:\n", " key, value = key_value\n", " data[key.strip()] = value.strip()\n", " return data\n", "\n", "def create_optimized_resume(info):\n", " prompt = f\"\"\"\n", " من اطلاعات زیر را به شما می‌دهم، لطفاً یک رزومه حرفه‌ای و منظم برای من ایجاد کنید.\n", " اطلاعات:\n", " {info}\n", " رزومه حرفه‌ای و منظم:\n", " \"\"\"\n", " response = openai.ChatCompletion.create(\n", " model=\"gpt-3.5-turbo\",\n", " messages=[\n", " {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n", " {\"role\": \"user\", \"content\": prompt}\n", " ],\n", " max_tokens=500,\n", " n=1,\n", " stop=None,\n", " temperature=0.5,\n", " )\n", "\n", " structured_data = parse_response(response.choices[0].message['content'].strip())\n", "\n", " # قالب رزومه\n", " template = \"\"\"\n", " نام: {name}\n", " سن: {age}\n", " محل اقامت: {location}\n", "\n", " وضعیت تأهل: {marital_status}\n", " جنسیت: {gender}\n", " وضعیت خدمت سربازی: {military_status}\n", "\n", " وضعیت شغلی: {job_status}\n", " علاقه: {interest}\n", " نوع شغل مورد نظر: {desired_job}\n", " حقوق مورد انتظار: {expected_salary}\n", "\n", " تحصیلات:\n", " {education}\n", "\n", " مهارت‌ها:\n", " {skills}\n", "\n", " علایق شغلی:\n", " {job_interests}\n", "\n", " مهارت‌های نرم:\n", " {soft_skills}\n", "\n", " زبان:\n", " {languages}\n", " \"\"\"\n", "\n", " optimized_resume = template.format(\n", " name=structured_data.get('نام', 'نام وارد نشده'),\n", " age=structured_data.get('سن', 'سن وارد نشده'),\n", " location=structured_data.get('محل اقامت', 'شهر وارد نشده'),\n", " marital_status=structured_data.get('وضعیت تأهل', 'وضعیت تأهل وارد نشده'),\n", " gender=structured_data.get('جنسیت', 'جنسیت وارد نشده'),\n", " military_status=structured_data.get('وضعیت خدمت سربازی', 'وضعیت خدمت سربازی وارد نشده'),\n", " job_status=structured_data.get('وضعیت شغلی', 'وضعیت شغلی وارد نشده'),\n", " interest=structured_data.get('علاقه', 'علاقه وارد نشده'),\n", " desired_job=structured_data.get('نوع شغل مورد نظر', 'نوع شغل مورد نظر وارد نشده'),\n", " expected_salary=structured_data.get('حقوق مورد انتظار', 'حقوق وارد نشده'),\n", " education=structured_data.get('تحصیلات', 'تحصیلات وارد نشده'),\n", " skills=structured_data.get('مهارت‌ها', 'مهارت‌ها وارد نشده'),\n", " job_interests=structured_data.get('علایق شغلی', 'علایق شغلی وارد نشده'),\n", " soft_skills=structured_data.get('مهارت‌های نرم', 'مهارت‌های نرم وارد نشده'),\n", " languages=structured_data.get('زبان', 'زبان وارد نشده')\n", " )\n", "\n", " return optimized_resume\n", "\n", "# مسیر پوشه‌ای که فایل‌های متنی در آن قرار دارند\n", "directory_path = '/content/'\n", "\n", "# برای هر فایل در پوشه\n", "for filename in os.listdir(directory_path):\n", " if filename.endswith('.txt'):\n", " file_path = os.path.join(directory_path, filename)\n", " # خواندن محتوای فایل\n", " with open(file_path, 'r', encoding='utf-8') as file:\n", " info = file.read()\n", " # ایجاد رزومه بهینه\n", " optimized_resume = create_optimized_resume(info)\n", " # ذخیره محتوای بهینه شده در همان فایل\n", " with open(file_path, 'w', encoding='utf-8') as file:\n", " file.write(optimized_resume)\n", " print(f'File {filename} has been optimized and saved.')\n", "print('All files have been processed.')" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "8q8RHAprT_u1", "outputId": "00b83931-d4d5-43cb-e1f4-2f9cf7bc2fc3" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "File caafc824-838e-4ebf-8ff6-d60f763f8816.txt has been optimized and saved.\n", "All files have been processed.\n" ] } ] }, { "cell_type": "code", "source": [ "import openai\n", "import pandas as pd\n", "\n", "# کلید API خود را وارد کنید (مطمئن شوید که این کلید را مخفی نگه دارید)\n", "openai.api_key = 'sk-proj-bC6H6QrP6DUqHkn5vOkYT3BlbkFJsSyvL4Bc9c3UEbHrsPMj'\n", "\n", "def is_job(name):\n", " prompt = f\"\"\"\n", " آیا عبارت زیر نام یک معرفی تحصیلات یک فرد است؟ فقط بله یا خیر پاسخ دهید.\n", " عبارت: {name}\n", " \"\"\"\n", " response = openai.ChatCompletion.create(\n", " model=\"gpt-3.5-turbo\",\n", " messages=[\n", " {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n", " {\"role\": \"user\", \"content\": prompt}\n", " ],\n", " max_tokens=5,\n", " n=1,\n", " stop=None,\n", " temperature=0,\n", " )\n", " answer = response.choices[0].message['content'].strip().lower()\n", " return 'بله' in answer or 'yes' in answer\n", "\n", "# مسیر فایل اکسل ورودی\n", "input_file = '/content/drive/MyDrive/education_output.xlsx'\n", "# مسیر فایل اکسل خروجی\n", "output_file = '/content/drive/MyDrive/F_education_output.xlsx'\n", "\n", "# خواندن فایل اکسل\n", "df = pd.read_excel(input_file)\n", "\n", "# فیلتر کردن سطرهایی که شامل شغل هستند\n", "df['is_job'] = df['Name'].apply(is_job)\n", "filtered_df = df[df['is_job'] == True].drop(columns=['is_job'])\n", "\n", "# ذخیره DataFrame فیلتر شده به عنوان فایل اکسل\n", "filtered_df.to_excel(output_file, index=False)\n", "\n", "print('Filtered jobs have been saved to the output Excel file.')" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "Mpvdcd1T4YYp", "outputId": "d2004d39-d4e2-4e37-993f-738b37eef9d7" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Filtered jobs have been saved to the output Excel file.\n" ] } ] }, { "cell_type": "code", "source": [ "import pandas as pd\n", "\n", "# مسیر فایل اکسل ورودی\n", "input_file = '/content/drive/MyDrive/jobs_output.xlsx'\n", "# مسیر فایل اکسل خروجی\n", "output_file = '/content/drive/MyDrive/job_output_W.xlsx'\n", "\n", "# خواندن فایل اکسل\n", "df = pd.read_excel(input_file)\n", "\n", "# لیستی برای ذخیره کلمات جداشده\n", "separated_words = []\n", "\n", "# جدا کردن کلمات هر سطر و اضافه کردن به لیست\n", "for row in df['Name']:\n", " words = row.split()\n", " separated_words.extend(words)\n", "\n", "# ایجاد DataFrame جدید از کلمات جداشده\n", "new_df = pd.DataFrame(separated_words, columns=['Name'])\n", "\n", "# ذخیره DataFrame جدید به عنوان فایل اکسل\n", "new_df.to_excel(output_file, index=False)\n", "\n", "print('Separated words have been saved to the output Excel file.')" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "SGAsssu3UBqV", "outputId": "2c3e59cb-ea06-411f-d156-21960e84fc43" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Separated words have been saved to the output Excel file.\n" ] } ] }, { "cell_type": "code", "source": [], "metadata": { "id": "pQEVyPv_VC72" }, "execution_count": null, "outputs": [] } ] }