Improve email ingestion: handle inline replies and track quoted content attribution #114
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(AI-generated description)
Summary
Enhances email import to properly handle inline replies (where the sender responds inline to quoted text) and tracks whether each text chunk is original content or quoted from someone else.
Changes
New Features
>quoted text, not just top-posted replieschunk_sourcesfield onEmailMessagethat parallelstext_chunks:None= original content from the email senderstr= quoted content (the string is the quoted person's name, or" "if unknown)Implementation
parse_email_chunks()function returnslist[tuple[str, str | None]]with full text and source attribution--) to exclude signatures from parsed contentWhy This Matters
Higher-level ingestion code can now decide how to index quoted text so it doesn't get incorrectly attributed to the email's sender. This enables more accurate knowledge extraction from email threads.
Testing
is_inline_reply()andparse_email_chunks()