{"id":13678807,"url":"https://github.com/WorksApplications/chikkarpy","last_synced_at":"2025-04-29T15:33:20.550Z","repository":{"id":44581578,"uuid":"370274201","full_name":"WorksApplications/chikkarpy","owner":"WorksApplications","description":"Japanese synonym library","archived":false,"fork":false,"pushed_at":"2022-02-07T06:13:23.000Z","size":58,"stargazers_count":51,"open_issues_count":1,"forks_count":2,"subscribers_count":8,"default_branch":"develop","last_synced_at":"2024-10-14T02:18:24.863Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WorksApplications.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-24T08:02:34.000Z","updated_at":"2024-08-18T05:40:50.000Z","dependencies_parsed_at":"2022-09-10T13:20:43.517Z","dependency_job_id":null,"html_url":"https://github.com/WorksApplications/chikkarpy","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorksApplications%2Fchikkarpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorksApplications%2Fchikkarpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorksApplications%2Fchikkarpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorksApplications%2Fchikkarpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WorksApplications","download_url":"https://codeload.github.com/WorksApplications/chikkarpy/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224179130,"owners_count":17269008,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T13:00:58.580Z","updated_at":"2024-11-11T21:31:32.209Z","avatar_url":"https://github.com/WorksApplications.png","language":"Python","readme":"# chikkarpy\n[![PyPi version](https://img.shields.io/pypi/v/chikkarpy.svg)](https://pypi.python.org/pypi/chikkarpy/)\n[![](https://img.shields.io/badge/python-3.5+-blue.svg)](https://www.python.org/downloads/release/python-350/)\n[![test](https://github.com/t-yamamura/chikkarpy/actions/workflows/test.yaml/badge.svg)](https://github.com/t-yamamura/chikkarpy/actions/workflows/test.yaml)\n[![](https://img.shields.io/github/license/t-yamamura/chikkarpy.svg)](https://github.com/t-yamamura/chikkarpy/blob/master/LICENSE)\n\nchikkarpyは[chikkar](https://github.com/WorksApplications/chikkar)のPython版です。 \nchikkarpy は [Sudachi 同義語辞書](https://github.com/WorksApplications/SudachiDict/blob/develop/docs/synonyms.md)を利用し、[SudachiPy](https://github.com/WorksApplications/SudachiPy)の出力に同義語展開を追加するために開発されたライブラリです。\n単体でも同義語辞書の検索ツールとして利用できます。\n\nchikkarpy is a Python version of [chikkar](https://github.com/WorksApplications/chikkar).\nchikkarpy is developed to utilize the [Sudachi synonym dictionary](https://github.com/WorksApplications/SudachiDict/blob/develop/docs/synonyms.md) and add synonym expansion to the output of [SudachiPy](https://github.com/WorksApplications/SudachiPy).\nThis library alone can be used as a search tool for our synonym dictionaries.\n\n## 利用方法 Usage\n## TL;DR\n```bash\n$ pip install chikkarpy\n\n$ echo \"閉店\" | chikkarpy\n閉店    クローズ,close,店仕舞い\n```\n\n## Step 1. chikkarpyのインストール Install chikkarpy\n```bash\n$ pip install chikkarpy\n```\n\n## Step 2. 使用方法 Usage\n### コマンドライン Command Line\n```bash\n$ echo \"閉店\" | chikkarpy\n閉店    クローズ,close,店仕舞い\n```\nchikkarpyは入力された単語を見て一致する同義語のリストを返します。\nchikkarpy looks at a headword of synonym dictionary by the entered word and returns a list of matching synonyms.\n\n同義語辞書内の曖昧性フラグが`1`の見出し語をトリガーにすることはできません。\nYou cannot use a headword with an ambiguity flag of `1` in a synonym dictionary as a search trigger.\n\n出力は`クエリ\\t同義語リスト`の形式です。\nThe output is in the form of a `query \\t synonym list`.\n\nデフォルトの [Sudachi 同義語辞書](https://github.com/WorksApplications/SudachiDict/blob/develop/docs/synonyms.md) の見出し語は、\nSudachiPyの正規化形 (`normalized_form()`) で登録されています。\n\nThe headwords in the Sudachi synonym dictionary are registered in SudachiPy's normalized form, `normalized_form()`.\n\n```bash\n$ chikkarpy search -h\nusage: chikkarpy search [-h] [-d [file [file ...]]] [-ev] [-o file] [-v]\n                        [file [file ...]]\n\nSearch synonyms\n\npositional arguments:\n  file                  text written in utf-8\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -d [file [file ...]]  synonym dictionary (default: system synonym\n                        dictionary)\n  -ev                   Enable verb and adjective synonyms.\n  -o file               the output file\n  -v, --version         print chikkarpy version\n```\n\n自分で用意したユーザー辞書を使いたい場合は`-d`で読み込むバイナリ辞書を指定できます。\n（バイナリ辞書のビルドは[辞書の作成](#辞書の作成-Build-a-dictionary)を参照してください。）\nWhen you use your user dictionary, you should specify the binary dictionary to read with `-d`.\n(For building a binary dictionary, see [Building a Dictionary](#辞書の作成-Build-a-dictionary).)\n\n複数辞書を読み込む場合は順番に注意してください。\nWhen reading multiple dictionaries, pay attention to the order.\n\n以下の場合，**user2 \u003e user \u003e system** の順で同義語を検索して見つかった時点で検索結果を返します。\nIn the following cases, the synonyms are searched in the order of **user2 \u003e user \u003e system**, and the search results are returned which are first found.\n\n```bash\nchikkarpy -d system.dic user.dic user2.dic\n```\n\nまた、出力はデフォルトで**体言**のみです。\nAlso, the output is **noun** only by default.\n\n**用言**も出力したい場合は`-ev`を有効にしてください。\nWhen you want to output **verb** as well, please enable `-ev`.\n\n```bash\n$ echo \"開放\" | chikkarpy\n開放\tオープン,open\n$ echo \"開放\" | chikkarpy -ev\n開放\t開け放す,開く,オープン,open\n```\n\n### Python ライブラリ / Python library\n使用例 Example of use\n\n```python\nfrom chikkarpy import Chikkar\nfrom chikkarpy.dictionarylib import Dictionary\n\nchikkar = Chikkar()\n\n# デフォルトのシステム同義語辞書を使う場合，Dictionaryの引数は省略可能 You may omit the ``Dictionary`` arguments if you want to use the system synonym dictionary\nsystem_dic = Dictionary()\nchikkar.add_dictionary(system_dic)\n\nprint(chikkar.find(\"閉店\"))\n# =\u003e ['クローズ', 'close', '店仕舞い']\n\nprint(chikkar.find(\"閉店\", group_ids=[5])) # グループIDによる検索 Search by group ID\n# =\u003e ['クローズ', 'close', '店仕舞い']\n\nprint(chikkar.find(\"開放\"))\n# =\u003e ['オープン', 'open']\n\nchikkar.enable_verb() # 用言の出力制御（デフォルトは体言のみ出力） Output control of verbs (default is to output only nouns)\nprint(chikkar.find(\"開放\"))\n# =\u003e ['開け放す', '開く', 'オープン', 'open']\n```\n\n`chikkar.add_dictionary()`で複数の辞書を読み込ませる場合は順番に注意してください。\n最後に読み込んだ辞書を優先して検索します。\nまた、`enable_trie`を`False`に設定した辞書では、同義語を検索するときに見出し語よりもグループIDを優先して検索します。\n\nWhen you read multiple dictionaries with `chikkar.add_dictionary()`, pay attention to the order.\nPriority is given to the last read dictionary.\nIf ``enable_trie`` is ``False``, a search by synonym group IDs takes precedence over a search by the headword.\n\n```python\nchikkar = Chikkar()\n\nsystem_dic = Dictionary(enable_trie=False)\nuser_dic = Dictionary(user_dict_path, enable_trie=True)\nuser2_dic = Dictionary(user_dict_path, enable_trie=True)\n\nchikkar.add_dictionary(system_dic)\nchikkar.add_dictionary(user_dic)\nchikkar.add_dictionary(user2_dic)\n```\n\n\n## 辞書の作成 Build a dictionary\n\n新しく辞書を追加する場合は、利用前にバイナリ形式辞書の作成が必要です。\nBefore using new dictionary, you need to create a binary format dictionary.\n\n同義語辞書のフォーマットは[Sudachi 同義語辞書](https://github.com/WorksApplications/SudachiDict/blob/develop/docs/synonyms.md)に従ってください。\nFollow the [Sudachi Synonym Dictionary](https://github.com/WorksApplications/SudachiDict/blob/develop/docs/synonyms.md) for the format of the synonym dictionary.\n\n```bash\n$ chikkarpy build -i synonym_dict.csv -o system.dic \n```\n\n```bash\n$ chikkarpy build -h\nusage: chikkarpy build [-h] -i file [-o file] [-d string]\n\nBuild Synonym Dictionary\n\noptional arguments:\n  -h, --help  show this help message and exit\n  -i file     dictionary file (csv)\n  -o file     output file (default: synonym.dic)\n  -d string   description comment to be embedded on dictionary\n```\n\n## 開発者向け\n\n### Code Format\n\n`scripts/lint.sh` を実行して、コードが正しいフォーマットかを確認してください。\nRun `scripts/lint.sh` to check if your code is formatted correctly.\n\n`flake8` `flake8-import-order` `flake8-builtins` が必要です。\nYou need packages `flake8` `flake8-import-order` `flake8-builtins`.\n\n### Test\n\n`scripts/test.sh` を実行してテストしてください。\nRun `scripts/test.sh` to run the tests.\n\n## Contact\n\nchikkarpyは[WAP Tokushima Laboratory of AI and NLP](http://nlp.worksap.co.jp/)によって開発されています。\nchikkarpy is developed by WAP Tokushima Laboratory of AI and NLP.\n\n開発者やユーザーの方々が質問したり議論するためのSlackワークスペースを用意しています。\nOpen an issue, or come to our Slack workspace for questions and discussion.\n- https://sudachi-dev.slack.com/  ([招待を受ける/Get invitation](https://join.slack.com/t/sudachi-dev/shared_invite/enQtMzg2NTI2NjYxNTUyLTMyYmNkZWQ0Y2E5NmQxMTI3ZGM3NDU0NzU4NGE1Y2UwYTVmNTViYjJmNDI0MWZiYTg4ODNmMzgxYTQ3ZmI2OWU))\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWorksApplications%2Fchikkarpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWorksApplications%2Fchikkarpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWorksApplications%2Fchikkarpy/lists"}