Skip to content

Fix type annotation in _find_word_boundaries docstring - #1289

Merged
bact merged 2 commits into
devfrom
copilot/check-issue-1030-status
Feb 5, 2026
Merged

Fix type annotation in _find_word_boundaries docstring#1289
bact merged 2 commits into
devfrom
copilot/check-issue-1030-status

Conversation

Copilot AI commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

What do these changes do

Corrects type annotation inconsistency in pythainlp/benchmarks/word_tokenization.py docstring.

What was wrong

The _find_word_boundaries function signature correctly specified bin_reps: "np.ndarray", but the docstring incorrectly documented the parameter as str:

def _find_word_boundaries(bin_reps: "np.ndarray") -> list[tuple[int, int]]:
    """Find the starting and ending location of each word.

    :param str bin_reps: binary representation of a text  # ← Wrong type
    ...
    """

This mismatch between type annotation and documentation created confusion for type checkers and developers.

How this fixes it

Updates the docstring parameter type from str to numpy.ndarray:

:param numpy.ndarray bin_reps: binary representation of a text

Your checklist for this pull request

  • Passed code styles and structures
  • Passed code linting checks and unit test
Original prompt

Please check if this issue #1030 is fixed?


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: bact <128572+bact@users.noreply.github.com>
@sonarqubecloud

sonarqubecloud Bot commented Feb 5, 2026

Copy link
Copy Markdown

Copilot AI changed the title [WIP] Check if issue 1030 is fixed Fix type annotation in _find_word_boundaries docstring Feb 5, 2026
Copilot AI requested a review from bact February 5, 2026 14:13
@bact bact added the documentation improve documentation and test cases label Feb 5, 2026
@bact
bact marked this pull request as ready for review February 5, 2026 14:18
@bact
bact merged commit 8dafab7 into dev Feb 5, 2026
21 of 31 checks passed
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 64.791%. remained the same
when pulling 4847bb7 on copilot/check-issue-1030-status
into a498d65 on dev.

@bact bact added this to the 5.3 milestone Feb 6, 2026
@bact bact linked an issue Mar 2, 2026 that may be closed by this pull request
@bact
bact deleted the copilot/check-issue-1030-status branch March 10, 2026 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation improve documentation and test cases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incompatible types in benchmarks.word_tokenization

3 participants