### Install Dependencies and Build McBopomofoWeb Source: https://github.com/openvanilla/mcbopomofoweb/blob/main/README.en.md Install project dependencies and build the web version of McBopomofoWeb. This command is used for general setup and building the primary web application. ```sh npm install npm run build ``` -------------------------------- ### Install Dependencies Source: https://github.com/openvanilla/mcbopomofoweb/wiki/PIME-框架下的-Node.js-輸入法開發 Run this command to install the necessary packages for PIME input method development. ```bash npm install ``` -------------------------------- ### Register Input Method Source: https://github.com/openvanilla/mcbopomofoweb/wiki/PIME-框架下的-Node.js-輸入法開發 Run this batch script to register your input method module with the Windows system. This is typically a one-time setup step. ```batch run_register_ime.bat ``` -------------------------------- ### Install GTK3 Versions of VIM and LibreOffice Source: https://github.com/openvanilla/mcbopomofoweb/wiki/在-Crostini-當中使用-Chrome-OS-的輸入法 Install the GTK3 versions of VIM and LibreOffice to ensure compatibility with cros_im for input method support. This allows these applications to utilize Chrome OS's native input methods. ```bash sudo apt install vim-gtk3 ``` ```bash sudo apt install libreoffice-gtk3 ``` -------------------------------- ### Install nvm and Node.js Source: https://github.com/openvanilla/mcbopomofoweb/wiki/Chrome-OS-輸入法開發 Use nvm to install Node.js version 18.5. This is required for TypeScript development. ```bash curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash nvm insyall 18.5 ``` -------------------------------- ### CLI Tool: Bopomofo to Text Conversion via Pipe Source: https://github.com/openvanilla/mcbopomofoweb/blob/main/README.en.md Example of using the CLI tool to convert Bopomofo string to Chinese characters by piping input via stdin. ```sh echo "ㄊㄞˊㄨㄢㄖㄣˊㄒㄩㄧㄠˋㄒㄧㄠㄅㄛㄎㄨㄞˋ" | node output/cli/index.js bpmf-to-text ``` -------------------------------- ### Configure Systemd for Input Method Shortcuts Source: https://github.com/openvanilla/mcbopomofoweb/wiki/在-Crostini-當中使用-Chrome-OS-的輸入法 Configure systemd user services to enable keyboard shortcuts like Ctrl+Space for switching input methods within Crostini applications. This involves creating an override configuration file and reloading/restarting the sommelier services. ```bash setup_conf() { mkdir -p "$1" echo -e '[Service]\nEnvironment="SOMMELIER_ACCELERATORS=Super_L,bracketleft,bracketright,space,space"' > "$1"/override.conf } setup_conf ~/.config/systemd/user/sommelier@.service.d setup_conf ~/.config/systemd/user/sommelier-x@.service.d # This will likely kill all running GUI apps systemctl --user daemon-reload systemctl --user restart sommelier{,-x}@{0,1}.service ``` -------------------------------- ### Build Chrome OS Input Method Source: https://github.com/openvanilla/mcbopomofoweb/wiki/Chrome-OS-輸入法開發 Compile the project for Chrome OS using the npm build script. This command should be run from the project's root directory. ```bash npm build:chromeos ``` -------------------------------- ### Run Local MCP Service Source: https://github.com/openvanilla/mcbopomofoweb/blob/main/README.en.md Navigate to the output directory and run the MCP service using Node.js. ```sh cd output/mcp node index.js ``` -------------------------------- ### 編譯小麥注音 MCP server Source: https://github.com/openvanilla/mcbopomofoweb/wiki/使用-AI-與-MCP-轉換台灣點字 在 macOS 上,使用 Git 和 Node.js 編譯小麥注音的 MCP server。確保已安裝 Git 和 Node.js。 ```sh git clone https://github.com/openvanilla/McBopomofoWeb.git cd McBopomofoWeb npm install npm run build:mcp ``` -------------------------------- ### Run CLI Tool Source: https://github.com/openvanilla/mcbopomofoweb/blob/main/README.en.md Execute the CLI tool from the output directory, specifying a command and optional input. Input can also be piped via stdin. ```sh node output/cli/index.js [input] [--format=unicode|ascii] ``` -------------------------------- ### Build CLI Tool Version of McBopomofoWeb Source: https://github.com/openvanilla/mcbopomofoweb/blob/main/README.en.md Build the command-line interface (CLI) tool version of McBopomofoWeb. This command is used for creating the CLI executable. ```sh npm run build:cli ``` -------------------------------- ### Build PIME Input Method Module Source: https://github.com/openvanilla/mcbopomofoweb/wiki/PIME-框架下的-Node.js-輸入法開發 Execute this command to compile your Node.js input method into a module file for PIME. The output will be in the 'output/pime' directory. ```bash npm run build:pime ``` -------------------------------- ### Configure Claude for Local MCP Server Source: https://github.com/openvanilla/mcbopomofoweb/blob/main/README.en.md Add settings to Claude's configuration file to use a local MCP server. Replace '/PATH/TO/output/mcp/index.js' with the actual path to your service. ```json { "mcpServers": { "my-local-server": { "command": "node", "args": ["/PATH/TO/output/mcp/index.js"] } } } ``` -------------------------------- ### PIME Input Method Lifecycle Sequence Diagram Source: https://github.com/openvanilla/mcbopomofoweb/wiki/PIME-框架下的-Node.js-輸入法開發 This diagram illustrates the communication flow and lifecycle events between the PIME server and an input method module, including initialization, activation, key event filtering, and deactivation. ```mermaid sequenceDiagram PIME->>+Module: init: 初始化輸入法 Module-->>+PIME: 回應 PIME->>+Module: onActivate 切到當前輸入法 Module-->>+PIME: 回應 PIME->>+PIME: 用戶按下按鍵 PIME->>+Module: filterKeyDown PIME 詢問輸入法是否該處理這個按鍵 Module-->>+PIME: 回應 PIME->>+Module: filterKeyDown PIME 要求輸入法處理這個按鍵 Module-->>+PIME: 回應 PIME->>+PIME: 用戶按下按鍵 PIME->>+Module: filterKeyDown PIME 詢問輸入法是否該處理這個按鍵 Module-->>+PIME: 回應 PIME->>+Module: onKeyDown PIME 要求輸入法處理這個按鍵 Module-->>+PIME: 回應 PIME->>+PIME: 用戶放開按鍵 PIME->>+Module: filterKeyUp PIME 詢問輸入法是否該處理這個按鍵 Module-->>+PIME: 回應 PIME->>+Module: onKeyUp PIME 要求輸入法處理這個按鍵 Module-->>+PIME: 回應 PIME->>+Module: onDeactivate 切到其他輸入法 Module-->>+PIME: 回應 PIME->>+Module: close: 初始化輸入法 Module-->>+PIME: 回應 ``` -------------------------------- ### 設定 Claude Desktop 的 MCP server Source: https://github.com/openvanilla/mcbopomofoweb/wiki/使用-AI-與-MCP-轉換台灣點字 在 Claude Desktop 的設定檔中,新增 'mcbopomofo' 的 MCP server 設定,指向編譯好的 MCP server 檔案路徑。 ```json { "mcpServers": { "mcbopomofo": { "command": "node", "args": ["/Users/zonble/Work/McBopomofoWeb/output/mcp/index.js"] } } } ``` -------------------------------- ### Build MCP Service Version of McBopomofoWeb Source: https://github.com/openvanilla/mcbopomofoweb/blob/main/README.en.md Build the MCP (Microsoft Common Provider) service version of McBopomofoWeb. Use this command when the MCP service is the target. ```sh npm run build:mcp ``` -------------------------------- ### Set Environment Variables for Cros_im Source: https://github.com/openvanilla/mcbopomofoweb/wiki/在-Crostini-當中使用-Chrome-OS-的輸入法 Set GTK_IM_MODULE and QT_IM_MODULE to 'cros' to enable cros_im support in Crostini applications. This is a prerequisite for using Chrome OS input methods. ```bash GTK_IM_MODULE=cros QT_IM_MODULE=cros ``` -------------------------------- ### Configure Codex for Local MCP Server Source: https://github.com/openvanilla/mcbopomofoweb/blob/main/README.en.md Edit Codex's configuration file to integrate a local McBopomofo MCP server. Ensure the 'args' path is correct. ```toml [mcp_servers.mcbopomofo] command = "node" args = ["/PATH/TO/output/mcp/index.js"] ``` -------------------------------- ### Build Chrome OS Version of McBopomofoWeb Source: https://github.com/openvanilla/mcbopomofoweb/blob/main/README.en.md Build the specific version of McBopomofoWeb for Chrome OS. This command is used when targeting the Chrome OS platform. ```sh npm run build:chromeos ``` -------------------------------- ### Convert data.txt to Web Dictionary Format Source: https://github.com/openvanilla/mcbopomofoweb/wiki/詞庫編輯方式 Command to convert the data.txt file to the Web version of the dictionary using the compiled tool and a Python script. The output is redirected to WebData.ts. ```sh cat data.txt | ./encode | python3 txt_to_map.py > WebData.ts ``` -------------------------------- ### Compile Dictionary Encoding Tool Source: https://github.com/openvanilla/mcbopomofoweb/wiki/詞庫編輯方式 Command to compile the dictionary encoding tool in macOS or Linux environments. This tool is used to convert the original data.txt format to the Web version. ```sh make ``` -------------------------------- ### Configure Emacs for Chrome OS Input Methods Source: https://github.com/openvanilla/mcbopomofoweb/wiki/在-Crostini-當中使用-Chrome-OS-的輸入法 Add specific Lisp configurations to your Emacs init file to enable native input method support via cros_im and unbind the default Ctrl+Space keybinding. This ensures Emacs can use Chrome OS's input methods correctly. ```lisp (setq x-gtk-use-native-input t) (global-unset-key (kbd "C-SPC")) ``` -------------------------------- ### Original data.txt Dictionary Format Source: https://github.com/openvanilla/mcbopomofoweb/wiki/詞庫編輯方式 The traditional format for McBopomofo dictionaries, with each entry on a new line. ```txt ㄞˋ 愛 -3.38905619 ㄞˋ 礙 -4.17357313 ㄞˋ 艾 -4.51821444 ㄞˋ 隘 -5.51877087 ㄞˋ 曖 -5.54163375 ㄞˋ 噯 -6.71189547 ㄞˋ 璦 -6.71189547 ㄞˋ 誒 -6.800000 ㄞˋ 靉 -6.80880548 ㄞˋ 乂 -7.41086547 ㄞˋ 僾 -7.41086547 ㄞˋ 堨 -7.71189547 ``` -------------------------------- ### McBopomofo Web Dictionary Format Source: https://github.com/openvanilla/mcbopomofoweb/wiki/詞庫編輯方式 The compressed JSON-like format used in the Web, Chrome OS, and PIME versions, stored within TypeScript. ```typescript export let webData: any = { Ld: "愛 -3.389 礙 -4.173 艾 -4.518 隘 -5.519 曖 -5.541 噯 -6.712 璦 -6.712 誒 -6.8 靉 -6.809 乂 -7.411 僾 -7.411 堨 -7.712 嬡 -7.712 濭 -7.712 薆 -7.712 譪 -7.712 賹 -7.712 鑀 -7.712 鴱 -7.712", LdVO: "愛彼 -7.568", "Ld=@0_IX": "愛不釋手 -5.865", "Ld=@Ld": "愛不愛 -6.22", }; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.