Information extraction transforms unstructured text into structured data. Whether you’re parsing resumes, analyzing contracts, or extracting entities from news articles, the right prompting patterns make all the difference. In this lesson, you’ll master techniques that progress from simple to complex extraction tasks.
Extract entities from the text and categorize them.Text: "For Tom Jenkins, CEO of the European Tourism Organisation, 2024 represents a shift in travel patterns across Europe."Format your response as:- Person: [names]- Organization: [organizations]- Date: [dates]- Location: [locations]
Output:
Copy
Ask AI
- Person: Tom Jenkins- Organization: European Tourism Organisation- Date: 2024- Location: Europe
Pro Tip: Explicitly specify the output format to ensure consistency across extractions.
Sometimes you need more than just the entity—you need its role or relationship.
Copy
Ask AI
Extract people mentioned in the text along with their roles.Text: "The research was led by Dr. Emily Watson, with contributions from graduate student Michael Park and advisor Professor Linda Chen."Format: Name | Role
Output:
Copy
Ask AI
Dr. Emily Watson | Research LeadMichael Park | Graduate StudentProfessor Linda Chen | Advisor
Extract not just entities, but the relationships between them.
Copy
Ask AI
Identify relationships between entities in the following text.Text: "Apple acquired the startup founded by Jane Smith for $500 million. Smith will join Apple as VP of Innovation."Extract:1. Acquisition: [Acquirer] acquired [Target] for [Amount]2. Employment: [Person] joined [Company] as [Role]
Output:
Copy
Ask AI
1. Acquisition: Apple acquired startup (founded by Jane Smith) for $500 million2. Employment: Jane Smith joined Apple as VP of Innovation
Extract specific fields from semi-structured text.
Copy
Ask AI
Extract the following information from the job posting:Job Posting: "Senior Software Engineer needed at TechCorp. Requirements: 5+ years Python experience, BS in Computer Science. Salary: $120k-$150k. Location: Remote (US only). Apply by March 15, 2024."Extract:- Job Title:- Company:- Experience Required:- Education Required:- Salary Range:- Location:- Application Deadline:
Analyze this customer review in three steps:Review: "I ordered the blue XL shirt on Monday. It arrived Thursday but was the wrong size. Customer service sent a replacement the same day, which arrived Saturday. Much better experience the second time!"Step 1 - Extract explicit facts:- Product:- Order date:- Delivery dates:- Issue:- Resolution:Step 2 - Identify timeline:- Total resolution time:- Response speed:Step 3 - Infer sentiment:- Initial experience:- Resolution experience:- Overall satisfaction:
Output:
Copy
Ask AI
Step 1 - Extract explicit facts:- Product: Blue XL shirt- Order date: Monday- Delivery dates: Thursday (first), Saturday (second)- Issue: Wrong size- Resolution: Replacement sent same dayStep 2 - Identify timeline:- Total resolution time: 5 days (Monday to Saturday)- Response speed: Same-day replacement shipmentStep 3 - Infer sentiment:- Initial experience: Negative (wrong item)- Resolution experience: Positive (fast response)- Overall satisfaction: Positive (problem resolved quickly)
Extract information from the following text and format as JSON.Text: "Meeting scheduled for January 15, 2024 at 2:00 PM in Conference Room B. Attendees: Alice Johnson (host), Bob Smith, Carol White. Agenda: Q1 budget review."JSON format:{ "date": "", "time": "", "location": "", "host": "", "attendees": [], "agenda": ""}
Extract product information and format as a table.Text: "We offer three plans: Basic at $10/month with 10GB storage, Pro at $25/month with 100GB storage and priority support, and Enterprise at $50/month with unlimited storage, priority support, and dedicated account manager."Create a table with columns: Plan | Price | Storage | Support | Account Manager
Output:
Copy
Ask AI
| Plan | Price/Month | Storage | Support | Account Manager ||------------|-------------|------------|------------------|-----------------|| Basic | $10 | 10GB | Standard | No || Pro | $25 | 100GB | Priority | No || Enterprise | $50 | Unlimited | Priority | Yes |
Extract and aggregate information from multiple sources.
Copy
Ask AI
Extract key information from these three customer feedback entries and summarize common themes.Feedback 1: "Love the new dashboard! Much easier to navigate."Feedback 2: "Dashboard is great, but mobile app needs work."Feedback 3: "New dashboard is intuitive. Please add dark mode."Extract:1. Mentioned features:2. Positive feedback:3. Improvement requests:4. Common themes:
Output:
Copy
Ask AI
1. Mentioned features: Dashboard, Mobile app, Dark mode2. Positive feedback: Dashboard is easier to navigate, intuitive, great3. Improvement requests: Mobile app improvements, Dark mode addition4. Common themes: Dashboard redesign is well-received; users want mobile and dark mode enhancements
Extract the following fields. If information is not present, indicate "Not specified".Text: "John Doe applied for the position. He has 5 years of experience."Extract:- Name:- Position:- Experience:- Education:- Salary Expectation:
Output:
Copy
Ask AI
- Name: John Doe- Position: Not specified- Experience: 5 years- Education: Not specified- Salary Expectation: Not specified
Extract information and note any ambiguities.Text: "The meeting is next Tuesday at 3."Extract:- Date:- Time:- Ambiguities:
Output:
Copy
Ask AI
- Date: Next Tuesday (specific date depends on current date)- Time: 3:00 (AM/PM not specified, likely PM based on context)- Ambiguities: Exact date unclear without current date; AM/PM not specified for time
Extract information and provide confidence levels (High/Medium/Low).Text: "Dr. Smith mentioned the patient might need surgery, possibly next month."Extract:- Doctor: [name] (Confidence: )- Recommendation: [action] (Confidence: )- Timeline: [when] (Confidence: )
Output:
Copy
Ask AI
- Doctor: Dr. Smith (Confidence: High - explicitly stated)- Recommendation: Surgery (Confidence: Medium - "might need" indicates uncertainty)- Timeline: Next month (Confidence: Low - "possibly" indicates speculation)
Resume: "Jane Smith, jane@email.com, (555) 123-4567. Education: BS Computer Science, MIT, 2018. Experience: Software Engineer at Google (2018-2021), Senior Engineer at Meta (2021-present). Skills: Python, Java, React, AWS."Extract and format as JSON with fields: name, contact, education, experience, skills.
Sample Solution
Copy
Ask AI
Extract the following information from the resume and format as JSON:{ "name": "", "contact": { "email": "", "phone": "" }, "education": [ { "degree": "", "institution": "", "year": "" } ], "experience": [ { "title": "", "company": "", "period": "" } ], "skills": []}Resume: [INSERT RESUME TEXT]
Extract the following key terms from the service agreement:Agreement: [INSERT TEXT]Extract:- Parties: [Party A] and [Party B]- Service Description:- Contract Duration:- Payment Terms:- Termination Conditions:- Liability Limitations:For each field, quote the relevant text and provide your interpretation.
Real-World Application: Customer Support Ticket Parser
Build a system to extract structured data from support tickets:
Copy
Ask AI
Parse the following customer support ticket and extract structured information.Ticket: "Subject: Login Issues. From: john@company.com. Priority: High. I can't log into my account since yesterday. I've tried resetting my password twice but the reset emails aren't arriving. My account email is john@company.com and my user ID is JD12345. This is blocking my work. Please help ASAP!"Extract:{ "ticket_info": { "subject": "", "from": "", "priority": "", "user_id": "" }, "issue": { "category": "", "description": "", "started": "", "attempts_to_resolve": [] }, "urgency_indicators": [], "required_action": ""}