Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions claims-ai-demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
def summarize_claim(claim_text):
"""
Summarize an insurance claim into key facts.
"""
# Split and clean sentences
sentences = [s.strip() for s in claim_text.split(".") if s.strip()]
# Take the first two sentences
summary = ". ".join(sentences[:2]) + "."
Comment on lines +1 to +8
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The summarize_claim function has a bug: it naively splits by periods without considering periods in abbreviations, numbers, or other contexts. For example, if a claim mentions "Dr. Smith" or "123.45", these would be incorrectly split. Consider using more robust sentence tokenization methods from libraries like nltk or spaCy, or at minimum, handle common edge cases like titles (Mr., Dr., etc.) and decimal numbers.

Suggested change
def summarize_claim(claim_text):
"""
Summarize an insurance claim into key facts.
"""
# Split and clean sentences
sentences = [s.strip() for s in claim_text.split(".") if s.strip()]
# Take the first two sentences
summary = ". ".join(sentences[:2]) + "."
import re
def summarize_claim(claim_text):
"""
Summarize an insurance claim into key facts.
"""
# Protect common abbreviations and decimal numbers from being split
abbreviations = ["Mr.", "Mrs.", "Ms.", "Dr.", "Prof.", "Sr.", "Jr.", "St."]
protected_text = claim_text
for abbr in abbreviations:
placeholder = abbr.replace(".", "<ABBR_DOT>")
protected_text = protected_text.replace(abbr, placeholder)
# Protect decimal points between digits (e.g., 123.45)
protected_text = re.sub(r"(?<=\d)\.(?=\d)", "<DECIMAL_DOT>", protected_text)
# Split into sentences on sentence-ending punctuation followed by whitespace
raw_sentences = re.split(r"(?<=[.!?])\s+", protected_text.strip())
# Restore protected periods and clean sentences
sentences = []
for s in raw_sentences:
s = s.replace("<ABBR_DOT>", ".").replace("<DECIMAL_DOT>", ".").strip()
if s:
sentences.append(s)
if not sentences:
return ""
# Take the first two sentences
summary = " ".join(sentences[:2])
# Ensure the summary ends with sentence-ending punctuation
if not summary.endswith((".", "!", "?")):
summary += "."

Copilot uses AI. Check for mistakes.
return summary
Comment on lines +1 to +9
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The summarize_claim function doesn't actually use any generative AI or LLM functionality - it's just basic string manipulation that splits text by periods and takes the first two sentences. This is misleading in a repository focused on teaching Generative AI applications. Consider implementing this using an actual AI service (like OpenAI or Azure OpenAI) to demonstrate how AI can intelligently summarize claims, extract key information, or generate structured summaries. See examples in 06-text-generation-apps/python/oai-app.py for the pattern used in this repository.

Copilot uses AI. Check for mistakes.

# Step 2: Example claim document
claim_document = "On December 10th, 2025, Mr. Ade filed a motor accident claim. His Toyota Corolla was rear-ended at a traffic light in Lagos. The estimated repair cost is ₦1,200,000. No injuries were reported."


# Step 3: Run the summarizer
print("Original Claim Document:")
print(claim_document)
print("\nAI-Generated Summary:")
print(summarize_claim(claim_document))
Comment on lines +1 to +19
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These files are placed at the root level of the repository, which is inconsistent with the repository's structure. All other code examples in this repository are organized within numbered lesson folders (e.g., 06-text-generation-apps/python/, 09-building-image-applications/python/). Consider organizing these files within an appropriate lesson folder or creating a new lesson folder if this represents a new lesson. For reference, see the organization pattern in folders like 06-text-generation-apps/ and 09-building-image-applications/.

Copilot uses AI. Check for mistakes.
24 changes: 24 additions & 0 deletions insurance-ai-usecases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generative AI in Nigerian Insurance

Generative AI can help insurance companies improve efficiency, reduce fraud, and enhance customer service.
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line has trailing whitespace (two spaces at the end). Remove the trailing spaces for cleaner code formatting.

Suggested change
Generative AI can help insurance companies improve efficiency, reduce fraud, and enhance customer service.
Generative AI can help insurance companies improve efficiency, reduce fraud, and enhance customer service.

Copilot uses AI. Check for mistakes.
Here are some practical use cases for Guinea Insurance Plc and similar organizations:

## 1. Claims Processing
- AI can automatically summarize claim documents and generate draft claim reports.
- Example: A motor accident claim can be summarized into key facts for faster approval.

## 2. Fraud Detection
- AI models can analyze claim patterns to flag suspicious activities.
- Example: Detecting repeated claims for the same vehicle damage across multiple policies.

## 3. Customer Support
- Chatbots powered by AI can answer FAQs in real time.
- Example: Explaining health insurance coverage to customers in simple language.

## 4. Policy Simplification
- AI can translate complex policy terms into plain English or local languages.
- Example: Explaining NDPR compliance requirements in customer‑friendly terms.

## 5. Regulatory Compliance
- AI can help monitor compliance with NAICOM regulations and NDPR data protection rules.
- Example: Automatically checking if customer data handling meets regulatory standards.
Loading