Detect Email language - Email flow

Hello

Im tryning to recognize email language using expressions in email flow but this doesnt work for email body and for subject work sometimes. Is there i need to take into consideration?

Regards

Hi @Eduardo_Solano,

When it comes to using the DetectLanguage function, the more text you can submit to it, in general the more accurate the language detection result will be. If you see that the subject and the body of emails are usually written in the same language, you could submit both the subject and body using an expression like this:

DetectLanguage(Append(Email.Message.subject, " ", EMail.Message.body))

The other thing to take in to consideration is that you may want to do some pre-processing on the email message body string to try and get at the text you really want from it. For example, you could have the text of an email whose body is written in Spanish but also as part of that body the sender's signature has a big confidentiality notice written in English or another language. For something like that odds are you wouldn't want to pass in the confidentiality notice because you're now submitting both English text along with the Spanish text. As such, you could try using flow logic to remove the confidentiality text, assign that to another variable such as Task.EmailBodyTextBeforeDisclaimer and then submit that variable instead of Email.Message.body to the Detect Language function to see if it improves your flow's detection results like this:

DetectLanguage(Append(Email.Message.subject, " ", Task.EmailBodyTextBeforeDisclaimer))

or if not using the email subject:

DetectLanguage(Task.EmailBodyTextBeforeDisclaimer)

Hope this helps!

Jim

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.