# ==========================================================
# COLLEGE INFORMATION AI AGENT
# ==========================================================
# College Knowledge Base
# ==========================================================
college_data = {
"admission": {
"keywords": ["admission", "apply", "application", "eligibility", "document"],
"response":
"""
========== ADMISSION INFORMATION ==========
Admission Process :
1. Fill the Online Application Form
2. Upload Required Documents
3. Pay Registration Fee
4. Document Verification
5. Admission Confirmation
Required Documents :
• 10th Marksheet
• 12th Marksheet
• Transfer Certificate (TC)
• Migration Certificate
• Aadhaar Card
• Passport Size Photograph
Eligibility
• 10+2 Passed
• Valid Entrance Score (if applicable)
"""
},
"fees": {
"keywords": ["fee", "fees", "payment", "tuition"],
"response":
"""
========== FEE DETAILS ==========
Tuition Fee : ₹50,000 / Year
Hostel Fee : ₹20,000 / Year
Library Fee : ₹2,000 / Year
Payment Methods
• UPI
• Debit Card
• Credit Card
• Net Banking
"""
},
"exam": {
"keywords": ["exam", "result", "semester", "revaluation", "admit"],
"response":
"""
========== EXAMINATION ==========
• Mid Semester Exams
• End Semester Exams
• Practical Exams
• Admit Card Download
• Result Declaration
• Revaluation Facility
"""
},
"scholarship": {
"keywords": ["scholarship", "financial"],
"response":
"""
========== SCHOLARSHIPS ==========
• NSP Scholarship
• State Scholarship
• Merit Scholarship
• SC/ST Scholarship
• Minority Scholarship
"""
},
"hostel": {
"keywords": ["hostel", "mess", "room"],
"response":
"""
========== HOSTEL ==========
Facilities
• Separate Boys & Girls Hostel
• Wi-Fi
• Mess
• RO Water
• Security
• 24×7 Electricity
"""
},
"placement": {
"keywords": ["placement", "package", "company", "internship", "job"],
"response":
"""
========== PLACEMENTS ==========
Highest Package : ₹18 LPA
Average Package : ₹5 LPA
Top Recruiters
• TCS
• Infosys
• Wipro
• Accenture
• Cognizant
"""
},
"library": {
"keywords": ["library", "book", "books"],
"response":
"""
========== LIBRARY ==========
• 50,000+ Books
• Digital Library
• Reading Hall
Timing
9:00 AM - 8:00 PM
"""
},
"general": {
"keywords": [],
"response":
"""
========== COLLEGE FACILITIES ==========
• Smart Classrooms
• Computer Labs
• Sports Complex
• Medical Room
• Cafeteria
• Auditorium
"""
}
}
# ==========================================================
# Conversation History
# ==========================================================
history = []
# ==========================================================
# AI Agents
# ==========================================================
class AdmissionAgent:
def handle(self):
return college_data["admission"]["response"]
class FeesAgent:
def handle(self):
return college_data["fees"]["response"]
class ExamAgent:
def handle(self):
return college_data["exam"]["response"]
class ScholarshipAgent:
def handle(self):
return college_data["scholarship"]["response"]
class HostelAgent:
def handle(self):
return college_data["hostel"]["response"]
class PlacementAgent:
def handle(self):
return college_data["placement"]["response"]
class LibraryAgent:
def handle(self):
return college_data["library"]["response"]
class GeneralAgent:
def handle(self):
return college_data["general"]["response"]
# ==========================================================
# Intent Classifier
# ==========================================================
class IntentClassifier:
def classify(self, query):
query = query.lower()
best_match = "general"
max_matches = 0
for department, details in college_data.items():
count = 0
for keyword in details["keywords"]:
if keyword in query:
count += 1
if count > max_matches:
max_matches = count
best_match = department
return best_match
# ==========================================================
# Response Agent
# ==========================================================
class ResponseAgent:
def __init__(self):
self.agents = {
"admission": AdmissionAgent(),
"fees": FeesAgent(),
"exam": ExamAgent(),
"scholarship": ScholarshipAgent(),
"hostel": HostelAgent(),
"placement": PlacementAgent(),
"library": LibraryAgent(),
"general": GeneralAgent()
}
def respond(self, intent, question):
answer = self.agents[intent].handle()
# Save conversation history
history.append({
"Question": question,
"Department": intent.title()
})
# Keep only last 5 conversations
if len(history) > 5:
history.pop(0)
return answer
# ==========================================================
# Display Recent Conversation
# ==========================================================
def show_history():
if not history:
return
print("\nRecent Conversation")
print("-" * 40)
for chat in history:
print(f"{chat['Department']} : {chat['Question']}")
print("-" * 40)
# ==========================================================
# Welcome Screen
# ==========================================================
def display_menu():
print("=" * 65)
print("COLLEGE INFORMATION AI AGENT")
print("=" * 65)
print("\nI can help you with:\n")
print("1. Admission")
print("2. Fees")
print("3. Examination")
print("4. Scholarship")
print("5. Hostel")
print("6. Placements")
print("7. Library")
print("8. General College Information")
print("\nType 'history' to view previous questions.")
print("Type 'exit' to close the chatbot.")
print("=" * 65)
# ==========================================================
# Greeting
# ==========================================================
def greet(query):
greetings = [
"hi",
"hello",
"hey",
"good morning",
"good afternoon",
"good evening"
]
return query.lower() in greetings
# ==========================================================
# Unknown Query Handler
# ==========================================================
def unknown_response():
return """
Sorry! I don't have enough information about that.
I can help you with:
• Admission
• Fees
• Examination
• Scholarships
• Hostel
• Placements
• Library
• General College Information
For further assistance, please contact the respective college department.
"""
# ==========================================================
# Main Function
# ==========================================================
def main():
display_menu()
classifier = IntentClassifier()
responder = ResponseAgent()
query = input("\nYou : ").strip()
if not query:
print("Please enter a valid question.")
return
if query.lower() == "exit":
print("\nThank you for using the Smart College Information AI Agent.")
print("Have a wonderful day!\n")
return
if query.lower() == "history":
show_history()
return
if greet(query):
print("\nBot : Hello!")
print("How can I help you today?")
return
intent = classifier.classify(query)
if intent == "general":
general_words = [
"college",
"facility",
"facilities",
"campus"
]
if not any(word in query.lower() for word in general_words):
print(unknown_response())
return
print("\nSearching information...")
answer = responder.respond(intent, query)
print("\n" + answer)
print("\n" + "-" * 60)
# ==========================================================
# Driver Code
# ==========================================================
if __name__ == "__main__":
main()