add a "try" wrapper for when getting probabs
This commit is contained in:
parent
789ccd5856
commit
f09d4177c7
@ -104,9 +104,13 @@ class da_detector:
|
||||
|
||||
# may contain None values if not found, hence uncleansed
|
||||
uncleansed_probabilities = []
|
||||
try:
|
||||
for ngram in ngrams:
|
||||
uncleansed_probabilities.append(lang_probs.get(ngram))
|
||||
return self.replace_nones(uncleansed_probabilities)
|
||||
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):
|
||||
|
Reference in New Issue
Block a user