This repository was archived by the owner on Mar 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
103 lines (71 loc) · 3.31 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
92
93
94
95
96
97
98
99
100
101
102
103
---
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()
```
# rjavacmecab <a href='https://paithiov909.github.io/rjavacmecab'><img src='man/figures/logo.png' align="right" height="139" /></a>
<!-- badges: start -->
[](#)
[](https://lifecycle.r-lib.org/articles/stages.html#superseded)
[](https://github.com/paithiov909/rjavacmecab/actions/workflows/check.yml)
[](https://app.codecov.io/gh/paithiov909/rjavacmecab?branch=main)
<!-- badges: end -->
> rJava Interface to CMeCab
rjavacmecab is an rJava interface to [takscape/cmecab-java](https://github.com/takscape/cmecab-java) that is a Java binding for MeCab.
The goal of this package is to provide the simplest way to help use 'MeCab' from R than alternatives ([RMeCab](https://github.com/IshidaMotohiro/RMeCab) and [RcppMeCab](https://github.com/junhewk/RcppMeCab)).
rjavacmecab is yet slower, but it should be easier to use because...
1. There is no need to build from C/C++ source.
2. It returns all features of each nodes accessible via cmecab-java.
## System Requirements
rjavacmecab requires 'MeCab' (mecab, libmecab-dev and mecab-ipadic-utf8) and JDK. Please note that they are installed and available before you use rjavacmecab.
In case using base R and JDK for 32/64bit under Windows, you need 32/64bit build of libmecab.
## Usage
### Installation
``` r
remotes::install_github("paithiov909/rjavacmecab")
```
### Call Tagger
To make cmecab tagger available, `rebuild_tagger` at first.
```{r cmecab_1}
rjavacmecab::rebuild_tagger()
res <- rjavacmecab::cmecab(c("長期的自己実現で福楽は得られない", "幸せは刹那の中にあり"))
str(res)
```
### Prettify Output
```{r cmecab_2}
res <- rjavacmecab::prettify(res)
str(res)
```
If you use IPA-styled dictionary, the output has these columns.
- doc_id: 文番号
- token: 表層形(surface form)
- POS1~POS4: 品詞, 品詞細分類1, 品詞細分類2, 品詞細分類3
- X5StageUse1: 活用型(ex. 五段, 下二段...)
- X5StageUse2: 活用形(ex. 連用形, 基本形...)
- Original: 原形(lemmatised form)
- Yomi1: 読み(readings)
- Yomi2: 発音(pronunciation)
### Pack Output
```{r cmecab_3}
res <- rjavacmecab::pack(res)
print(res)
```
### Use Igo
[Igo](http://igo.osdn.jp/) is a pure Java port of MeCab. rjavacmecab also provides a wrapper function of that.
```{r igo}
res <- rjavacmecab::igo("お前がそう思うんならそうなんだろう、お前ん中ではな")
str(res)
```
## License
BSD 3-clause License.
This software includes works that are distributed in Public Domain and New BSD License.
See https://github.com/takscape/cmecab-java/blob/master/README.txt for more details.
Icons made by [Vectors Market](https://www.flaticon.com/authors/vectors-market) from [Flaticon](https://www.flaticon.com/).