Skip to content

Commit

Permalink
Removed migration flags for typing corrections.
Browse files Browse the repository at this point in the history
These flags were introduced to make trivial modifications on the scoring functions.

Confirmed that these migration has no quality impact through 10% rollout experiment.

PiperOrigin-RevId: 681765823
  • Loading branch information
taku910 authored and hiroyuki-komatsu committed Oct 3, 2024
1 parent e4b41cf commit e183c13
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
9 changes: 3 additions & 6 deletions src/prediction/dictionary_predictor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -510,13 +510,10 @@ void DictionaryPredictor::MaybeSuppressAggressiveTypingCorrection(
// Top is already literal.
const auto &top_result = results->front();

const auto &params = request.request().decoder_experiment_params();

auto is_typing_correction = [&](const Result &result) {
return (result.types & PredictionType::TYPING_CORRECTION ||
(params.fix_legacy_typing_correction_behavior() &&
(result.candidate_attributes &
Segment::Candidate::TYPING_CORRECTION)));
return (
result.types & PredictionType::TYPING_CORRECTION ||
(result.candidate_attributes & Segment::Candidate::TYPING_CORRECTION));
};

if (!is_typing_correction(*top_result)) {
Expand Down
3 changes: 0 additions & 3 deletions src/prediction/dictionary_predictor_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1764,14 +1764,11 @@ TEST_F(DictionaryPredictorTest, MaybeSuppressAggressiveTypingCorrectionTest) {
EXPECT_EQ(get_top_value(), "value_0"); // top is typing correction.
EXPECT_EQ(get_second_value(), "value_3"); // second is literal.

// Tests fix_legacy_typing_correction_behavior
reset_results_ptrs();
params.literal_on_top = true;
params.literal_at_least_second = false;
results[3].candidate_attributes = Segment::Candidate::TYPING_CORRECTION;

request_->mutable_decoder_experiment_params()
->set_fix_legacy_typing_correction_behavior(true);
DictionaryPredictorTestPeer::MaybeSuppressAggressiveTypingCorrection(
*convreq_for_suggestion_, params, &results_ptrs);
EXPECT_EQ(get_top_value(), "value_4");
Expand Down
3 changes: 0 additions & 3 deletions src/protocol/commands.proto
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,6 @@ message DecoderExperimentParams {
// <= katakana_override_min_per_char_cost
optional int32 katakana_override_min_per_char_cost = 91 [default = 0];

// Treats the legacy typing correction candidate as
// literal-on-top or literal-at-least-second.
optional bool fix_legacy_typing_correction_behavior = 92 [default = false];
}

// Clients' request to the server.
Expand Down

0 comments on commit e183c13

Please sign in to comment.