Skip to content

Commit

Permalink
Docs: worker examples
Browse files Browse the repository at this point in the history
  • Loading branch information
qinwf committed Sep 28, 2016
1 parent 90ebaa1 commit adc7320
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 33 deletions.
46 changes: 29 additions & 17 deletions R/worker.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,30 +111,42 @@
#' jiebaR worker.
#'
#' @examples
#' ### Note: Can not display Chinese character on Windows here.
#' ### Note: Can not display Chinese characters here.
#' \dontrun{
#' words = "hello world"
#' test1 = worker()
#' test1
#' test1 <= words
#' engine1 = worker()
#' segment(words, engine1)
#'
#' test <= "./temp.txt"
#'
#' engine2 = worker("mix",symbol = T)
#' engine2 <= "./temp.txt"
#' engine2
#' engine2$symbol = T
#' engine2
#' engine2 <= words
#' # "./temp.txt" is a file path
#'
#' engine3 = worker(type = "mix", dict = "dict_path",symbol = T)
#' engine3 <= "./temp.txt"
#' segment("./temp.txt", engine1)
#'
#' engine2 = worker("hmm")
#' segment("./temp.txt", engine2)
#'
#' engine2$write = T
#' segment("./temp.txt", engine2)
#'
#' keys = worker("keywords", topn = 1)
#' keys <= words
#' engine3 = worker(type = "mix", dict = "dict_path",symbol = T)
#' segment("./temp.txt", engine3)
#' }
#'
#' \dontrun{
#' ### Keyword Extraction
#' engine = worker("keywords", topn = 1)
#' keywords(words, engine)
#'
#' ### Speech Tagging
#' tagger = worker("tag")
#' tagger <= words}
#' tagging(words, tagger)
#'
#' ### Simhash
#' simhasher = worker("simhash", topn = 1)
#' simhash(words, simhasher)
#' distance("hello world" , "hello world!" , simhasher)
#'
#' show_dictpath()
#' }
#' @export
worker <- function(type = "mix", dict = DICTPATH, hmm = HMMPATH,
user = USERPATH, idf = IDFPATH, stop_word = STOPPATH, write = T,
Expand Down
44 changes: 28 additions & 16 deletions man/worker.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit adc7320

Please # to comment.