Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 640038494
  • Loading branch information
tf-text-github-robot committed Jun 4, 2024
1 parent fa2b81a commit 6c85aa3
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_text/core/kernels/mst_op_kernels.cc
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class MaxSpanningTreeOpKernel : public tensorflow::OpKernel {
argmax_sources_bxm(problem, i) = -1;
}

return tensorflow::OkStatus();
return absl::OkStatus();
}

private:
Expand Down
8 changes: 4 additions & 4 deletions tensorflow_text/core/kernels/mst_solver.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ tensorflow::Status MstSolver<Index, Score>::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 <class Index, class Score>
Expand Down Expand Up @@ -378,7 +378,7 @@ tensorflow::Status MstSolver<Index, Score>::Solve(absl::Span<Index> argmax) {
MaybePenalizeRootScoresForTree();
TF_RETURN_IF_ERROR(ContractionPhase());
TF_RETURN_IF_ERROR(ExpansionPhase(argmax));
return tensorflow::OkStatus();
return absl::OkStatus();
}

template <class Index, class Score>
Expand Down Expand Up @@ -537,7 +537,7 @@ tensorflow::Status MstSolver<Index, Score>::ContractionPhase() {
}
}

return tensorflow::OkStatus();
return absl::OkStatus();
}

template <class Index, class Score>
Expand Down Expand Up @@ -599,7 +599,7 @@ tensorflow::Status MstSolver<Index, Score>::ExpansionPhase(
return tensorflow::errors::FailedPrecondition("Infeasible digraph");
}

return tensorflow::OkStatus();
return absl::OkStatus();
}

} // namespace text
Expand Down
2 changes: 1 addition & 1 deletion tensorflow_text/core/kernels/sentence_breaking_kernels.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
42 changes: 21 additions & 21 deletions tensorflow_text/core/kernels/sentence_breaking_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -60,15 +60,15 @@ 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;
const auto& status = GetOneUChar(input, &has_more_than_one_char, &char_value);
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
Expand All @@ -80,21 +80,21 @@ 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<USentenceBreak>(
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,
bool* result) const {
*result = false;
if (input == "''") {
*result = true;
return OkStatus();
return absl::OkStatus();
}

bool has_more_than_one_char = false;
Expand All @@ -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
Expand All @@ -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<ULineBreak>(
Expand All @@ -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,
Expand All @@ -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
Expand All @@ -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<ULineBreak>(
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,
Expand All @@ -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
Expand All @@ -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<ULineBreak>(
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,
Expand All @@ -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
Expand All @@ -204,21 +204,21 @@ 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,
bool* result) const {
*result = false;
if (input == "...") {
*result = true;
return OkStatus();
return absl::OkStatus();
}

bool has_more_than_one_char = false;
Expand All @@ -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
Expand Down
36 changes: 18 additions & 18 deletions tensorflow_text/core/kernels/sentence_fragmenter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -127,15 +127,15 @@ class SentenceFragmenter::FragmentBoundaryMatch {

if (no_transition) {
*result = false;
return OkStatus();
return absl::OkStatus();
} else {
limit_index_ = index + 1;
if (state_ == COLLECTING_TERMINAL_PUNC) {
// We've gotten terminal punctuation, but no close punctuation yet.
first_close_punc_index_ = limit_index_;
}
*result = true;
return OkStatus();
return absl::OkStatus();
}
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand All @@ -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
Expand Down Expand Up @@ -290,7 +290,7 @@ Status SentenceFragmenter::UpdateLatestOpenParenForFragment(int i_start,
}
}

return OkStatus();
return absl::OkStatus();
}

Status SentenceFragmenter::FillInFragmentFields(
Expand Down Expand Up @@ -330,7 +330,7 @@ Status SentenceFragmenter::FillInFragmentFields(
}
}

return OkStatus();
return absl::OkStatus();
}

// The standard first terminal punctuation index is just
Expand All @@ -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();

Expand All @@ -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:
Expand All @@ -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();

Expand All @@ -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,
Expand All @@ -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();

Expand All @@ -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
Expand Down

0 comments on commit 6c85aa3

Please sign in to comment.