Skip to content

Commit 2d928ab

Browse files
fix: potential issue in edge case when detecting language
Signed-off-by: thiswillbeyourgithub <26625900+thiswillbeyourgithub@users.noreply.github.com>
1 parent 69dca45 commit 2d928ab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

wdoc/utils/misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ def check_docs_tkn_length(
814814
# check if language check is above a threshold and cast as lowercase as it's apparently what it was trained on
815815
try:
816816
probs = [language_detector(d.page_content.replace("\n", "<br>")) for d in docs]
817-
if probs[0] is None or not probs:
817+
if not probs or probs[0] is None:
818818
# bypass if language_detector not defined
819819
return 1.0
820820
prob = sum(probs) / len(probs)

0 commit comments

Comments
 (0)