def command_delete_text(parsed_args): corpus = Corpus() corpus.delete_text(parsed_args.text_name)
def command_markov_text(parsed_args): corpus = Corpus() markov = corpus.markov_sentence(sentences=parsed_args.sentences, start_word=parsed_args.start_word) print(markov)
def command_list_text(parsed_args): corpus = Corpus() print("Texts learned") for path in corpus.texts: print('{} "{}"'.format(path, corpus.texts[path]))
def command_add_text(parsed_args): corpus = Corpus() corpus.add_text(parsed_args.location) print("I have learned {}".format(parsed_args.location.name))
def setUp(self): self.corpus_location = os.path.join(tempfile.gettempdir(), 'temp_corpus') os.mkdir(self.corpus_location) self.corpus = Corpus(location=self.corpus_location) self.corpus.clear_text()
def step(context, num=0): corpus = Corpus() assert (len(corpus.texts) == num)
def step(context): corpus = Corpus() corpus.clear_text() assert (len(corpus.texts) == 0)