chore: set insanity_threshold dynamically

This commit is contained in:
surtur 2021-12-20 00:58:10 +01:00
parent c6215e6146
commit fce2c7c0de
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

@ -70,8 +70,9 @@ class da_detector:
t_len = len(text)
# list of random n-grams
r_ngrams = []
# how many times to attempt to skin the cat
insanity_threshold = 1000
# how many times to attempt to skin the cat, dynamically set depending
# on total length of the subject text examined
insanity_threshold = t_len * 20
sanity_ctr = 0
while (len(r_ngrams) < how_many and sanity_ctr < insanity_threshold):