def setUp(self):
     """Prepare fake corpus with !truth.txt file."""
     self.email_dict = create_corpus_dictionary()
     self.true_class = create_classification_for(self.email_dict.keys())
     create_corpus_dir_from_dictionary(self.email_dict)
     truth_filepath = os.path.join(CORPUS_DIR, TRUTH_FILENAME)
     save_classification_to_file(self.true_class, fname=truth_filepath)
     self.tc = TrainingCorpus(CORPUS_DIR)
 def setUp(self):
     """Prepare fake corpus with !truth.txt file."""
     self.email_dict = create_corpus_dictionary()
     self.true_class = create_classification_for(self.email_dict.keys())
     create_corpus_dir_from_dictionary(self.email_dict)
     truth_filepath = os.path.join(CORPUS_DIR, TRUTH_FILENAME)
     save_classification_to_file(self.true_class, fname=truth_filepath)
     with replaced_open():
         self.tc = TrainingCorpus(CORPUS_DIR)
Example #3
0
 def create_corpus_without_truth(self):
     """Create fake directory with text files for testing purposes."""
     # Create contents of the fake corpus and store them in a member 
     # variable just for the case it is needed by the add_truth_to_corpus.
     self.file_dict = create_corpus_dictionary()
     create_corpus_dir_from_dictionary(self.file_dict, CORPUS_DIR)
 def create_corpus_without_truth(self):
     """Create fake directory with text files for testing purposes."""
     # Create contents of the fake corpus and store them in a member 
     # variable just for the case it is needed by the add_truth_to_corpus.
     self.file_dict = create_corpus_dictionary()
     create_corpus_dir_from_dictionary(self.file_dict, CORPUS_DIR)