libtextclassifier: fix a "divide-by-zero" bug.

Fix the bug and be consistent with upstream's CL: cl/309912555

BUG=chromium:1077405
TEST=unit test of ml-serivce passed.

Change-Id: I6084e011cb5819c889f47add17d7c72bf9b26831
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/libtextclassifier/+/2181935
Reviewed-by: Lukas Zilka <zilka@google.com>
Reviewed-by: Andrew Moylan <amoylan@chromium.org>
Commit-Queue: Honglin Yu <honglinyu@chromium.org>
Tested-by: Honglin Yu <honglinyu@chromium.org>
1 file changed
tree: 67b8c7d946cd11ccb2e16e28ae9f29825f592230
  1. annotator/
  2. utils/
  3. BUILD.gn
  4. CONTRIBUTING.md
  5. LICENSE
  6. OWNERS
  7. README.md
README.md

libtextclassifier

A library for on-device text classification (address, telephone number, emails etc.).

Usage in Chrome OS

To use libtextclassifier, one also needs to install a flatbuffer model defined in “model.fbs”. For simplicity, this model file will be installed in the ebuild of ml-service.

And libtextclassifier currently depends on the chrome-icu package which requires explicitly initializing the icu data, just like chrome.

The ml-service is currently the only user of this library. If another library in Chrome OS also wants to use it, please let the owners of ml-service and libtextclassifier know because then,

  1. we need to make libtextclassifier into a shared library to save space;
  2. we may also need to move the installation of libtextclassifier‘s model file into libtextclassifier’s ebuild.