Skip to content

Commit ba4746f

Browse files
committed
Fix NAMESPACE and MAN
1 parent ede5608 commit ba4746f

File tree

7 files changed

+19
-26
lines changed

7 files changed

+19
-26
lines changed

DESCRIPTION

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@ URL: https://github.com/bnosac/word2vec
1313
License: Apache License (>= 2.0)
1414
Encoding: UTF-8
1515
RoxygenNote: 7.3.2
16-
Depends: R (>= 2.10)
16+
Depends:
17+
methods,
18+
R (>= 3.5.0)
1719
Imports:
18-
Rcpp (>= 0.11.5),
19-
stats,
2020
quanteda (>= 4.1.0),
21+
stringi,
22+
Matrix,
23+
proxyC,
2124
RSpectra,
2225
irlba,
2326
rsvd

NAMESPACE

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ export(doc2vec)
1212
export(lsa)
1313
export(synonyms)
1414
export(word2vec)
15+
importFrom(methods,as)
1516
importFrom(quanteda,dfm)
17+
importFrom(quanteda,dfm_weight)
1618
importFrom(quanteda,featfreq)
17-
importFrom(quanteda,tokens_keep)
19+
importFrom(quanteda,tokens_trim)
20+
importFrom(utils,head)
21+
importFrom(utils,tail)
1822
useDynLib(wordvector)

R/lsa.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ lsa <- function(x, dim = 50, min_count = 5L, engine = c("RSpectra", "irlba", "rs
44
UseMethod("lsa")
55
}
66

7+
#' @importFrom quanteda tokens_trim dfm featfreq
78
#' @export
89
lsa.tokens <- function(x, dim = 50, min_count = 5L, engine = c("RSpectra", "irlba", "rsvd"),
910
weight = "count", verbose = FALSE, ...) {
@@ -36,14 +37,17 @@ lsa.tokens <- function(x, dim = 50, min_count = 5L, engine = c("RSpectra", "irlb
3637
return(result)
3738
}
3839

40+
#' @importFrom quanteda dfm_weight
41+
#' @importFrom methods as
3942
get_svd <- function(x, k, engine, weight = "count", reduce = FALSE, ...) {
4043
if (reduce) {
41-
x <- quanteda::dfm_weight(x, weights = 1 / sqrt(featfreq(x)))
44+
# NOTE: generalize? featfreq(x) ^ (1 / reduce)
45+
x <- dfm_weight(x, weights = 1 / sqrt(featfreq(x)))
4246
} else {
4347
if (weight == "sqrt") {
4448
x@x <- sqrt(x@x)
4549
} else {
46-
x <- quanteda::dfm_weight(x, scheme = weight)
50+
x <- dfm_weight(x, scheme = weight)
4751
}
4852
}
4953
if (engine == "RSpectra") {

R/word2vec.R

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@
4141
#' @seealso \code{\link{predict.word2vec}}, \code{\link{as.matrix.word2vec}}, \code{\link{word2vec}}, \code{\link{word2vec.character}}, \code{\link{word2vec.list}}
4242
#' @export
4343
#' @useDynLib wordvector
44-
#' @examples
45-
#'
46-
#' \dontshow{\} # End of main if statement running only if the required packages are installed}
4744
word2vec <- function(x, dim = 50, type = c("cbow", "skip-gram"),
4845
min_count = 5L, window = ifelse(type == "cbow", 5L, 10L),
4946
iter = 5L, lr = 0.05, hs = FALSE, negative = 5L,
@@ -53,10 +50,7 @@ word2vec <- function(x, dim = 50, type = c("cbow", "skip-gram"),
5350

5451
#' @inherit word2vec title description params details seealso return references
5552
#' @export
56-
#' @importFrom quanteda dfm featfreq tokens_keep
57-
#' @examples
58-
#'
59-
#' \dontshow{\} # End of main if statement running only if the required packages are installed}
53+
#' @importFrom quanteda tokens_trim
6054
word2vec.tokens <- function(x, dim = 50, type = c("cbow", "skip-gram"),
6155
min_count = 5L, window = ifelse(type == "cbow", 5L, 10L),
6256
iter = 5L, lr = 0.05, hs = FALSE, negative = 5L,
@@ -173,9 +167,8 @@ doc2vec.tokens <- function(x, model = NULL, ...) {
173167
}
174168

175169
#' Find similar words via formula interface
176-
#' @examples
177-
#' analogy(mod, ~ japan - tokyo)
178170
#' @export
171+
#' @importFrom utils head tail
179172
analogy <- function(model, formula, n = 10, method = c("cosine", "dot")) {
180173

181174
method <- match.arg(method)

man/analogy.Rd

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/word2vec.Rd

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/word2vec.tokens.Rd

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)