kasitbot / synonyms.py
snygginghani's picture
Update logo to blue robot design, add 150+ Jordanian dialect synonyms, add Arabic fees QA
009edd0
Raw
History Blame Contribute Delete
80.1 kB
"""
Course synonym/alias expansion for the KASIT RAG pipeline.
Maps common student abbreviations and nicknames to official KASIT course names.
expand_query() appends matched official names to the query so BM25, vector
search, and HyDE all benefit without losing the original terms.
"""
import re
# Keys are lowercase aliases students commonly use.
# Values are the official course names as they appear in the knowledge base.
COURSE_SYNONYMS: dict[str, str] = {
# ── Natural Language Processing ──────────────────────────────────────────
"nlp": "Natural Language Processing",
"natural language": "Natural Language Processing",
# ── Linear Algebra ───────────────────────────────────────────────────────
"linear algebra": "Linear Algebra for Computer Science",
"linear": "Linear Algebra for Computer Science",
"linalg": "Linear Algebra for Computer Science",
# ── Artificial Intelligence ───────────────────────────────────────────────
"ai": "Artificial Intelligence",
"intro ai": "Introduction to Artificial Intelligence",
"intro to ai": "Introduction to Artificial Intelligence",
"introduction ai": "Introduction to Artificial Intelligence",
# ── Machine Learning ──────────────────────────────────────────────────────
"ml": "Machine Learning and Neural Networks",
"machine learning": "Machine Learning and Neural Networks",
"neural networks": "Machine Learning and Neural Networks",
"mlnn": "Machine Learning and Neural Networks",
# ── Deep Learning ─────────────────────────────────────────────────────────
"dl": "Deep Learning",
"deep learning": "Deep Learning",
# ── Data Structures ───────────────────────────────────────────────────────
"ds": "Data Structures",
"data struct": "Data Structures",
# ── Operating Systems ─────────────────────────────────────────────────────
"os": "Operating Systems",
# ── Object-Oriented Programming ───────────────────────────────────────────
"oop": "Object-Oriented Programming",
"object oriented": "Object-Oriented Programming",
"object-oriented": "Object-Oriented Programming",
"oo programming": "Object-Oriented Programming",
# ── Software Engineering ──────────────────────────────────────────────────
"se": "Software Engineering",
"soft eng": "Software Engineering",
"software eng": "Software Engineering",
# ── Database ─────────────────────────────────────────────────────────────
"dbms": "Database Management Systems",
"database management": "Database Management Systems",
"db management": "Database Management Systems",
"db techniques": "Database Techniques and Applications",
"database techniques": "Database Techniques and Applications",
"advanced db": "Advanced Topics in Databases",
"advanced databases": "Advanced Topics in Databases",
"nosql": "NoSQL Databases",
"no sql": "NoSQL Databases",
"non-relational": "NoSQL Databases",
# ── Computer Networks ─────────────────────────────────────────────────────
"networks": "Computer Networks",
"networking": "Computer Networks",
"cn": "Computer Networks",
# ── Network Security ──────────────────────────────────────────────────────
"net sec": "Network Security",
"network sec": "Network Security",
# ── Discrete Mathematics ──────────────────────────────────────────────────
"discrete": "Discrete Mathematics",
"discrete math": "Discrete Mathematics",
# ── Theory of Algorithms ──────────────────────────────────────────────────
"algorithms": "Theory of Algorithms",
"algo": "Theory of Algorithms",
# ── Theory of Computation ────────────────────────────────────────────────
"toc": "Theory of Computation",
"computation theory": "Theory of Computation",
# ── Introduction to Programming ──────────────────────────────────────────
"intro programming": "Introduction to Programming",
"intro to programming": "Introduction to Programming",
"intro prog": "Introduction to Programming",
# ── Advanced Java Programming ─────────────────────────────────────────────
"java": "Advanced Java Programming",
"advanced java": "Advanced Java Programming",
"java programming": "Advanced Java Programming",
# ── Computer Graphics ─────────────────────────────────────────────────────
"cg": "Computer Graphics",
"graphics": "Computer Graphics",
# ── Computer Vision ───────────────────────────────────────────────────────
"cv": "Computer Vision",
"vision": "Computer Vision",
# ── Digital Image Processing ─────────────────────────────────────────────
"dip": "Digital Image Processing",
"image processing": "Digital Image Processing",
# ── Computer Organization ────────────────────────────────────────────────
"computer org": "Computer Organization",
"co": "Computer Organization",
# ── Computer Architecture and Assembly Language ───────────────────────────
"computer arch": "Computer Architecture and Assembly Language",
"assembly": "Computer Architecture and Assembly Language",
"asm": "Computer Architecture and Assembly Language",
"architecture": "Computer Architecture and Assembly Language",
# ── Digital Logic ────────────────────────────────────────────────────────
"digital logic": "Digital Logic",
# ── Cryptography ─────────────────────────────────────────────────────────
"crypto": "Cryptography",
"encryption": "Cryptography",
# ── Information Security and Privacy ─────────────────────────────────────
"infosec": "Information Security and Privacy",
"info security": "Information Security and Privacy",
# ── Security Fundamentals ────────────────────────────────────────────────
"security basics": "Security Fundamentals",
"sec fundamentals": "Security Fundamentals",
# ── Penetration Testing and Ethical Hacking ───────────────────────────────
"pentest": "Penetration Testing and Ethical Hacking",
"pen test": "Penetration Testing and Ethical Hacking",
"pentesting": "Penetration Testing and Ethical Hacking",
"ethical hacking": "Penetration Testing and Ethical Hacking",
# ── Cybersecurity Programming ─────────────────────────────────────────────
"cybersecurity programming": "Cybersecurity Programming",
"cyber programming": "Cybersecurity Programming",
# ── Cybersecurity for Physical Systems ────────────────────────────────────
"cpss": "Cybersecurity for Physical Systems",
"cps security": "Cybersecurity for Physical Systems",
# ── Security Operations ───────────────────────────────────────────────────
"sec ops": "Security Operations",
"secops": "Security Operations",
# ── Security Intelligence ─────────────────────────────────────────────────
"sec intel": "Security Intelligence",
"security intel": "Security Intelligence",
# ── Security Management and Auditing ─────────────────────────────────────
"security audit": "Security Management and Auditing",
"security management": "Security Management and Auditing",
# ── Web Applications Development ─────────────────────────────────────────
"web dev": "Web Applications Development",
"web development": "Web Applications Development",
"web apps dev": "Web Applications Development",
# ── Advanced Web Applications ─────────────────────────────────────────────
"advanced web": "Advanced Web Applications",
"awa": "Advanced Web Applications",
# ── Web Application Security ─────────────────────────────────────────────
"web sec": "Web Application Security",
"web security": "Web Application Security",
# ── Web Server Programming ───────────────────────────────────────────────
"web server": "Web Server Programming",
"server programming": "Web Server Programming",
# ── Mobile Programming ────────────────────────────────────────────────────
"mobile": "Mobile Programming",
"mobile prog": "Mobile Programming",
# ── Mobile Development Frameworks ────────────────────────────────────────
"mobile frameworks": "Mobile Development Frameworks",
"mobile dev": "Mobile Development Frameworks",
# ── Cloud Computing ───────────────────────────────────────────────────────
"cloud": "Cloud Computing",
"cc": "Cloud Computing",
# ── Internet of Things ────────────────────────────────────────────────────
"iot": "Internet of Things",
# ── Embedded Systems ─────────────────────────────────────────────────────
"embedded": "Embedded Systems",
# ── Intelligent Robots ────────────────────────────────────────────────────
"robotics": "Intelligent Robots",
"robots": "Intelligent Robots",
# ── Parallel and Distributed Systems ─────────────────────────────────────
"parallel systems": "Parallel and Distributed Systems",
"distributed systems": "Parallel and Distributed Systems",
"pds": "Parallel and Distributed Systems",
# ── Systems Programming and Compiler Construction ─────────────────────────
"compilers": "Systems Programming and Compiler Construction",
"compiler": "Systems Programming and Compiler Construction",
"system programming": "Systems Programming and Compiler Construction",
# ── Computer Ethics ───────────────────────────────────────────────────────
"comp ethics": "Computer Ethics",
"ethics": "Computer Ethics",
# ── Computer Ethics and Documentation ────────────────────────────────────
"ethics and docs": "Computer Ethics and Documentation",
# ── Human-Computer Interaction ───────────────────────────────────────────
"hci": "Human-Computer Interaction",
"human computer": "Human-Computer Interaction",
# ── Data Mining ───────────────────────────────────────────────────────────
"data mining": "Data Mining",
# ── Big Data ──────────────────────────────────────────────────────────────
"big data": "Big Data",
# ── Data Visualization ────────────────────────────────────────────────────
"data viz": "Data Visualization",
"visualization": "Data Visualization",
# ── Data Science Fundamentals ─────────────────────────────────────────────
"data science basics": "Data Science Fundamentals",
"data science fundamentals": "Data Science Fundamentals",
"dsf": "Data Science Fundamentals",
# ── Data Engineering and Analytics ───────────────────────────────────────
"data engineering": "Data Engineering and Analytics",
"dea": "Data Engineering and Analytics",
# ── AI and Data Science Ethics ────────────────────────────────────────────
"ai ethics": "AI and Data Science Ethics",
"data science ethics": "AI and Data Science Ethics",
# ── AI Programming ────────────────────────────────────────────────────────
"ai programming": "AI Programming",
"ai prog": "AI Programming",
# ── Pattern Recognition and Information Analysis ──────────────────────────
"pattern recognition": "Pattern Recognition and Information Analysis",
# ── Ontology and Knowledge Graphs ─────────────────────────────────────────
"ontology": "Ontology and Knowledge Graphs",
"knowledge graphs": "Ontology and Knowledge Graphs",
# ── Knowledge Representation and Reasoning ───────────────────────────────
"krr": "Knowledge Representation and Reasoning",
"knowledge representation": "Knowledge Representation and Reasoning",
# ── Knowledge Management Systems ─────────────────────────────────────────
"kms": "Knowledge Management Systems",
"knowledge management": "Knowledge Management Systems",
# ── Graph Theory ──────────────────────────────────────────────────────────
"graphs": "Graph Theory",
"graph theory": "Graph Theory",
# ── Numerical Analysis ────────────────────────────────────────────────────
"numerical": "Numerical Analysis",
# ── Computational Problems and Techniques ────────────────────────────────
"computational problems": "Computational Problems and Techniques",
"comp problems": "Computational Problems and Techniques",
# ── Modeling and Simulation ───────────────────────────────────────────────
"modeling": "Modeling and Simulation",
"simulation": "Modeling and Simulation",
# ── Operations Research ───────────────────────────────────────────────────
"or": "Operations Research",
"ops research": "Operations Research",
# ── Project Management ────────────────────────────────────────────────────
"pm": "Project Management",
"proj management": "Project Management",
# ── IT Project Management ─────────────────────────────────────────────────
"it pm": "IT Project Management",
"it project": "IT Project Management",
# ── Total Quality Management ──────────────────────────────────────────────
"tqm": "Total Quality Management",
"quality management": "Total Quality Management",
# ── Management Information Systems ───────────────────────────────────────
"mis": "Management Information Systems",
"management info systems": "Management Information Systems",
# ── Information Systems and Applications ──────────────────────────────────
"info systems": "Information Systems and Applications",
# ── Intelligent Business Systems ──────────────────────────────────────────
"ibs": "Intelligent Business Systems",
"intelligent business": "Intelligent Business Systems",
# ── Business Simulation ───────────────────────────────────────────────────
"business sim": "Business Simulation",
"biz simulation": "Business Simulation",
# ── E-Business ───────────────────────────────────────────────────────────
"e business": "E-Business",
"ebusiness": "E-Business",
"electronic business": "E-Business",
# ── E-Learning ────────────────────────────────────────────────────────────
"e learning": "E-Learning and Its Applications",
"elearning": "E-Learning and Its Applications",
"electronic learning": "E-Learning and Its Applications",
# ── Statistical Packages ──────────────────────────────────────────────────
"stats packages": "Statistical Packages",
"statistics packages": "Statistical Packages",
# ── Applied Statistics ────────────────────────────────────────────────────
"applied stats": "Applied Statistics",
# ── Geographic Information Systems ────────────────────────────────────────
"gis": "Geographic Information Systems",
"geographic info systems": "Geographic Information Systems",
# ── Document Analysis and Recognition ────────────────────────────────────
"document analysis": "Document Analysis and Recognition",
"dar": "Document Analysis and Recognition",
# ── Multimedia ────────────────────────────────────────────────────────────
"multi media": "Multimedia",
# ── Digital Forensics ─────────────────────────────────────────────────────
"forensics": "Digital Forensics",
# ── Reverse Engineering and Malware Analysis ──────────────────────────────
"reverse engineering": "Reverse Engineering and Malware Analysis",
"re": "Reverse Engineering and Malware Analysis",
"malware analysis": "Reverse Engineering and Malware Analysis",
"malware": "Reverse Engineering and Malware Analysis",
# ── Verification and Security Models ─────────────────────────────────────
"security models": "Verification and Security Models",
"verification": "Verification and Security Models",
# ── Secure Software Engineering ───────────────────────────────────────────
"secure se": "Secure Software Engineering",
"secure software": "Secure Software Engineering",
# ── Advanced Topics in Software Engineering ───────────────────────────────
"advanced se": "Advanced Topics in Software Engineering",
"advanced software engineering": "Advanced Topics in Software Engineering",
# ── Systems Analysis and Design ───────────────────────────────────────────
"sad": "Systems Analysis and Design",
"systems analysis": "Systems Analysis and Design",
# ── IT Fundamentals ───────────────────────────────────────────────────────
"it basics": "IT Fundamentals",
"it fund": "IT Fundamentals",
# ── IT Entrepreneurship and Innovation ───────────────────────────────────
"entrepreneurship": "IT Entrepreneurship and Innovation",
"it startup": "IT Entrepreneurship and Innovation",
# ── Social Media ─────────────────────────────────────────────────────────
"social media": "Social Media",
"sm": "Social Media",
# ── Computer Fundamentals ────────────────────────────────────────────────
"comp fundamentals": "Computer Fundamentals",
"computer basics": "Computer Fundamentals",
# ── Modern Digital Skills ─────────────────────────────────────────────────
"digital skills": "Modern Digital Skills",
"mds": "Modern Digital Skills",
# ── Career Preparation ────────────────────────────────────────────────────
"career prep": "Career Preparation",
"job prep": "Career Preparation",
"اعداد وظيفي": "Career Preparation",
# ── Python (Special Topic) ────────────────────────────────────────────────
"python": "Special Topic in Digital Skills Python Programming and Problem Solving",
"python programming": "Special Topic in Digital Skills Python Programming and Problem Solving",
# ── Special Topics in Data Science ───────────────────────────────────────
"special topics data science": "Special Topics in Data Science",
"data science special": "Special Topics in Data Science",
# ── Security Risk Management and Ethics ───────────────────────────────────
"security risk": "Security Risk Management and Ethics",
"srme": "Security Risk Management and Ethics",
# ── Adaptive User Systems ─────────────────────────────────────────────────
"adaptive systems": "Adaptive User Systems",
"user systems": "Adaptive User Systems",
# ════════════════════════════════════════════════════════════════════════
# OFFICE HOURS — English
# ════════════════════════════════════════════════════════════════════════
"office hours": "office hours faculty schedule",
"consultation hours": "office hours consultation",
"visiting hours": "office hours visit faculty",
"office schedule": "office hours faculty schedule",
"when can i visit": "office hours visit",
"when can i see": "office hours visit faculty",
"meet the professor": "office hours faculty",
"meet professor": "office hours faculty",
"meet dr": "office hours faculty",
"visit dr": "office hours visit faculty",
"visit professor": "office hours visit faculty",
"see the professor": "office hours faculty",
"faculty availability": "office hours faculty schedule",
"professor availability": "office hours faculty schedule",
# ════════════════════════════════════════════════════════════════════════
# FEES / TUITION / COST — English
# ════════════════════════════════════════════════════════════════════════
"tuition": "credit hour fees tuition program",
"tuition fees": "credit hour fees tuition program",
"credit hour fees": "credit hour fees program track",
"credit hour cost": "credit hour fees program track",
"credit hour price": "credit hour fees program track",
"program fees": "credit hour fees program track",
"program cost": "credit hour fees program track",
"how much does it cost": "credit hour fees tuition program",
"how much is": "credit hour fees tuition",
"registration fees": "registration fees credit hour",
"enrollment fees": "registration fees credit hour",
"mutanafis": "Regular Mutanafis track credit hour fees",
"parallel track": "Parallel track credit hour fees",
"international track": "International track credit hour fees USD",
"muwazi": "Parallel Muwazi track credit hour fees",
"regular track": "Regular Mutanafis track credit hour fees",
# Programs by name (fees context)
"cs program": "Computer Science CS credit hour fees",
"cis program": "Computer Information Systems CIS credit hour fees",
"bit program": "Business Information Technology BIT credit hour fees",
"cys program": "Cybersecurity CYS credit hour fees",
"ai program": "Artificial Intelligence AI credit hour fees",
"ds program": "Data Science DS credit hour fees",
"computer science program": "Computer Science CS credit hour fees",
"cybersecurity program": "Cybersecurity CYS credit hour fees",
"data science program": "Data Science DS credit hour fees",
# ════════════════════════════════════════════════════════════════════════
# MAKRAMA / GRANT PROGRAMS — English
# ════════════════════════════════════════════════════════════════════════
"makrama": "makrama scholarship grant benefit program",
"maqrama": "makrama scholarship grant benefit program",
"army makrama": "Army Makrama military scholarship armed forces",
"army scholarship": "Army Makrama military scholarship armed forces",
"military scholarship": "Army Makrama Jaseem Makrama military",
"armed forces scholarship": "Army Makrama military scholarship",
"civil defense scholarship": "Army Makrama civil defense scholarship",
"public security scholarship": "Army Makrama public security scholarship",
"intelligence scholarship": "Army Makrama general intelligence scholarship",
"gendarmerie scholarship": "Army Makrama gendarmerie Darak scholarship",
"jaseem": "Jaseem Makrama military disability martyr",
"jaseem makrama": "Jaseem Makrama military disability martyr",
"martyr scholarship": "Jaseem Makrama martyr children scholarship",
"children of martyrs": "Jaseem Makrama martyr children",
"military disabled": "Jaseem Makrama military disability 40 percent",
"teachers makrama": "Teachers Makrama Ministry of Education scholarship",
"teacher scholarship": "Teachers Makrama Ministry of Education",
"ministry of education scholarship": "Teachers Makrama Ministry of Education",
"education employee scholarship": "Teachers Makrama Ministry of Education",
"scholarship": "makrama scholarship grant benefit program",
"grant program": "makrama scholarship grant benefit program",
"benefit program": "makrama scholarship grant benefit program",
# ════════════════════════════════════════════════════════════════════════
# GRADE BOUNDARIES — English
# ════════════════════════════════════════════════════════════════════════
"grade boundary": "grade boundaries score needed Fall 2025",
"grade boundaries": "grade boundaries score needed Fall 2025",
"grade cutoff": "grade boundaries cutoff score",
"passing score": "grade boundaries passing score",
"passing grade": "grade boundaries passing grade",
"what score for a": "grade boundaries A score needed",
"what grade for": "grade boundaries score needed",
"score needed": "grade boundaries score needed",
"score for a": "grade boundaries A score needed",
"score for b": "grade boundaries B score needed",
"minimum score": "grade boundaries minimum score",
"grade scale": "grade boundaries grade scale",
"grading": "grade boundaries grading system",
# ════════════════════════════════════════════════════════════════════════
# FACULTY EMAIL / CONTACT — English
# ════════════════════════════════════════════════════════════════════════
"email": "email faculty contact directory",
"faculty email": "email faculty contact directory",
"professor email": "email faculty contact directory",
"contact professor": "email contact faculty directory",
"contact faculty": "email contact faculty directory",
"faculty contact": "email contact faculty directory",
"faculty directory": "faculty directory email contact",
"contact dr": "email contact faculty",
"reach professor": "email contact faculty",
"reach dr": "email contact faculty",
"department members": "faculty directory department members",
# ════════════════════════════════════════════════════════════════════════
# SUMMER SEMESTER — English
# ════════════════════════════════════════════════════════════════════════
"summer semester": "summer semester courses schedule 2026",
"summer course": "summer semester courses schedule",
"summer courses": "summer semester courses schedule",
"summer 2026": "Summer 2026 semester courses schedule",
"summer schedule": "summer semester courses schedule",
"summer registration": "summer semester courses registration",
# ════════════════════════════════════════════════════════════════════════
# FINAL EXAM SCHEDULE — English
# ════════════════════════════════════════════════════════════════════════
"final exam": "final exam schedule date hall lab",
"final exam schedule": "final exam schedule date hall lab",
"final exam date": "final exam schedule date",
"exam date": "exam schedule date",
"exam schedule": "exam schedule date hall lab",
"when is the final": "final exam schedule date",
"where is the final": "final exam schedule hall lab",
"what hall": "exam schedule hall location",
"what lab": "exam schedule lab location",
"exam location": "exam schedule hall lab location",
"exam hall": "exam schedule hall location",
"exam lab": "exam schedule lab location",
"second semester exam": "second semester 2025 2026 final exam",
"second semester final": "second semester 2025 2026 final exam",
# ════════════════════════════════════════════════════════════════════════
# SEMESTER / ACADEMIC CALENDAR — English
# ════════════════════════════════════════════════════════════════════════
"first semester": "first semester Fall 2025 2026",
"second semester": "second semester Spring 2025 2026",
"fall 2025": "Fall 2025 2026 first semester",
"spring 2026": "second semester Spring 2026",
# ════════════════════════════════════════════════════════════════════════
# Arabic colloquial query expansions
# Maps informal/dialect terms students use → standard Arabic terms that
# appear in the knowledge base so BM25 and vector search can match.
# ════════════════════════════════════════════════════════════════════════
# ── "Where is the exam?" (location) ──────────────────────────────────
# Jordanian dialect: وين / فين / في وين → مختبر قاعة موقع
"وين": "مختبر قاعة موقع",
"فين": "مختبر قاعة موقع",
"في وين": "مختبر قاعة موقع",
"وين الامتحان": "مختبر قاعة موقع امتحان",
"فين الامتحان": "مختبر قاعة موقع امتحان",
"وين الاختبار": "مختبر قاعة موقع امتحان",
# ── "In which lab / hall?" ────────────────────────────────────────────
"في اي مختبر": "مختبر تكنولوجيا",
"في أي مختبر": "مختبر تكنولوجيا",
"في اي قاعة": "قاعة",
"في أي قاعة": "قاعة",
"في اي المختبرات": "مختبر تكنولوجيا",
"في أي المختبرات": "مختبر تكنولوجيا",
"في اي القاعات": "قاعة",
"في أي القاعات": "قاعة",
"اي مختبر": "مختبر تكنولوجيا",
"اي قاعة": "قاعة",
# ── "When is the exam?" (time/date) ──────────────────────────────────
# Jordanian colloquial: امتى / وقتيش / إمتى → موعد تاريخ وقت
"امتى": "موعد تاريخ وقت",
"إمتى": "موعد تاريخ وقت",
"وقتيش": "موعد تاريخ وقت",
"امتى الامتحان": "موعد تاريخ امتحان",
"امتى الاختبار": "موعد تاريخ امتحان",
# ── Lab / hall informal spellings ────────────────────────────────────
"لاب": "مختبر",
"لابات": "مختبرات",
"اختبار": "امتحان",
"تيست": "امتحان",
# ════════════════════════════════════════════════════════════════════════
# Arabic — Office Hours (ساعات الدوام المكتبي)
# ════════════════════════════════════════════════════════════════════════
"ساعات المكتب": "ساعات الدوام المكتبي أعضاء هيئة التدريس",
"ساعات الاستقبال": "ساعات الدوام المكتبي",
"ساعات الدوام": "ساعات الدوام المكتبي",
"دوام مكتبي": "ساعات الدوام المكتبي",
"وقت الدكتور": "ساعات الدوام المكتبي",
"وقت الاستاذ": "ساعات الدوام المكتبي",
"وقت الدكتورة": "ساعات الدوام المكتبي",
"متى يكون الدكتور": "ساعات الدوام المكتبي",
"متى يكون الاستاذ": "ساعات الدوام المكتبي",
"زيارة الدكتور": "ساعات الدوام المكتبي زيارة",
"زيارة الاستاذ": "ساعات الدوام المكتبي زيارة",
"اقابل الدكتور": "ساعات الدوام المكتبي",
"اشوف الدكتور": "ساعات الدوام المكتبي",
"متى الدكتور موجود": "ساعات الدوام المكتبي",
"وقت الاستشارة": "ساعات الدوام المكتبي استشارة",
"ساعة مكتبية": "ساعات الدوام المكتبي",
# ════════════════════════════════════════════════════════════════════════
# Arabic — Fees / Tuition (رسوم)
# ════════════════════════════════════════════════════════════════════════
"رسوم": "رسوم الساعات الدراسية رسوم التسجيل",
"تكلفة": "رسوم الساعات الدراسية تكلفة",
"رسوم الساعة": "رسوم الساعات الدراسية",
"رسوم الساعات": "رسوم الساعات الدراسية",
"رسوم التسجيل": "رسوم التسجيل الدراسي",
"كم رسوم": "رسوم الساعات الدراسية رسوم التسجيل",
"قديش الساعة": "رسوم الساعات الدراسية",
"قديش الدراسة": "رسوم الساعات الدراسية",
"بكم الساعة": "رسوم الساعات الدراسية",
"كم تكلف": "رسوم الساعات الدراسية تكلفة",
"كم ثمن": "رسوم الساعات الدراسية",
"تكاليف الدراسة": "رسوم الساعات الدراسية تكاليف",
"برنامج التنافس": "برنامج التنافس رسوم الساعات الدراسية",
"تنافس": "برنامج التنافس رسوم",
"موازي": "برنامج الموازي رسوم الساعات الدراسية",
"برنامج الموازي": "برنامج الموازي رسوم الساعات الدراسية",
"دولي": "البرنامج الدولي رسوم بالدولار",
"برنامج دولي": "البرنامج الدولي رسوم بالدولار",
"دينار": "رسوم بالدينار الأردني",
"دولار": "رسوم بالدولار البرنامج الدولي",
# ════════════════════════════════════════════════════════════════════════
# Arabic — Makrama / Grant Programs (مكرمة)
# ════════════════════════════════════════════════════════════════════════
"مكرمة": "مكرمة منحة دراسية برنامج دعم",
"المكرمة": "مكرمة منحة دراسية",
"مكرمة الجيش": "مكرمة الجيش القوات المسلحة الأردنية منحة",
"مكرمة المعلمين": "مكرمة المعلمين وزارة التربية والتعليم منحة",
"مكرمة الجسيم": "مكرمة الجسيم شهداء مصابون عسكريون منحة",
"منحة": "منحة مكرمة دراسية",
"شهداء": "أبناء الشهداء مكرمة الجسيم",
"أبناء الشهداء": "مكرمة الجسيم أبناء الشهداء والمصابين",
"جسيم": "مكرمة الجسيم عجز عسكري 40",
"المصابون العسكريون": "مكرمة الجسيم مصابون عسكريون",
"القوات المسلحة": "مكرمة الجيش القوات المسلحة الأردنية",
"الدفاع المدني": "مكرمة الجيش الدفاع المدني",
"الأمن العام": "مكرمة الجيش الأمن العام",
"المخابرات": "مكرمة الجيش المخابرات العامة",
"الدرك": "مكرمة الجيش الدرك",
"وزارة التربية": "مكرمة المعلمين وزارة التربية والتعليم",
"ضابط ارتباط": "مكرمة المعلمين ضابط ارتباط",
"نظام الموازي": "برنامج الموازي مكرمة الجسيم",
"مكرمة الطالب": "مكرمة منحة دراسية",
# ════════════════════════════════════════════════════════════════════════
# Arabic — Grade Boundaries (حدود الدرجات)
# ════════════════════════════════════════════════════════════════════════
"حدود الدرجات": "حدود الدرجات درجة النجاح الفصل الأول",
"الدرجة المطلوبة": "حدود الدرجات درجة مطلوبة",
"علامة النجاح": "حدود الدرجات درجة النجاح",
"كم علامة للنجاح": "حدود الدرجات درجة النجاح",
"كم علامة للـ a": "حدود الدرجات درجة A",
"كم علامة للـ b": "حدود الدرجات درجة B",
"حد النجاح": "حدود الدرجات درجة النجاح",
"درجة الـ a": "حدود الدرجات درجة A",
"درجة A": "حدود الدرجات A",
"درجة B": "حدود الدرجات B",
"كم ادرس": "حدود الدرجات",
# ════════════════════════════════════════════════════════════════════════
# Arabic — Faculty Email / Contact (بريد إلكتروني)
# ════════════════════════════════════════════════════════════════════════
"بريد": "بريد إلكتروني أعضاء هيئة التدريس",
"بريد إلكتروني": "بريد إلكتروني أعضاء هيئة التدريس",
"ايميل": "بريد إلكتروني",
"إيميل": "بريد إلكتروني",
"ايميل الدكتور": "بريد إلكتروني أعضاء هيئة التدريس",
"ايميل الاستاذ": "بريد إلكتروني أعضاء هيئة التدريس",
"تواصل مع الدكتور": "بريد إلكتروني تواصل أعضاء هيئة التدريس",
"كيف اتواصل": "بريد إلكتروني تواصل",
"رقم الدكتور": "بريد إلكتروني تواصل أعضاء هيئة التدريس",
# ════════════════════════════════════════════════════════════════════════
# Arabic — Summer Semester (الفصل الصيفي)
# ════════════════════════════════════════════════════════════════════════
"صيفي": "الفصل الصيفي مواد جدول",
"الصيفي": "الفصل الصيفي مواد جدول",
"الصيف": "الفصل الصيفي مواد جدول",
"فصل صيفي": "الفصل الصيفي مواد جدول",
"مواد الصيف": "مواد الفصل الصيفي جدول",
"جدول الصيفي": "جدول مواد الفصل الصيفي",
"تسجيل الصيفي": "تسجيل الفصل الصيفي مواد",
# ════════════════════════════════════════════════════════════════════════
# Arabic — Final Exam Schedule (امتحانات نهائية)
# ════════════════════════════════════════════════════════════════════════
"نهائي": "امتحان نهائي جدول موعد",
"امتحان نهائي": "امتحان نهائي جدول موعد قاعة",
"الامتحان النهائي": "امتحان نهائي جدول موعد قاعة",
"جدول الامتحانات": "جدول الامتحانات النهائية موعد",
"جدول الامتحانات النهائية": "جدول الامتحانات النهائية موعد قاعة",
"موعد الامتحان": "موعد امتحان جدول تاريخ",
"موعد الامتحان النهائي": "موعد امتحان نهائي جدول",
"متى الامتحان النهائي": "موعد امتحان نهائي جدول",
"وين الامتحان النهائي": "قاعة مختبر امتحان نهائي",
"مكان الامتحان": "قاعة مختبر امتحان موقع",
# ════════════════════════════════════════════════════════════════════════
# Arabic — Semester references (فصل أول / ثاني)
# ════════════════════════════════════════════════════════════════════════
"فصل أول": "الفصل الأول 2025 2026",
"الفصل الأول": "الفصل الأول Fall 2025 2026",
"فصل ثاني": "الفصل الثاني 2025 2026",
"الفصل الثاني": "الفصل الثاني Spring 2026",
# ════════════════════════════════════════════════════════════════════════
# Arabic — Course schedule / registration (جدول المواد)
# ════════════════════════════════════════════════════════════════════════
"جدول المواد": "جدول المواد الدراسية شعبة",
"جدول الدراسة": "جدول المواد الدراسية",
"مواد مفتوحة": "شعب مفتوحة تسجيل",
"شعبة": "شعبة section تسجيل",
"شعب": "شعب sections تسجيل",
"مفتوحة": "شعبة مفتوحة للتسجيل",
"مغلقة": "شعبة مغلقة ممتلئة",
"مسجلين": "عدد المسجلين شعبة",
"يدرس": "يدرّس مادة دكتور مدرس",
"من يدرس": "من يدرّس مادة أستاذ",
"مين يعلم": "من يدرّس مادة أستاذ مدرس",
"ييجي": "مادة متاحة شعبة",
# ════════════════════════════════════════════════════════════════════════
# JORDANIAN DIALECT — عامية أردنية
# Maps everyday colloquial phrases Jordanian students type to the
# Modern Standard Arabic (fusha) terms used in the knowledge base.
# Organised by topic so additions are easy to find and extend.
# ════════════════════════════════════════════════════════════════════════
# ── Interrogative / question words ───────────────────────────────────
"شو": "ما ماذا",
"شو هو": "ما هو",
"شو هي": "ما هي",
"شو يعني": "ماذا يعني",
"شو المطلوب": "ما المطلوب ما الشروط",
"شو الشروط": "ما الشروط المتطلبات",
"شو اللي": "ما الذي",
"كيفاش": "كيف",
"كيف بعمل": "كيف أقوم بـ",
"كيف بسوي": "كيف أقوم بـ",
"مين": "من",
"مين الاستاذ": "من يدرّس أستاذ مدرس",
"مين الدكتور": "من يدرّس أستاذ دكتور",
"مين بدرّس": "من يدرّس مادة أستاذ",
"مين بيدرس": "من يدرّس مادة أستاذ",
"مين بعلم": "من يدرّس مادة أستاذ",
# ── General request / intent phrases ─────────────────────────────────
"بدي": "أريد",
"بدي اعرف": "أريد معرفة",
"بحتاج": "أحتاج",
"بحتاج اعرف": "أحتاج معرفة",
"قولي": "أخبرني",
"احكيلي": "أخبرني",
"خبرني": "أخبرني",
"وضحلي": "اشرح لي وضح",
"ساعدني": "مساعدة",
"ابي اعرف": "أريد معرفة",
"بدي اشوف": "أريد الاطلاع على",
"حابب اعرف": "أريد معرفة",
"فيه معلومات عن": "معلومات حول",
"فيه شي عن": "معلومات حول",
# ── Course / subject queries ──────────────────────────────────────────
"مادة": "مادة مقرر دراسي",
"ماده": "مادة مقرر دراسي",
"مواد": "مواد مقررات دراسية",
"مادتي": "مادتي مقرري",
"الماده": "المادة المقرر",
"شو المادة": "ما المادة ما المقرر",
"اي مادة": "أي مادة مقرر",
"سكشن": "شعبة section",
"سكشنات": "شعب sections",
"كلاس": "محاضرة شعبة",
"كلاسات": "محاضرات شعب",
"كلاس مفتوح": "شعبة مفتوحة للتسجيل",
"كلاس زحمة": "شعبة ممتلئة مغلقة",
"زحمة": "شعبة ممتلئة مغلقة",
"فاضية": "شعبة مفتوحة متاحة",
"مو زحمة": "شعبة مفتوحة متاحة",
"كم طالب": "عدد المسجلين شعبة",
"كم مسجل": "عدد المسجلين شعبة",
"فيه مقاعد": "مقاعد متاحة شعبة مفتوحة",
"مقعد": "مقعد شعبة تسجيل",
"فاضي مقعد": "مقعد متاح شعبة مفتوحة",
# ── Mid-term exam (Jordanian dialect) ────────────────────────────────
"ميد": "امتحان منتصف الفصل mid",
"الميد": "امتحان منتصف الفصل mid",
"ميدترم": "امتحان منتصف الفصل midterm",
"امتحان الميد": "امتحان منتصف الفصل midterm",
"وين الميد": "قاعة مختبر امتحان منتصف الفصل",
"امتى الميد": "موعد تاريخ امتحان منتصف الفصل",
"وقت الميد": "موعد امتحان منتصف الفصل",
# ── Final exam (Jordanian dialect) ───────────────────────────────────
"فاينل": "امتحان نهائي final",
"الفاينل": "امتحان نهائي final",
"اكسم": "امتحان نهائي exam",
"أكسم": "امتحان نهائي exam",
"اكزام": "امتحان exam",
"وين الفاينل": "قاعة مختبر امتحان نهائي",
"امتى الفاينل": "موعد تاريخ امتحان نهائي",
"وقت الفاينل": "موعد امتحان نهائي جدول",
"جدول الفاينل": "جدول الامتحانات النهائية موعد قاعة",
# ── Quiz ─────────────────────────────────────────────────────────────
"كويز": "اختبار قصير quiz",
"كويزات": "اختبارات قصيرة quizzes",
"كويز متى": "موعد اختبار قصير",
# ── Grades / marks (Jordanian dialect) ───────────────────────────────
"علامة": "درجة علامة grade",
"علاماتي": "درجاتي علاماتي",
"علامتي": "درجتي علامتي",
"شو علامتي": "ما درجتي علامتي",
"كم طلعت": "ما الدرجة",
"طلع كم": "ما الدرجة",
"نجحت": "نجح درجة النجاح",
"رسبت": "رسب درجة الرسوب",
"ناجح": "ناجح درجة النجاح",
"راسب": "راسب رسب حدود الدرجات",
"بدي انجح": "درجة النجاح حدود الدرجات",
"علامة الباس": "درجة النجاح passing grade",
"الباس": "درجة النجاح passing",
"شو الباس": "ما درجة النجاح حدود الدرجات",
"الفيل": "درجة الرسوب fail",
"شو الفيل": "ما درجة الرسوب حدود الدرجات",
"باس مارك": "درجة النجاح حدود الدرجات",
"علامة جيد": "درجة جيد B grade boundaries",
"علامة ممتاز": "درجة ممتاز A grade boundaries",
"شو بدي اجيب": "حدود الدرجات درجة النجاح",
"بدي آخذ أي": "حدود الدرجات درجة A",
"بدي آخذ بي": "حدود الدرجات درجة B",
# ── Fees / cost (Jordanian dialect) ──────────────────────────────────
"فلوس": "رسوم تكلفة دفع",
"شو بدفع": "كم الرسوم رسوم الساعات الدراسية",
"بدفع كم": "كم الرسوم رسوم الساعات الدراسية",
"بكم": "رسوم تكلفة",
"غالي": "رسوم تكلفة سعر",
"رخيص": "رسوم تكلفة سعر",
"الساعة بكم": "رسوم الساعة الدراسية",
"كم دينار الساعة": "رسوم الساعة الدراسية بالدينار",
"بدفع عليها": "رسوم الساعات الدراسية",
"شو بدفعش": "رسوم ما الرسوم",
"المبلغ": "رسوم المبلغ المطلوب",
"بكم الساعة": "رسوم الساعة الدراسية",
# ── Registration / enrollment (Jordanian dialect) ─────────────────────
"بسجل": "تسجيل مواد",
"كيف بسجل": "كيفية تسجيل المواد",
"بدي اسجل": "أريد تسجيل مواد",
"سجلت": "تسجيل",
"موعد التسجيل": "موعد تسجيل المواد",
"وقت التسجيل": "موعد تسجيل المواد",
"اشطب": "حذف مادة",
"بشطب": "حذف مادة",
"شطب مادة": "حذف مادة",
"سحب مادة": "حذف مادة سحب",
"اضيف مادة": "إضافة مادة",
"بضيف مادة": "إضافة مادة",
"إضافة وحذف": "إضافة وحذف المواد تسجيل",
"الدروب": "حذف مادة drop",
"دروبت": "حذف مادة drop",
"ساعات منجزة": "ساعات معتمدة منجزة",
"ساعات خلصتها": "ساعات معتمدة منجزة",
"كم ساعة خلصت": "كم ساعة معتمدة منجزة",
"باقيلي": "ساعات متبقية للتخرج",
"متطلبات التخرج": "شروط التخرج ساعات معتمدة",
# ── Lecture schedule / timing (Jordanian dialect) ─────────────────────
"وقت الكلاس": "وقت المحاضرة جدول",
"وين الكلاس": "قاعة مختبر محاضرة",
"وين المحاضرة": "قاعة مختبر محاضرة",
"موعد المحاضرة": "وقت المحاضرة جدول",
"جدول الدكتور": "جدول المواد أستاذ مدرس",
"امتى الكلاس": "موعد وقت المحاضرة",
"امتى المحاضرة": "موعد وقت المحاضرة",
"يوم المحاضرة": "يوم موعد المحاضرة جدول",
# ── Office hours (more Jordanian dialect) ────────────────────────────
"الدكتور موجود": "ساعات الدوام المكتبي أعضاء هيئة التدريس",
"بلاقي الدكتور": "ساعات الدوام المكتبي",
"بشوف الدكتور": "ساعات الدوام المكتبي",
"بروح على مكتب": "ساعات الدوام المكتبي",
"وين مكتب الدكتور": "مكتب أستاذ ساعات الدوام",
"وين مكتب الاستاذ": "مكتب أستاذ ساعات الدوام",
"رح اجي": "ساعات الدوام المكتبي زيارة",
"بقدر اجي": "ساعات الدوام المكتبي",
"فين مكتبه": "مكتب ساعات الدوام المكتبي",
# ── Email / contact (Jordanian dialect) ──────────────────────────────
"ايميله": "بريده الإلكتروني أعضاء هيئة التدريس",
"ايميلها": "بريدها الإلكتروني أعضاء هيئة التدريس",
"ايميل الاستاذة": "بريد إلكتروني أعضاء هيئة التدريس",
"كيف اتواصل مع": "بريد إلكتروني تواصل",
"اكتبله": "بريد إلكتروني تواصل",
"ارسلله": "بريد إلكتروني إرسال",
"رقمه": "بريد إلكتروني تواصل أعضاء هيئة التدريس",
# ── Makrama / grants (Jordanian dialect) ─────────────────────────────
"عسكري": "مكرمة الجيش القوات المسلحة الأردنية",
"ابو عسكري": "مكرمة الجيش أبناء العسكريين",
"ولد عسكري": "مكرمة الجيش أبناء العسكريين",
"بنت عسكري": "مكرمة الجيش أبناء العسكريين",
"معلم": "مكرمة المعلمين وزارة التربية والتعليم",
"ابو معلم": "مكرمة المعلمين أبناء المعلمين",
"ولد معلم": "مكرمة المعلمين أبناء المعلمين",
"بنت معلم": "مكرمة المعلمين أبناء المعلمين",
"شهيد": "مكرمة الجسيم أبناء الشهداء",
"ابن شهيد": "مكرمة الجسيم أبناء الشهداء",
"مجروح": "مكرمة الجسيم مصابون عسكريون عجز",
"عجز": "مكرمة الجسيم نسبة عجز 40 بالمئة",
"نسبة عجز": "مكرمة الجسيم نسبة عجز عسكري",
"بدي امتحن": "منحة مكرمة امتحان قبول",
"كيف اقدم": "كيفية التقديم منحة مكرمة",
"كيف اتقدم": "كيفية التقديم منحة مكرمة",
# ── Program / department (Jordanian dialect) ──────────────────────────
"قسم": "قسم تخصص برنامج",
"تخصص": "تخصص برنامج دراسي",
"شو التخصص": "ما التخصص البرنامج",
"كلية": "كلية الحاسوب والمعلومات KASIT",
"الكلية": "كلية الحاسوب والمعلومات KASIT",
"كاسيت": "KASIT كلية الحاسوب والمعلومات",
"الجامعة": "جامعة الأردن University of Jordan",
"جامعة الاردن": "جامعة الأردن University of Jordan KASIT",
"الأردن الجامعة": "جامعة الأردن University of Jordan",
"اليو جي": "جامعة الأردن UJ University of Jordan",
# ── Summer semester (more Jordanian dialect) ─────────────────────────
"صيف": "الفصل الصيفي مواد جدول",
"كلاسات الصيف": "مواد الفصل الصيفي جدول",
"مواد الصيفي": "مواد الفصل الصيفي جدول",
"تسجيل الصيف": "تسجيل الفصل الصيفي مواد",
"بسجل صيفي": "تسجيل الفصل الصيفي مواد",
"فيه صيفي": "الفصل الصيفي مواد متاحة",
"مواد متاحة الصيف": "مواد الفصل الصيفي متاحة للتسجيل",
# ── Academic standing / GPA (Jordanian dialect) ───────────────────────
"معدل": "المعدل التراكمي GPA",
"المعدل": "المعدل التراكمي GPA",
"جي بي اي": "المعدل التراكمي GPA",
"معدلي": "معدلي التراكمي GPA",
"شو معدلي": "ما معدلي التراكمي GPA",
"رفع المعدل": "رفع المعدل التراكمي",
"انذار": "إنذار أكاديمي academic warning",
"فصل": "فصل أكاديمي academic dismissal",
"مراجعة علامة": "مراجعة درجة اعتراض",
"اعتراض على علامة": "مراجعة اعتراض درجة",
}
# Sort by length descending so longer phrases match before shorter substrings.
_SORTED_ALIASES = sorted(COURSE_SYNONYMS.keys(), key=len, reverse=True)
# Pre-compile one pattern per alias for whole-word matching.
_PATTERNS = {
alias: re.compile(r"\b" + re.escape(alias) + r"\b", re.IGNORECASE)
for alias in _SORTED_ALIASES
}
def expand_query(query: str) -> str:
"""
Append official course names for any aliases found in the query.
The original query is preserved; expansions are appended so all
retrieval methods see both the student term and the official name.
"""
lower = query.lower()
additions: list[str] = []
for alias in _SORTED_ALIASES:
if _PATTERNS[alias].search(lower):
official = COURSE_SYNONYMS[alias]
# Only add if the official name is not already present.
if official.lower() not in lower and official not in additions:
additions.append(official)
if not additions:
return query
return query + " " + " ".join(additions)