Skip to content

Commit cb5a0b8

Browse files
committed
fix division by 0 in compute_special_characters_ratio
1 parent ff3b5e4 commit cb5a0b8

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

ac_dc/filtering.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,8 @@ def check_repetitions_removal(
454454

455455
@staticmethod
456456
def compute_special_characters_ratio(document, special_characters):
457+
if len(document) == 0:
458+
return 0
457459
special_characters_ratio = len(
458460
[char for char in document if char in special_characters]
459461
) / len(document)

0 commit comments

Comments
 (0)