Commit 53992784 authored by Curtis McMullan's avatar Curtis McMullan Committed by Chromium LUCI CQ

cros-suggest: add required suggestion proto ops

This CL adds the required proto operations to request and return
suggestion candidates to the IME shared library.

Bug: 1146266
Change-Id: Ie3636e7ef9abf546c2e0ec5c11a8b47cd865f8b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2583669
Commit-Queue: Curtis McMullan <curtismcmullan@chromium.org>
Reviewed-by: default avatarDarren Shen <shend@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837862}
parent a17ae9db
......@@ -143,6 +143,50 @@ struct AutocorrectSpan {
string original_text;
};
// Proposed candidate for completing some text.
// TODO(crbug/1159614): Remove in favour of sending serialized proto data.
struct CompletionCandidate {
// The candidate text
string text;
// Normalized confidence scoring for the candidate
float normalized_score;
};
// Single request to generate suggestion candidates from the given context.
// TODO(crbug/1159614): Remove in favour of sending serialized proto data.
struct SuggestionsRequest {
// The preceding text used to produced the suggestions.
string text;
// Optional: any candidates generated to complete the current text.
array<CompletionCandidate> completion_candidates;
};
// A suggestion candidate containing multiple predicted words.
// TODO(crbug/1159614): Remove in favour of sending serialized proto data.
struct MultiWordSuggestionCandidate {
// The words predicted.
string text;
// The normalized confidence scoring for the prediction.
float normalized_score;
};
// Represents a single generated suggestion candidate.
// TODO(crbug/1159614): Remove in favour of sending serialized proto data.
union SuggestionCandidate {
// A suggestion candidate that contains multiple words.
MultiWordSuggestionCandidate multi_word;
};
// Encapsulates the results of a suggestions request.
// TODO(crbug/1159614): Remove in favour of sending serialized proto data.
struct SuggestionsResponse {
// A list of suggestion candidates generated.
array<SuggestionCandidate> candidates;
};
// Manages access to a set of IME engines, implemented by the IME service
// itself. The IME framework in the browser process is responsible for brokering
// the connection between the IME service and the IME extension, but does not
......
......@@ -40,6 +40,8 @@ message PublicMessage {
FinishComposition finish_composition = 12;
DeleteSurroundingText delete_surrounding_text = 13;
HandleAutocorrect handle_autocorrect = 14;
SuggestionsRequest suggestions_request = 15;
SuggestionsResponse suggestions_response = 16;
}
}
......@@ -197,3 +199,36 @@ message DeleteSurroundingText {
message HandleAutocorrect {
optional AutocorrectSpan autocorrect_span = 1;
}
// Protobuf version of CompletionCandidate in
// chromeos/services/ime/public/mojom/input_engine.mojom
message CompletionCandidate {
optional string text = 1;
optional float normalized_score = 2;
}
// Protobuf version of SuggestionsRequest in
// chromeos/services/ime/public/mojom/input_engine.mojom
message SuggestionsRequest {
optional string text = 1;
repeated CompletionCandidate completion_candidates = 2;
}
// Protobuf version of MultiWordSuggestionCandidate in
// chromeos/services/ime/public/mojom/input_engine.mojom
message MultiWordSuggestionCandidate {
optional string text = 1;
optional float normalized_score = 2;
}
// Protobuf version of SuggestionCandidate in
// chromeos/services/ime/public/mojom/input_engine.mojom
message SuggestionCandidate {
oneof candidate { MultiWordSuggestionCandidate multi_word = 1; }
}
// Protobuf version of SuggestionsResponse in
// chromeos/services/ime/public/mojom/input_engine.mojom
message SuggestionsResponse {
repeated SuggestionCandidate candidates = 1;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment