{"id":32206230,"url":"https://github.com/uribo/sudachir","last_synced_at":"2025-10-22T05:09:19.605Z","repository":{"id":44909679,"uuid":"306534080","full_name":"uribo/sudachir","owner":"uribo","description":"R Interface to 'Sudachi'","archived":false,"fork":false,"pushed_at":"2023-02-01T00:10:04.000Z","size":274,"stargazers_count":6,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-18T21:55:25.080Z","etag":null,"topics":["japanese-language","nlp","rpackage"],"latest_commit_sha":null,"homepage":"https://uribo.github.io/sudachir/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uribo.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["uribo"],"custom":["https://www.buymeacoffee.com/uribo"]}},"created_at":"2020-10-23T05:03:30.000Z","updated_at":"2023-09-19T01:50:54.000Z","dependencies_parsed_at":"2023-02-17T00:10:18.022Z","dependency_job_id":null,"html_url":"https://github.com/uribo/sudachir","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/uribo/sudachir","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uribo%2Fsudachir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uribo%2Fsudachir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uribo%2Fsudachir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uribo%2Fsudachir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uribo","download_url":"https://codeload.github.com/uribo/sudachir/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uribo%2Fsudachir/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280383000,"owners_count":26321423,"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-22T02:00:06.515Z","response_time":63,"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":["japanese-language","nlp","rpackage"],"created_at":"2025-10-22T05:09:16.532Z","updated_at":"2025-10-22T05:09:19.600Z","avatar_url":"https://github.com/uribo.png","language":"R","funding_links":["https://github.com/sponsors/uribo","https://www.buymeacoffee.com/uribo"],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# sudachir \u003ca href='https://uribo.github.io/sudachir/'\u003e\u003cimg src='man/figures/logo.png' align=\"right\" height=\"139\" /\u003e\u003c/a\u003e\n\nSudachiR is an R version of [Sudachi](https://github.com/WorksApplications/sudachi.rs), a Japanese morphological analyzer.\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/sudachir)](https://CRAN.R-project.org/package=sudachir)\n[![R build status](https://github.com/uribo/sudachir/workflows/R-CMD-check/badge.svg)](https://github.com/uribo/sudachir/actions)\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)\n\u003c!-- badges: end --\u003e\n\n## Installation\n\nYou can install the released version of `{sudachir}` from CRAN with:\n\n``` r\ninstall.packages(\"sudachir\")\n```\n\nand also, the developmment version from GitHub.\n\n``` r\nif (!requireNamespace(\"remotes\"))\n  install.packages(\"remotes\")\n\nremotes::install_github(\"uribo/sudachir\")\n```\n\n## Usage\n\n### Set up 'r-sudachipy' environment\n\n`{sudachir}` works with [sudachipy](https://github.com/WorksApplications/sudachi.rs/tree/develop/python)  (\u003e= 0.6.\\*) via the [reticulate](https://github.com/rstudio/reticulate/) package.\n\nTo get started, it requires a Python environment that has sudachipy and its dictionaries already installed and available.\n\nThis package provides a function `install_sudachipy` which helps users prepare a Python virtual environment. The desired modules (`sudachipy`, `sudachidict_core`, `pandas`) can be installed with this function, but can also be installed manually.\n\n```{r}\nlibrary(reticulate)\nlibrary(sudachir)\n\nif (!virtualenv_exists(\"r-sudachipy\")) {\n  install_sudachipy()\n}\n\nuse_virtualenv(\"r-sudachipy\", required = TRUE)\n```\n\n### Tokenize sentences\n\nUse `tokenize_to_df` for tokenization.\n\n```{r}\ntxt \u003c- c(\n  \"国家公務員は鳴門海峡に行きたい\",\n  \"吾輩は猫である。\\n名前はまだない。\"\n)\ntokenize_to_df(data.frame(doc_id = c(1, 2), text = txt))\n```\n\nYou can control which dictionary features are parsed using the `col_select` argument.\n\n```{r}\ntokenize_to_df(txt, col_select = 1:3) |\u003e\n  dplyr::glimpse()\n\ntokenize_to_df(\n  txt, \n  into = dict_features(\"en\"),\n  col_select = c(\"pos1\", \"pos2\")\n) |\u003e\n  dplyr::glimpse()\n```\n\nThe `as_tokens` function can tidy up tokens and the first part-of-speech informations into a list of named tokens. Also, you can use the `form` function as a shorthand of `tokenize_to_df(txt) |\u003e as_tokens()`.\n\n```{r}\ntokenize_to_df(txt) |\u003e as_tokens(type = \"surface\")\n\nform(txt, type = \"surface\")\nform(txt, type = \"normalized\")\nform(txt, type = \"dictionary\")\nform(txt, type = \"reading\")\n```\n\n### Change split mode\n\n```{r}\ntokenize_to_df(txt, instance = rebuild_tokenizer(\"B\")) |\u003e\n  as_tokens(\"surface\", pos = FALSE)\n\ntokenize_to_df(txt, instance = rebuild_tokenizer(\"A\")) |\u003e\n  as_tokens(\"surface\", pos = FALSE)\n```\n\n### Change dictionary edition\n\nYou can touch dictionary options using the `rebuild_tokenizer` function.\n\n```{r}\nif (py_module_available(\"sudachidict_full\")) {\n  tokenizer_full \u003c- rebuild_tokenizer(mode = \"C\", dict_type = \"full\")\n  tokenize_to_df(txt, instance = tokenizer_full) |\u003e\n    as_tokens(\"surface\", pos = FALSE)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furibo%2Fsudachir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Furibo%2Fsudachir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furibo%2Fsudachir/lists"}