Skip to content

Commit 3734b72

Browse files
committedOct 10, 2020
Make example conditionally on availability of udpipe
1 parent 80c3a54 commit 3734b72

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed
 

‎R/word2vec.R

+6-7
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#' @seealso \code{\link{predict.word2vec}}, \code{\link{as.matrix.word2vec}}
4040
#' @export
4141
#' @examples
42+
#' \dontshow{if(require(udpipe))\{}
4243
#' library(udpipe)
4344
#' ## Take data and standardise it a bit
4445
#' data(brussels_reviews, package = "udpipe")
@@ -103,6 +104,8 @@
103104
#' nn
104105
#' nn <- predict(model, c("accueillir/VBN", "accueillir/VBG"), type = "nearest")
105106
#' nn
107+
#'
108+
#' \dontshow{\} # End of main if statement running only if the required packages are installed}
106109
word2vec <- function(x,
107110
type = c("cbow", "skip-gram"),
108111
dim = 50, window = ifelse(type == "cbow", 5L, 10L),
@@ -215,9 +218,8 @@ as.matrix.word2vec_trained <- function(x, encoding='UTF-8', ...){
215218
#' \dontshow{
216219
#' file.remove(path)
217220
#' }
218-
#' \dontshow{if(require(udpipe))
219-
#' \{
220-
#' }
221+
#'
222+
#' \dontshow{if(require(udpipe))\{}
221223
#' ## Save the model to hard disk as a text file (uses package udpipe)
222224
#' library(udpipe)
223225
#' path <- "mymodel.txt"
@@ -228,10 +230,7 @@ as.matrix.word2vec_trained <- function(x, encoding='UTF-8', ...){
228230
#' \dontshow{
229231
#' file.remove(path)
230232
#' }
231-
#' \dontshow{
232-
#' \}
233-
#' # End of main if statement running only if the required packages are installed
234-
#' }
233+
#' \dontshow{\} # End of main if statement running only if the required packages are installed}
235234
write.word2vec <- function(x, file, type = c("bin", "txt"), encoding = "UTF-8"){
236235
type <- match.arg(type)
237236
if(type == "bin"){

‎man/word2vec.Rd

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎man/write.word2vec.Rd

+3-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)