import markovify


class MarkovChainTextGenerator:
    def __init__(self, generate_num, sentence_num):
        self.__generate_num = generate_num
        self.__sentence_num = sentence_num

    def generate(self, json_path):
        texts = []
        with open(json_path, 'r') as f:
            model = markovify.Text.from_json(f.read())
            for _ in range(self.__generate_num):
                texts.append(model.make_short_sentence(self.__sentence_num))
        return texts


if __name__ == '__main__':
    generate_num = 10
    sentence_num = 100
    generator = MarkovChainTextGenerator(generate_num, sentence_num)
    json_path = '../data/data.json'
    texts = generator.generate(json_path)
    generated_texts = set()
    for text in texts:
        generated_texts.add(text)

    for generated_text in generated_texts:
        print(generated_text)
    print(f'Generated texts number is {len(generated_texts)}')

import markovify


class MarkovChainTextGenerator:
    def __init__(self, generate_num, sentence_num):
        self.__generate_num = generate_num
        self.__sentence_num = sentence_num

    def generate(self, json_path):
        texts = []
        with open(json_path, 'r') as f:
            model = markovify.Text.from_json(f.read())
            for _ in range(self.__generate_num):
                texts.append(model.make_short_sentence(self.__sentence_num))
        return texts


if __name__ == '__main__':
    generate_num = 10
    sentence_num = 100
    generator = MarkovChainTextGenerator(generate_num, sentence_num)
    json_path = '../data/data.json'
    texts = generator.generate(json_path)
    generated_texts = set()
    for text in texts:
        generated_texts.add(text)

    for generated_text in generated_texts:
        print(generated_text)
    print(f'Generated texts number is {len(generated_texts)}')
