├── ghadaam-ir
├── front-end.py
├── ghadaam-ir = backend.api
├── __pycache__
│ ├── long_responses.cpython-39.pyc
│ └── long_responses.cpython-312.pyc
├── long_responses.py
├── back-end.py
└── main.py
└── README.md
/ghadaam-ir/front-end.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ghadaam-ir/ghadaam-ir = backend.api:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ghadaam-ir/__pycache__/long_responses.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sahandmohammadrehzaii/ghadaam-ir/HEAD/ghadaam-ir/__pycache__/long_responses.cpython-39.pyc
--------------------------------------------------------------------------------
/ghadaam-ir/__pycache__/long_responses.cpython-312.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sahandmohammadrehzaii/ghadaam-ir/HEAD/ghadaam-ir/__pycache__/long_responses.cpython-312.pyc
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | #
3 |
4 | #
5 |
6 | in the name of god
7 |
8 |
9 | #
10 |
11 | #
12 |
13 |
14 |
15 | hello people the this project desgined by sahand mohammadrezaii
16 |
17 |
18 |
19 | #
20 |
21 |
22 |
23 | This robot was created by Sahand Mohammad Rezaei and this robot was created for Rhinofest Festival and will be updated after the competition.
24 |
25 |
26 |
27 | #
28 |
--------------------------------------------------------------------------------
/ghadaam-ir/long_responses.py:
--------------------------------------------------------------------------------
1 | import random
2 |
3 | R_EATING = "من دوست ندارم چیزی بخورم، زیرا من یک ربات ساخته شده توسط تیم قادم هستم"
4 | R_ADVICE = "من اگه جای شما بودم میرفتم تو اینترنت و دقیقا اون چیزی که نوشته بودید رو اونجا تایپ میکردم و اگه نخیر از هوش مصنوعی های دیگری نیز کمک می گرفتم"
5 |
6 |
7 | def unknown():
8 | response = ["ممکن است لطفا آن را دوباره بیان کنید؟",
9 | "...",
10 | "به نظر درست نمیاد.",
11 | "معنی آن چیست؟"][
12 | random.randrange(4)]
13 | return response
14 |
--------------------------------------------------------------------------------
/ghadaam-ir/back-end.py:
--------------------------------------------------------------------------------
1 | import tkinter as tk
2 |
3 | def register():
4 | # دریافت اطلاعات از ورودیها
5 | username = entry_username.get()
6 | password = entry_password.get()
7 | email = entry_email.get()
8 |
9 | # بررسی تکمیل اطلاعات
10 | if not username or not password or not email:
11 | message_window = tk.Toplevel(window)
12 | message_window.title("مشکل ثبت نام")
13 | message_label = tk.Label(message_window, text=". لطفا تمامی اطلاعات لازم و خواسته شده را وارد بکنید")
14 | message_label.pack(padx=40, pady=20)
15 | return
16 |
17 | # نمایش اطلاعات در کنسول
18 | print("نام کاربری:", username)
19 | print("رمز عبور:", password)
20 | print("ایمیل:", email)
21 |
22 | # ذخیره اطلاعات در فایل
23 | with open("ghadaam-ir = backend.api", "a") as file:
24 | file.write(f"username: {username}\n")
25 | file.write("\n")
26 | file.write("|-----------------|\n")
27 | file.write("\n")
28 | file.write(f"password: {password}\n")
29 | file.write("\n")
30 | file.write("|-----------------|\n")
31 | file.write("\n")
32 | file.write(f"email: {email}\n")
33 | file.write("\n")
34 | file.write("|-----------------|\n")
35 | file.write("\n")
36 |
37 | # نمایش پیام با استفاده از ویجت Toplevel
38 | message_window = tk.Toplevel(window)
39 | message_window.title("ثبت نام")
40 | message_label = tk.Label(message_window, text="ثبت نام با موفقیت انجام شد.")
41 | message_label.pack(padx=20, pady=10)
42 |
43 | # ایجاد پنجره اصلی
44 | window = tk.Tk()
45 | window.title("فرم ثبت نام - ghadaam-IR")
46 | window.geometry("400x400")
47 |
48 | # تنظیم رنگ پس زمینه
49 | window.configure(bg="blue")
50 |
51 | # عنوان فرم
52 | label_title = tk.Label(window, text="فرم ثبت نام", font=("Arial", 20), bg="blue", fg="white")
53 | label_title.pack(pady=20)
54 |
55 | # فیلد نام کاربری
56 | label_username = tk.Label(window, text="نام کاربری:", bg="blue", fg="white")
57 | label_username.pack()
58 | entry_username = tk.Entry(window)
59 | entry_username.pack()
60 |
61 | # فیلد رمز عبور
62 | label_password = tk.Label(window, text="رمز عبور:", bg="blue", fg="white")
63 | label_password.pack()
64 | entry_password = tk.Entry(window, show="*")
65 | entry_password.pack()
66 |
67 | # فیلد ایمیل
68 | label_email = tk.Label(window, text="ایمیل:", bg="blue", fg="white")
69 | label_email.pack()
70 | entry_email = tk.Entry(window)
71 | entry_email.pack()
72 |
73 | # دکمه ثبت نام
74 | button_register = tk.Button(window, text="ثبت نام", command=register)
75 | button_register.pack(pady=20)
76 |
77 | # شروع حلقه رویدادها
78 | window.mainloop()
--------------------------------------------------------------------------------
/ghadaam-ir/main.py:
--------------------------------------------------------------------------------
1 | #in the name of god
2 |
3 | #coming soon
4 |
5 | # desgined by sahandmohammadrezaii and ghadaam team
6 |
7 | import re
8 | import long_responses as long
9 |
10 | for i in range(1):
11 | print(" به هوش مصنوعی ساخته شده توسط تیم ویژه قادم خوش آمدید")
12 |
13 | #cli-1
14 |
15 | for i in range(1):
16 | print("")
17 |
18 | #cli-2
19 |
20 | for i in range(1):
21 | print("")
22 |
23 | #cli-3
24 |
25 | for i in range(1):
26 | print("")
27 |
28 | #wellcome-massage
29 |
30 | for i in range(1):
31 | print("ghadaam-ir : سلام من قادم آی آر هستم من آماده خدمت به شما در هر لحظه ای هستم")
32 |
33 | #cli-4
34 |
35 | for i in range(1):
36 | print("");
37 |
38 | #cli-5
39 |
40 | for i in range(1):
41 | print("");
42 |
43 | #cli-6
44 |
45 | for i in range(1):
46 | print("");
47 |
48 | #massage-components
49 |
50 | def message_probability(user_message, recognised_words, single_response=False, required_words=[]):
51 | message_certainty = 0
52 | has_required_words = True
53 |
54 | #massage-if & else
55 |
56 | for word in user_message:
57 | if word in recognised_words:
58 | message_certainty += 1
59 |
60 |
61 | percentage = float(message_certainty) / float(len(recognised_words))
62 |
63 |
64 | for word in required_words:
65 | if word not in user_message:
66 | has_required_words = False
67 | break
68 |
69 |
70 | if has_required_words or single_response:
71 | return int(percentage * 100)
72 | else:
73 | return 0
74 |
75 |
76 | def check_all_messages(message):
77 | highest_prob_list = {}
78 |
79 | def response(bot_response, list_of_words, single_response=False, required_words=[]):
80 | nonlocal highest_prob_list
81 | highest_prob_list[bot_response] = message_probability(message, list_of_words, single_response, required_words)
82 |
83 | #write-the-massage-ghadaam-ir => black.cli <+> console.log("hello world I am ghadaam-ir")
84 |
85 | response('سلام', ['hello', 'سلام', 'hi', 'salam',], single_response=True)
86 | response('به اميد ديدار', ['به اميد ديدار', 'bye', 'goodbye', 'خداحافظ', 'باي',], single_response=True)
87 | response('من هيچ گونه احساس ندارم و نمي توانم مانند انسان ها حس داشته باشم', ['حالت چطوره', 'خوبي', 'how are you', 'حالت خوبه '], required_words=['چطوري'])
88 | response('خوش آمدید به قادم آی آر', ['thank', 'thanks'], single_response=True)
89 | response('متشکرم از شما', ['ممنون', 'دستت درد نکنه', 'با تشکر از شما',], required_words=['code', 'palace'])
90 |
91 |
92 | response(long.R_ADVICE, ['give', 'advice'], required_words=['advice'])
93 | response(long.R_EATING, ['what', 'you', 'eat'], required_words=['you', 'eat'])
94 |
95 | best_match = max(highest_prob_list, key=highest_prob_list.get)
96 |
97 |
98 | return long.unknown() if highest_prob_list[best_match] < 1 else best_match
99 |
100 |
101 |
102 | def get_response(user_input):
103 | split_message = re.split(r'\s+|[,;?!.-]\s*', user_input.lower())
104 | response = check_all_messages(split_message)
105 | return response
106 |
107 |
108 |
109 | while True:
110 | print('ghadaam-ir : ' + get_response(input('شما : ')))
111 |
112 | while False:
113 | print('ghadaam-ir = > def datebassment.getbyelement : ' + get_response(input('user = > api-cli: ')))
114 |
--------------------------------------------------------------------------------