Repository navigation
fix(content): count a Hindi word with its vowel signs as one in the rules, as Readability does (#1411 follow-up) - #1444
Merged
Conversation
…ules, as Readability does (ansvisor#1411 follow-up) The Rules tab's word counts (a summary's words, a section's answer, an intro's length) split a Hindi word at each vowel sign: they are marks, not letters, so "वाक्य" counted as three words. The rules now count words with Readability's own counter (countWords), which keeps a mark inside its word. Co-Authored-By: Claude Opus 5.5 <[email protected]>
gkhngyk
approved these changes
Oct 24, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good. With one shared countWords, the rules and Readability count words the same way. Nothing else imported the removed rules.ts export, and readability.ts doesn't import rules.ts, so this adds no import cycle. The test covers both the Hindi case and inner apostrophes and hyphens.
8 of 12 tasks
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 24, 2026
ansvisor#1433 is on main (squash-merged), with ansvisor#1429–ansvisor#1436 and ansvisor#1442/ansvisor#1444; this branch's own change (Send to CMS part 2) is applied on top. Co-Authored-By: Claude Opus 5.5 <[email protected]>
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 24, 2026
…library ansvisor#1438's branch now has main (ansvisor#1429–ansvisor#1436, ansvisor#1442, ansvisor#1444); this branch's own changes (Send to CMS part 3a) are applied on top. Co-Authored-By: Claude Opus 5.5 <[email protected]>
cihan-gyk
added a commit
to cihan-gyk/ansvisor
that referenced
this pull request
Oct 24, 2026
…-bulk ansvisor#1439's branch now has main (ansvisor#1429–ansvisor#1436, ansvisor#1442, ansvisor#1444); this branch's own change (Send to CMS part 3b) is applied on top. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #1411. That PR made Readability keep a Hindi vowel sign inside its word. The Rules tab's own counter (
rules.ts countWords) didn't do the same.\p{M}), not letters, so the rules' counter broke a word at each one. For example, "वाक्य" counted as three words.The fix:
rules.tsnow counts words with Readability'scountWords, now exported, instead of its own copy without\p{M}. The rules and Readability count words one way.English and other spaced scripts count as before; a test checks that apostrophes and hyphens stay inside a word.
Related issue
Follow-up to #1411.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
Run
cd web && npx vitest run src/lib/content/rules.test.ts. "यह पहला वाक्य है। यह दूसरा है।" now counts 7 words; the old counter gave 10.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/): 0 errors, 6 existing warnings in files this PR doesn't touchyarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Also run:
yarn test(362 files / 3281 tests) andyarn buildwith CI's placeholder env.🤖 Generated with Claude Code