openvanilla / fcitx5-mcbopomofo Goto Github PK
View Code? Open in Web Editor NEWMcBopomofo for fcitx5
License: MIT License
McBopomofo for fcitx5
License: MIT License
Recently, I would like to install fcitx5-mcbopomofo on my Ubuntu 22.04.3 LTS.
I installed all the required packages.
After following the commands:
cmake ../ -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
make
I confronted an error when the progress is about 46%.
The error information is like this:
[ 44%] Building CXX object src/CMakeFiles/mcbopomofo.dir/McBopomofo.cpp.o
[ 46%] Linking CXX shared module mcbopomofo.so
/usr/bin/ld: libMcBopomofoLib.a(DictionaryService.cpp.o): in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > fmt::v8::format<>(fmt::v8::basic_format_string<char>)':
/usr/include/fmt/core.h:3119: undefined reference to `fmt::v8::vformat[abi:cxx11](fmt::v8::basic_string_view<char>, fmt::v8::basic_format_args<fmt::v8::basic_format_context<fmt::v8::appender, char> >)'
/usr/bin/ld: /usr/include/fmt/core.h:3119: undefined reference to `fmt::v8::vformat[abi:cxx11](fmt::v8::basic_string_view<char>, fmt::v8::basic_format_args<fmt::v8::basic_format_context<fmt::v8::appender, char> >)'
/usr/bin/ld: libMcBopomofoLib.a(DictionaryService.cpp.o): in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > fmt::v8::format<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(fmt::v8::basic_format_string<char, fmt::v8::type_identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>::type, fmt::v8::type_identity<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>::type>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/usr/include/fmt/core.h:3119: undefined reference to `fmt::v8::vformat[abi:cxx11](fmt::v8::basic_string_view<char>, fmt::v8::basic_format_args<fmt::v8::basic_format_context<fmt::v8::appender, char> >)'
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/mcbopomofo.dir/build.make:107:src/mcbopomofo.so] 錯誤 1
make[1]: *** [CMakeFiles/Makefile2:346:src/CMakeFiles/mcbopomofo.dir/all] 錯誤 2
make: *** [Makefile:146:all] 錯誤 2
May you help me how to solve this problem?
上次在 #77 提供的安裝說明需要更新
在第一部安裝套件的部分,更新為
sudo dnf install fcitx5 fcitx5-configtool \
fcitx5-devel cmake extra-cmake-modules gettext fmt-devel libicu-devel json-c-devel
變更部分:
libicu-devel
、json-c-devel
fcitx5-autostart
附註說明:
fcitx5-autostart
為 X11 用的開機啟動, Wayland 現在不需安裝此套件,設定方式請參考 fcitx5 wikiAs discussed in #63, now that we've improved the effectiveness of UOM, it seems valuable to persist the model.
Obviously we don't want to save to disk every time we observe a user override, and so we need some rate limiting.
We never come up with a way to (de)serialize the UOM, and so that also needs addressing.
We should check if the disk write needs to be async—may be an overkill if the UOM (even at full capacity) is always small.
For the longest time the C++ code of McBopomofo was written (very loosely) in the WebKit style. Now that a lot of C++ work is actively done in fcitx5-mcbopomofo (then it gets synced over to McBopomofo, the macOS project), I think we can unify the style by making a one-time PR both here and to the macOS project. Compared to other files in fcitx5-mcbopomofo, those in src/Engine/
excluding gramambular2 and Mandarin are the only ones that still follow the WebKit style.
One additional benefit is that we can run cpplint
over the reformatted code.
在使用 Chrome 引擎的瀏覽器當中打字時,如果對 fcitx5 的 input context 呼叫了 commitString() API 的話,那麼輸入法引擎就會收到一個 focus out 事件,並且呼叫到 reset() 方法。
如果我們真的在 reset() 方法中,清除掉了目前用戶輸入的注音 reading 以及 composing buffer,由於小麥的邏輯是注音 reading 超過上限之後,就會用 commitString 輸入超過上限的部分,如果這時候因為 focus out 而被清除,就會有種用戶打字到一半,有些字直接不見的狀況,而造成用戶難以輸入整段文字。另一方面,用戶在使用 Chrome 系列瀏覽器(包括 Chrome、Chromium、MS Edge、Sidekick 等)以及 Electron 瀏覽器打字的場合,真的非常多。
目前先暫時寫死幾組需要忽略 focus out 的瀏覽器,但我們應該把這應該排除的 app 做得更靈活些。
I wonder if we would like to recommend using ninja
to build the project.
To enable ninja
, simply add -G Ninja
to the CMake
command.
cmake ../ -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug -DENABLE_CLANG_TIDY=On
cmake --build .
# or just `ninja`
I observed a ~2x boost on my system ( Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
)
# ninja uses $(nproc) +2 jobs by default
$ nproc
16
$ time ninja
[40/40] Linking CXX shared module src/mcbopomofo.so
real 0m22.833s
user 2m46.923s
sys 0m4.956s
$ time make -j 18
...
[100%] Built target mcbopomofo
real 0m48.043s
user 2m9.943s
sys 0m4.526s
https://docs.flathub.org/docs/for-app-authors/metainfo-guidelines/#name-summary-and-developer-name
This is now required on flathub, otherwise no new build can be done on flathub.
Example change that I did for other fcitx5 package:
Two concerns from maintenance perspective:
data.txt
in fcitx5-mcbopomofo are not sustainable, since any sync with the upstream could cause changes to be overwrittenFor now I can see some short-term solutions:
data.txt
are also reflected in the upstream data sourcedata.txt
I'll update the README later. I'm thinking:
.clang-format
at the top level and we encourage (or require?) contributors to clang-format
their code. We deviate from the style in these few items:
snake_case_variable
, so no such local variables, member variables, or parameter names.Foo::doSomething()
, and never Foo::DoSomething
. That applies to both instance and static member functions.Engine/
(but not its subdirectories) follow WebKit style for historical reasons, and we should keep using that style. Another .clang-format
is supplied there.TODO: Add WebKit .clang-format
to Engine/
and Google C++ Style .clang-format
to Mandarin and Gramambular.
在您回報問題之前,建議也可以先參考 Wiki 上的 常見問題 與 使用手冊
摘要
請簡單說明您遇到了什麼問題。這份表格雖然是中文的(我們相信注音輸入法的用戶應該都能看懂中文),但開發團隊可以使用中英文溝通,您也可以使用英文回報問題。
快速分類
請問您遇到的是:
問題發生步驟
預期正常狀況
輸出一次注音
螢幕截圖或螢幕錄製
螢幕錄影 20231229(1).webm
電腦環境
請問您在怎樣的環境遇到這個問題?
See #57 (review) for details. We've always returned value strings when collecting the candidates at the node, but the example in the review comment shows why returning (reading, value) pairs will help disambiguate certain situations.
在您回報問題之前,建議也可以先參考 Wiki 上的 常見問題 與 使用手冊
摘要
請簡單說明您遇到了什麼問題。這份表格雖然是中文的(我們相信注音輸入法的用戶應該都能看懂中文),但開發團隊可以使用中英文溝通,您也可以使用英文回報問題。
快速分類
請問您遇到的是:
問題發生步驟
預期正常狀況
輸出一次注音
螢幕截圖或螢幕錄製
無法
電腦環境
最近在嘗試 fedora 然後想安裝小麥輸入法,目前有試出一個安裝的方案。
方法跟 Readme 上的差不多,只差在相依安裝的方式不同
sudo dnf install fcitx5 fcitx5-configtool fcitx5-autostart fcitx5-devel cmake extra-cmake-modules gettext fmt-devel
mkdir -p build
cd build
cmake ../ -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug
make
sudo make install
In #116 we introduced a constant (of value 1000) that passed to fcitx5's Notifications::showTip
. From the source 1 the parameter doesn't seem to be used other than be logged, and it's not clear what time unit is that, though millisecond seems to be the only reasonable guess given the magnitude. Filing this as a TODO.
在使用 debian 的時候發現的。fcitx5 在載入小麥注音的時候,如果沒有 .local/share/fcitx5/mcbopomofo 這個目錄,就會造成小麥注音載入失敗。建立這個目錄之後重跑 fcitx5 就會成功,但照理說應該要自動建立這個目錄才對。
Fcitx 5 是可以支持運作在 flatpak 當中的 (https://flatpak.org/),現在已有不少 Fcitx 5 的其他引擎在 flathub 上
整體代碼來說一般並不需要做任何修改,具體編譯方式和安裝路徑可以參考 https://github.com/fcitx/flatpak-fcitx5/ 的其他任一引擎
因爲 flathub 一般是採取 maintainer 自己提交的方式,因此最好由你們自己申請。至於申請流程可以參考:https://github.com/flathub/flathub/wiki/App-Submission
目前觀察 repo 的文件,主要問題是缺少一個 metainfo 的文件(spec: https://www.freedesktop.org/wiki/Distributions/AppStream/)
隨便舉一例可以參考添加上: https://github.com/fcitx/fcitx5-rime/blob/master/org.fcitx.Fcitx5.Addon.Rime.metainfo.xml.in
即使不考慮支持 flatpak 的使用情況,添加這樣一個文件在被發行版收錄時也會在現行軟件商店中展示(現在GNOME和KDE的軟件商店只展示有appdata的包,而不展示任意發行版的deb package)
(如圖,搜索 fcitx 的結果,這樣的包的展示的名稱說明都來自對應的 metainfo.xml)
相對來講,我認爲 flathub 是一個很方便的能快速讓軟體能被最終用戶用上的方法,例如相對古早的 Ubuntu, 未有提供 fcitx5 的 RHEL 也可以利用 flatpak 運行最新的 fcitx5
fcitx5-mcbopomofo/run-xgettext.sh
Line 27 in e611aa7
developers cannot update new strings without correct pot file.
please include it into git repo.
also, the regenerate line commented above has duplicated po/ directory.
Hi,
It seems that if the user has some customized pronunciations for certain characters in their data.txt
, it will confuse the phrase suggestion language model with undesired results.
For instance, if I have the following in my data.txt
.
丼 ㄉㄨㄥˋ
❤️ ㄒㄧㄣ
The default phrase will include the characters with customized pronunciations, it requires an extra transform (hit the space key) to obtain the desired results.
Default: 丼作
Expected: 動作
Perhaps we can adjust the priority of the default suggestion if there exists some other phrases in the dictionary that match the pronunciation of the entire phrase? E.g., when typing ㄉㄨㄥˋㄗㄨㄛˋ
, as 動作
matches the pronunciations of the entire phrase, we provide 動作
as the default.
Per #70 (comment) (@Brli), there are a few things we can do to improve the project and CI setup:
In McBopomofoEngine::McBopomofoEngine
, we leverage xdg-open
to invoke the user-preferred text editor. However, the desktop environment hangs if system()
invokes a synchronous command. For instance, the default text editor on my box is set to vim
.
The lambda invoked by fcitx5::SimpleAction
will never return since vim
is not opened in a proper environment (e.g., terminal emulator).
https://github.com/openvanilla/fcitx5-mcbopomofo/blob/master/src/McBopomofo.cpp#L176-L190
Reproduce:
vim
.xdg-mime default vim.desktop text/plain
the fstab of the directory is as follows:
tmpfs /home/user/.cache tmpfs rw,size=8G,nr_inodes=5k,noexec,nodev,nosuid,uid=user,gid=user,mode=1700 0 0
the return error is:
[100%] Linking CXX executable McBopomofoTest
CMake Error at /usr/share/cmake/Modules/GoogleTestAddTests.cmake:112 (message):
Error running test executable.
Path: '/home/user/.cache/yay/fcitx5-mcbopomofo-git/src/fcitx5-mcbopomofo/build/src/McBopomofoTest'
Result: Permission denied
Output:
Call Stack (most recent call first):
/usr/share/cmake/Modules/GoogleTestAddTests.cmake:225 (gtest_discover_tests_impl)
is it normal?
不覺得這個應該是使用頻率的問題
但好像就是怎樣都不會校正回更常用的花
而不是正常來講是四聲的化
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.