Support re2 == 2023-06-02 (#16257)

### Description

google/re2 [was
switched](49d776b9d2)
to absl::string_view in version 2023-06-02.

As `absl::string_view` is a drop-in replacement for `std::string_view`
it does not have `as_string()` method.
This PR ensures the forward compatibility with the newest versions of
re2 library.
This commit is contained in:
Yuriy Chernyshov 2023-06-08 20:26:26 +02:00 committed by GitHub
parent b07b647f66
commit a3a443c804
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -242,7 +242,7 @@ Status Tokenizer::SeparatorExpressionTokenizer(OpKernelContext* ctx,
token_len, utf8_chars);
if (!valid) {
return Status(common::ONNXRUNTIME, common::INVALID_ARGUMENT,
"Match contains invalid utf8 chars: " + submatch.as_string());
"Match contains invalid utf8 chars: " + std::string{submatch});
}
if (utf8_chars >= size_t(mincharnum_)) {
tokens.emplace_back(text.data() + start_pos, token_len);
@ -384,7 +384,7 @@ Status Tokenizer::TokenExpression(OpKernelContext* ctx,
utf8_chars = 0;
if (!utf8_len(reinterpret_cast<const unsigned char*>(submatch.data()), token_len, utf8_chars)) {
return Status(common::ONNXRUNTIME, common::INVALID_ARGUMENT,
"Match contains invalid utf8 chars: " + submatch.as_string());
"Match contains invalid utf8 chars: " + std::string{submatch});
}
if (utf8_chars >= size_t(mincharnum_)) {
row.push_back(submatch);