Provides Korean morphological analysis, part-of-speech (POS) tagging, noun extraction, Hangul (Korean script) conversion utilities, concordance search, mutual information statistics, and user dictionary management tools for Korean text research. The morphological analyzer backend is derived from the 'KoNLP' package and the 'HanNanum' analyzer, and is reimplemented in native C so that no Java runtime is required. Bundled dictionary and statistical resources allow analysis to work out of the box, and optional dictionaries can be loaded at runtime from the 'Sejong' and 'NIADic' packages when they are installed and loaded.
This package offers POS tagging and morphological analysis for Korean linguistics research. It comes packed with specialized utilities—including a keystroke converter, Hangul automata, and tools for calculating Mutual Information. You can also customize your workflow by selectively adding or editing entries in the morphological dictionary.
derived from KoNLP
Since the Hannanum analyzer, which KoNLP depends on, is written in Java, KoNLP requires rJava and a Java environment to function. However, configuring the Java environment for rJava involves several manual steps, often making the installation process of KoNLP quite cumbersome.
HanNLP is a package designed to eliminate the dependency on rJava and the Java environment by porting the core implementations of KoNLP and the Hannanum analyzer to C.
install.packages('devtools')
devtools::install_github('ShapeLayer/HanNLP')
Alternatively, you can download this repository and install it by entering the following command in your terminal:
R CMD INSTALL path_of_HanNLP
# Example: (git required)
# git clone https://github.com/shapelayer/HanNLP.git
# R CMD INSTALL HanNLP
Analysis and dictionary lookup use the bundled data without creating files. Before modifying or backing up a dictionary, explicitly set HANNLP_USER_DATA_DIR to a destination directory; no writable path is selected by default. Backups live in the backup subdirectory of that destination. For temporary use:
local({
old <- Sys.getenv("HANNLP_USER_DATA_DIR", unset = NA_character_)
path <- tempfile("hannlp-dictionary-")
on.exit({
if (is.na(old)) Sys.unsetenv("HANNLP_USER_DATA_DIR") else
Sys.setenv(HANNLP_USER_DATA_DIR = old)
unlink(path, recursive = TRUE)
})
Sys.setenv(HANNLP_USER_DATA_DIR = path)
mergeUserDic(data.frame(term = "HanNLP", tag = "ncn"), append = FALSE)
})