From 269a246d62e2655978536675c5fcccacb3bfc264 Mon Sep 17 00:00:00 2001 From: Taku Kudo Date: Wed, 2 Oct 2024 03:35:37 +0000 Subject: [PATCH 1/4] Remove typing_correction_enable_number_decoder flag. This flag is set true by default. PiperOrigin-RevId: 681269488 --- src/prediction/dictionary_prediction_aggregator.cc | 7 ------- .../dictionary_prediction_aggregator_test.cc | 14 -------------- src/protocol/commands.proto | 3 --- 3 files changed, 24 deletions(-) diff --git a/src/prediction/dictionary_prediction_aggregator.cc b/src/prediction/dictionary_prediction_aggregator.cc index f91691044..316334f5a 100644 --- a/src/prediction/dictionary_prediction_aggregator.cc +++ b/src/prediction/dictionary_prediction_aggregator.cc @@ -1713,13 +1713,6 @@ void DictionaryPredictionAggregator::AggregateTypingCorrectedPrediction( // Populates number when number candidate is not added. bool number_added = base_selected_types & NUMBER; - if (!request.request() - .decoder_experiment_params() - .typing_correction_enable_number_decoder()) { - // disables number decoder by assuming that number candidate - // is already added. - number_added = true; - } for (const auto &query : queries) { absl::string_view key = query.correction; diff --git a/src/prediction/dictionary_prediction_aggregator_test.cc b/src/prediction/dictionary_prediction_aggregator_test.cc index ad8fa64d8..6853e1280 100644 --- a/src/prediction/dictionary_prediction_aggregator_test.cc +++ b/src/prediction/dictionary_prediction_aggregator_test.cc @@ -2200,9 +2200,6 @@ TEST_F(DictionaryPredictionAggregatorTest, config_->set_use_typing_correction(true); - request_->mutable_decoder_experiment_params() - ->set_typing_correction_enable_number_decoder(true); - Segments segments; SetUpInputForSuggestionWithHistory("にしゆうこ", "", "", composer_.get(), &segments); @@ -2216,23 +2213,12 @@ TEST_F(DictionaryPredictionAggregatorTest, data_and_aggregator->set_supplemental_model(mock.get()); - request_->mutable_decoder_experiment_params() - ->set_typing_correction_enable_number_decoder(false); std::vector results; - aggregator.AggregateTypingCorrectedPrediction(*prediction_convreq_, segments, - &results); - EXPECT_EQ(results.size(), 1); - - request_->mutable_decoder_experiment_params() - ->set_typing_correction_enable_number_decoder(true); - results.clear(); aggregator.AggregateTypingCorrectedPrediction(*prediction_convreq_, segments, &results); EXPECT_EQ(results.size(), 2); EXPECT_EQ(results[1].value, "25"); // default is full width. - request_->mutable_decoder_experiment_params() - ->set_typing_correction_enable_number_decoder(false); data_and_aggregator->set_supplemental_model(nullptr); } diff --git a/src/protocol/commands.proto b/src/protocol/commands.proto index f50cb3951..1e2ad97d9 100644 --- a/src/protocol/commands.proto +++ b/src/protocol/commands.proto @@ -593,9 +593,6 @@ message DecoderExperimentParams { // Bitmap of enabled variation character types. optional uint32 variation_character_types = 8 [default = 0]; - // Applies the number decoder to the output of typing corrector - optional bool typing_correction_enable_number_decoder = 89 [default = false]; - // Enables final results reranking against literal results. // If zero, the previous implementation is used. optional int32 typing_correction_result_reranker_mode = 95 [default = 0]; From de7615fd0739a3c949edb47caef495290a023740 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Thu, 3 Oct 2024 03:02:01 +0000 Subject: [PATCH 2/4] Remove an obsolete workaround from `.bazelrc` This follows up to my previous commit [1], which was added as a temporary workaround while working on Bazel build for Windows (##948). As of Bazel 7.3.2 with bzlmod enabled, --noincompatible_enable_cc_toolchain_resolution looks to be no longer necessary. Let's remove it for simplicity. [1]: 5efa371c639be5e06bdc797a9deef1dc53048f58 #codehealth PiperOrigin-RevId: 681690120 --- src/.bazelrc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/.bazelrc b/src/.bazelrc index 2f8a716a4..058a0c88e 100644 --- a/src/.bazelrc +++ b/src/.bazelrc @@ -65,12 +65,6 @@ test:macos_env --test_tag_filters=-nomac build:windows_env --build_tag_filters=-nowin test:windows_env --test_tag_filters=-nowin -# A temporary workaround to make "mozc_win_build_rule" work. -# Note that "incompatible_enable_cc_toolchain_resolution" is now enabled by -# default. See https://github.com/bazelbuild/bazel/issues/7260 -# TODO: Re-enable "incompatible_enable_cc_toolchain_resolution" -build:windows_env --noincompatible_enable_cc_toolchain_resolution - # Android specific options build:android_env --copt "-DOS_ANDROID" build:android_env --build_tag_filters=-noandroid From e4b41cf2362100fe4d26559eb88d3cd71e956ac7 Mon Sep 17 00:00:00 2001 From: Mozc team Date: Thu, 3 Oct 2024 04:23:39 +0000 Subject: [PATCH 3/4] Remove unused visibility specs (last referenced in codebase over 93 days ago) Tested: Local presubmit tests passed. PiperOrigin-RevId: 681709407 --- src/base/strings/BUILD.bazel | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/base/strings/BUILD.bazel b/src/base/strings/BUILD.bazel index 9eeb704a0..458067b99 100644 --- a/src/base/strings/BUILD.bazel +++ b/src/base/strings/BUILD.bazel @@ -108,9 +108,7 @@ mozc_cc_library( "japanese.cc", ], hdrs = ["japanese.h"], - visibility = [ - "//:__subpackages__", - ], + visibility = ["//:__subpackages__"], deps = [ "//base/strings/internal:double_array", "//base/strings/internal:japanese_rules", From e183c13fe9d78d76e2a2347a3024cf9c4624c752 Mon Sep 17 00:00:00 2001 From: Taku Kudo Date: Thu, 3 Oct 2024 08:13:57 +0000 Subject: [PATCH 4/4] Removed migration flags for typing corrections. 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 --- src/prediction/dictionary_predictor.cc | 9 +++------ src/prediction/dictionary_predictor_test.cc | 3 --- src/protocol/commands.proto | 3 --- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/prediction/dictionary_predictor.cc b/src/prediction/dictionary_predictor.cc index 56ef64e85..4fa34c4fd 100644 --- a/src/prediction/dictionary_predictor.cc +++ b/src/prediction/dictionary_predictor.cc @@ -510,13 +510,10 @@ void DictionaryPredictor::MaybeSuppressAggressiveTypingCorrection( // Top is already literal. const auto &top_result = results->front(); - const auto ¶ms = 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)) { diff --git a/src/prediction/dictionary_predictor_test.cc b/src/prediction/dictionary_predictor_test.cc index 2eebf2958..7bf7bc1b1 100644 --- a/src/prediction/dictionary_predictor_test.cc +++ b/src/prediction/dictionary_predictor_test.cc @@ -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"); diff --git a/src/protocol/commands.proto b/src/protocol/commands.proto index 1e2ad97d9..62d28e7fc 100644 --- a/src/protocol/commands.proto +++ b/src/protocol/commands.proto @@ -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.