Skip to content

Commit

Permalink
Remove default parameters for nvtext::detail functions (#12007)
Browse files Browse the repository at this point in the history
Removes default parameters from the `nvtext::detail` functions. Most of these were internal default parameters which were unnecessary. The nvtext detail functions are only used within nvtext APIs.

Reference #11967

Authors:
  - David Wendt (https://github.com/davidwendt)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - Nghia Truong (https://github.com/ttnghia)

URL: #12007
  • Loading branch information
davidwendt authored Nov 1, 2022
1 parent a5aaa52 commit 991c86b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 39 deletions.
38 changes: 16 additions & 22 deletions cpp/include/nvtext/detail/tokenize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ namespace detail {
* @param mr Device memory resource used to allocate the returned column's device memory.
* @return New strings columns of tokens.
*/
std::unique_ptr<cudf::column> tokenize(
cudf::strings_column_view const& strings,
cudf::string_scalar const& delimiter = cudf::string_scalar{""},
// Move before delimiter?
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
std::unique_ptr<cudf::column> tokenize(cudf::strings_column_view const& strings,
cudf::string_scalar const& delimiter,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);

/**
* @copydoc nvtext::tokenize(strings_column_view const&,strings_column_view
Expand All @@ -52,11 +50,10 @@ std::unique_ptr<cudf::column> tokenize(
* @param mr Device memory resource used to allocate the returned column's device memory.
* @return New strings columns of tokens.
*/
std::unique_ptr<cudf::column> tokenize(
cudf::strings_column_view const& strings,
cudf::strings_column_view const& delimiters,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
std::unique_ptr<cudf::column> tokenize(cudf::strings_column_view const& strings,
cudf::strings_column_view const& delimiters,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);

/**
* @copydoc nvtext::count_tokens(strings_column_view const&, string_scalar
Expand All @@ -69,12 +66,10 @@ std::unique_ptr<cudf::column> tokenize(
* @param mr Device memory resource used to allocate the returned column's device memory.
* @return New INT32 column of token counts.
*/
std::unique_ptr<cudf::column> count_tokens(
cudf::strings_column_view const& strings,
cudf::string_scalar const& delimiter = cudf::string_scalar{""},
// Move before delimiter?
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
std::unique_ptr<cudf::column> count_tokens(cudf::strings_column_view const& strings,
cudf::string_scalar const& delimiter,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);

/**
* @copydoc nvtext::count_tokens(strings_column_view const&,strings_column_view
Expand All @@ -86,11 +81,10 @@ std::unique_ptr<cudf::column> count_tokens(
* @param mr Device memory resource used to allocate the returned column's device memory.
* @return New INT32 column of token counts.
*/
std::unique_ptr<cudf::column> count_tokens(
cudf::strings_column_view const& strings,
cudf::strings_column_view const& delimiters,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
std::unique_ptr<cudf::column> count_tokens(cudf::strings_column_view const& strings,
cudf::strings_column_view const& delimiters,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr);

} // namespace detail
} // namespace nvtext
11 changes: 5 additions & 6 deletions cpp/src/text/generate_ngrams.cu
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,11 @@ struct ngram_generator_fn {

} // namespace

std::unique_ptr<cudf::column> generate_ngrams(
cudf::strings_column_view const& strings,
cudf::size_type ngrams = 2,
cudf::string_scalar const& separator = cudf::string_scalar{"_"},
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
std::unique_ptr<cudf::column> generate_ngrams(cudf::strings_column_view const& strings,
cudf::size_type ngrams,
cudf::string_scalar const& separator,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
CUDF_EXPECTS(separator.is_valid(stream), "Parameter separator must be valid");
cudf::string_view const d_separator(separator.data(), separator.size());
Expand Down
13 changes: 6 additions & 7 deletions cpp/src/text/ngrams_tokenize.cu
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,12 @@ struct ngram_builder_fn {

// detail APIs

std::unique_ptr<cudf::column> ngrams_tokenize(
cudf::strings_column_view const& strings,
cudf::size_type ngrams = 2,
cudf::string_scalar const& delimiter = cudf::string_scalar(""),
cudf::string_scalar const& separator = cudf::string_scalar{"_"},
rmm::cuda_stream_view stream = cudf::get_default_stream(),
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
std::unique_ptr<cudf::column> ngrams_tokenize(cudf::strings_column_view const& strings,
cudf::size_type ngrams,
cudf::string_scalar const& delimiter,
cudf::string_scalar const& separator,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
CUDF_EXPECTS(delimiter.is_valid(stream), "Parameter delimiter must be valid");
cudf::string_view d_delimiter(delimiter.data(), delimiter.size());
Expand Down
7 changes: 3 additions & 4 deletions cpp/src/text/normalize.cu
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,9 @@ struct codepoint_to_utf8_fn {
} // namespace

// detail API
std::unique_ptr<cudf::column> normalize_spaces(
cudf::strings_column_view const& strings,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource())
std::unique_ptr<cudf::column> normalize_spaces(cudf::strings_column_view const& strings,
rmm::cuda_stream_view stream,
rmm::mr::device_memory_resource* mr)
{
if (strings.is_empty()) return cudf::make_empty_column(cudf::data_type{cudf::type_id::STRING});

Expand Down

0 comments on commit 991c86b

Please sign in to comment.