Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.
Python calibrationclassificationdecision-modelhuggingfacejevmodernbertmultilingualnlppythonpytorchroutingtyped-decisionszero-shot
fix(email): preserve request text after device mentions
Lloyd Aloysius7c49c7cb7931
diff --git a/laya/email.py b/laya/email.pyindex a4a6dcf2..2e017bd5 100644--- a/laya/email.py+++ b/laya/email.py@@ -59,7 +59,6 @@ _SIGNATURE_MARKERS = [r"(?i:\s+(?:and|&)\s+regards|\s+(?:regards|wishes|again|in advance|a lot|so much|very much))?"r"[\s,;:!.]*(?:[^\W\d_a-zß-öø-ÿ][\w'-]*[\s,.]*){0,3}$"),- re.compile(r"^\s*sent from my (iphone|android|mobile|ipad)", re.I),# Portuguese/Spanish sign-offs match only on their own: "Obrigado pelo retorno, mas ..." is a# request, not a signature, so unlike the English marker no trailing words are allowedre.compile(@@ -72,7 +71,7 @@ _SIGNATURE_MARKERS = [# Mobile and mail-app footers. Only a line that is nothing *but* the footer matches -- "Enviado do meu# celular o comprovante ontem." is a request -- and such a line may run to 60 characters, since# Samsung's default ("Enviado do meu smartphone Samsung Galaxy.") is longer than a sign-off's 40.-_DEVICE = (r"iphone|ipad|android|ios|celular|telemóvel|móvil|galaxy|smartphone|samsung|tablet|"+_DEVICE = (r"iphone|ipad|android|ios|mobile|celular|telemóvel|móvil|galaxy|smartphone|samsung|tablet|"r"outlook|yahoo|mail|e-?mail|gmail|windows")_DEVICE_FOOTER = re.compile(r"^\s*((enviad[oa] (do|pelo|pela|via|desde|a partir do)( meu| minha| mi)?|sent from( my)?)"diff --git a/tests/test_email.py b/tests/test_email.pyindex 0d13424a..4108b07d 100644--- a/tests/test_email.py+++ b/tests/test_email.py@@ -400,10 +400,23 @@ for label, tail in [("thanks in advance", "Thanks in advance,"),("sincerely", "Sincerely,\nA. Meier"),("sent from phone", "Sent from my iPhone"),+ ("sent from tablet", "Sent from my iPad."),+ ("sent from android", "Sent from my Android"),+ ("sent from mobile", "Sent from my mobile"),("dash delimiter", "--\nAnna Meier\nSupport"),]:check("signoff cut/" + label, clean_email_body("%s\n\n%s" % (BODY, tail)), BODY)+# A device mention can describe the request rather than close the message.+for sentence in [+ "Sent from my iPhone by mistake.",+ "Sent from my iPad yesterday.",+ "Sent from my Android by mistake.",+ "Sent from my mobile yesterday.",+]:+ body = "Hi support,\n%s\nPlease cancel the duplicate order." % sentence+ check("device sentence kept/" + sentence, clean_email_body(body), body)+# ------------------------------------------- closings the case rule did not reach (#132 follow-up)# These were cut before #132 and are not now: `warmest` is not in the alternation, `and regards`# is not one of its continuations, and `[A-Z]` is ASCII, so a name in any other script reads as a