Repository navigation
fix(ts): clean French mail like Python - #939
Merged
Merged
Conversation
Owner
|
Merged. The TypeScript runtime is documented to behave like Python, so French mail keeping its whole quoted history, sign-off block and device footer was the port silently disagreeing with the reference on real input. Four parity tests mirrored from The differential run over about 4,000 generated English and French emails, 50 or more mismatches before and 0 after, is what makes this convincing rather than case-by-case. Keeping sentences that merely mention a device while removing the footer is the part that would have been easy to get wrong in the other direction. Verified on the merged tree: 654 TypeScript tests pass across 34 files, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Port the French mail cleaning that the Python
clean_email_bodyalready has (#736, #913) to the TypeScriptcleanEmailBodyinlaya-ts/src/email.ts:Le lun. 3 mars 2025 à 10:00, Jean <[email protected]> a écrit :), including the wrapped two-line form-----Message d'origine-----) andDe :/Envoyé :/À :/Objet :header blocksCordialement,Bien à vous,Merci,Bonne journée, …)Envoyé depuis mon iPhone, …) while keeping sentences that merely mention a deviceWhy
The TS port is documented to behave like Python, but for French mail it currently keeps the whole quoted history, the sign-off block and the "Envoyé depuis mon iPhone" footer, so
classifyEmail/ routing see different text in TS than in Python for the same input.Example:
"Bonjour,\n\nLe colis n'est jamais arrivé.\n\nCordialement,\nJean\n\nLe lun. 3 mars 2025 à 10:00, Support <[email protected]> a écrit :"(sign-off and French reply header kept)"Bonjour,\n\nLe colis n'est jamais arrivé.", same as PythonHow it was verified
tests/email-presets.test.ts, mirroring the French cases intests/test_email.py. Three of them fail onmainand all pass with this change.clean_email_bodyand TScleanEmailBody: 50+ mismatches before, 0 after.Checklist
main