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 May 29, 2024
2 parents 64a4c4a + 483c9e1 commit 3264cc8
Show file tree
Hide file tree
Showing 53 changed files with 272 additions and 190 deletions.
11 changes: 1 addition & 10 deletions src/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ load("@bazel_skylib//lib:selects.bzl", "selects")
load(
"//:build_defs.bzl",
"mozc_select",
"mozc_select_enable_neural_language_model",
"mozc_select_enable_session_watchdog",
"mozc_select_enable_supplemental_model",
"mozc_select_enable_usage_rewriter",
Expand Down Expand Up @@ -108,8 +107,7 @@ cc_library(
) + mozc_select_enable_supplemental_model([
]) + mozc_select_enable_usage_rewriter(
off = ["NO_USAGE_REWRITER"],
) + mozc_select_enable_neural_language_model([
]),
),
)

bzl_library(
Expand Down Expand Up @@ -181,10 +179,3 @@ selects.config_setting_group(
"//bazel/cc_target_os:prod_windows",
],
)

selects.config_setting_group(
name = "enable_neural_language_model",
match_any = [
"@platforms//:incompatible", # placeholder to avoid empty match.
],
)
6 changes: 0 additions & 6 deletions src/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -440,12 +440,6 @@ def mozc_select_enable_usage_rewriter(on = [], off = []):
"//conditions:default": off,
})

def mozc_select_enable_neural_language_model(on = [], off = []):
return select({
"//:enable_neural_language_model": on,
"//conditions:default": off,
})

