Skip to content

Commit 4ebef18

Browse files
fix for counting subs
1 parent bd0ab50 commit 4ebef18

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

guardrails/validator_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ def split_sentence_word_tokenizers_jl(
7171
is_minimum_length = True
7272

7373
# check for potential line endings, which is what split_sentences does
74-
chunk_with_potential_line_endings, count = re.sub(
74+
chunk_with_potential_line_endings, count = re.subn(
7575
r"([?!.])(?=\s|$)", rf"\1{separator}", chunk
7676
)
77-
any_potential_line_endings = int(count) > 0
77+
any_potential_line_endings = count > 0
7878
if not is_minimum_length or not any_potential_line_endings:
7979
return []
8080

0 commit comments

Comments
 (0)