Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ispunct function to check if a word is a punctuation #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chenghf
Copy link

@chenghf chenghf commented Oct 24, 2024

No description provided.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

@@ -503,6 +503,10 @@ for idx,value in ipairs({ 1, 5 }) do
assert(clusters[idx] == value)
end

local str = '中文标点符号测试:文字内容,98满意,hello world'
for p, ch in utf8.codes(str) do
print (ch, utf8.char(ch), utf8.ispunct(ch))
Copy link
Contributor

Choose a reason for hiding this comment

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

Just printing an output isn't enough to test this, you need to actually have some test or assertion that proves the result is what it is expected to be for a given input.

@starwing
Copy link
Owner

starwing commented Oct 24, 2024

I'm not very approve with this API, you should just use "%p" to match a Unicode punctuation. If you add this one, all Unicode categories should all have their own API. That makes this library messy.

@chenghf
Copy link
Author

chenghf commented Oct 25, 2024 via email

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.

3 participants