Prepare a clean, structured dataset of emails for semantic extraction and graph construction. This step ensures that all necessary information is available in a consistent format for downstream processing.
- Python mailbox: For parsing MBOX files (Gmail Takeout or synthetic data)
- LlamaIndex Mbox Reader: For rapid ingestion and parsing (LlamaIndex Email Data Extraction Example)
- Pandas: For data manipulation and storage
- CSV/JSON: For storing parsed email data
-
Collect Email Data
- Gather a small, diverse set of emails (10–50 per use case) covering all target queries.
- Use real Gmail Takeout data or generate synthetic emails for each scenario.
-
Parse Emails
- Use Python's
mailboxor LlamaIndex Mbox Reader to extract:- Subject
- Body
- Sender
- Recipient(s)
- Date
- (Optional) Attachments, labels, thread info
- Use Python's
-
Store Parsed Data
- Save parsed emails in a structured format (CSV, JSON, or Pandas DataFrame).
- Ensure each record contains all required fields for semantic extraction.
-
Validate Data Quality
- Check for missing or malformed fields.
- Ensure consistent formatting (e.g., date formats, email addresses).
- Remove duplicates and irrelevant emails.
- Write or adapt a script to parse and save email data from MBOX or sample files.
- Validate that all required fields are present and correctly formatted.
- Create a summary (count, types, date range) of the collected dataset.
- Store the cleaned dataset in the project directory for use in the next step.
Document created for Step 2 of the Semantic Email Knowledge Graph PoC.