Skip to content
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

Fix Tapas bug due to exceeding the maximum rank value #13772

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ class TapasEncoder(
protected val MAX_YEAR = 2120

protected val MIN_NUMBER_OF_ROWS_WITH_VALUES_PROPORTION = 0.5f
protected val MAX_COLUMN_RANK = 255

protected val ORDINAL_SUFFIXES: Array[String] = Array("st", "nd", "rd", "th")
protected val NUMBER_WORDS: Array[String] = Array(
Expand Down Expand Up @@ -525,9 +526,10 @@ class TapasEncoder(
columnIds = setMaxSentenceLimit(emptyTokenTypes ++ columnIds ++ padding),
rowIds = setMaxSentenceLimit(emptyTokenTypes ++ rowIds ++ padding),
prevLabels = setMaxSentenceLimit(emptyTokenTypes ++ prevLabels ++ padding),
columnRanks = setMaxSentenceLimit(emptyTokenTypes ++ columnRanks ++ padding),
invertedColumnRanks =
setMaxSentenceLimit(emptyTokenTypes ++ invertedColumnRanks ++ padding),
columnRanks = setMaxSentenceLimit(
emptyTokenTypes ++ columnRanks.map(x => scala.math.min(x, MAX_COLUMN_RANK)) ++ padding),
invertedColumnRanks = setMaxSentenceLimit(emptyTokenTypes ++ invertedColumnRanks.map(x =>
scala.math.min(x, MAX_COLUMN_RANK)) ++ padding),
numericRelations = setMaxSentenceLimit(emptyTokenTypes ++ numericRelations ++ padding))
}

Expand Down