Skip to content

Commit

Permalink
(temprorarily?) switch to std::unordered_map - not sure how to fix g+…
Browse files Browse the repository at this point in the history
…+-8 sparse_hash_map warnings. See dselivanov/r-sparsepp#5 for details
  • Loading branch information
dselivanov committed Feb 12, 2020
1 parent a5d7ce6 commit 6910527
Show file tree
Hide file tree
Showing 6 changed files with 191 additions and 176 deletions.
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ Remotes:
github::dselivanov/rsparse
LinkingTo:
Rcpp,
digest (>= 0.6.8),
sparsepp (>= 0.2.0)
digest (>= 0.6.8)
Suggests:
magrittr,
udpipe (>= 0.6),
Expand Down
80 changes: 40 additions & 40 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

create_xptr_unordered_set <- function(x) {
.Call(`_text2vec_create_xptr_unordered_set`, x)
}

collapse_collocations_cpp <- function(docs, xptr_unordered_set_phrases, xptr_unordered_set_stopwords, r_sep) {
.Call(`_text2vec_collapse_collocations_cpp`, docs, xptr_unordered_set_phrases, xptr_unordered_set_stopwords, r_sep)
}

hasher <- function(x, hash_size) {
.Call(`_text2vec_hasher`, x, hash_size)
}
Expand All @@ -29,38 +21,6 @@ cpp_hash_corpus_get_dtm <- function(ptr) {
.Call(`_text2vec_cpp_hash_corpus_get_dtm`, ptr)
}

colMins <- function(x) {
.Call(`_text2vec_colMins`, x)
}

colMaxs <- function(x) {
.Call(`_text2vec_colMaxs`, x)
}

rowMins <- function(x) {
.Call(`_text2vec_rowMins`, x)
}

rowMaxs <- function(x) {
.Call(`_text2vec_rowMaxs`, x)
}

euclidean_dist <- function(x, y) {
.Call(`_text2vec_euclidean_dist`, x, y)
}

malloc_trim <- function() {
.Call(`_text2vec_malloc_trim`)
}

is_invalid_ptr <- function(sexp_ptr) {
.Call(`_text2vec_is_invalid_ptr`, sexp_ptr)
}

cpp_fixed_char_tokenizer <- function(x, delim) {
.Call(`_text2vec_cpp_fixed_char_tokenizer`, x, delim)
}

cpp_vocabulary_corpus_create <- function(vocab_R, n_min, n_max, stopwords_R, delim) {
.Call(`_text2vec_cpp_vocabulary_corpus_create`, vocab_R, n_min, n_max, stopwords_R, delim)
}
Expand Down Expand Up @@ -97,6 +57,46 @@ cpp_get_document_count <- function(ptr) {
.Call(`_text2vec_cpp_get_document_count`, ptr)
}

create_xptr_unordered_set <- function(x) {
.Call(`_text2vec_create_xptr_unordered_set`, x)
}

collapse_collocations_cpp <- function(docs, xptr_unordered_set_phrases, xptr_unordered_set_stopwords, r_sep) {
.Call(`_text2vec_collapse_collocations_cpp`, docs, xptr_unordered_set_phrases, xptr_unordered_set_stopwords, r_sep)
}

colMins <- function(x) {
.Call(`_text2vec_colMins`, x)
}

colMaxs <- function(x) {
.Call(`_text2vec_colMaxs`, x)
}

rowMins <- function(x) {
.Call(`_text2vec_rowMins`, x)
}

rowMaxs <- function(x) {
.Call(`_text2vec_rowMaxs`, x)
}

euclidean_dist <- function(x, y) {
.Call(`_text2vec_euclidean_dist`, x, y)
}

malloc_trim <- function() {
.Call(`_text2vec_malloc_trim`)
}

is_invalid_ptr <- function(sexp_ptr) {
.Call(`_text2vec_is_invalid_ptr`, sexp_ptr)
}

cpp_fixed_char_tokenizer <- function(x, delim) {
.Call(`_text2vec_cpp_fixed_char_tokenizer`, x, delim)
}

warplda_create <- function(n_topics, doc_topic_prior, topic_word_prior) {
.Call(`_text2vec_warplda_create`, n_topics, doc_topic_prior, topic_word_prior)
}
Expand Down
248 changes: 124 additions & 124 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,6 @@

using namespace Rcpp;

