mozcdict-ext
Convert external words into Mozc system dictionary
Overview
This set of tools was originally created as an "emergency escape" to compensate for the loss of Mozc-UT (Mozcdic-UT). Currently, it aims to build a more comfortable conversion environment through an approach different from Mozc-UT.
This set of tools constructs a Mozc system dictionary from external resources outside Mozc. By incorporating this into Mozc and building it, you can increase Mozc's vocabulary.
The dictionaries generated by this software are not included. Also, Mozc itself is not included.
Originally, it was software created as an emergency "stopgap," but now it is developed under a policy somewhat different from Mozc-UT.
The major differences from Mozcdic-UT are as follows:
- It is an open project licensed under GPL v3
- The software is a tool for dictionary generation, not the generated dictionary itself
- Mozcdic-UT targets only common nouns, but Mozcdict-EXT does not restrict parts of speech
- Besides the web dictionary converter, it has a ByHand dictionary compiled manually
Usage
Basic generation
The mkdict.zsh or mkdict.rb in each directory generates the converted dictionary and outputs it to standard output.
At this time, the following prerequisites must be met:
- The script must be executed with its directory as the current directory
- The environment variable
$MOZC_ID_FILEmust contain the path to Mozc’sid.deffile
id.def file is located at src/data/dictionary_oss/id.def in Mozc.
This file is not included in this software.
Since Mozc is needed for the build anyway, it is desirable to obtain or update the Mozc repository beforehand.The contents output to standard output in this way can be treated as a Mozc system dictionary and can be included by incorporating it into the system dictionary and building.
The recommendation is to append to src/data/dictionary_oss/dictionary09.txt.
Final Formatting
If multiple dictionaries are generated, applying formatting across multiple dictionaries is even better.
.dev.utils/uniqword.rb reads dictionaries from ARGF and outputs to STDOUT excluding identical words including parts of speech.
Duplicate words are output to STDERR.
ruby uniqword.rb ~/dict/neologd.txt ~/dict/sudachi.txt > ~/dict/unified.txt
Unlike Mozcdic-UT, this process generates proper nouns, so it is recommended to perform this task.In the case of Archlinux
We have prepared an AUR package called fcitx5-mozc-ext-neologd separate from this project.
By installing this package from AUR, you can build and install Mozc including external dictionaries.
Note that this package is different from this project.
Environment Variables
$MOZC_ID_FILE
Required. Indicates the location of MOZC's id.def.
$WORDCLASS_ROUND
When there is no exactly matching part of speech, round to a more general part of speech.
Specify no to disable this processing.
Works with the following dictionary tools:
- sudachi
$ERROR_ON_UNEXPECTED_CLASS
Causes an error if there are words with unknown parts of speech.
By default, no error is raised; specifying yes causes an error.
Works with the following dictionary tools:
- sudachi
Execution Options
-e / --english
Normally, this tool excludes "conversion to English."
Using the -e or --english option allows English conversion results.
--english-proper
If --english is not specified but --english-proper is, English is only allowed if it is a proper noun.
-P / --no-proper
Exclude proper nouns.
-w / --fullwidth-english (neologd, sudachi)
Do not exclude conversion to full-width alphanumeric characters and half-width kana.
More precisely, normally it is excluded if it matches the Onigmo regular expression /^[\p{Symbol}\p{In_CJK_Symbols_and_Punctuation}\p{Punctuation}\p{White_Space}\p{In_Halfwidth_and_Fullwidth_Forms}]+$/, but this exclusion is stopped.
-W / --exclude-containing-fullwidth-english (byhand)
Exclude if full-width alphanumeric characters or half-width kana are contained.
--fullwidth-english-proper (neologd, sudachi)
Allow only proper nouns if --fullwidth-english is not specified.
-s / --symbol
Normally, this tool excludes symbols that interfere with conversion during processing, but
if the -s or --symbol option is specified, they are forcibly included in the output.
Default options
If you want to change the default options without using command line options, you can specify the default options via the config.yaml file in the configuration directory (${XDG_CONFIG_HOME:-$HOME/.config}/mozcdict-ext).
For example, to always enable --fullwidth-english, do the following.
fullwidth-english: trueExclusion
You can specify patterns to avoid adding to the dictionary by using the exclude.txt file in the configuration directory.
The exclusion list consists of one pattern per line, with the reading pattern and the base form pattern separated by one or more consecutive whitespace characters.
Each pattern is checked using File.fnmatch.
For example, to exclude all candidates converted from readings starting with ゃ, you would write:
ゃ
to be done.Issues and PRs
If there is any problem, please write it in an Issue or generate a Pull Request.
However, please understand that I am already contributing significantly and creating this software in good faith. In other words, I cannot guarantee that I will be able to respond to all Issues or Pull Requests. (At least, I intend to respond as much as possible.)
Adding vocabulary to the ByHand dictionary and reporting missing vocabulary
If there are words that cannot be converted with the latest Mozc and all dictionaries of this software enabled, please apply at Mozcdict Ext Vocabulary Missing Report.
For items that cannot be applied for on the same page, please report them in an issue. Also, if you can specify the exact Mozc part of speech, please create an issue instead of using the same page.
License and Packaging
This software is licensed under GPL v3. You are free to copy and use the software "freely."
On the other hand, I cannot take any responsibility for any problems or deficiencies in this software. As everyone well knows, there is ABSOLUTELY NO WARRANTY.
This software provides a dictionary generation tool. However, if you want to distribute it as a distribution, it will probably be Mozc built by it. Mozc built in this way has nothing to do with the license of this tool. Because this tool is not included in that Mozc. Such packages will be subject to the licenses and terms of Mozc and the resources used as external dictionaries. The fact that distribution is possible in this way is also not guaranteed by this software or me.
Current Progress
- NEologd - functional
- Sudachi - generated only for some parts of speech (experimental, under development)
Notes
- This software has no involvement whatsoever with the license or validity of dictionaries generated by this software.
Items Particularly Seeking Contribution
Sudachi's clsmap.yaml (Conversion from Sudachi's part-of-speech classification to Mozc's part-of-speech classification)
Using utils/dev-by-cls.rb categorizes specific words by part of speech and outputs them under .dev.reference/sudachi-cls (which is specified in .gitignore), so the work to solidify the part-of-speech classification is currently underway referring to this.
Dependency
- Ruby >= 3.0
- Zsh
- xz(1)
- curl(1)
- Git (Submodules)
About the Dictionaries
neologd
A dictionary based on mecab-ipadic-NEologd.
sudachi
A dictionary reused from the morphological analysis software Sudachi.
It is planned to be used for parts of speech other than nouns as well, but currently it is stalled.
byhand
A dictionary manually compiled for words that cannot be converted or are difficult to convert even using neologd or sudachi.
As a rule, it only contains general words that would be listed in a Japanese language mini-dictionary, and does not include proper nouns.
Mozc Common User Dict
Mozc Common User Dict is a general user dictionary complementing this project.
Those difficult to include in byhand for some reason are included here. --- Tranlated By Open Ai Tx | Last indexed: 2026-07-14 ---