HugoLaurencon
commited on
Commit
•
b607b76
1
Parent(s):
6f25c5c
fix division by 0 in compute_special_characters_ratio
Browse files- filtering.py +2 -0
filtering.py
CHANGED
@@ -454,6 +454,8 @@ class Filtering:
|
|
454 |
|
455 |
@staticmethod
|
456 |
def compute_special_characters_ratio(document, special_characters):
|
|
|
|
|
457 |
special_characters_ratio = len(
|
458 |
[char for char in document if char in special_characters]
|
459 |
) / len(document)
|
|
|
454 |
|
455 |
@staticmethod
|
456 |
def compute_special_characters_ratio(document, special_characters):
|
457 |
+
if len(document) == 0:
|
458 |
+
return 0
|
459 |
special_characters_ratio = len(
|
460 |
[char for char in document if char in special_characters]
|
461 |
) / len(document)
|