Skip to content

Commit

Permalink
fix pylibcudf declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwendt committed Sep 25, 2024
1 parent f703265 commit 3caea9d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
8 changes: 4 additions & 4 deletions python/pylibcudf/pylibcudf/libcudf/strings/findall.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ from pylibcudf.libcudf.strings.regex_program cimport regex_program
cdef extern from "cudf/strings/findall.hpp" namespace "cudf::strings" nogil:

cdef unique_ptr[column] findall(
column_view source_strings,
regex_program) except +
column_view input,
regex_program prog) except +

cdef unique_ptr[column] find_re(
column_view source_strings,
regex_program) except +
column_view input,
regex_program prog) except +
1 change: 1 addition & 0 deletions python/pylibcudf/pylibcudf/strings/findall.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ from pylibcudf.column cimport Column
from pylibcudf.strings.regex_program cimport RegexProgram


cpdef Column find_re(Column input, RegexProgram pattern)
cpdef Column findall(Column input, RegexProgram pattern)
30 changes: 30 additions & 0 deletions python/pylibcudf/pylibcudf/strings/findall.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,33 @@ cpdef Column findall(Column input, RegexProgram pattern):
)

return Column.from_libcudf(move(c_result))


cpdef Column find_re(Column input, RegexProgram pattern):
"""
Returns character positions where the pattern first matches
the elements in source_strings.
For details, see For details, see :cpp:func:`cudf::strings::find_re`.
Parameters
----------
input : Column
Strings instance for this operation
pattern : RegexProgram
Regex pattern
Returns
-------
Column
New column of integers
"""
cdef unique_ptr[column] c_result

with nogil:
c_result = move(
cpp_findall.find_re(
input.view(),
pattern.c_obj.get()[0]
)
)

return Column.from_libcudf(move(c_result))

0 comments on commit 3caea9d

Please sign in to comment.