A few years ago, Google introduced ML Kit to make it easier for developers to implement machine learning into their apps. Since then, we’ve seen APIs for Digital Ink Recognition, On-Device Translation, and Face Detection. Now, Google is adding a new Entity Extraction to ML Kit along with a new Selfie Segmentation feature.

Google said the new Entity Extraction API will allow developers to detect and locate entities from raw text, and take action based on those entities.

“The API works on static text and also in real-time while a user is typing,” Google said. “It supports 11 different entities and 15 different languages (with more coming in the future) to allow developers to make any text interaction a richer experience for the user.”

Here are the entities that are supported:

  • Address (350 third street, cambridge)
  • Date-Time* (12/12/2020, tomorrow at 3pm) (let's meet tomorrow at 6pm)
  • Email (entity-extraction@google.com)
  • Flight Number* (LX37)
  • IBAN* (CH52 0483 0000 0000 0000 9)
  • ISBN* (978-1101904190)
  • Money (including currency)* ($12, 25USD)
  • Payment Card* (4111 1111 1111 1111)
  • Phone Number ((555) 225-3556, 12345)
  • Tracking Number* (1Z204E380338943508)
  • URL (www.google.com, https://en.wikipedia.org/wiki/Platypus, seznam.cz)
Google Entity Extraction TamTam

Google said it’s been testing the Entity Extraction API with TamTam to allow the app to provide helpful suggestions to users during chat conversations. When an address is on the screen, for example, clicking on it will bring up a menu to copy the address, open with another app, or get directions to the location.

The neural network annotators/models in the Entity Extraction API work as follows: A given input text is first split into words (based on space separation), then all possible word subsequences of certain maximum length (15 words in the example above) are generated, and for each candidate the scoring neural net assigns a value (between 0 and 1) based on whether it represents a valid entity.

Next, the generated entities that overlap are removed, favoring the ones with a higher score over the conflicting ones with a lower score. Then a second neural network is used to classify the type of the entity as a phone number, an address, or in some cases, a non-entity.

Google said ML Kit’s Entity Extraction API builds on technology that powered the Smart Linkify feature introduced with Android 10.

Google Selfie Segmentation

In addition to text-based Entity Extraction, Google also announced a new Selfie Segmentation API. The feature will allow developers to separate the background from a scene. This will enable users to add cool effects to selfies or even insert themselves into a better background. Google said the new API is capable of producing great results with low latency on both Android and iOS.

The ML Kit SDK incorporates years of Google’s work on machine learning into a Firebase package that mobile app developers can use to enhance their apps. Since ML Kit was introduced, a number of APIs have been unveiled that makes implementing machine learning-powered features in apps much easier for developers. With Entity Extraction and Selfie Segmentation, apps of the future are going to get even better.