An open API service indexing awesome lists of open source software.

https://github.com/paithiov909/tangela

rJava Interface to atilika/kuromoji
https://github.com/paithiov909/tangela

kuromoji r r-package rjava

Last synced: over 1 year ago
JSON representation

rJava Interface to atilika/kuromoji

Awesome Lists containing this project

README

          

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
pkgload::load_all()
```

# tangela

[![GitHub last commit](https://img.shields.io/github/last-commit/paithiov909/tangela)](#)
[![tangela status badge](https://paithiov909.r-universe.dev/badges/tangela)](https://paithiov909.r-universe.dev)
[![GitHub license](https://img.shields.io/github/license/paithiov909/tangela)](https://github.com/paithiov909/tangela/blob/main/LICENSE)

tangela is an rJava wrapper for atilika/kuromoji (bundled v0.7.7).

[Kuromoji](https://github.com/atilika/kuromoji) is a "self-contained Japanese morphological analyzer" such that tangela only requires Java;
It never has any other dependencies such as MeCab and its dictionaries.

## Usage

### Installation

``` r
remotes::install_github("paithiov909/tangela")
```

### Call tagger

```{r}
res <- tangela::kuromoji(
c("なぜ分かり合えないのか!?",
"なぜ貴様等は他を出し抜こうとするのか!?",
"ところできのこはあんな縦に長かったか!?")
)
str(res)
```

### Prettify Output

```{r}
res <- tangela::prettify(res)
head(res)
```

The output has these columns.

- doc_id: 文番号
- token: 表層形(surface form)
- is_unk: 未知語判定(whether or not the token is unknown word?)
- is_user: ユーザー辞書判定(whether or not the token is user defined word?)
- POS1~POS4: 品詞, 品詞細分類1, 品詞細分類2, 品詞細分類3
- X5StageUse1: 活用型(ex. 五段, 下二段…)
- X5StageUse2: 活用形(ex. 連用形, 基本形…)
- Original: 原形(lemmatised form)
- Yomi1: 読み(readings)
- Yomi2: 発音(pronunciation)

### Pack Output

```{r}
res <- tangela::kuromoji(
c("なぜ分かり合えないのか!?",
"なぜ貴様等は他を出し抜こうとするのか!?",
"ところできのこはあんな縦に長かったか!?",
"とにかく不様、そんな事ではあの小娘には勝てないわ。",
"そう、皆で協力して挑むのだ!",
"えー、まぁ今回はその件で伺いました。")
) |>
tangela::prettify() |>
tangela::pack()
print(res)
```

## License

© 2024 Akiru Kato

Licensed under [the Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). This software includes the works distributed under the Apache License, Version 2.0.

Icons made by [Eucalyp](https://www.flaticon.com/authors/eucalyp) from [www.flaticon.com](https://www.flaticon.com/).