BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Google Expands ML Kit, Adds Smart Reply and Language Identification

Google Expands ML Kit, Adds Smart Reply and Language Identification

This item in japanese

In a recent Android blog post, Google announced the release of two new Natural Language Processing (NLP) APIs for ML Kit, a mobile SDK that brings Google Machine Learning capabilities to iOS and Android devices, including Language Identification and Smart Reply. In both cases, Google is providing domain-independent APIs that help developers analyze and generate text, speak and other types of Natural Language text. Both of these APIs are available in the latest version of the ML Kit SDK on iOS (9.0 and higher) and Android (4.1 and higher).

The Language Identification API supports 110 different languages and allows developers to build applications that identify the language of the text passed into the API. Christiaan Prins, a product manager at Google, describes the following use case for the Language Identification API:

The language of a given text string is a subtle but helpful piece of information. A lot of apps have functionality with a dependency on the language: you can think of features like spell checking, text translation or Smart Reply. Rather than asking a user to specify the language they use, you can use our new Language Identification API.

Image source: https://android-developers.googleblog.com/2019/04/ml-kit-expands-into-nlp-with-language.html

Identifying the language of a piece of text can be determined by calling the identifyLanguage function. The return value for the function is a BCP-47 language code. If the language can’t be detected, then an undetermined code of und will be returned.

Image source: https://android-developers.googleblog.com/2019/04/ml-kit-expands-into-nlp-with-language.html

Smart Reply allows for contextually-aware message response suggestions to be returned within a chat-based application. Using this feature allows for a quick, and accurate, response in a chat session. Gmail users have been using the Smart Reply feature for a couple years now on the mobile and desktop versions of the service. Now developers can include Smart Reply capabilities within their applications. Prins provides some insights into how the Smart Reply feature works:

With the new Smart Reply API you can now quickly achieve the same in your own apps (as Gmail). The API provides suggestions based on the last 10 messages in a conversation, although it still works if only one previous message is available. It is a stateless API that fully runs on-device, so we don't keep message history in memory nor send it to a server.

Image source: (screenshot) https://www.youtube.com/watch?v=HYYaHN7tQJU

Much like the Language Identification API, Smart Reply can be invoked by calling a single function. In this case, the function name is called suggestReplies and the response will include a list of suggestions.

Image source: https://android-developers.googleblog.com/2019/04/ml-kit-expands-into-nlp-with-language.html

Smart Reply uses a machine-learned model that is executed using TensorFlow Lite. However, some modifications have been made, including:

We added a model to detect sensitive topics, so that we avoid making suggestions in response to profanity or in cases of personal tragedy/hardship.

Both APIs are currently available in ML Kit and developers are encouraged to join the Firebase Talk Google Group.

 

Rate this Article

Adoption
Style

BT