{"id":21994374,"url":"https://github.com/codelibs/esanpy","last_synced_at":"2025-10-07T13:53:04.955Z","repository":{"id":57426926,"uuid":"105423667","full_name":"codelibs/esanpy","owner":"codelibs","description":"Python Text Analyzer based on Elasticsearch","archived":false,"fork":false,"pushed_at":"2017-12-14T06:41:10.000Z","size":25,"stargazers_count":9,"open_issues_count":1,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-09-19T16:31:49.926Z","etag":null,"topics":["analyzer","python"],"latest_commit_sha":null,"homepage":"","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/codelibs.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":"2017-10-01T06:26:46.000Z","updated_at":"2023-10-19T15:59:43.000Z","dependencies_parsed_at":"2022-09-19T06:00:39.770Z","dependency_job_id":null,"html_url":"https://github.com/codelibs/esanpy","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/codelibs/esanpy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelibs%2Fesanpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelibs%2Fesanpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelibs%2Fesanpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelibs%2Fesanpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codelibs","download_url":"https://codeload.github.com/codelibs/esanpy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelibs%2Fesanpy/sbom","scorecard":{"id":296650,"data":{"date":"2025-08-11","repo":{"name":"github.com/codelibs/esanpy","commit":"f1c1dc6b5c6be40edb412d410ee76ba268421f6e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/28 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-17T19:42:05.614Z","repository_id":57426926,"created_at":"2025-08-17T19:42:05.614Z","updated_at":"2025-08-17T19:42:05.614Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278786691,"owners_count":26045588,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["analyzer","python"],"created_at":"2024-11-29T21:08:40.202Z","updated_at":"2025-10-07T13:53:04.917Z","avatar_url":"https://github.com/codelibs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Esanpy: Elasticsearch based Analyzer for Python [![Build Status](https://travis-ci.org/codelibs/esanpy.svg?branch=master)](https://travis-ci.org/codelibs/esanpy)\n\nEsanpy is Python Text Analyzer based on Elasticsearch.\nUsing Elasticsearch, Esanpy provides powerful and fully-customizable text analysis.\nSince Esanpy manages Elasticsearch instance internally, you DO NOT need to install/configure Elasticsearch.\n\n## Install Esanpy\n\n    $ pip install esanpy\n\nIf you want to install development version, run as below:\n\n    $ git clone https://github.com/codelibs/esanpy.git\n    $ cd esanpy\n    $ pip install .\n\n### Requirement\n\n* Python 2.7 or 3.4-3.6\n* Java 8 or above\n\n## Python\n\nFirst of all, import esanpy module.\n\n```\nimport esanpy\n```\n\n### Start Server\n\nTo access to Elasticsearch, use `start_server` function.\nThis function downloads/configures embedded elasticsearch and plugins, and then start Elasticsearch instance.\nThe elasticsearch is saved in `~/.esanpy` directory.\nIf they are configured, this function just start elasticsearch instance.\n\n```\nesanpy.start_server()\n```\n\n### Analyze Text\n\nEsanpy provides `analyzer` and `custom_analyzer` function.\n\n```\ntokens = esanpy.analyzer(\"This is a pen.\")\n# tokens = [\"this\", \"is\", \"a\", \"pen\"]\n```\n\nTo use other analyzer, set an analyzer name with `analyzer`.\n\n```\ntokens = esanpy.analyzer(\"今日の天気は晴れです。\", analyzer=\"kuromoji\")\n```\n\n`custom_analyzer` has `tokenizer`, `token_filter` and `char_filter` as arguments.\n\n```\ntokens = esanpy.custom_analyzer('this is a \u003cb\u003etest\u003c/b\u003e',\n                                tokenizer=\"keyword\",\n                                token_filter=[\"lowercase\"],\n                                char_filter=[\"html_strip\"])\n```\n\nFor Elasticsearch Analyze API, see [Analyze](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-analyze.html).\n\n### Stop Server\n\nTo stop Elasticsearch, use `stop_server()`.\n\n```\nesanpy.stop_server()\n```\n\n## Command\n\nEsanpy provides `esanpy` command.\n\n```\n$ esanpy --text \"This is a pen.\"\nthis\nis\na\npen\n```\n\n`esanpy` starts Elasticsearch if it does not run.\nSo, it takes time to start it, but it will be fast after that because Elasticsearch instance is reused.\n\nTo change analyzer, use `--analyzer` option.\n\n```\n$ esanpy --text 今日の天気は晴れです。 --analyzer kuromoji\n今日\n天気\n晴れ\n```\n\n`--stop` opition stops Elasticsearch instance on the command exit.\n\n```\n$ esanpy --text \"This is a pen.\" --stop\n```\n\n## Advance Usecases\n\n### Register Analyzer\n\nYou can register own analyzers by `create_analysis`.\nTo register analyzers with `my_analyzers` namespace:\n\n```\nesanpy.create_analysis('my_analyzers',\n                       char_filter={\n                           \"mapping_ja_filter\": {\n                               \"type\": \"mapping\",\n                               \"mappings_path\": mapping_file\n                               }\n                       },\n                       tokenizer={\n                           \"kuromoji_user_dict\": {\n                               \"type\": \"kuromoji_tokenizer\",\n                               \"mode\": \"normal\",\n                               \"user_dictionary\": userdict_file,\n                               \"discard_punctuation\": False\n                               }\n                       },\n                       token_filter={\n                           \"ja_stopword\": {\n                               \"type\": \"ja_stop\",\n                               \"stopwords\": [\n                                   \"行く\"\n                                   ]\n                               }\n                       },\n                       analyzer={\n                           \"kuromoji_analyzer\": {\n                               \"type\": \"custom\",\n                               \"char_filter\": [\"mapping_ja_filter\"],\n                               \"tokenizer\": \"kuromoji_user_dict\",\n                               \"filter\": [\"ja_stopword\"]\n                               }\n                       }\n                       )\n```\n\nTo use kuromoji_analyzer, invoke `analyzer` with a namespace and analyzer:\n\n```\ntokens = esanpy.analyzer('①東京スカイツリーに行く',\n                         analyzer=\"kuromoji_analyzer\",\n                         namespace='my_analyzers')\n# tokens = ['1', '東京スカイツリー', 'に']\n```\n\nTo delete namespace, use `delete_analysis`:\n\n```\nesanpy.delete_analysis('my_analyzers')\n```\n\nFor more information, see [Analysis](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/analysis.html).\n\n### Use Kuromoji Neologd\n\nInstalling analysis-kuromoji-neologd plugin, you can use Nelogd analyzer.\nTo install it, use `--plugin` option.\n\n```\n$ esanpy --stop\n$ esanpy --plugin org.codelibs:elasticsearch-analysis-kuromoji-neologd:5.6.1\n```\n\nAfter installation, `kuromoji_neologd` analyzer is available.\n\n```\n$ esanpy --text 今日の天気は晴れです。 --analyzer kuromoji_neologd\n今日の天気\n晴れ\n```\n\n### Uninstall Esanpy\n\nTo remove Esanpy, check/kill processes:\n\n```\n$ ps aux | grep esanpy\n$ kill [above PIDs]\n```\n\nand then remove `~/.esanpy` directory:\n\n```\n$ rm -rf ~/.esanpy\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodelibs%2Fesanpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodelibs%2Fesanpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodelibs%2Fesanpy/lists"}