Hello everyone,
AI in business is evolving. We have slowly begun to trust machines with intellectual tasks that are usually performed by humans. Keeping up with the trend, Deluge offers a set of built-in artificial intelligence tasks for prediction and language processing operations. In this post, let us take a look at the existing Deluge AI tasks and the new addition to the set - zoho.ai.translate.
AI task
| |
| Interprets the input text to predict if it is a positive, negative, or neutral emotion.
|
| Identifies the language of the input text.
|
| Provides device, network, location, and formatting information of the input phone number.
|
| Performs Optical Character Recognition (OCR) operation on the input images and PDFs.
|
| Extracts the parameters relevant to the specified keyword from the input text.
|
| Splits the input address into individual components.
|
| Translates the input text into the specified language.
|
New AI task - zoho.ai.translate
This task translates the input text into the specified language.
Syntax
- response = zoho.ai.translate(<input_text>, <target_language>, [source_language]);
where:
- input_text is the text that needs to be translated.
- target_language is the language in which the input_text needs to be translated
- source_language is the language of the input_text. This is an optional parameter. When no value is supplied to this parameter, it assumes English.
Example 1: Predict language of a customer feedback, translate to English, and analyze its sentiment
Step 1:
Determine the language of the customer feedback stored in the variable feedback using the predict language AI task.
- feedback = "Estou muito satisfeito com o seu serviço. Ansioso por mais anos de parceria. Obrigado";
- predict_language_response = zoho.ai.predictLanguage(feedback);
The predict language task returns response in the following format in which the prediction result is stored against the key - predictionProbabilities:
- {
- "data": {
- "items": [ {
- "predictionProbabilities": {
- "pt": 1
- },
- "queryValue": <input_text>
- } ] },
- "message": "OK",
- "status": 200
- }
Step 2:
By the end of this step, the most probable language will be stored in the variable - predicted_language.
- predicted_language= predict_language_response.get("data").get("items").get(0).get("predictionProbabilities").Keys();
Note: The response of zoho.ai.predictLanguage task may predict more than one language for an input text. In that case, you can iterate the response to find the language that has the highest probability using the for each and if statements.
Step 3:
Translate the customer feedback to English using zoho.ai.translate task.
- translate_response = zoho.ai.translate(feedback, "en", predicted_language.toString());
Step 4:
Fetch the translated text from the response using get function.
- translated_text = translate_response.get("translation").get(0).get("translate");
Step 5:
Predict if the feedback is positive, negative, or neutral using analyse sentiment AI task.
- sentiment = zoho.ai.analyseSentiment(translated_text);
- info sentiment;
Example 2: Parse an address and update a lead's address fields in Zoho CRM
Step 1:
Parse the input address using the parse address AI task.
- address = "Estancia IT Park, GST Road, Vallancherry Village, Chengalpattu, Kanchipuram district, Tamil Nadu, India 603202";
- parse_address_response = zoho.ai.parseAddress(address);
Step 2:
Fetch the components from the response of the AI task using get function.
- components = parse_address_response.get("data").get("items").get(0);
Step 3:
Construct a map to hold the components fetched by parsing the input address against their respective Zoho CRM field link names.
- input_map = Map();
- input_map.put("Street", components.get("road"));
- input_map.put("City", components.get("city"));
- input_map.put("State", components.get("state"));
- input_map.put("Zip_Code", components.get("postcode"));
- input_map.put("Country", components.get("country"));
Step 4:
Update the required lead using Zoho CRM - update record integration task.
- response = zoho.crm.updateRecord("Leads", 692969000001050002, input_map);
- info response ;
Note
- The prediction results of Deluge AI tasks may not be accurate, which is also the case with any AI prediction. However, we are working on improving this.
- The results are dynamic. The same script may produce different outcomes at different times based on how much the machine has learned.