Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into fcitx
Browse files Browse the repository at this point in the history
  • Loading branch information
Fcitx Bot committed Oct 3, 2024
2 parents f96eb8f + e183c13 commit 4edf39e
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 45 deletions.
6 changes: 0 additions & 6 deletions src/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions src/base/strings/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 0 additions & 7 deletions src/prediction/dictionary_prediction_aggregator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 0 additions & 14 deletions src/prediction/dictionary_prediction_aggregator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<Result> 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);
}

Expand Down
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
6 changes: 0 additions & 6 deletions src/protocol/commands.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -662,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 4edf39e

Please sign in to comment.