Emoji Handling in Dialogflow (download intent and entities)

Chatbots, Python Development, Machine Learning, Natural Language Processing (NLP)

πŸ™‚ 😊 😁 πŸ‘ πŸ˜‚ 🀣 😍 πŸ‘Œ

Nowadays emojis are being integral part of text-based chat conversations. People love to use it ever now and then to express their emotions better.

But what if a user is communicating with a chatbot and send an emoji as response? Mostly bots fail to understand it and come back with default response. In Dialogflow, there is no direct support for emoji handling. If a user respond with emoji then agent will respond back with generic reply β€˜Can you say that again?’, β€˜Sorry, what was that?’, β€˜I didn’t get that. Can you repeat?’ set in Default Fallback Intent.

Instead of going to Default fallback intent, Dialogflow should be able to detect that there is an emoji input and respond accordingly.

General Solution

A simple solution is to create one intent and add all the emojis one by one as training phrase. So that when user gives input with emoji then that intent will be triggered and you can perform action or reply accordingly.

Another similar solution is to create entity, add all the emojis as a new entry or synonyms and use the entity in training phrases.

But there are more than 1500 emojis so adding them as training phrase or entity synonyms one by one will be a cumbersome task. Also, Dialogflow allows 1000 training phrases per intent (on their official document it is mentioned that an intent can have maximum 2000 training phrases but as per our testing, it was giving error for 1000+ training phrases.). So, you will need to create multiple intents for that.

Our Solution

To get rid of this emoji issue, we have created intents and entities for emoji handling. These intents and entities includes all the emojis that we use in conversation and it can be imported in any existing Dialogflow agent.

After importing these intents, if Dialogflow agent receives emoji input then it will trigger the appropriate intent where you can set an appropriate response or perform any action you would like.

Fill up the form below to download your emoji intents and entities for Dialogflow.

* indicates required

You will receive zipped file containing emoji intents (JSON file) and emoji entities (CSV file). The intents are setup with same responses for any emoji input. You can change response as per your need in each intent.

How to import emoji intents in your bot

To import emoji intents, extract zipped file you downloaded. You will find 7 JSON files:

  • Activity_emoji.json
  • Animals_Nature_emoji.json
  • Flags_emoji.json
  • Foods_Drink_emoji_intent.json
  • Objects_emoji.json
  • Smileys_People_emoji_intent.json
  • Symbols_emoji.json
  • Travel_Places_emoji_intent.json

Each file contains intent with the different emojis as training phrases.

Flags_emoji.json file would have all the flag emojis as training phrases, Smileys_People_emoji_intent .json would have all the people and smiley emojis as training phrases and so on.

Now, to import these intent, open your Dialogflow agent. And click on 3 vertical dots menu on right side of Create Intent button.

You will see 2 options. Click on “Upload Intent” menu.

You can see Choose file button to upload intent. Select intent from extracted zip file and upload it.

As soon as you will upload file, Dialogflow will automatically create an intent from it and you will get to see the message “File FILE_NAME.json uploaded successfully.” on right bottom of your screen.

Upload all the intents one by one and check in intents list.

All uploaded intents are displayed in list. These intents cover all popular emojis.

Now you can try to input emoji in conversation with bot. It will display custom response for emoji input instead of default fallback response.

Uploading entities is also a simple process and almost similar to importing intent. Just go to Entities tab, click on 3 dot menu on right side of Create Entity, select Upload Entity and then upload emoji entity CSV file as per your requirement. Entities will be created which you can reference in various intents.

Hope you find this useful. If you have any other idea to make this better then do leave your feedback in the comment section. We’ll improve it further.

Disclaimer

Using these intents you can not create specific response for each emoji. If you would like to do that then you can try Emojibot. It’s not free but the money you spend will go in charity. So, we encourage it.

Leave a Reply

Your email address will not be published. Required fields are marked *