Skip to content

Commit

Permalink
Change Rcpp::CharacterVector by Rcpp::StringVector for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
AbrJA committed Jun 28, 2023
1 parent 937477f commit 99ccc69
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions src/KeywordProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ SEXP loadTrie(const std::string& trieStr) {
}

// [[Rcpp::export]]
SEXP buildTrie(const Rcpp::CharacterVector& keys, const Rcpp::CharacterVector& values, const std::string& id) {
SEXP buildTrie(const Rcpp::StringVector& keys, const Rcpp::StringVector& values, const std::string& id) {
json trie;
const Rcpp::LogicalVector keys_na = Rcpp::is_na(keys);
const int size = keys.size();
Expand All @@ -50,7 +50,7 @@ SEXP buildTrie(const Rcpp::CharacterVector& keys, const Rcpp::CharacterVector& v
}

// [[Rcpp::export]]
int addKeysWords(SEXP ptr, const Rcpp::CharacterVector& keys, const Rcpp::CharacterVector& values, const std::string& id) {
int addKeysWords(SEXP ptr, const Rcpp::StringVector& keys, const Rcpp::StringVector& values, const std::string& id) {
Rcpp::XPtr<json> trie(ptr);
int counter = 0;
const Rcpp::LogicalVector keys_na = Rcpp::is_na(keys);
Expand All @@ -77,7 +77,7 @@ std::string dumpTrie(SEXP ptr) {
}

// [[Rcpp::export]]
Rcpp::LogicalVector containKeys(SEXP ptr, const Rcpp::CharacterVector& keys, const std::string& id) {
Rcpp::LogicalVector containKeys(SEXP ptr, const Rcpp::StringVector& keys, const std::string& id) {
const Rcpp::XPtr<json> trie(ptr);
const int size = keys.size();
Rcpp::LogicalVector is_in(size);
Expand All @@ -92,7 +92,7 @@ Rcpp::LogicalVector containKeys(SEXP ptr, const Rcpp::CharacterVector& keys, con
}

// [[Rcpp::export]]
Rcpp::StringVector getWords(SEXP ptr, const Rcpp::CharacterVector& keys, const std::string& id) {
Rcpp::StringVector getWords(SEXP ptr, const Rcpp::StringVector& keys, const std::string& id) {
const Rcpp::XPtr<json> trie(ptr);
const int size = keys.size();
Rcpp::StringVector words(size);
Expand All @@ -113,7 +113,7 @@ Rcpp::StringVector getWords(SEXP ptr, const Rcpp::CharacterVector& keys, const s
}

// [[Rcpp::export]]
Rcpp::List findKeys(SEXP ptr, const Rcpp::CharacterVector& sentences, const std::string& word_chars, const std::string& id, bool span_info) {
Rcpp::List findKeys(SEXP ptr, const Rcpp::StringVector& sentences, const std::string& word_chars, const std::string& id, bool span_info) {
const Rcpp::XPtr<json> trie(ptr);
const int lens = sentences.length();
Rcpp::List keys_found(lens);
Expand Down Expand Up @@ -204,7 +204,7 @@ Rcpp::List findKeys(SEXP ptr, const Rcpp::CharacterVector& sentences, const std:
}

// [[Rcpp::export]]
Rcpp::StringVector replaceKeys(SEXP ptr, const Rcpp::CharacterVector& sentences, const std::string& word_chars, const std::string& id) {
Rcpp::StringVector replaceKeys(SEXP ptr, const Rcpp::StringVector& sentences, const std::string& word_chars, const std::string& id) {
const Rcpp::XPtr<json> trie(ptr);
const int lens = sentences.length();
const Rcpp::LogicalVector sentences_na = Rcpp::is_na(sentences);
Expand Down
28 changes: 14 additions & 14 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ BEGIN_RCPP
END_RCPP
}
// buildTrie
SEXP buildTrie(const Rcpp::CharacterVector& keys, const Rcpp::CharacterVector& values, const std::string& id);
SEXP buildTrie(const Rcpp::StringVector& keys, const Rcpp::StringVector& values, const std::string& id);
RcppExport SEXP _rflashtext_buildTrie(SEXP keysSEXP, SEXP valuesSEXP, SEXP idSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< const Rcpp::CharacterVector& >::type keys(keysSEXP);
Rcpp::traits::input_parameter< const Rcpp::CharacterVector& >::type values(valuesSEXP);
Rcpp::traits::input_parameter< const Rcpp::StringVector& >::type keys(keysSEXP);
Rcpp::traits::input_parameter< const Rcpp::StringVector& >::type values(valuesSEXP);
Rcpp::traits::input_parameter< const std::string& >::type id(idSEXP);
rcpp_result_gen = Rcpp::wrap(buildTrie(keys, values, id));
return rcpp_result_gen;
END_RCPP
}
// addKeysWords
int addKeysWords(SEXP ptr, const Rcpp::CharacterVector& keys, const Rcpp::CharacterVector& values, const std::string& id);
int addKeysWords(SEXP ptr, const Rcpp::StringVector& keys, const Rcpp::StringVector& values, const std::string& id);
RcppExport SEXP _rflashtext_addKeysWords(SEXP ptrSEXP, SEXP keysSEXP, SEXP valuesSEXP, SEXP idSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< SEXP >::type ptr(ptrSEXP);
Rcpp::traits::input_parameter< const Rcpp::CharacterVector& >::type keys(keysSEXP);
Rcpp::traits::input_parameter< const Rcpp::CharacterVector& >::type values(valuesSEXP);
Rcpp::traits::input_parameter< const Rcpp::StringVector& >::type keys(keysSEXP);
Rcpp::traits::input_parameter< const Rcpp::StringVector& >::type values(valuesSEXP);
Rcpp::traits::input_parameter< const std::string& >::type id(idSEXP);
rcpp_result_gen = Rcpp::wrap(addKeysWords(ptr, keys, values, id));
return rcpp_result_gen;
Expand All @@ -60,39 +60,39 @@ BEGIN_RCPP
END_RCPP
}
// containKeys
Rcpp::LogicalVector containKeys(SEXP ptr, const Rcpp::CharacterVector& keys, const std::string& id);
Rcpp::LogicalVector containKeys(SEXP ptr, const Rcpp::StringVector& keys, const std::string& id);
RcppExport SEXP _rflashtext_containKeys(SEXP ptrSEXP, SEXP keysSEXP, SEXP idSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< SEXP >::type ptr(ptrSEXP);
Rcpp::traits::input_parameter< const Rcpp::CharacterVector& >::type keys(keysSEXP);
Rcpp::traits::input_parameter< const Rcpp::StringVector& >::type keys(keysSEXP);
Rcpp::traits::input_parameter< const std::string& >::type id(idSEXP);
rcpp_result_gen = Rcpp::wrap(containKeys(ptr, keys, id));
return rcpp_result_gen;
END_RCPP
}
// getWords
Rcpp::StringVector getWords(SEXP ptr, const Rcpp::CharacterVector& keys, const std::string& id);
Rcpp::StringVector getWords(SEXP ptr, const Rcpp::StringVector& keys, const std::string& id);
RcppExport SEXP _rflashtext_getWords(SEXP ptrSEXP, SEXP keysSEXP, SEXP idSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< SEXP >::type ptr(ptrSEXP);
Rcpp::traits::input_parameter< const Rcpp::CharacterVector& >::type keys(keysSEXP);
Rcpp::traits::input_parameter< const Rcpp::StringVector& >::type keys(keysSEXP);
Rcpp::traits::input_parameter< const std::string& >::type id(idSEXP);
rcpp_result_gen = Rcpp::wrap(getWords(ptr, keys, id));
return rcpp_result_gen;
END_RCPP
}
// findKeys
Rcpp::List findKeys(SEXP ptr, const Rcpp::CharacterVector& sentences, const std::string& word_chars, const std::string& id, bool span_info);
Rcpp::List findKeys(SEXP ptr, const Rcpp::StringVector& sentences, const std::string& word_chars, const std::string& id, bool span_info);
RcppExport SEXP _rflashtext_findKeys(SEXP ptrSEXP, SEXP sentencesSEXP, SEXP word_charsSEXP, SEXP idSEXP, SEXP span_infoSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< SEXP >::type ptr(ptrSEXP);
Rcpp::traits::input_parameter< const Rcpp::CharacterVector& >::type sentences(sentencesSEXP);
Rcpp::traits::input_parameter< const Rcpp::StringVector& >::type sentences(sentencesSEXP);
Rcpp::traits::input_parameter< const std::string& >::type word_chars(word_charsSEXP);
Rcpp::traits::input_parameter< const std::string& >::type id(idSEXP);
Rcpp::traits::input_parameter< bool >::type span_info(span_infoSEXP);
Expand All @@ -101,13 +101,13 @@ BEGIN_RCPP
END_RCPP
}
// replaceKeys
Rcpp::StringVector replaceKeys(SEXP ptr, const Rcpp::CharacterVector& sentences, const std::string& word_chars, const std::string& id);
Rcpp::StringVector replaceKeys(SEXP ptr, const Rcpp::StringVector& sentences, const std::string& word_chars, const std::string& id);
RcppExport SEXP _rflashtext_replaceKeys(SEXP ptrSEXP, SEXP sentencesSEXP, SEXP word_charsSEXP, SEXP idSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< SEXP >::type ptr(ptrSEXP);
Rcpp::traits::input_parameter< const Rcpp::CharacterVector& >::type sentences(sentencesSEXP);
Rcpp::traits::input_parameter< const Rcpp::StringVector& >::type sentences(sentencesSEXP);
Rcpp::traits::input_parameter< const std::string& >::type word_chars(word_charsSEXP);
Rcpp::traits::input_parameter< const std::string& >::type id(idSEXP);
rcpp_result_gen = Rcpp::wrap(replaceKeys(ptr, sentences, word_chars, id));
Expand Down

0 comments on commit 99ccc69

Please sign in to comment.