knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
Collection of useful functions that return tidy text data.frame and make "wakatigaki" to text from RMeCab.
RMeCabによる形態素解析の結果をtidy textなdata.frameで返す関数と、分かち書きをする関数が含まれます。RMeCabで形態素解析を行い、出力を整形しています。
MeCabとRMeCabのインストールも別途必要です。
remotes::install_github("suzuna/mecabtools")
例として、以下の文章を形態素解析します。
text <- c("吾輩は猫である。","名前はまだない。")
MeCabの全ての出力結果(表層形、品詞、品詞細分類1、品詞細分類2、品詞細分類3、活用形1、活用形2、原形、読み、発音)をdata.frameで返します。
引数は以下の通りです。
mecabtools::pos_full(text,id_name="id")
pos_fullのうち、表層形か原形のどちらかと、その品詞のみを返します。
引数は以下の通りです。
mecabtools::pos(text,type="surface",id_name="id")
分かち書きをします。
引数は以下の通りです。
mecabtools::wakati(text,collapse=" ")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.