Skip to content

fix the connectivity of cli commands - #1154

Merged
wannaphong merged 9 commits into
PyThaiNLP:devfrom
kartik912:fix/help
Oct 20, 2025
Merged

fix the connectivity of cli commands#1154
wannaphong merged 9 commits into
PyThaiNLP:devfrom
kartik912:fix/help

Conversation

@kartik912

Copy link
Copy Markdown
Contributor

What does this changes

i changes the cli init file, and now the commands

  • !thainlp tokenize --help
  • !thainlp soundex วรรณ

show output

BEFORE

before

AFTER

after

What was wrong

The root cause of this issue is a missing import dependency that creates a disconnect between command registration and command execution.

How this fixes it

Updated the import statement in the command line helpers module to explicitly import the tokenize and soundex submodules from pythainlp.cli. This change ensures that these modules are properly loaded and available for use by the command-line interface, preventing the no-output problem faced earlier.

Fixes #1151

Your checklist for this pull request

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

@kartik912

Copy link
Copy Markdown
Contributor Author

@bact hello, please check this PR and consider merging

@wannaphong

Copy link
Copy Markdown
Member

Could you add tag, benchmark, and misspell? I think the modules aren't working too.

@coveralls

coveralls commented Oct 14, 2025

Copy link
Copy Markdown

Coverage Status

coverage: 53.331% (+0.4%) from 52.907%
when pulling e9babd3 on kartik912:fix/help
into 720f784 on PyThaiNLP:dev.

@kartik912

Copy link
Copy Markdown
Contributor Author

@wannaphong i added those also

@kartik912

Copy link
Copy Markdown
Contributor Author

why is there so many failed test, can anyone guide me about how to fix this if this is my part to do

Comment thread pythainlp/cli/__init__.py
Comment on lines +40 to +49
if __name__ == "__main__":
# Create a simple mapping from command name to the imported module
COMMAND_MAP = {
"tokenize": tokenize,
"soundex": soundex,
"tag": tag,
"benchmark": benchmark,
"misspell": misspell,

}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we have all these at line 15 already?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we have all these at line 15 already?

you are right @bact , but the problem is only resolved if I import those libraries in this file, but your tests shows an error stating that the libraries were never used, that is why I have to explicitly add those, if you want I can remove them .

@wannaphong

Copy link
Copy Markdown
Member

why is there so many failed test, can anyone guide me about how to fix this if this is my part to do

Can you add pyyaml to https://github.com/PyThaiNLP/pythainlp/blob/dev/setup.py#L44?

@sonarqubecloud

Copy link
Copy Markdown

@kartik912

Copy link
Copy Markdown
Contributor Author

@wannaphong hey, i know i am doing a lot of errors, it would be great if you can approve this again one last time, i think this time everything should be fine.

@kartik912

Copy link
Copy Markdown
Contributor Author

@bact , please review and consider merging

@wannaphong

Copy link
Copy Markdown
Member

@wannaphong
wannaphong requested a review from bact October 16, 2025 15:34
@wannaphong wannaphong added the hacktoberfest-accepted hacktoberfest accepted pull requests. label Oct 19, 2025
@wannaphong
wannaphong merged commit a14b4b5 into PyThaiNLP:dev Oct 20, 2025
26 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted hacktoberfest accepted pull requests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: thainlp command line is not working with Python 3.12

4 participants