-
Notifications
You must be signed in to change notification settings - Fork 915
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose stream parameter in public nvtext APIs (#14456)
Add stream parameter to public APIs: - `nvtext::is_letter()` - `nvtext::porter_stemmer_measure` - `nvtext::edit_distance()` - `nvtext::edit_distance_matrix()` Also cleaned up some of the doxygen comments and added stream gtests. Reference #13744 Authors: - David Wendt (https://github.com/davidwendt) Approvers: - Vyas Ramasubramani (https://github.com/vyasr) - Mark Harris (https://github.com/harrism) URL: #14456
- Loading branch information
1 parent
fcc8950
commit cfa2d51
Showing
7 changed files
with
148 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (c) 2023, NVIDIA CORPORATION. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <nvtext/edit_distance.hpp> | ||
|
||
#include <cudf_test/base_fixture.hpp> | ||
#include <cudf_test/column_wrapper.hpp> | ||
#include <cudf_test/default_stream.hpp> | ||
|
||
class TextEditDistanceTest : public cudf::test::BaseFixture {}; | ||
|
||
TEST_F(TextEditDistanceTest, EditDistance) | ||
{ | ||
auto const input = cudf::test::strings_column_wrapper({"dog", "cat", "mouse", "pupper"}); | ||
auto const input_view = cudf::strings_column_view(input); | ||
auto const target = cudf::test::strings_column_wrapper({"hog", "cake", "house", "puppy"}); | ||
auto const target_view = cudf::strings_column_view(target); | ||
nvtext::edit_distance(input_view, target_view, cudf::test::get_default_stream()); | ||
nvtext::edit_distance_matrix(input_view, cudf::test::get_default_stream()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) 2023, NVIDIA CORPORATION. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <nvtext/stemmer.hpp> | ||
|
||
#include <cudf_test/base_fixture.hpp> | ||
#include <cudf_test/column_wrapper.hpp> | ||
#include <cudf_test/default_stream.hpp> | ||
|
||
class TextStemmerTest : public cudf::test::BaseFixture {}; | ||
|
||
TEST_F(TextStemmerTest, IsLetter) | ||
{ | ||
auto const input = | ||
cudf::test::strings_column_wrapper({"abbey", "normal", "creates", "yearly", "trouble"}); | ||
auto const view = cudf::strings_column_view(input); | ||
auto const delimiter = cudf::string_scalar{" ", true, cudf::test::get_default_stream()}; | ||
nvtext::is_letter(view, nvtext::letter_type::VOWEL, 0, cudf::test::get_default_stream()); | ||
auto const indices = cudf::test::fixed_width_column_wrapper<int32_t>({0, 1, 3, 5, 4}); | ||
nvtext::is_letter(view, nvtext::letter_type::VOWEL, indices, cudf::test::get_default_stream()); | ||
} | ||
|
||
TEST_F(TextStemmerTest, Porter) | ||
{ | ||
auto const input = | ||
cudf::test::strings_column_wrapper({"abbey", "normal", "creates", "yearly", "trouble"}); | ||
auto const view = cudf::strings_column_view(input); | ||
nvtext::porter_stemmer_measure(view, cudf::test::get_default_stream()); | ||
} |