diff --git a/tensorflow_text/core/kernels/constrained_sequence_kernel.cc b/tensorflow_text/core/kernels/constrained_sequence_kernel.cc index cda1f3a25..2d007e59f 100644 --- a/tensorflow_text/core/kernels/constrained_sequence_kernel.cc +++ b/tensorflow_text/core/kernels/constrained_sequence_kernel.cc @@ -78,7 +78,7 @@ tensorflow::Status ValidateConstraintTensor(const Tensor &tensor, " when num_states is ", num_states, " and use_start_and_end_states is ", use_start_end_states)); } - return tensorflow::OkStatus(); + return absl::OkStatus(); } } // namespace diff --git a/tensorflow_text/core/kernels/mst_op_kernels.cc b/tensorflow_text/core/kernels/mst_op_kernels.cc index 5d41b6ce5..0de52f70b 100644 --- a/tensorflow_text/core/kernels/mst_op_kernels.cc +++ b/tensorflow_text/core/kernels/mst_op_kernels.cc @@ -166,7 +166,7 @@ class MaxSpanningTreeOpKernel : public tensorflow::OpKernel { argmax_sources_bxm(problem, i) = -1; } - return tensorflow::OkStatus(); + return absl::OkStatus(); } private: diff --git a/tensorflow_text/core/kernels/mst_solver.h b/tensorflow_text/core/kernels/mst_solver.h index 3dcc1f053..818518bc2 100644 --- a/tensorflow_text/core/kernels/mst_solver.h +++ b/tensorflow_text/core/kernels/mst_solver.h @@ -337,7 +337,7 @@ tensorflow::Status MstSolver::Init(bool forest, Index num_nodes) { // This doesn't need to be cleared now; it will be cleared before use. cycle_.reserve(num_original_nodes_); - return tensorflow::OkStatus(); + return absl::OkStatus(); } template @@ -378,7 +378,7 @@ tensorflow::Status MstSolver::Solve(absl::Span argmax) { MaybePenalizeRootScoresForTree(); TF_RETURN_IF_ERROR(ContractionPhase()); TF_RETURN_IF_ERROR(ExpansionPhase(argmax)); - return tensorflow::OkStatus(); + return absl::OkStatus(); } template @@ -537,7 +537,7 @@ tensorflow::Status MstSolver::ContractionPhase() { } } - return tensorflow::OkStatus(); + return absl::OkStatus(); } template @@ -599,7 +599,7 @@ tensorflow::Status MstSolver::ExpansionPhase( return tensorflow::errors::FailedPrecondition("Infeasible digraph"); } - return tensorflow::OkStatus(); + return absl::OkStatus(); } } // namespace text diff --git a/tensorflow_text/core/kernels/sentence_breaking_kernels.cc b/tensorflow_text/core/kernels/sentence_breaking_kernels.cc index 0cd68cf30..1fd3e38d5 100644 --- a/tensorflow_text/core/kernels/sentence_breaking_kernels.cc +++ b/tensorflow_text/core/kernels/sentence_breaking_kernels.cc @@ -117,7 +117,7 @@ Status GetErrorOptions(OpKernelConstruction* context, ErrorOptions* out) { &(out->replace_control_chars))); } - return OkStatus(); + return absl::OkStatus(); } inline bool ShouldHandleFormatError(const ErrorOptions& error_options, diff --git a/tensorflow_text/core/kernels/sentence_breaking_utils.cc b/tensorflow_text/core/kernels/sentence_breaking_utils.cc index 0fb907526..bbfd53674 100644 --- a/tensorflow_text/core/kernels/sentence_breaking_utils.cc +++ b/tensorflow_text/core/kernels/sentence_breaking_utils.cc @@ -51,7 +51,7 @@ Status UnicodeUtil::GetOneUChar(const absl::string_view& input, *has_more_than_one_char = false; } - return ::tensorflow::OkStatus(); + return absl::OkStatus(); } Status UnicodeUtil::IsTerminalPunc(const absl::string_view& input, @@ -60,7 +60,7 @@ Status UnicodeUtil::IsTerminalPunc(const absl::string_view& input, const auto& ellipsis_status = IsEllipsis(input, result); // If there was a error decoding, or if we found an ellipsis, then return. if (!ellipsis_status.ok()) return ellipsis_status; - if (*result) return OkStatus(); + if (*result) return absl::OkStatus(); bool has_more_than_one_char = false; UChar32 char_value; @@ -68,7 +68,7 @@ Status UnicodeUtil::IsTerminalPunc(const absl::string_view& input, if (!status.ok()) return status; if (has_more_than_one_char) { *result = false; - return OkStatus(); + return absl::OkStatus(); } // These are unicode characters that should be considered in this category but @@ -80,13 +80,13 @@ Status UnicodeUtil::IsTerminalPunc(const absl::string_view& input, case 0x037E: // Greek question mark case 0x2026: // ellipsis *result = true; - return OkStatus(); + return absl::OkStatus(); } USentenceBreak sb_property = static_cast( u_getIntPropertyValue(char_value, UCHAR_SENTENCE_BREAK)); *result = sb_property == U_SB_ATERM || sb_property == U_SB_STERM; - return OkStatus(); + return absl::OkStatus(); } Status UnicodeUtil::IsClosePunc(const absl::string_view& input, @@ -94,7 +94,7 @@ Status UnicodeUtil::IsClosePunc(const absl::string_view& input, *result = false; if (input == "''") { *result = true; - return OkStatus(); + return absl::OkStatus(); } bool has_more_than_one_char = false; @@ -103,7 +103,7 @@ Status UnicodeUtil::IsClosePunc(const absl::string_view& input, if (!status.ok()) return status; if (has_more_than_one_char) { *result = false; - return OkStatus(); + return absl::OkStatus(); } // These are unicode characters that should be considered in this category but @@ -116,7 +116,7 @@ Status UnicodeUtil::IsClosePunc(const absl::string_view& input, case 65282: // fullwidth quotation mark case 65287: // fullwidth apostrophe *result = true; - return OkStatus(); + return absl::OkStatus(); } ULineBreak lb_property = static_cast( @@ -125,7 +125,7 @@ Status UnicodeUtil::IsClosePunc(const absl::string_view& input, *result = lb_property == U_LB_CLOSE_PUNCTUATION || lb_property == U_LB_CLOSE_PARENTHESIS || lb_property == U_LB_QUOTATION; - return OkStatus(); + return absl::OkStatus(); } Status UnicodeUtil::IsOpenParen(const absl::string_view& input, @@ -137,7 +137,7 @@ Status UnicodeUtil::IsOpenParen(const absl::string_view& input, if (!status.ok()) return status; if (has_more_than_one_char) { *result = false; - return OkStatus(); + return absl::OkStatus(); } // These are unicode characters that should be considered in this category but @@ -146,13 +146,13 @@ Status UnicodeUtil::IsOpenParen(const absl::string_view& input, case '<': case 64830: // Ornate left parenthesis *result = true; - return OkStatus(); + return absl::OkStatus(); } ULineBreak lb_property = static_cast( u_getIntPropertyValue(char_value, UCHAR_LINE_BREAK)); *result = lb_property == U_LB_OPEN_PUNCTUATION; - return OkStatus(); + return absl::OkStatus(); } Status UnicodeUtil::IsCloseParen(const absl::string_view& input, @@ -164,7 +164,7 @@ Status UnicodeUtil::IsCloseParen(const absl::string_view& input, if (!status.ok()) return status; if (has_more_than_one_char) { *result = false; - return OkStatus(); + return absl::OkStatus(); } // These are unicode characters that should be considered in this category but @@ -173,14 +173,14 @@ Status UnicodeUtil::IsCloseParen(const absl::string_view& input, case '>': case 64831: // Ornate right parenthesis *result = true; - return OkStatus(); + return absl::OkStatus(); } ULineBreak lb_property = static_cast( u_getIntPropertyValue(char_value, UCHAR_LINE_BREAK)); *result = lb_property == U_LB_CLOSE_PUNCTUATION || lb_property == U_LB_CLOSE_PARENTHESIS; - return OkStatus(); + return absl::OkStatus(); } Status UnicodeUtil::IsPunctuationWord(const absl::string_view& input, @@ -192,7 +192,7 @@ Status UnicodeUtil::IsPunctuationWord(const absl::string_view& input, if (!status.ok()) return status; if (has_more_than_one_char) { *result = false; - return OkStatus(); + return absl::OkStatus(); } // These are unicode characters that should be considered in this category but @@ -204,13 +204,13 @@ Status UnicodeUtil::IsPunctuationWord(const absl::string_view& input, case '~': case 5741: *result = true; - return OkStatus(); + return absl::OkStatus(); } *result = u_ispunct(char_value) || u_hasBinaryProperty(char_value, UCHAR_DASH) || u_hasBinaryProperty(char_value, UCHAR_HYPHEN); - return OkStatus(); + return absl::OkStatus(); } Status UnicodeUtil::IsEllipsis(const absl::string_view& input, @@ -218,7 +218,7 @@ Status UnicodeUtil::IsEllipsis(const absl::string_view& input, *result = false; if (input == "...") { *result = true; - return OkStatus(); + return absl::OkStatus(); } bool has_more_than_one_char = false; @@ -227,11 +227,11 @@ Status UnicodeUtil::IsEllipsis(const absl::string_view& input, if (!status.ok()) return status; if (has_more_than_one_char) { *result = false; - return OkStatus(); + return absl::OkStatus(); } *result = char_value == 0x2026; - return OkStatus(); + return absl::OkStatus(); } } // namespace text diff --git a/tensorflow_text/core/kernels/sentence_fragmenter.cc b/tensorflow_text/core/kernels/sentence_fragmenter.cc index fc8b31a29..263654b9d 100644 --- a/tensorflow_text/core/kernels/sentence_fragmenter.cc +++ b/tensorflow_text/core/kernels/sentence_fragmenter.cc @@ -57,7 +57,7 @@ Status SpaceAllowedBeforeToken(const UnicodeUtil *util, const Token &token, *result = (TokenHasProperty(Token::EMOTICON, token) || (is_ellipsis || is_terminal_punc || is_close_paren)); - return OkStatus(); + return absl::OkStatus(); } } // namespace @@ -127,7 +127,7 @@ class SentenceFragmenter::FragmentBoundaryMatch { if (no_transition) { *result = false; - return OkStatus(); + return absl::OkStatus(); } else { limit_index_ = index + 1; if (state_ == COLLECTING_TERMINAL_PUNC) { @@ -135,7 +135,7 @@ class SentenceFragmenter::FragmentBoundaryMatch { first_close_punc_index_ = limit_index_; } *result = true; - return OkStatus(); + return absl::OkStatus(); } } @@ -197,7 +197,7 @@ Status SentenceFragmenter::FindFragments( result->push_back(std::move(fragment)); i_start = match.limit_index(); } - return OkStatus(); + return absl::OkStatus(); } // This method is essentially a control layer on top of a simple state machine @@ -243,7 +243,7 @@ Status SentenceFragmenter::FindNextFragmentBoundary( if (previous_match.GotTerminalPunc()) { // Extension failed. Return previous match. *result = previous_match; - return OkStatus(); + return absl::OkStatus(); } else { // Start matching again from scratch. current_match.Reset(); @@ -255,7 +255,7 @@ Status SentenceFragmenter::FindNextFragmentBoundary( } } *result = current_match; - return OkStatus(); + return absl::OkStatus(); } // Keep track of whether the latest open parenthesis seen so far appears to be @@ -290,7 +290,7 @@ Status SentenceFragmenter::UpdateLatestOpenParenForFragment(int i_start, } } - return OkStatus(); + return absl::OkStatus(); } Status SentenceFragmenter::FillInFragmentFields( @@ -330,7 +330,7 @@ Status SentenceFragmenter::FillInFragmentFields( } } - return OkStatus(); + return absl::OkStatus(); } // The standard first terminal punctuation index is just @@ -349,7 +349,7 @@ Status SentenceFragmenter::GetAdjustedFirstTerminalPuncIndex( int i1 = match.first_terminal_punc_index(); if (i1 < 0) { *result = i1; - return OkStatus(); + return absl::OkStatus(); } int i2 = match.first_close_punc_index(); @@ -361,19 +361,19 @@ Status SentenceFragmenter::GetAdjustedFirstTerminalPuncIndex( if (i == i2) { // Ellipsis is last terminal punctuation mark. No adjustment. *result = i1; - return OkStatus(); + return absl::OkStatus(); } else { // Ellipsis is not the last terminal punctuation mark. Return the index // of the terminal punctuation mark after it. *result = i; // current token = i - 1 - return OkStatus(); + return absl::OkStatus(); } } } // No ellipsis. *result = i1; - return OkStatus(); + return absl::OkStatus(); } // Example of an an "unattachable" terminal punctuation mark: @@ -392,7 +392,7 @@ Status SentenceFragmenter::HasUnattachableTerminalPunc( int i1 = match.first_terminal_punc_index(); if (i1 < 0) { *result = false; - return OkStatus(); + return absl::OkStatus(); } int i2 = match.first_close_punc_index(); @@ -407,12 +407,12 @@ Status SentenceFragmenter::HasUnattachableTerminalPunc( !TokenHasProperty(Token::EMOTICON, token)) { // Found an unattachable, unambiguous terminal punctuation mark. *result = true; - return OkStatus(); + return absl::OkStatus(); } } *result = false; - return OkStatus(); + return absl::OkStatus(); } Status SentenceFragmenter::HasCloseParen(const FragmentBoundaryMatch &match, @@ -422,7 +422,7 @@ Status SentenceFragmenter::HasCloseParen(const FragmentBoundaryMatch &match, int i1 = match.first_close_punc_index(); if (i1 < 0) { *result = false; - return OkStatus(); + return absl::OkStatus(); } int i2 = match.limit_index(); @@ -432,11 +432,11 @@ Status SentenceFragmenter::HasCloseParen(const FragmentBoundaryMatch &match, TF_RETURN_IF_ERROR(util_->IsCloseParen(token.word(), &is_close_paren)); if (is_close_paren) { *result = true; - return OkStatus(); + return absl::OkStatus(); } } *result = false; - return OkStatus(); + return absl::OkStatus(); } } // namespace text