Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let ubuild subcommand require system-dict argument #239

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,18 +309,20 @@ You can build a user dictionary with the subcommand `ubuild`.

```bash
$ sudachipy ubuild -h
usage: sudachipy ubuild [-h] [-d string] [-o file] [-s file] file [file ...]
usage: sudachipy ubuild [-h] [-o file] [-d string] -s file file [file ...]

Build User Dictionary

positional arguments:
file source files with CSV format (one or more)

optional arguments:
options:
-h, --help show this help message and exit
-d string description comment to be embedded on dictionary
-o file output file (default: user.dic)
-s file system dictionary path (default: system core dictionary path)
-d string description comment to be embedded on dictionary

required named arguments:
-s file system dictionary path
```

About the dictionary file format, please refer to [this document](https://github.com/WorksApplications/Sudachi/blob/develop/docs/user_dict.md) (written in Japanese, English version is not available yet).
Expand Down
10 changes: 6 additions & 4 deletions python/py_src/sudachipy/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,14 @@ def main():
# build user-dictionary parser
parser_ubd = subparsers.add_parser(
'ubuild', help='see `ubuild -h`', description='Build User Dictionary')
parser_ubd.add_argument('-d', dest='description', default='', metavar='string', required=False,
help='description comment to be embedded on dictionary')
parser_ubd.add_argument('-o', dest='out_file', metavar='file', default='user.dic',
help='output file (default: user.dic)')
parser_ubd.add_argument('-s', dest='system_dic', metavar='file', required=False,
help='system dictionary path (default: system core dictionary path)')
parser_ubd.add_argument('-d', dest='description', default='', metavar='string', required=False,
help='description comment to be embedded on dictionary')
required_named_ubd = parser_ubd.add_argument_group(
'required named arguments')
required_named_ubd.add_argument('-s', dest='system_dic', metavar='file', required=True,
help='system dictionary path')
parser_ubd.add_argument("in_files", metavar="file", nargs=argparse.ONE_OR_MORE,
help='source files with CSV format (one or more)')
parser_ubd.set_defaults(handler=_command_user_build,
Expand Down