NLP Exp 9 Outputs
NLP Exp 9 Outputs
def extract_text_from_pdf_arr(file_path):
reader = PdfReader(file_path)
text = []
for page in reader.pages:
page_words = []
# Extract text for each page and store in a list
for word in page.extract_text().splitlines(): # Split by lines
if word.strip(): # Avoid empty lines
page_words.append(word.strip()) # Add cleaned word
text.append(page_words) # Append words of each page
return text
# Chat interaction
while True:
user_input = input("You: ") # Take input from the user
if user_input.lower() == "exit":
print("Exiting chat...")
break
# P i t th AI' i M kd f b tt f tti
# Print the AI's response using Markdown for better formatting
display(Markdown(f"**You:** {user_input}"))
display(Markdown(f"**Chatbot:** {ai_response.content}"))
Enter the PDF file path (or 'exit' to quit): What is this document all about ?
Error reading the PDF: [Errno 2] No such file or directory: 'What is this document all about ?'
Enter the PDF file path (or 'exit' to quit): /content/NLP Exp 8.pdf
Context updated from the new file.
You: What is this document all about ?
You: What is this document all about ?
Chatbot: This document outlines an experiment using LangChain and a Large Language Model (LLM) like Gemini to automatically generate Multiple Choice
Questions (MCQs).
Here's a breakdown of the key takeaways:
Purpose: The experiment aims to demonstrate how to leverage LLMs for efficient and effective MCQ generation in educational settings.
Benefits: Automating MCQ generation can streamline assessments, provide varied and targeted questions, and offer valuable feedback to learners and
educators.
Techniques: The document details both basic and advanced prompt engineering techniques. This includes ensuring clarity and specificity in prompts,
focusing on relevant content, and customizing questions based on difficulty and target audience.
Quality Control: The document emphasizes the
You: So What is an LLM as mentioned in the Document
You: So What is an LLM as mentioned in the Document
Chatbot: This document talks about using Large Language Models (LLMs) like Gemini for MCQ generation.
In simpler terms, an LLM is a computer program that's really good at understanding and using human language. It's trained on massive amounts of text data,
allowing it to:
Understand the meaning of words and sentences.
Generate text that sounds like natural human language.
Answer questions, summarize information, and even write stories.
In the context of education, LLMs can be used to automate the creation of multiple-choice questions, making life easier for teachers and providing students with
varied and targeted assessments.
You: exit
Exiting chat...
Enter the PDF file path (or 'exit' to quit): exit
Exiting chat...