// create_xptr_unordered_set
SEXP create_xptr_unordered_set(CharacterVector x);
RcppExport SEXP _text2vec_create_xptr_unordered_set(SEXP xSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< CharacterVector >::type x(xSEXP);
rcpp_result_gen = Rcpp::wrap(create_xptr_unordered_set(x));
return rcpp_result_gen;
END_RCPP
}
// collapse_collocations_cpp
ListOf<CharacterVector> collapse_collocations_cpp(const ListOf<const CharacterVector>& docs, SEXP xptr_unordered_set_phrases, SEXP xptr_unordered_set_stopwords, const String r_sep);
RcppExport SEXP _text2vec_collapse_collocations_cpp(SEXP docsSEXP, SEXP xptr_unordered_set_phrasesSEXP, SEXP xptr_unordered_set_stopwordsSEXP, SEXP r_sepSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< const ListOf<const CharacterVector>& >::type docs(docsSEXP);
Rcpp::traits::input_parameter< SEXP >::type xptr_unordered_set_phrases(xptr_unordered_set_phrasesSEXP);
Rcpp::traits::input_parameter< SEXP >::type xptr_unordered_set_stopwords(xptr_unordered_set_stopwordsSEXP);
Rcpp::traits::input_parameter< const String >::type r_sep(r_sepSEXP);
rcpp_result_gen = Rcpp::wrap(collapse_collocations_cpp(docs, xptr_unordered_set_phrases, xptr_unordered_set_stopwords, r_sep));
return rcpp_result_gen;
END_RCPP
}
// hasher
IntegerVector hasher(CharacterVector x, int hash_size);
RcppExport SEXP _text2vec_hasher(SEXP xSEXP, SEXP hash_sizeSEXP) {
Expand Down Expand Up @@ -93,95 +68,6 @@ BEGIN_RCPP
return rcpp_result_gen;
END_RCPP
}
// colMins
NumericVector colMins(const NumericMatrix x);
RcppExport SEXP _text2vec_colMins(SEXP xSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< const NumericMatrix >::type x(xSEXP);
rcpp_result_gen = Rcpp::wrap(colMins(x));
return rcpp_result_gen;
END_RCPP
}
// colMaxs
NumericVector colMaxs(const NumericMatrix x);
RcppExport SEXP _text2vec_colMaxs(SEXP xSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< const NumericMatrix >::type x(xSEXP);
rcpp_result_gen = Rcpp::wrap(colMaxs(x));
return rcpp_result_gen;
END_RCPP
}
// rowMins
NumericVector rowMins(const NumericMatrix x);
RcppExport SEXP _text2vec_rowMins(SEXP xSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< const NumericMatrix >::type x(xSEXP);
rcpp_result_gen = Rcpp::wrap(rowMins(x));
return rcpp_result_gen;
END_RCPP
}
// rowMaxs
NumericVector rowMaxs(const NumericMatrix x);
RcppExport SEXP _text2vec_rowMaxs(SEXP xSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< const NumericMatrix >::type x(xSEXP);
rcpp_result_gen = Rcpp::wrap(rowMaxs(x));
return rcpp_result_gen;
END_RCPP
}
// euclidean_dist
NumericMatrix euclidean_dist(const NumericMatrix x, const NumericMatrix y);
RcppExport SEXP _text2vec_euclidean_dist(SEXP xSEXP, SEXP ySEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< const NumericMatrix >::type x(xSEXP);
Rcpp::traits::input_parameter< const NumericMatrix >::type y(ySEXP);
rcpp_result_gen = Rcpp::wrap(euclidean_dist(x, y));
return rcpp_result_gen;
END_RCPP
}
// malloc_trim
SEXP malloc_trim();
RcppExport SEXP _text2vec_malloc_trim() {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
rcpp_result_gen = Rcpp::wrap(malloc_trim());
return rcpp_result_gen;
END_RCPP
}
// is_invalid_ptr
int is_invalid_ptr(SEXP sexp_ptr);
RcppExport SEXP _text2vec_is_invalid_ptr(SEXP sexp_ptrSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< SEXP >::type sexp_ptr(sexp_ptrSEXP);
rcpp_result_gen = Rcpp::wrap(is_invalid_ptr(sexp_ptr));
return rcpp_result_gen;
END_RCPP
}
// cpp_fixed_char_tokenizer
SEXP cpp_fixed_char_tokenizer(CharacterVector x, char delim);
RcppExport SEXP _text2vec_cpp_fixed_char_tokenizer(SEXP xSEXP, SEXP delimSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< CharacterVector >::type x(xSEXP);
Rcpp::traits::input_parameter< char >::type delim(delimSEXP);
rcpp_result_gen = Rcpp::wrap(cpp_fixed_char_tokenizer(x, delim));
return rcpp_result_gen;
END_RCPP
}
// cpp_vocabulary_corpus_create
SEXP cpp_vocabulary_corpus_create(const CharacterVector vocab_R, uint32_t n_min, uint32_t n_max, const CharacterVector stopwords_R, const String delim);
RcppExport SEXP _text2vec_cpp_vocabulary_corpus_create(SEXP vocab_RSEXP, SEXP n_minSEXP, SEXP n_maxSEXP, SEXP stopwords_RSEXP, SEXP delimSEXP) {
Expand Down Expand Up @@ -294,6 +180,120 @@ BEGIN_RCPP
return rcpp_result_gen;
END_RCPP
}
// create_xptr_unordered_set
SEXP create_xptr_unordered_set(CharacterVector x);
RcppExport SEXP _text2vec_create_xptr_unordered_set(SEXP xSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< CharacterVector >::type x(xSEXP);
rcpp_result_gen = Rcpp::wrap(create_xptr_unordered_set(x));
return rcpp_result_gen;
END_RCPP
}
// collapse_collocations_cpp
ListOf<CharacterVector> collapse_collocations_cpp(const ListOf<const CharacterVector>& docs, SEXP xptr_unordered_set_phrases, SEXP xptr_unordered_set_stopwords, const String r_sep);
RcppExport SEXP _text2vec_collapse_collocations_cpp(SEXP docsSEXP, SEXP xptr_unordered_set_phrasesSEXP, SEXP xptr_unordered_set_stopwordsSEXP, SEXP r_sepSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< const ListOf<const CharacterVector>& >::type docs(docsSEXP);
Rcpp::traits::input_parameter< SEXP >::type xptr_unordered_set_phrases(xptr_unordered_set_phrasesSEXP);
Rcpp::traits::input_parameter< SEXP >::type xptr_unordered_set_stopwords(xptr_unordered_set_stopwordsSEXP);
Rcpp::traits::input_parameter< const String >::type r_sep(r_sepSEXP);
rcpp_result_gen = Rcpp::wrap(collapse_collocations_cpp(docs, xptr_unordered_set_phrases, xptr_unordered_set_stopwords, r_sep));
return rcpp_result_gen;
END_RCPP
}
// colMins
NumericVector colMins(const NumericMatrix x);
RcppExport SEXP _text2vec_colMins(SEXP xSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< const NumericMatrix >::type x(xSEXP);
rcpp_result_gen = Rcpp::wrap(colMins(x));
return rcpp_result_gen;
END_RCPP
}
// colMaxs
NumericVector colMaxs(const NumericMatrix x);
RcppExport SEXP _text2vec_colMaxs(SEXP xSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< const NumericMatrix >::type x(xSEXP);
rcpp_result_gen = Rcpp::wrap(colMaxs(x));
return rcpp_result_gen;
END_RCPP
}
// rowMins
NumericVector rowMins(const NumericMatrix x);
RcppExport SEXP _text2vec_rowMins(SEXP xSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< const NumericMatrix >::type x(xSEXP);
rcpp_result_gen = Rcpp::wrap(rowMins(x));
return rcpp_result_gen;
END_RCPP
}
// rowMaxs
NumericVector rowMaxs(const NumericMatrix x);
RcppExport SEXP _text2vec_rowMaxs(SEXP xSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< const NumericMatrix >::type x(xSEXP);
rcpp_result_gen = Rcpp::wrap(rowMaxs(x));
return rcpp_result_gen;
END_RCPP
}
// euclidean_dist
NumericMatrix euclidean_dist(const NumericMatrix x, const NumericMatrix y);
RcppExport SEXP _text2vec_euclidean_dist(SEXP xSEXP, SEXP ySEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< const NumericMatrix >::type x(xSEXP);
Rcpp::traits::input_parameter< const NumericMatrix >::type y(ySEXP);
rcpp_result_gen = Rcpp::wrap(euclidean_dist(x, y));
return rcpp_result_gen;
END_RCPP
}
// malloc_trim
SEXP malloc_trim();
RcppExport SEXP _text2vec_malloc_trim() {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
rcpp_result_gen = Rcpp::wrap(malloc_trim());
return rcpp_result_gen;
END_RCPP
}
// is_invalid_ptr
int is_invalid_ptr(SEXP sexp_ptr);
RcppExport SEXP _text2vec_is_invalid_ptr(SEXP sexp_ptrSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< SEXP >::type sexp_ptr(sexp_ptrSEXP);
rcpp_result_gen = Rcpp::wrap(is_invalid_ptr(sexp_ptr));
return rcpp_result_gen;
END_RCPP
}
// cpp_fixed_char_tokenizer
SEXP cpp_fixed_char_tokenizer(CharacterVector x, char delim);
RcppExport SEXP _text2vec_cpp_fixed_char_tokenizer(SEXP xSEXP, SEXP delimSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< CharacterVector >::type x(xSEXP);
Rcpp::traits::input_parameter< char >::type delim(delimSEXP);
rcpp_result_gen = Rcpp::wrap(cpp_fixed_char_tokenizer(x, delim));
return rcpp_result_gen;
END_RCPP
}
// warplda_create
SEXP warplda_create(int n_topics, double doc_topic_prior, double topic_word_prior);
RcppExport SEXP _text2vec_warplda_create(SEXP n_topicsSEXP, SEXP doc_topic_priorSEXP, SEXP topic_word_priorSEXP) {
Expand Down Expand Up @@ -432,21 +432,11 @@ END_RCPP
}

