-
Notifications
You must be signed in to change notification settings - Fork 4
support rsplit #24
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
base: main
Are you sure you want to change the base?
support rsplit #24
Conversation
|
@ochafik please check again |
ochafik
left a comment
There was a problem hiding this 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!
|
@ochafik Currently, none of the open-source large language models use |
|
Could you kindly review the current submission? |
|
@ochafik gentle ping |
| 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++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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; |
| 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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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 ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (start == std::string::npos) return ""; | |
| if (start == std::string::npos) return ""; |
No description provided.