-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from mrchypark/cpp11-package
change to cpp11 package
- Loading branch information
Showing
60 changed files
with
3,427 additions
and
2,176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,32 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(Kiwi) | ||
export(Match) | ||
export(Stopwords) | ||
export(Tags) | ||
export(analyze) | ||
export(kiwi_model_path) | ||
export(model_is_set) | ||
export(get_model) | ||
export(model_exists) | ||
export(model_home) | ||
export(model_works) | ||
export(split_into_sents) | ||
export(tokenize) | ||
export(tokenize_tbl) | ||
export(tokenize_tibble) | ||
export(tokenize_tidy) | ||
export(tokenize_tidytext) | ||
export(tokenize_tt) | ||
importFrom(R6,R6Class) | ||
importFrom(dplyr,anti_join) | ||
importFrom(dplyr,bind_rows) | ||
importFrom(methods,new) | ||
importFrom(dplyr,mutate) | ||
importFrom(matchr,Enum) | ||
importFrom(purrr,map) | ||
importFrom(purrr,map_chr) | ||
importFrom(purrr,map_int) | ||
importFrom(tibble,tibble) | ||
importFrom(utils,download.file) | ||
importFrom(utils,untar) | ||
importFrom(vroom,vroom) | ||
importFrom(vroom,vroom_write) | ||
useDynLib(elbird, .registration = TRUE) | ||
useDynLib(elbird,kiwi_analyze_) | ||
useDynLib(elbird,kiwi_clear_error_) | ||
useDynLib(elbird,kiwi_error_) | ||
useDynLib(elbird,kiwi_init_) | ||
useDynLib(elbird,kiwi_version_) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,31 @@ | ||
#' analyze | ||
#' | ||
#' @param text target text. | ||
#' @param top_n Number of result. default is 3. | ||
#' @name analyze | ||
#' @param top_n \code{integer}: Number of result. Default is 3. | ||
#' @inheritParams tokenize | ||
#' @examples | ||
#' \dontrun{ | ||
#' analyze("Test text.") | ||
#' analyze("Please use Korean.", top_n = 1) | ||
#' analyze("Test text.", 1, Match$ALL_WITH_NORMALIZING) | ||
#' analyze("Test text.", stopwords = FALSE) | ||
#' analyze("Test text.", stopwords = TRUE) | ||
#' analyze("Test text.", stopwords = "user_dict.txt") | ||
#' analyze("Test text.", stopwords = Stopwords$new(TRUE)) | ||
#' } | ||
#' @export | ||
analyze <- function(text, top_n = 3) { | ||
if (init_chk_not()) | ||
init() | ||
analyze <- | ||
function(text, | ||
top_n = 3, | ||
match_option = Match$ALL, | ||
stopwords = FALSE) { | ||
if (init_chk_not()) | ||
init() | ||
|
||
return( | ||
kiwi_analyze( | ||
kiwi_analyze_wrap( | ||
get("kb", envir = .el), | ||
text, | ||
top_n, 1 | ||
top_n, | ||
match_option, | ||
stopwords | ||
) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Generated by cpp11: do not edit by hand | ||
|
||
kiwi_version_ <- function() { | ||
.Call(`_elbird_kiwi_version_`) | ||
} | ||
|
||
kiwi_error_ <- function() { | ||
.Call(`_elbird_kiwi_error_`) | ||
} | ||
|
||
kiwi_clear_error_ <- function() { | ||
invisible(.Call(`_elbird_kiwi_clear_error_`)) | ||
} | ||
|
||
kiwi_builder_close_ <- function(handle_ex) { | ||
.Call(`_elbird_kiwi_builder_close_`, handle_ex) | ||
} | ||
|
||
kiwi_builder_init_ <- function(model_path, num_threads, options) { | ||
.Call(`_elbird_kiwi_builder_init_`, model_path, num_threads, options) | ||
} | ||
|
||
kiwi_builder_add_word_ <- function(handle_ex, word, pos, score) { | ||
.Call(`_elbird_kiwi_builder_add_word_`, handle_ex, word, pos, score) | ||
} | ||
|
||
kiwi_builder_add_alias_word_ <- function(handle_ex, alias, pos, score, orig_word) { | ||
.Call(`_elbird_kiwi_builder_add_alias_word_`, handle_ex, alias, pos, score, orig_word) | ||
} | ||
|
||
kiwi_builder_add_pre_analyzed_word_ <- function(handle_ex, form, analyzed_r, score) { | ||
.Call(`_elbird_kiwi_builder_add_pre_analyzed_word_`, handle_ex, form, analyzed_r, score) | ||
} | ||
|
||
kiwi_builder_load_dict_ <- function(handle_ex, dict_path) { | ||
.Call(`_elbird_kiwi_builder_load_dict_`, handle_ex, dict_path) | ||
} | ||
|
||
kiwi_close_ <- function(handle_ex) { | ||
.Call(`_elbird_kiwi_close_`, handle_ex) | ||
} | ||
|
||
kiwi_builder_extract_words_ <- function(handle_ex, input, min_cnt, max_word_len, min_score, pos_threshold) { | ||
.Call(`_elbird_kiwi_builder_extract_words_`, handle_ex, input, min_cnt, max_word_len, min_score, pos_threshold) | ||
} | ||
|
||
kiwi_builder_extract_add_words_ <- function(handle_ex, input, min_cnt, max_word_len, min_score, pos_threshold) { | ||
.Call(`_elbird_kiwi_builder_extract_add_words_`, handle_ex, input, min_cnt, max_word_len, min_score, pos_threshold) | ||
} | ||
|
||
kiwi_builder_build_ <- function(handle_ex) { | ||
.Call(`_elbird_kiwi_builder_build_`, handle_ex) | ||
} | ||
|
||
kiwi_init_ <- function(model_path, num_threads, options) { | ||
.Call(`_elbird_kiwi_init_`, model_path, num_threads, options) | ||
} | ||
|
||
kiwi_set_option_ <- function(handle_ex, option, value) { | ||
invisible(.Call(`_elbird_kiwi_set_option_`, handle_ex, option, value)) | ||
} | ||
|
||
kiwi_get_option_ <- function(handle_ex, option) { | ||
.Call(`_elbird_kiwi_get_option_`, handle_ex, option) | ||
} | ||
|
||
kiwi_analyze_ <- function(handle_ex, text, top_n, match_options, stopwords_r) { | ||
.Call(`_elbird_kiwi_analyze_`, handle_ex, text, top_n, match_options, stopwords_r) | ||
} | ||
|
||
kiwi_split_into_sents_ <- function(handle_ex, text, match_options, return_tokens) { | ||
.Call(`_elbird_kiwi_split_into_sents_`, handle_ex, text, match_options, return_tokens) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
dict_path <- function() { | ||
path <- Sys.getenv("ELBIRD_DICTIONARY_HOME") | ||
if (nzchar(path)) { | ||
normalizePath(path, mustWork = FALSE) | ||
} else { | ||
normalizePath(file.path(system.file("", package = "elbird"), "dicts"), | ||
mustWork = FALSE) | ||
} | ||
} | ||
|
||
dict_stopwords_path <- function() { | ||
normalizePath(file.path(dict_path(), "stopwords.txt"), mustWork = FALSE) | ||
} | ||
|
||
dict_user_path <- function() { | ||
normalizePath(file.path(dict_path(), "stopwords.txt"), mustWork = FALSE) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.