From ae40f2f40903d014d38989a8b4bf012310267787 Mon Sep 17 00:00:00 2001 From: Luis Verde Arregoitia Date: Wed, 2 Sep 2026 09:55:40 -0600 Subject: [PATCH] fix lost braces note --- R/utils.R | 10 ++++----- R/word2vec.R | 46 +++++++++++++++++++------------------- man/predict.word2vec.Rd | 8 +++---- man/read.word2vec.Rd | 8 +++---- man/txt_clean_word2vec.Rd | 10 ++++----- man/word2vec.Rd | 26 ++++++++++----------- man/word2vec.character.Rd | 22 +++++++++--------- man/word2vec.list.Rd | 22 +++++++++--------- man/word2vec_similarity.Rd | 4 ++-- 9 files changed, 78 insertions(+), 78 deletions(-) diff --git a/R/utils.R b/R/utils.R index a67b620..0be1f26 100644 --- a/R/utils.R +++ b/R/utils.R @@ -1,11 +1,11 @@ #' @title Text cleaning specific for input to word2vec #' @description Standardise text by #' \itemize{ -#' \item{Conversion of text from UTF-8 to ASCII} -#' \item{Keeping only alphanumeric characters: letters and numbers} -#' \item{Removing multiple spaces} -#' \item{Removing leading/trailing spaces} -#' \item{Performing lowercasing} +#' \item Conversion of text from UTF-8 to ASCII +#' \item Keeping only alphanumeric characters: letters and numbers +#' \item Removing multiple spaces +#' \item Removing leading/trailing spaces +#' \item Performing lowercasing #' } #' @param x a character vector in UTF-8 encoding #' @param ascii logical indicating to use \code{iconv} to convert the input from UTF-8 to ASCII. Defaults to TRUE. diff --git a/R/word2vec.R b/R/word2vec.R index 2376f01..97c6509 100644 --- a/R/word2vec.R +++ b/R/word2vec.R @@ -15,28 +15,28 @@ #' @param ... further arguments passed on to the methods \code{\link{word2vec.character}}, \code{\link{word2vec.list}} as well as the C++ function \code{w2v_train} - for expert use only #' @return an object of class \code{w2v_trained} which is a list with elements #' \itemize{ -#' \item{model: a Rcpp pointer to the model} -#' \item{data: a list with elements file: the training data used, stopwords: the character vector of stopwords, n} -#' \item{vocabulary: the number of words in the vocabulary} -#' \item{success: logical indicating if training succeeded} -#' \item{error_log: the error log in case training failed} -#' \item{control: as list of the training arguments used, namely min_count, dim, window, iter, lr, skipgram, hs, negative, sample, split_words, split_sents, expTableSize and expValueMax} +#' \item model: a Rcpp pointer to the model +#' \item data: a list with elements file: the training data used, stopwords: the character vector of stopwords, n +#' \item vocabulary: the number of words in the vocabulary +#' \item success: logical indicating if training succeeded +#' \item error_log: the error log in case training failed +#' \item control: as list of the training arguments used, namely min_count, dim, window, iter, lr, skipgram, hs, negative, sample, split_words, split_sents, expTableSize and expValueMax #' } #' @references \url{https://github.com/maxoodf/word2vec}, \url{https://arxiv.org/pdf/1310.4546.pdf} #' @details #' Some advice on the optimal set of parameters to use for training as defined by Mikolov et al. #' \itemize{ -#' \item{argument type: skip-gram (slower, better for infrequent words) vs cbow (fast)} -#' \item{argument hs: the training algorithm: hierarchical softmax (better for infrequent words) vs negative sampling (better for frequent words, better with low dimensional vectors)} -#' \item{argument dim: dimensionality of the word vectors: usually more is better, but not always} -#' \item{argument window: for skip-gram usually around 10, for cbow around 5} -#' \item{argument sample: sub-sampling of frequent words: can improve both accuracy and speed for large data sets (useful values are in range 0.001 to 0.00001)} +#' \item argument type: skip-gram (slower, better for infrequent words) vs cbow (fast) +#' \item argument hs: the training algorithm: hierarchical softmax (better for infrequent words) vs negative sampling (better for frequent words, better with low dimensional vectors) +#' \item argument dim: dimensionality of the word vectors: usually more is better, but not always +#' \item argument window: for skip-gram usually around 10, for cbow around 5 +#' \item argument sample: sub-sampling of frequent words: can improve both accuracy and speed for large data sets (useful values are in range 0.001 to 0.00001) #' } #' @note #' Some notes on the tokenisation #' \itemize{ -#' \item{If you provide to \code{x} a list, each list element should correspond to a sentence (or what you consider as a sentence) and should contain a character vector of tokens. The word2vec model is then executed using \code{\link{word2vec.list}}} -#' \item{If you provide to \code{x} a character vector or the path to the file on disk, the tokenisation into words depends on the first element provided in \code{split} and the tokenisation into sentences depends on the second element provided in \code{split} when passed on to \code{\link{word2vec.character}}} +#' \item If you provide to \code{x} a list, each list element should correspond to a sentence (or what you consider as a sentence) and should contain a character vector of tokens. The word2vec model is then executed using \code{\link{word2vec.list}} +#' \item If you provide to \code{x} a character vector or the path to the file on disk, the tokenisation into words depends on the first element provided in \code{split} and the tokenisation into sentences depends on the second element provided in \code{split} when passed on to \code{\link{word2vec.character}} #' } #' @seealso \code{\link{predict.word2vec}}, \code{\link{as.matrix.word2vec}}, \code{\link{word2vec}}, \code{\link{word2vec.character}}, \code{\link{word2vec.list}} #' @export @@ -349,10 +349,10 @@ write.word2vec <- function(x, file, type = c("bin", "txt"), encoding = "UTF-8"){ #' @param normalize logical indicating to normalize the embeddings by dividing by the factor (sqrt(sum(x . x) / length(x))). Defaults to FALSE. #' @return an object of class w2v which is a list with elements #' \itemize{ -#' \item{model: a Rcpp pointer to the model} -#' \item{model_path: the path to the model on disk} -#' \item{dim: the dimension of the embedding matrix} -#' \item{n: the number of words in the vocabulary} +#' \item model: a Rcpp pointer to the model +#' \item model_path: the path to the model on disk +#' \item dim: the dimension of the embedding matrix +#' \item n: the number of words in the vocabulary #' } #' @export #' @examples @@ -445,8 +445,8 @@ summary.word2vec_trained <- function(object, type = "vocabulary", ...){ #' @title Predict functionalities for a word2vec model #' @description Get either #' \itemize{ -#' \item{the embedding of words} -#' \item{the nearest words which are similar to either a word or a word vector} +#' \item the embedding of words +#' \item the nearest words which are similar to either a word or a word vector #' } #' @param object a word2vec model as returned by \code{\link{word2vec}} or \code{\link{read.word2vec}} #' @param newdata for type 'embedding', \code{newdata} should be a character vector of words\cr @@ -457,8 +457,8 @@ summary.word2vec_trained <- function(object, type = "vocabulary", ...){ #' @param ... not used #' @return depending on the type, you get a different result back: #' \itemize{ -#' \item{for type nearest: a list of data.frames with columns term, similarity and rank indicating with words which are closest to the provided \code{newdata} words or word vectors. If \code{newdata} is just one vector instead of a matrix, it returns a data.frame} -#' \item{for type embedding: a matrix of word vectors of the words provided in \code{newdata}} +#' \item for type nearest: a list of data.frames with columns term, similarity and rank indicating with words which are closest to the provided \code{newdata} words or word vectors. If \code{newdata} is just one vector instead of a matrix, it returns a data.frame +#' \item for type embedding: a matrix of word vectors of the words provided in \code{newdata} #' } #' @seealso \code{\link{word2vec}}, \code{\link{read.word2vec}} #' @export @@ -523,8 +523,8 @@ predict.word2vec_trained <- function(object, newdata, type = c("nearest", "embed #' @title Similarity between word vectors as used in word2vec #' @description The similarity between word vectors is defined #' \itemize{ -#' \item{for type 'dot': as the square root of the average inner product of the vector elements (sqrt(sum(x . y) / ncol(x))) capped to zero} -#' \item{for type 'cosine': as the the cosine similarity, namely sum(x . y) / (sum(x^2)*sum(y^2)) } +#' \item for type 'dot': as the square root of the average inner product of the vector elements (sqrt(sum(x . y) / ncol(x))) capped to zero +#' \item for type 'cosine': as the the cosine similarity, namely sum(x . y) / (sum(x^2)*sum(y^2)) #' } #' @param x a matrix with embeddings where the rownames of the matrix provide the label of the term #' @param y a matrix with embeddings where the rownames of the matrix provide the label of the term diff --git a/man/predict.word2vec.Rd b/man/predict.word2vec.Rd index 8d27876..d83b681 100644 --- a/man/predict.word2vec.Rd +++ b/man/predict.word2vec.Rd @@ -30,15 +30,15 @@ for type 'nearest', \code{newdata} should be a character vector of words or a ma \value{ depending on the type, you get a different result back: \itemize{ -\item{for type nearest: a list of data.frames with columns term, similarity and rank indicating with words which are closest to the provided \code{newdata} words or word vectors. If \code{newdata} is just one vector instead of a matrix, it returns a data.frame} -\item{for type embedding: a matrix of word vectors of the words provided in \code{newdata}} +\item for type nearest: a list of data.frames with columns term, similarity and rank indicating with words which are closest to the provided \code{newdata} words or word vectors. If \code{newdata} is just one vector instead of a matrix, it returns a data.frame +\item for type embedding: a matrix of word vectors of the words provided in \code{newdata} } } \description{ Get either \itemize{ -\item{the embedding of words} -\item{the nearest words which are similar to either a word or a word vector} +\item the embedding of words +\item the nearest words which are similar to either a word or a word vector } } \examples{ diff --git a/man/read.word2vec.Rd b/man/read.word2vec.Rd index a206b24..863a37d 100644 --- a/man/read.word2vec.Rd +++ b/man/read.word2vec.Rd @@ -14,10 +14,10 @@ read.word2vec(file, normalize = FALSE) \value{ an object of class w2v which is a list with elements \itemize{ -\item{model: a Rcpp pointer to the model} -\item{model_path: the path to the model on disk} -\item{dim: the dimension of the embedding matrix} -\item{n: the number of words in the vocabulary} +\item model: a Rcpp pointer to the model +\item model_path: the path to the model on disk +\item dim: the dimension of the embedding matrix +\item n: the number of words in the vocabulary } } \description{ diff --git a/man/txt_clean_word2vec.Rd b/man/txt_clean_word2vec.Rd index 0191527..a7cdfc9 100644 --- a/man/txt_clean_word2vec.Rd +++ b/man/txt_clean_word2vec.Rd @@ -25,11 +25,11 @@ keeping only alphanumeric elements \description{ Standardise text by \itemize{ -\item{Conversion of text from UTF-8 to ASCII} -\item{Keeping only alphanumeric characters: letters and numbers} -\item{Removing multiple spaces} -\item{Removing leading/trailing spaces} -\item{Performing lowercasing} +\item Conversion of text from UTF-8 to ASCII +\item Keeping only alphanumeric characters: letters and numbers +\item Removing multiple spaces +\item Removing leading/trailing spaces +\item Performing lowercasing } } \examples{ diff --git a/man/word2vec.Rd b/man/word2vec.Rd index ee8ce9d..47167f2 100644 --- a/man/word2vec.Rd +++ b/man/word2vec.Rd @@ -50,12 +50,12 @@ word2vec( \value{ an object of class \code{w2v_trained} which is a list with elements \itemize{ -\item{model: a Rcpp pointer to the model} -\item{data: a list with elements file: the training data used, stopwords: the character vector of stopwords, n} -\item{vocabulary: the number of words in the vocabulary} -\item{success: logical indicating if training succeeded} -\item{error_log: the error log in case training failed} -\item{control: as list of the training arguments used, namely min_count, dim, window, iter, lr, skipgram, hs, negative, sample, split_words, split_sents, expTableSize and expValueMax} +\item model: a Rcpp pointer to the model +\item data: a list with elements file: the training data used, stopwords: the character vector of stopwords, n +\item vocabulary: the number of words in the vocabulary +\item success: logical indicating if training succeeded +\item error_log: the error log in case training failed +\item control: as list of the training arguments used, namely min_count, dim, window, iter, lr, skipgram, hs, negative, sample, split_words, split_sents, expTableSize and expValueMax } } \description{ @@ -64,18 +64,18 @@ Construct a word2vec model on text. The algorithm is explained at \url{https://a \details{ Some advice on the optimal set of parameters to use for training as defined by Mikolov et al. \itemize{ -\item{argument type: skip-gram (slower, better for infrequent words) vs cbow (fast)} -\item{argument hs: the training algorithm: hierarchical softmax (better for infrequent words) vs negative sampling (better for frequent words, better with low dimensional vectors)} -\item{argument dim: dimensionality of the word vectors: usually more is better, but not always} -\item{argument window: for skip-gram usually around 10, for cbow around 5} -\item{argument sample: sub-sampling of frequent words: can improve both accuracy and speed for large data sets (useful values are in range 0.001 to 0.00001)} +\item argument type: skip-gram (slower, better for infrequent words) vs cbow (fast) +\item argument hs: the training algorithm: hierarchical softmax (better for infrequent words) vs negative sampling (better for frequent words, better with low dimensional vectors) +\item argument dim: dimensionality of the word vectors: usually more is better, but not always +\item argument window: for skip-gram usually around 10, for cbow around 5 +\item argument sample: sub-sampling of frequent words: can improve both accuracy and speed for large data sets (useful values are in range 0.001 to 0.00001) } } \note{ Some notes on the tokenisation \itemize{ -\item{If you provide to \code{x} a list, each list element should correspond to a sentence (or what you consider as a sentence) and should contain a character vector of tokens. The word2vec model is then executed using \code{\link{word2vec.list}}} -\item{If you provide to \code{x} a character vector or the path to the file on disk, the tokenisation into words depends on the first element provided in \code{split} and the tokenisation into sentences depends on the second element provided in \code{split} when passed on to \code{\link{word2vec.character}}} +\item If you provide to \code{x} a list, each list element should correspond to a sentence (or what you consider as a sentence) and should contain a character vector of tokens. The word2vec model is then executed using \code{\link{word2vec.list}} +\item If you provide to \code{x} a character vector or the path to the file on disk, the tokenisation into words depends on the first element provided in \code{split} and the tokenisation into sentences depends on the second element provided in \code{split} when passed on to \code{\link{word2vec.character}} } } \examples{ diff --git a/man/word2vec.character.Rd b/man/word2vec.character.Rd index 6a4aaa9..061b546 100644 --- a/man/word2vec.character.Rd +++ b/man/word2vec.character.Rd @@ -61,12 +61,12 @@ is passed on to \code{file} when writing \code{x} to hard disk in case you provi \value{ an object of class \code{w2v_trained} which is a list with elements \itemize{ -\item{model: a Rcpp pointer to the model} -\item{data: a list with elements file: the training data used, stopwords: the character vector of stopwords, n} -\item{vocabulary: the number of words in the vocabulary} -\item{success: logical indicating if training succeeded} -\item{error_log: the error log in case training failed} -\item{control: as list of the training arguments used, namely min_count, dim, window, iter, lr, skipgram, hs, negative, sample, split_words, split_sents, expTableSize and expValueMax} +\item model: a Rcpp pointer to the model +\item data: a list with elements file: the training data used, stopwords: the character vector of stopwords, n +\item vocabulary: the number of words in the vocabulary +\item success: logical indicating if training succeeded +\item error_log: the error log in case training failed +\item control: as list of the training arguments used, namely min_count, dim, window, iter, lr, skipgram, hs, negative, sample, split_words, split_sents, expTableSize and expValueMax } } \description{ @@ -75,11 +75,11 @@ Construct a word2vec model on text. The algorithm is explained at \url{https://a \details{ Some advice on the optimal set of parameters to use for training as defined by Mikolov et al. \itemize{ -\item{argument type: skip-gram (slower, better for infrequent words) vs cbow (fast)} -\item{argument hs: the training algorithm: hierarchical softmax (better for infrequent words) vs negative sampling (better for frequent words, better with low dimensional vectors)} -\item{argument dim: dimensionality of the word vectors: usually more is better, but not always} -\item{argument window: for skip-gram usually around 10, for cbow around 5} -\item{argument sample: sub-sampling of frequent words: can improve both accuracy and speed for large data sets (useful values are in range 0.001 to 0.00001)} +\item argument type: skip-gram (slower, better for infrequent words) vs cbow (fast) +\item argument hs: the training algorithm: hierarchical softmax (better for infrequent words) vs negative sampling (better for frequent words, better with low dimensional vectors) +\item argument dim: dimensionality of the word vectors: usually more is better, but not always +\item argument window: for skip-gram usually around 10, for cbow around 5 +\item argument sample: sub-sampling of frequent words: can improve both accuracy and speed for large data sets (useful values are in range 0.001 to 0.00001) } } \examples{ diff --git a/man/word2vec.list.Rd b/man/word2vec.list.Rd index c5d93e3..3c58b51 100644 --- a/man/word2vec.list.Rd +++ b/man/word2vec.list.Rd @@ -50,12 +50,12 @@ \value{ an object of class \code{w2v_trained} which is a list with elements \itemize{ -\item{model: a Rcpp pointer to the model} -\item{data: a list with elements file: the training data used, stopwords: the character vector of stopwords, n} -\item{vocabulary: the number of words in the vocabulary} -\item{success: logical indicating if training succeeded} -\item{error_log: the error log in case training failed} -\item{control: as list of the training arguments used, namely min_count, dim, window, iter, lr, skipgram, hs, negative, sample, split_words, split_sents, expTableSize and expValueMax} +\item model: a Rcpp pointer to the model +\item data: a list with elements file: the training data used, stopwords: the character vector of stopwords, n +\item vocabulary: the number of words in the vocabulary +\item success: logical indicating if training succeeded +\item error_log: the error log in case training failed +\item control: as list of the training arguments used, namely min_count, dim, window, iter, lr, skipgram, hs, negative, sample, split_words, split_sents, expTableSize and expValueMax } } \description{ @@ -64,11 +64,11 @@ Construct a word2vec model on text. The algorithm is explained at \url{https://a \details{ Some advice on the optimal set of parameters to use for training as defined by Mikolov et al. \itemize{ -\item{argument type: skip-gram (slower, better for infrequent words) vs cbow (fast)} -\item{argument hs: the training algorithm: hierarchical softmax (better for infrequent words) vs negative sampling (better for frequent words, better with low dimensional vectors)} -\item{argument dim: dimensionality of the word vectors: usually more is better, but not always} -\item{argument window: for skip-gram usually around 10, for cbow around 5} -\item{argument sample: sub-sampling of frequent words: can improve both accuracy and speed for large data sets (useful values are in range 0.001 to 0.00001)} +\item argument type: skip-gram (slower, better for infrequent words) vs cbow (fast) +\item argument hs: the training algorithm: hierarchical softmax (better for infrequent words) vs negative sampling (better for frequent words, better with low dimensional vectors) +\item argument dim: dimensionality of the word vectors: usually more is better, but not always +\item argument window: for skip-gram usually around 10, for cbow around 5 +\item argument sample: sub-sampling of frequent words: can improve both accuracy and speed for large data sets (useful values are in range 0.001 to 0.00001) } } \examples{ diff --git a/man/word2vec_similarity.Rd b/man/word2vec_similarity.Rd index b0c638d..ec03604 100644 --- a/man/word2vec_similarity.Rd +++ b/man/word2vec_similarity.Rd @@ -27,8 +27,8 @@ ordered from high to low similarity and keeping only the top_n most similar reco \description{ The similarity between word vectors is defined \itemize{ - \item{for type 'dot': as the square root of the average inner product of the vector elements (sqrt(sum(x . y) / ncol(x))) capped to zero} - \item{for type 'cosine': as the the cosine similarity, namely sum(x . y) / (sum(x^2)*sum(y^2)) } + \item for type 'dot': as the square root of the average inner product of the vector elements (sqrt(sum(x . y) / ncol(x))) capped to zero + \item for type 'cosine': as the the cosine similarity, namely sum(x . y) / (sum(x^2)*sum(y^2)) } } \examples{