from guesslang import Guess class PreTrainedPipeline(): def __init__(self, path=""): self.guess = Guess() def __call__(self, text): return [{k: v} for k, v in self.guess.probabilities(text)[:5]]