summaryrefslogtreecommitdiff
path: root/jni
diff options
context:
space:
mode:
authorTony Mak <tonymak@google.com>2021-04-07 15:35:23 +0100
committerTony Mak <tonymak@google.com>2021-04-07 15:52:45 +0000
commite940bc291b7a483505b86beb083444dc6a90b720 (patch)
tree61a7b2df21c69a8a9f5dd9681d2821a9514b927f /jni
parentb5e90cd6346abf582d6ed8025d39b3d1ea2f78f9 (diff)
downloadlibtextclassifier-e940bc291b7a483505b86beb083444dc6a90b720.tar.gz
Export libtextclassifier
The major update is to enable the datetime grammar annotator. Bug: 169147920 Test: atest -p external/libtextclassifeir Change-Id: I9fd0ba783199a87440918b1c0a1803d61d72d4aa
Diffstat (limited to 'jni')
-rw-r--r--jni/com/google/android/textclassifier/ActionsSuggestionsModel.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/jni/com/google/android/textclassifier/ActionsSuggestionsModel.java b/jni/com/google/android/textclassifier/ActionsSuggestionsModel.java
index 49818a0..c5f2112 100644
--- a/jni/com/google/android/textclassifier/ActionsSuggestionsModel.java
+++ b/jni/com/google/android/textclassifier/ActionsSuggestionsModel.java
@@ -172,6 +172,13 @@ public final class ActionsSuggestionsModel implements AutoCloseable {
assetFileDescriptor.getLength());
}
+ /** Initializes DeepCLU, passing the given serialized config to it. */
+ public void initializeDeepClu(byte[] serializedConfig) {
+ if (!nativeInitializeDeepClu(actionsModelPtr, serializedConfig)) {
+ throw new IllegalArgumentException("Couldn't initialize DeepCLU");
+ }
+ }
+
/** Action suggestion that contains a response text and the type of the response. */
public static final class ActionSuggestion {
@Nullable private final String responseText;
@@ -338,6 +345,8 @@ public final class ActionsSuggestionsModel implements AutoCloseable {
private static native long nativeNewActionsModelWithOffset(
int fd, long offset, long size, byte[] preconditionsOverwrite);
+ private native boolean nativeInitializeDeepClu(long actionsModelPtr, byte[] serializedConfig);
+
private static native String nativeGetLocales(int fd);
private static native String nativeGetLocalesWithOffset(int fd, long offset, long size);