Microsoft is continuously adding new Prebuilt AI models which are very easy to use. Currently, there are a few new prebuilt AI models that Microsoft recently introduced, two of them are:
1) Text Translation
2) Receipt Processing model. For Receipt Processing Model, you can check out our blog here.
In this blog, we will illustrate how Text Translation AI Model can help your business process by improving productivity.
Text Translation AI model can improve communication with your customers and suppliers when they do not share a common language with you. The problem of language barrier has always existed and usually, the solution was to solve this by hiring a translator to make the communication possible. But this isn’t needed anymore.
Suppose a customer/potential customer has enquired about goods or services and they have sent you an email in German. This is beyond your scope of understanding so this time instead of translating it using other translator tools; you can incorporate the AI Model in your process by which you can understand what the customer is asking for.
Before using the Text Translation AI Model, we need to consider its limitations as we can only translate 5,120 characters at a time. You can handle this limitation using the logic we have demonstrated below.
Follow the step by step process to know how we can incorporate the Text Translator AI Model in our process.
First, we have created a field in the Email entity with the name Translated Text and placed it on the email entity form.
Then we have created the Power Automate with the name “Translate Email Text” and set the trigger on “When a record is selected”.
Here, we required the content of mail which is inside the description field of email entity and since the data is in the html format, will use the html to text conversion step, and pass the description field.
As the result, we will get the plane text provided in the description field.
Now, we will define the number of iterations we require to use this AI Model since we can only perform translation to 5,120 characters at a time. Initialize a variable “Iteration Count” and set Default value to be “1” so even if the characters is less than 5,120 characters it should iterate once.
Add the condition step here and check the length of characters present inside the input.
If characters are more than 5000 then we will divide the total characters by 5000 and that will give us the actual number of iteration. (Note: – We use 5000 characters instead of 5,120 in the condition for the safer side.)
To get the length of the characters we will use the length() function from the expression.
And to divide the total characters by 5000, we will use div() function from the expression.
In the below image, we have first checked the condition, if the length of the characters is more than 5000, set the “Iteration Count” variable by the division of it.
We will initialize one more variable here to store the current iteration of the loop and the default value for it will be Zero (“0”).
For looping to all iterations, we will use the “Do until” control as shown below to run the loop until the “Iteration Count” becomes Zero (“0”).
And inside the loop, first set the “Iteration Count” variable to decrement by one as follows:
Now within the loop, we are able to use the AI Model and there are two options available as of now for Text Translation AI Models step, either we can have it from “Predict” in Common Data Service (Current Environment) or from AI builder connector as “Text Translation to Another Language”.
We will be using both for demonstration purpose and set the required parameters as follow.
1. Text: – The text will be extracted from the input based on the number of iteration and length of 5000.
In the below expression we will use “substring” function from the expression. It has two required parameters and one optional parameter.
In the first parameter, we will provide the input text.
In the second parameter, we will use the current iteration variable, which we have initialized above and multiply it by 5000 which means at first current iteration will be “Zero” so it will make the entire value to “Zero” and based on the iteration the value will be like. 0, 5000, 10000 etc.
In the third parameter, we will use the check if the length is more than 5000 then set the value 5000 else the length of the input text.
substring(outputs(‘Html_to_text’)?[‘body’],mul(variables(‘Current Iteration’),5000),if(greater(length(outputs(‘Html_to_text’)?[‘body’]),5000),length(substring(outputs(‘Html_to_text’)?[‘body’],mul(add(variables(‘Current Iteration’),1),5000))),length(outputs(‘Html_to_text’)?[‘body’])))
2. Translated to: – Select English.
3. Translated From: – auto (Detect Automatically).
Similarly, we can use the Text Translation Model from Predict step from CDS (Current Environment)
- Model: – Select the Text Translator Model.
- Translated To: – en (English language).
- Translated From: – auto (auto for let the system identify the source language by own).
- Text: – Same as explained for AI Model.
We are almost done here and in the result, the Text Translation AI Model provides us “text result” and the “detected language”. We will now set the Translated Text field by concatenating the existing data with newly translated text given by the model using the below expression.
Update the email message entity by adding the translated text.
At the end set the “Current Iteration” variable increments by 1 within the loop itself and we are done with the configuration.
Save the power automate and now we are good to go with the test. Navigate to the email entity and run the created power automate.
Why and where we will use the Text Translation AI Model?
Microsoft provides the AI Models with low-code/no-code development platform using Power Automate. It is easy to use and features like Auto-Detecting language used in the input make it very effective. We only need to define the Language code by which we want the text should be translated.
In addition, we can use this to translate the customer’s feedback towards our goods or services in the Dynamics 365 apps to find out the areas where we need to improve our services, helping us to improve customer satisfaction.
With the help Text Translation AI Model in our customer sales process, we can significantly improve productivity.