Skip to content

fix: tokenize validate_word_constraint like IFEvalG#1779

Open
Chessing234 wants to merge 2 commits into
allenai:mainfrom
Chessing234:fix/word-constraint-tokenize
Open

fix: tokenize validate_word_constraint like IFEvalG#1779
Chessing234 wants to merge 2 commits into
allenai:mainfrom
Chessing234:fix/word-constraint-tokenize

Conversation

@Chessing234

@Chessing234 Chessing234 commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Whitespace split() undercounted punctuated text (It's as one token).
  • Use \w+ tokens like IFEvalG count_words.

Test plan

  • TestValidateWordConstraint

GPU_TESTS=bypass
CHANGELOG=

Chessing234 and others added 2 commits July 18, 2026 20:02
Whitespace split undercounted words with punctuation (It's → one token).

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the validate_word_constraint function in open_instruct/if_functions.py to tokenize words using re.findall(r"\w+", text) instead of text.strip().split(), aligning it with the IFEvalG count_words behavior. It also adds corresponding unit tests in open_instruct/test_if_functions.py and updates the CHANGELOG.md. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

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.

1 participant