-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
91 lines (70 loc) · 2.78 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
pkgload::load_all()
```
# tangela <a href='https://paithiov909.github.io/tangela'><img src='man/figures/logo.png' align="right" height="139" /></a>
<!-- badges: start -->
[![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)
<!-- badges: end -->
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/).