static const R_CallMethodDef CallEntries[] = {
{"_text2vec_create_xptr_unordered_set", (DL_FUNC) &_text2vec_create_xptr_unordered_set, 1},
{"_text2vec_collapse_collocations_cpp", (DL_FUNC) &_text2vec_collapse_collocations_cpp, 4},
{"_text2vec_hasher", (DL_FUNC) &_text2vec_hasher, 2},
{"_text2vec_cpp_hash_corpus_create", (DL_FUNC) &_text2vec_cpp_hash_corpus_create, 4},
{"_text2vec_cpp_hash_corpus_insert_document_batch", (DL_FUNC) &_text2vec_cpp_hash_corpus_insert_document_batch, 6},
{"_text2vec_cpp_hash_corpus_get_tcm", (DL_FUNC) &_text2vec_cpp_hash_corpus_get_tcm, 1},
{"_text2vec_cpp_hash_corpus_get_dtm", (DL_FUNC) &_text2vec_cpp_hash_corpus_get_dtm, 1},
{"_text2vec_colMins", (DL_FUNC) &_text2vec_colMins, 1},
{"_text2vec_colMaxs", (DL_FUNC) &_text2vec_colMaxs, 1},
{"_text2vec_rowMins", (DL_FUNC) &_text2vec_rowMins, 1},
{"_text2vec_rowMaxs", (DL_FUNC) &_text2vec_rowMaxs, 1},
{"_text2vec_euclidean_dist", (DL_FUNC) &_text2vec_euclidean_dist, 2},
{"_text2vec_malloc_trim", (DL_FUNC) &_text2vec_malloc_trim, 0},
{"_text2vec_is_invalid_ptr", (DL_FUNC) &_text2vec_is_invalid_ptr, 1},
{"_text2vec_cpp_fixed_char_tokenizer", (DL_FUNC) &_text2vec_cpp_fixed_char_tokenizer, 2},
{"_text2vec_cpp_vocabulary_corpus_create", (DL_FUNC) &_text2vec_cpp_vocabulary_corpus_create, 5},
{"_text2vec_cpp_vocabulary_corpus_insert_document_batch", (DL_FUNC) &_text2vec_cpp_vocabulary_corpus_insert_document_batch, 7},
{"_text2vec_cpp_vocabulary_corpus_get_tcm", (DL_FUNC) &_text2vec_cpp_vocabulary_corpus_get_tcm, 1},
Expand All @@ -456,6 +446,16 @@ static const R_CallMethodDef CallEntries[] = {
{"_text2vec_cpp_vocabulary_insert_document_batch_xptr", (DL_FUNC) &_text2vec_cpp_vocabulary_insert_document_batch_xptr, 2},
{"_text2vec_cpp_get_vocab_statistics", (DL_FUNC) &_text2vec_cpp_get_vocab_statistics, 1},
{"_text2vec_cpp_get_document_count", (DL_FUNC) &_text2vec_cpp_get_document_count, 1},
{"_text2vec_create_xptr_unordered_set", (DL_FUNC) &_text2vec_create_xptr_unordered_set, 1},
{"_text2vec_collapse_collocations_cpp", (DL_FUNC) &_text2vec_collapse_collocations_cpp, 4},
{"_text2vec_colMins", (DL_FUNC) &_text2vec_colMins, 1},
{"_text2vec_colMaxs", (DL_FUNC) &_text2vec_colMaxs, 1},
{"_text2vec_rowMins", (DL_FUNC) &_text2vec_rowMins, 1},
{"_text2vec_rowMaxs", (DL_FUNC) &_text2vec_rowMaxs, 1},
{"_text2vec_euclidean_dist", (DL_FUNC) &_text2vec_euclidean_dist, 2},
{"_text2vec_malloc_trim", (DL_FUNC) &_text2vec_malloc_trim, 0},
{"_text2vec_is_invalid_ptr", (DL_FUNC) &_text2vec_is_invalid_ptr, 1},
{"_text2vec_cpp_fixed_char_tokenizer", (DL_FUNC) &_text2vec_cpp_fixed_char_tokenizer, 2},
{"_text2vec_warplda_create", (DL_FUNC) &_text2vec_warplda_create, 3},
{"_text2vec_warplda_init_dtm", (DL_FUNC) &_text2vec_warplda_init_dtm, 5},
{"_text2vec_warplda_set_topic_word_count", (DL_FUNC) &_text2vec_warplda_set_topic_word_count, 2},
Expand Down
Loading

0 comments on commit 6910527

Please sign in to comment.