| 553 | } |
| 554 | |
| 555 | static std::vector<size_t> unicode_regex_split_custom(const std::string & text, const std::string & regex_expr, const std::vector<size_t> & offsets) { |
| 556 | std::vector<size_t> bpe_offsets; |
| 557 | |
| 558 | if (regex_expr == "'s|'t|'re|'ve|'m|'ll|'d| ?\\p{L}+| ?\\p{N}+| ?[^\\s\\p{L}\\p{N}]+|\\s+(?!\\S)") { |
| 559 | bpe_offsets = unicode_regex_split_custom_gpt2(text, offsets); |
| 560 | } else if ( |
| 561 | regex_expr == "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?\\p{L}+|\\p{N}{1,3}| ?[^\\s\\p{L}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+" || |
| 562 | regex_expr == "(?:'[sS]|'[tT]|'[rR][eE]|'[vV][eE]|'[mM]|'[lL][lL]|'[dD])|[^\\r\\n\\p{L}\\p{N}]?\\p{L}+|\\p{N}{1,3}| ?[^\\s\\p{L}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+") { |
| 563 | |
| 564 | bpe_offsets = unicode_regex_split_custom_llama3(text, offsets); |
| 565 | } |
| 566 | |
| 567 | return bpe_offsets; |
| 568 | } |
| 569 | |
| 570 | // |
| 571 | // interface |
no test coverage detected