summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfban <fban@google.com>2022-05-16 18:51:38 +0000
committerfban <fban@google.com>2022-05-19 03:16:07 +0000
commit951bdd861d124712e8fa37c18126c6e12129240e (patch)
treed70256c79ebd9f130c3856d029f0cea3fc0c8964
parent2cf62209283859a2c049c3326cfd579d9d2f45ca (diff)
downloadlibtextclassifier-951bdd861d124712e8fa37c18126c6e12129240e.tar.gz
Adds a target for the libtextclassifier bert_tokenizer.
This CL enables tflite-support to use the AOSP-friendly libtextclassifier fork of bert_tokenizer. We will use it to help port the bert_nl_classifier to AOSP. Test: m Bug: 228840235 Change-Id: I7bb2a9b7ef0998f4d0228425ea7693e1b4c4b3b2
-rw-r--r--native/Android.bp55
1 files changed, 55 insertions, 0 deletions
diff --git a/native/Android.bp b/native/Android.bp
index b80c979..ed514da 100644
--- a/native/Android.bp
+++ b/native/Android.bp
@@ -135,6 +135,61 @@ cc_defaults {
],
}
+cc_library_static {
+ name: "libtextclassifier_bert_tokenizer",
+ export_include_dirs: ["."],
+ visibility: ["//external/tflite-support:__subpackages__"],
+ srcs: [
+ "utils/base/logging.cc",
+ "utils/base/logging_raw.cc",
+ "utils/bert_tokenizer.cc",
+ "utils/strings/utf8.cc",
+ "utils/tokenizer-utils.cc",
+ "utils/utf8/unilib-common.cc",
+ "utils/utf8/unicodetext.cc",
+ "utils/wordpiece_tokenizer.cc",
+ ],
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.extservices",
+ "com.android.adservices",
+ ],
+ cflags: [
+ "-Wno-ignored-qualifiers",
+ "-Wno-missing-field-initializers",
+ "-Wno-unused-parameter",
+
+ "-DLIBTEXTCLASSIFIER_UNILIB_ICU",
+ "-DZLIB_CONST",
+ "-DSAFTM_COMPACT_LOGGING",
+ "-DTC3_WITH_ACTIONS_OPS",
+ "-DTC3_UNILIB_JAVAICU",
+ "-DTC3_CALENDAR_JAVAICU",
+ "-DTC3_AOSP",
+ "-DTC3_VOCAB_ANNOTATOR_IMPL",
+ "-DTC3_POD_NER_ANNOTATOR_IMPL",
+ ],
+ product_variables: {
+ debuggable: {
+ // Only enable debug logging in userdebug/eng builds.
+ cflags: ["-DTC3_DEBUG_LOGGING=1"],
+ },
+ },
+ header_libs: [
+ "jni_headers",
+ "tensorflow_headers",
+ "flatbuffer_headers",
+ "libtextclassifier_flatbuffer_headers",
+ ],
+ static_libs: [
+ "libtextclassifier_abseil",
+ "tflite_support",
+ ],
+ sdk_version: "current",
+ min_sdk_version: "30",
+ stl: "libc++_static",
+}
+
// -----------------
// Generate headers with FlatBuffer schema compiler.
// -----------------