Skip to content

Commit

Permalink
Make example conditionally on availability of udpipe
Browse files Browse the repository at this point in the history
  • Loading branch information
jwijffels committed Oct 10, 2020
1 parent 80c3a54 commit 3734b72
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
13 changes: 6 additions & 7 deletions R/word2vec.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#' @seealso \code{\link{predict.word2vec}}, \code{\link{as.matrix.word2vec}}
#' @export
#' @examples
#' \dontshow{if(require(udpipe))\{}
#' library(udpipe)
#' ## Take data and standardise it a bit
#' data(brussels_reviews, package = "udpipe")
Expand Down Expand Up @@ -103,6 +104,8 @@
#' nn
#' nn <- predict(model, c("accueillir/VBN", "accueillir/VBG"), type = "nearest")
#' nn
#'
#' \dontshow{\} # End of main if statement running only if the required packages are installed}
word2vec <- function(x,
type = c("cbow", "skip-gram"),
dim = 50, window = ifelse(type == "cbow", 5L, 10L),
Expand Down Expand Up @@ -215,9 +218,8 @@ as.matrix.word2vec_trained <- function(x, encoding='UTF-8', ...){
#' \dontshow{
#' file.remove(path)
#' }
#' \dontshow{if(require(udpipe))
#' \{
#' }
#'
#' \dontshow{if(require(udpipe))\{}
#' ## Save the model to hard disk as a text file (uses package udpipe)
#' library(udpipe)
#' path <- "mymodel.txt"
Expand All @@ -228,10 +230,7 @@ as.matrix.word2vec_trained <- function(x, encoding='UTF-8', ...){
#' \dontshow{
#' file.remove(path)
#' }
#' \dontshow{
#' \}
#' # End of main if statement running only if the required packages are installed
#' }
#' \dontshow{\} # End of main if statement running only if the required packages are installed}
write.word2vec <- function(x, file, type = c("bin", "txt"), encoding = "UTF-8"){
type <- match.arg(type)
if(type == "bin"){
Expand Down
3 changes: 3 additions & 0 deletions man/word2vec.Rd

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

10 changes: 3 additions & 7 deletions man/write.word2vec.Rd

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

0 comments on commit 3734b72

Please sign in to comment.