File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -54,16 +54,16 @@ def _get_ngrams(segment: list[str], max_order: int):
5454 return ngram_counts
5555
5656
57- def _lcs_length (a : list [str ], b : list [str ]) -> int :
57+ def _lcs_length (str1 : list [str ], str2 : list [str ]) -> int :
5858 """Computes the length of the Longest Common Subsequence (LCS)."""
59- lengths = [[0 for j in range (len (b ) + 1 )] for i in range (len (a ) + 1 )]
60- for i , x in enumerate (a ):
61- for j , y in enumerate (b ):
59+ lengths = [[0 for j in range (len (str2 ) + 1 )] for i in range (len (str1 ) + 1 )]
60+ for i , x in enumerate (str1 ):
61+ for j , y in enumerate (str2 ):
6262 if x == y :
6363 lengths [i + 1 ][j + 1 ] = lengths [i ][j ] + 1
6464 else :
6565 lengths [i + 1 ][j + 1 ] = max (lengths [i + 1 ][j ], lengths [i ][j + 1 ])
66- return lengths [len (a )][len (b )]
66+ return lengths [len (str1 )][len (str2 )]
6767
6868
6969@flax .struct .dataclass
You can’t perform that action at this time.
0 commit comments