chore: add base of pick_ngrams() method

This commit is contained in:
surtur 2021-12-16 05:06:13 +01:00
parent 86f4c3e54d
commit 294c16c110
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

@ -45,9 +45,23 @@ class da_detector:
raise e
return obj
def pick_ngrams(self, what_grams: int, text: str):
if not isinstance(what_grams, int):
raise TypeError("what_grams has to be an int")
self.what_grams = what_grams
if (what_grams <= 0):
raise ValueError("this is bogus, give me a number from ")
elif (what_grams > 5):
raise ValueError("not doing larger-grams than 5")
# TODO(me): complete n-gram picking method implementation
freqs_folder = "./freqs/"
detector = da_detector()
detector.pick_ngrams(3, "")
sk_json = detector.parse_freqs("sk.json")
cz_json = detector.parse_freqs("cz.json")