Skip to content

Conversation

@f291400
Copy link

@f291400 f291400 commented Dec 29, 2025

No description provided.

@f291400
Copy link
Author

f291400 commented Dec 29, 2025

@ochafik please check again

Copy link
Owner

@ochafik ochafik left a comment

Choose a reason for hiding this comment

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

Hi @f291400 , thanks for opening this PR

The tests seem to cover something different than rsplit. Can you drop those changes and add a test for rsplit in test-syntax, and also mention in which template you've seen this? (if this unlock a new template, can you add it to the tested model ids in tests/CMakeLists.txt ?)

As for the thinking tests, I'm preparing an overhaul of thinking patterns in templates and their testing, stay tuned!

@f291400
Copy link
Author

f291400 commented Dec 30, 2025

@ochafik Currently, none of the open-source large language models use rsplit; this is used in the custom YouTu-LLM model, which will be open-sourced soon.
I just deleted the relevant test code, please check it again.

@f291400
Copy link
Author

f291400 commented Jan 1, 2026

Could you kindly review the current submission?

@CISC
Copy link
Collaborator

CISC commented Jan 3, 2026

@ochafik gentle ping

Comment on lines +1458 to +1463
int splits = 0;
while (end != std::string::npos && (maxsplit < 0 || splits < maxsplit)) {
result.push_back(s.substr(start, end - start));
start = end + sep.length();
end = s.find(sep, start);
splits++;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
int splits = 0;
while (end != std::string::npos && (maxsplit < 0 || splits < maxsplit)) {
result.push_back(s.substr(start, end - start));
start = end + sep.length();
end = s.find(sep, start);
splits++;
while (end != std::string::npos && maxsplit != 0) {
result.push_back(s.substr(start, end - start));
start = end + sep.length();
end = s.find(sep, start);
--maxsplit;

Comment on lines +1473 to +1481
int splits = 0;
while (pos != std::string::npos && (maxsplit < 0 || splits < maxsplit)) {
result.insert(result.begin(), s.substr(pos + sep.length(), end - pos - sep.length()));
end = pos;
splits++;
if (pos == 0) break;
pos = s.rfind(sep, pos - 1);
}
result.insert(result.begin(), s.substr(0, end));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
int splits = 0;
while (pos != std::string::npos && (maxsplit < 0 || splits < maxsplit)) {
result.insert(result.begin(), s.substr(pos + sep.length(), end - pos - sep.length()));
end = pos;
splits++;
if (pos == 0) break;
pos = s.rfind(sep, pos - 1);
}
result.insert(result.begin(), s.substr(0, end));
while (pos != std::string::npos && maxsplit != 0) {
result.push_back(s.substr(pos + sep.length(), end - pos - sep.length()));
end = pos;
--maxsplit;
if (pos == 0) break;
pos = s.rfind(sep, pos - 1);
}
result.push_back(s.substr(0, end));
std::reverse(result.begin(), result.end());

auto charset = chars.empty() ? " \t\n\r" : chars;
auto start = left ? s.find_first_not_of(charset) : 0;
if (start == std::string::npos) return "";
if (start == std::string::npos) return "";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (start == std::string::npos) return "";
if (start == std::string::npos) return "";

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