diff options
| author | Tony Mak <tonymak@google.com> | 2018-10-22 16:17:45 +0100 |
|---|---|---|
| committer | Tony Mak <tonymak@google.com> | 2018-10-30 14:50:28 +0000 |
| commit | c9d31e2752605eb05c95238bc2fc6cb31599c1d9 (patch) | |
| tree | 2acd03f90666f23d5e3d9c0343837346bf99abfb /opengl/tests/gl_basic/gl_basic.cpp | |
| parent | ac1973164c9f78140483723341dc20da70a0026b (diff) | |
Introduce TextClassifier.suggestConversationActions
Example usage:
// App side
ConversationAction.TypeConfig typeConfig =
new ConversationAction.TypeConfig.Builder().setIncludedTypes(
Collections.singletonList(ConversationAction.TYPE_TEXT_REPLY)).build();
ConversationAction.Message message =
ConversationAction.Message.Builder().setText("How are you?").build();
ConversationAction.Request request =
new ConversationAction.Request.Builder(
Collections.singletonList(message), HINT_FOR_IN_APP)
.setTypeConfig(typeConfig)
.build();
List<ConversationAction> conversationActions =
textClassifier.suggestConversationActions(request).getConversationActions();
for (ConversationAction conversationAction : conversationActions) {
// 1. Use the RemoteAction directly (if available)
RemoteAction actions= conversationAction.getActions();
// 2. Use the parsed action types and entities.
String type = conversationAction.getType();
ConversationAction.Entities entities = conversationAction.getEntities();
}
// In the TextClassificationService side:
ConversationAction.Entities entities = new ConversationAction.Entities.Builder().setReplies(Arrays.asList("I am good.", ":(", ":)")).build();
ConversationAction conversationAction = new ConversationAction.Builder(
ConversationAction.TYPE_TEXT_REPLY).setEntities(entities).build();
BUG: 111437455
BUG: 111406942
Test: atest cts/tests/tests/view/src/android/view/textclassifier/cts/*cts/tests/tests/view/src/android/view/textclassifier/cts/TextClassificationManagerTest.java
Test: cts/tests/tests/view/src/android/view/textclassifier/cts/ConversationActionsTest.java
Change-Id: Ie8639f93f88336ecdfda602ce14cd8ca578c092a
Diffstat (limited to 'opengl/tests/gl_basic/gl_basic.cpp')
0 files changed, 0 insertions, 0 deletions
