Skip to content

Conversation

kartik912
Copy link

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
Author

@bact hello, please check this PR and consider merging

@wannaphong
Copy link
Member

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

@coveralls
Copy link

coveralls commented Oct 14, 2025

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
Author

@wannaphong i added those also

@kartik912
Copy link
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 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
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
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
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?

Copy link

@kartik912
Copy link
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
Author

@bact , please review and consider merging

@wannaphong
Copy link
Member

@wannaphong wannaphong requested a review from bact October 16, 2025 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

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