Exemple #1
0
def command_delete_text(parsed_args):
    corpus = Corpus()
    corpus.delete_text(parsed_args.text_name)
Exemple #2
0
def command_markov_text(parsed_args):
    corpus = Corpus()
    markov = corpus.markov_sentence(sentences=parsed_args.sentences,
            start_word=parsed_args.start_word)
    print(markov)
Exemple #3
0
def command_list_text(parsed_args):
    corpus = Corpus()
    print("Texts learned")
    for path in corpus.texts:
        print('{} "{}"'.format(path, corpus.texts[path]))
Exemple #4
0
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()
Exemple #6
0
def step(context, num=0):
    corpus = Corpus()
    assert (len(corpus.texts) == num)
Exemple #7
0
def step(context):
    corpus = Corpus()
    corpus.clear_text()
    assert (len(corpus.texts) == 0)