# Tags aliases for build filtering.
MOZC_TAGS = struct(
ANDROID_ONLY = ["nolinux", "nomac", "nowin"],
Expand Down
206 changes: 142 additions & 64 deletions src/data/symbol/symbol.tsv

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/engine/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ bool Engine::Reload() {
}

bool Engine::Sync() {
GetUserDataManager()->Sync();
if (!modules_->GetUserDictionary()) {
return true;
}
Expand Down
2 changes: 0 additions & 2 deletions src/prediction/dictionary_prediction_aggregator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
#include "testing/mozctest.h"
#include "transliteration/transliteration.h"


namespace mozc {
namespace prediction {

Expand Down Expand Up @@ -200,7 +199,6 @@ using ::testing::StrEq;
using ::testing::Truly;
using ::testing::WithParamInterface;


// Action to call the third argument of LookupPrefix/LookupPredictive with the
// token <key, value>.
ACTION_P6(InvokeCallbackWithOneToken, key, value, cost, lid, rid, attributes) {
Expand Down
2 changes: 2 additions & 0 deletions src/prediction/dictionary_predictor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1427,9 +1427,11 @@ std::shared_ptr<Result> DictionaryPredictor::MaybeGetPreviousTopResult(
// 2. cost diff is less than max_diff.
// 3. current key is shorter than previous key.
// 4. current key is the prefix of previous key.
// 5. current result is not a partial suggestion.
if (prev_top_result && cur_top_key_length > prev_top_key_length &&
std::abs(current_top_result.cost - prev_top_result->cost) < max_diff &&
current_top_result.key.size() < prev_top_result->key.size() &&
!(current_top_result.types & PREFIX) &&
absl::StartsWith(prev_top_result->key, current_top_result.key)) {
// Do not need to remember the previous key as `prev_top_result` is still
// top result.
Expand Down
17 changes: 17 additions & 0 deletions src/prediction/dictionary_predictor_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2010,6 +2010,23 @@ TEST_F(DictionaryPredictorTest, MaybeGetPreviousTopResultTest) {
EXPECT_EQ(result->value, "志賀高原");
}

// top is partial
{
InitSegmentsWithKey("しが", &segments);
EXPECT_FALSE(predictor.MaybeGetPreviousTopResult(
init_top, *convreq_for_suggestion_, segments));

InitSegmentsWithKey("しがこう", &segments);
EXPECT_FALSE(predictor.MaybeGetPreviousTopResult(
pre_top, *convreq_for_suggestion_, segments));

InitSegmentsWithKey("しがこうげ", &segments);
auto cur_top_prefix = cur_top;
cur_top_prefix.types |= PREFIX;
EXPECT_FALSE(predictor.MaybeGetPreviousTopResult(
cur_top_prefix, *convreq_for_suggestion_, segments));
}

// Already consistent.
{
InitSegmentsWithKey("しが", &segments);
Expand Down
2 changes: 1 addition & 1 deletion src/third_party/protobuf
Submodule protobuf updated 1021 files
5 changes: 2 additions & 3 deletions src/unix/emacs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ mozc_cc_binary(
deps = [
":mozc_emacs_helper_lib",
"//base:init_mozc",
"//base:logging",
"//base:version",
"//client",
"//config:config_handler",
"//protocol:commands_cc_proto",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
],
Expand All @@ -69,9 +69,7 @@ mozc_cc_library(
"mozc_emacs_helper_lib.h",
],
deps = [
"//base:logging",
"//base:util",
"//base/protobuf",
"//base/protobuf:descriptor",
"//base/protobuf:message",
"//client",
Expand All @@ -80,6 +78,7 @@ mozc_cc_library(
"//protocol:commands_cc_proto",
"//storage:lru_cache",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
],
Expand Down
2 changes: 1 addition & 1 deletion src/unix/emacs/mozc_emacs_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
#include <vector>

#include "absl/flags/flag.h"
#include "absl/log/check.h"
#include "absl/strings/str_format.h"
#include "absl/strings/str_join.h"
#include "absl/strings/string_view.h"
#include "base/init_mozc.h"
#include "base/logging.h"
#include "base/version.h"
#include "client/client.h"
#include "config/config_handler.h"
Expand Down
2 changes: 1 addition & 1 deletion src/unix/emacs/mozc_emacs_helper_lib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
#include <vector>

#include "absl/base/optimization.h"
#include "absl/log/check.h"
#include "absl/strings/ascii.h"
#include "absl/strings/numbers.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "absl/strings/str_replace.h"
#include "absl/strings/string_view.h"
#include "base/logging.h"
#include "base/protobuf/descriptor.h"
#include "base/util.h"
#include "composer/key_parser.h"
Expand Down
1 change: 0 additions & 1 deletion src/unix/emacs/mozc_emacs_helper_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

#include "absl/strings/string_view.h"
#include "base/protobuf/message.h"
#include "base/protobuf/protobuf.h"
#include "protocol/commands.pb.h"

namespace mozc {
Expand Down
17 changes: 10 additions & 7 deletions src/unix/ibus/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,12 @@ mozc_cc_library(
":ibus_wrapper",
"//base:const",
"//base:file_util",
"//base:logging",
"//base:port",
"//base:system_util",
"//client",
"//protocol:commands_cc_proto",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/strings",
] + mozc_select(
linux = ["//third_party/ibus"],
Expand All @@ -146,9 +147,8 @@ mozc_cc_library(
"MOZC_IBUS_INSTALL_DIR=\\\"" + IBUS_MOZC_INSTALL_DIR + "\\\"",
],
deps = [
"//base:logging",
"//base:port",
"//base:util",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/strings",
],
)
Expand Down Expand Up @@ -205,7 +205,6 @@ mozc_cc_library(
"//base:clock",
"//base:const",
"//base:file_util",
"//base:logging",
"//base:port",
"//base:singleton",
"//base:system_util",
Expand All @@ -220,6 +219,7 @@ mozc_cc_library(
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
"@com_google_absl//absl/time",
Expand Down Expand Up @@ -249,10 +249,11 @@ mozc_cc_library(
deps = [
":ibus_config_cc_proto",
"//base:file_util",
"//base:logging",
"//base:system_util",
"//base/protobuf:text_format",
"@com_google_absl//absl/log",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
],
)
Expand All @@ -263,6 +264,7 @@ mozc_cc_test(
srcs = ["ibus_config_test.cc"],
deps = [
":ibus_config",
":ibus_config_cc_proto",
"//testing:gunit_main",
],
)
Expand Down Expand Up @@ -294,9 +296,9 @@ mozc_cc_binary(
":ibus_mozc_lib",
":ibus_utils",
"//base:init_mozc",
"//base:logging",
"//base:version",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/strings",
],
)
Expand Down Expand Up @@ -344,13 +346,14 @@ mozc_cc_library(
deps = [
":ibus_header",
"//base:coordinates",
"//base:logging",
"//base:port",
"//protocol:candidates_cc_proto",
"//protocol:commands_cc_proto",
"//protocol:renderer_cc_proto",
"//renderer:renderer_client",
"//renderer:renderer_interface",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/strings",
] + mozc_select(
linux = [
Expand Down
3 changes: 2 additions & 1 deletion src/unix/ibus/candidate_window_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
#include <string>
#include <variant>

#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/string_view.h"
#include "base/logging.h"
#include "protocol/candidates.pb.h"
#include "protocol/commands.pb.h"
#include "protocol/renderer_command.pb.h"
Expand Down
2 changes: 1 addition & 1 deletion src/unix/ibus/engine_registrar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include "unix/ibus/engine_registrar.h"

#include "base/logging.h"
#include "absl/log/check.h"
#include "base/vlog.h"
#include "unix/ibus/engine_interface.h"

Expand Down
1 change: 0 additions & 1 deletion src/unix/ibus/ibus_candidate_window_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <string>

#include "absl/strings/str_format.h"
#include "base/logging.h"
#include "protocol/candidates.pb.h"
#include "protocol/commands.pb.h"
#include "protocol/config.pb.h"
Expand Down
3 changes: 2 additions & 1 deletion src/unix/ibus/ibus_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@
#include <utility>
#include <vector>

#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/ascii.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_replace.h"
#include "absl/strings/string_view.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/protobuf/text_format.h"
#include "base/system_util.h"
#include "unix/ibus/ibus_config.pb.h"
Expand Down
1 change: 1 addition & 0 deletions src/unix/ibus/ibus_config_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <string>

#include "testing/gunit.h"
#include "unix/ibus/ibus_config.pb.h"

namespace mozc {
namespace ibus {
Expand Down
3 changes: 2 additions & 1 deletion src/unix/ibus/key_event_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@

#include "unix/ibus/key_event_handler.h"

#include "base/logging.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "base/port.h"
#include "base/singleton.h"

Expand Down
11 changes: 5 additions & 6 deletions src/unix/ibus/key_translator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <set>
#include <string>

#include "base/logging.h"
#include "absl/log/check.h"
#include "base/vlog.h"

namespace mozc {
Expand Down Expand Up @@ -151,7 +151,7 @@ static const auto kIbusModifierMaskMap = new std::map<uint, uint>({
// '4' is mapped to Japanese 'Hiragana Letter U' (without Shift modifier) and
// 'Hiragana Letter Small U' (with Shift modifier).
// TODO(team): Add kana_map_dv to support Dvoraklayout.
typedef std::map<uint, std::pair<const char*, const char*>> KanaMap;
typedef std::map<uint, std::pair<const char *, const char *>> KanaMap;
static const KanaMap *kKanaJpMap = new KanaMap({
{'1', {"", ""}},
{'!', {"", ""}},
Expand Down Expand Up @@ -361,9 +361,8 @@ bool KeyTranslator::IsHiraganaKatakanaKeyWithShift(uint keyval, uint keycode,
return ((modifiers & IBUS_SHIFT_MASK) && (keyval == IBUS_Hiragana_Katakana));
}

bool KeyTranslator::IsKanaAvailable(uint keyval, uint keycode,
uint modifiers, bool layout_is_jp,
std::string *out) const {
bool KeyTranslator::IsKanaAvailable(uint keyval, uint keycode, uint modifiers,
bool layout_is_jp, std::string *out) const {
if ((modifiers & IBUS_CONTROL_MASK) || (modifiers & IBUS_MOD1_MASK)) {
return false;
}
Expand All @@ -378,7 +377,7 @@ bool KeyTranslator::IsKanaAvailable(uint keyval, uint keycode,
}

const bool is_shift = (modifiers & IBUS_SHIFT_MASK);
const char* kana = GetKanaValue(kana_map, keyval, is_shift);
const char *kana = GetKanaValue(kana_map, keyval, is_shift);

if (kana == nullptr) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/unix/ibus/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
#include <string>

#include "absl/flags/flag.h"
#include "absl/log/check.h"
#include "base/init_mozc.h"
#include "base/logging.h"
#include "base/version.h"
#include "unix/ibus/engine_registrar.h"
#include "unix/ibus/ibus_config.h"
Expand Down
4 changes: 2 additions & 2 deletions src/unix/ibus/message_translator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@

#include "unix/ibus/message_translator.h"

#include <cstddef>
#include <iterator>
#include <map>
#include <string>
#include <utility>
#include <vector>

#include "absl/log/check.h"
#include "absl/strings/str_split.h"
#include "base/logging.h"
#include "base/port.h"
#include "base/util.h"

namespace {
Expand Down
2 changes: 0 additions & 2 deletions src/unix/ibus/message_translator.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
#include <map>
#include <string>

#include "base/port.h"

namespace mozc {
namespace ibus {

Expand Down
Loading

0 comments on commit 3264cc8

Please sign in to comment.