diff --git a/da_detector.py b/da_detector.py index 5638369..4b4013e 100755 --- a/da_detector.py +++ b/da_detector.py @@ -104,9 +104,13 @@ class da_detector: # may contain None values if not found, hence uncleansed uncleansed_probabilities = [] - for ngram in ngrams: - uncleansed_probabilities.append(lang_probs.get(ngram)) - return self.replace_nones(uncleansed_probabilities) + try: + for ngram in ngrams: + uncleansed_probabilities.append(lang_probs.get(ngram)) + cleansed_probabs = self.replace_nones(uncleansed_probabilities) + except Exception as e: + raise e + return cleansed_probabs def replace_nones(self, probabilities: list): if not isinstance(probabilities, list):