chore: add base of pick_ngrams() method
This commit is contained in:
parent
86f4c3e54d
commit
294c16c110
@ -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")
|
||||
|
Reference in New Issue
Block a user