feat: read declined and negative replies in Dutch, Italian and Portuguese when the workspace chooses those tagging languages, matched as whole words like the German, French and Spanish phrases

This commit is contained in:
555aaditya
2026-10-25 16:52:03 +05:30
parent ab762d1d49
commit fc44971401
3 changed files with 80 additions and 3 deletions
+1 -1
View File
@@ -233,7 +233,7 @@ The reading before any call covers:
- **Quoted history**, cut from a reply so the classifier reads what the person wrote and not your own message quoted under it: the reply line each mail client writes ("Den ... skrev", "W dniu ... pisze:", "于 ... 写道:" and the like), Outlook's quoted `From: / Sent:` block in that language (`Von: / Gesendet:`, `De : / Envoyé :`, `差出人: / 送信日時:`), and the dashed "Original message" and "Forwarded message" lines.
- **Out-of-office replies**, recognized by the subject their mail provider writes (`Автоматический ответ`, `自動応答`, `자동 회신`, `رد تلقائي` and so on) and decided with no call at all.
- **Non-delivery notices**, by the subject Exchange writes in Spanish, Italian, Dutch and Portuguese. A notice carrying a delivery-status report is recognized in any language without this.
- **Replies that say no**, in German, French and Spanish: a declined interest ("kein Interesse", "pas intéressé", "no me interesa") or another clear no ("nein danke", "non merci", "no gracias", "falscher Ansprechpartner", "pas la bonne personne"). The reply classifier reads these as negative with no call, the same verdict "not interested" and "no thanks" get in English, so they take the `reply_negative` branch. Inbox labels still come from the classifier. Phrases of interest are read in English only for now.
- **Replies that say no**, in German, French, Spanish, Dutch, Italian and Portuguese: a declined interest ("kein Interesse", "pas intéressé", "no me interesa", "geen interesse", "non sono interessato", "não tenho interesse") or another clear no ("nein danke", "non merci", "no gracias", "nee bedankt", "no grazie", "não, obrigado", "falscher Ansprechpartner", "persona sbagliata"). Each phrase is matched as whole words, so "no grazie" never matches inside "buono, grazie". The reply classifier reads these as negative with no call, the same verdict "not interested" and "no thanks" get in English, so they take the `reply_negative` branch. Inbox labels still come from the classifier. Phrases of interest are read in English only for now.
Tagging languages are part of the workspace settings, so they travel with a [workspace export](/guides/workspace-export-import/).
+26
View File
@@ -175,18 +175,44 @@ var languageRules = map[string]langRules{
},
separators: []string{`mensagem original`, `mensagem encaminhada`},
bounce: []string{"não é possível entregar"},
declined: []string{
"não tenho interesse", "não temos interesse", "não estou interessado", "não estou interessada",
"não estamos interessados", "não estamos interessadas", "não me interessa", "não nos interessa",
},
negative: []string{
"não obrigado", "não, obrigado", "não obrigada", "não, obrigada", "pessoa errada",
"não sou a pessoa certa", "já temos uma solução", "já temos fornecedor",
},
},
"it": {
quote: []quoteMarker{{re: headerBlock(`da`, `inviato|data`)}},
separators: []string{`messaggio originale`, `messaggio inoltrato`},
ooo: []string{"fuori ufficio"},
bounce: []string{"non recapitabile"},
declined: []string{
"non sono interessato", "non sono interessata", "non siamo interessati", "non siamo interessate",
"non sono più interessato", "non sono più interessata", "non siamo più interessati",
"non mi interessa", "non ci interessa", "nessun interesse",
},
negative: []string{
"no grazie", "no, grazie", "non fa per noi", "persona sbagliata", "non sono la persona giusta",
"abbiamo già una soluzione", "abbiamo già un fornitore",
},
},
"nl": {
quote: []quoteMarker{{re: headerBlock(`van`, `verzonden|datum`)}},
separators: []string{`oorspronkelijk bericht`, `doorgestuurd bericht`},
ooo: []string{"buiten kantoor"},
bounce: []string{"onbestelbaar"},
declined: []string{
"geen interesse", "niet geïnteresseerd", "niet meer geïnteresseerd",
"interesseert ons niet", "interesseert me niet", "interesseert mij niet",
},
negative: []string{
"nee dank je", "nee, dank je", "nee dank u", "nee, dank u", "nee bedankt", "nee, bedankt",
"geen behoefte", "verkeerde persoon", "niet de juiste persoon", "niet de juiste contactpersoon",
"we hebben al een oplossing", "wij hebben al een oplossing",
},
},
"sv": {
quote: []quoteMarker{nordicAttribution, {re: headerBlock(`från`, `skickat|datum`)}},
@@ -32,6 +32,42 @@ func TestDeclinedAndNegativeRepliesByLanguage(t *testing.T) {
"Je ne suis pas le bon interlocuteur.",
"Nous avons déjà une solution en place.",
},
"nl": {
"Bedankt, maar we hebben geen interesse.",
"Geen interesse.",
"Wij zijn niet geïnteresseerd.",
"We zijn niet meer geinteresseerd.",
"Dat interesseert ons niet.",
"Nee, dank je wel.",
"Nee bedankt.",
"Op dit moment geen behoefte.",
"Ik ben niet de juiste persoon hiervoor.",
"Wij hebben al een oplossing.",
},
"it": {
"Grazie, ma non sono interessato.",
"Non siamo interessati al momento.",
"Non sono più interessata.",
"Non mi interessa, grazie.",
"Nessun interesse.",
"No, grazie.",
"No grazie",
"Non fa per noi.",
"Credo abbia scritto alla persona sbagliata.",
"Abbiamo già una soluzione.",
},
"pt": {
"Obrigado, mas não tenho interesse.",
"Não temos interesse no momento.",
"Não estou interessada.",
"Nao estamos interessados.",
"Não me interessa.",
"Não, obrigado.",
"Nao obrigada",
"Não sou a pessoa certa para isso.",
"Acho que falou com a pessoa errada.",
"Já temos uma solução.",
},
"es": {
"Gracias, pero no estoy interesado.",
"No estamos interesados en este momento.",
@@ -74,6 +110,21 @@ func TestInterestedRepliesAreNotReadAsNegative(t *testing.T) {
"Merci, c'est intéressant. Pouvez-vous m'envoyer une offre ?",
"Je suis intéressée, quel est le tarif ?",
},
"nl": {
"Interessant, kunnen we volgende week bellen?",
"Ja graag, stuur me meer informatie.",
"Bedankt, ik ben geïnteresseerd.",
},
"it": {
"Buono, grazie mille, sono interessato a una demo.",
"Molto interessante, possiamo sentirci giovedì?",
"Grazie, sono interessata a saperne di più.",
},
"pt": {
"Tenho interesse, podemos falar amanhã?",
"Obrigado, estou interessado em saber mais.",
"Sim, obrigada, envie a proposta.",
},
"es": {
"Bueno gracias, estoy interesado en una demo.",
"Me interesa mucho, ¿hablamos el jueves?",
@@ -81,7 +132,7 @@ func TestInterestedRepliesAreNotReadAsNegative(t *testing.T) {
"Sí, gracias, envíeme la propuesta.",
},
}
all := []string{"de", "fr", "es"}
all := []string{"de", "fr", "es", "nl", "it", "pt"}
for lang, replies := range neutral {
for _, body := range replies {
if got := ClassifyOffline(Input{Subject: "Re: Hallo", BodyText: body, Languages: all}); got.Class == ClassNegative {
@@ -95,7 +146,7 @@ func TestInterestedRepliesAreNotReadAsNegative(t *testing.T) {
func TestChosenLanguagesKeepTheEnglishPhrases(t *testing.T) {
for _, body := range []string{"Not interested, thanks.", "No thanks.", "Sounds good, let's talk.", "Not réally interested? I am, tell me more."} {
base := ClassifyOffline(Input{BodyText: body})
withLanguages := ClassifyOffline(Input{BodyText: body, Languages: []string{"de", "fr", "es"}})
withLanguages := ClassifyOffline(Input{BodyText: body, Languages: []string{"de", "fr", "es", "nl", "it", "pt"}})
if base.Class != withLanguages.Class {
t.Errorf("%q = %q without languages, %q with them", body, base.Class, withLanguages.Class)
}