当前位置: 首页>>代码示例>>Python>>正文


Python Corpus.emails_as_string方法代码示例

本文整理汇总了Python中corpus.Corpus.emails_as_string方法的典型用法代码示例。如果您正苦于以下问题:Python Corpus.emails_as_string方法的具体用法?Python Corpus.emails_as_string怎么用?Python Corpus.emails_as_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在corpus.Corpus的用法示例。


在下文中一共展示了Corpus.emails_as_string方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_corpusContainsOnlyEmails

# 需要导入模块: from corpus import Corpus [as 别名]
# 或者: from corpus.Corpus import emails_as_string [as 别名]
 def test_corpusContainsOnlyEmails(self):
     """Test reading the corpus with email messages only."""
     corpus = Corpus(CORPUSDIR)
     # Exercise the SUT
     nitems = 0
     for fname, contents in corpus.emails_as_string():
         nitems += 1
         # Validate the results
         self.assertEqual(self.expected[fname], contents,
                          'The read file contents are not equal to the expected contents.')
     self.assertEqual(nitems, NEMAILS,
                      'The emails_as_string() method did not return the right number of files.')
开发者ID:MikkCZ,项目名称:OI-BC,代码行数:14,代码来源:test_corpus.py

示例2: test_corpusContainsOnlyEmails

# 需要导入模块: from corpus import Corpus [as 别名]
# 或者: from corpus.Corpus import emails_as_string [as 别名]
 def test_corpusContainsOnlyEmails(self):
     """Test reading the corpus with email messages only."""
     corpus = Corpus(CORPUS_DIR)
     # Exercise the SUT
     observed = {}
     for fname, contents in corpus.emails_as_string():
         observed[fname] = contents
     # Verify the results
     self.assertEqual(len(self.expected), len(observed),
                      'The emails_as_string() method did not generate all the corpus files.')
     self.assertEqual(self.expected, observed,
                          'The read file contents are not equal to the expected contents.')
开发者ID:jakubkulhan,项目名称:bayesian-spam-filter,代码行数:14,代码来源:test_corpus.py

示例3: test_corpusContainsAlsoSpecialFiles

# 需要导入模块: from corpus import Corpus [as 别名]
# 或者: from corpus.Corpus import emails_as_string [as 别名]
 def test_corpusContainsAlsoSpecialFiles(self):
     """Test reading the corpus with special files."""
     # Add a special file into the corpus dir
     save_file_to_corpus_dir(
         fname=SPECIAL_FILENAME, contents='fake', dirname=CORPUS_DIR)     
     corpus = Corpus(CORPUS_DIR)
     # Exercise the SUT
     observed = {}
     for fname, contents in corpus.emails_as_string():
         observed[fname] = contents
     # Verify the results
     self.assertEqual(len(self.expected), len(observed),
                      'The emails_as_string() method did not generate all the corpus files.')
     self.assertEqual(self.expected, observed,
                          'The read file contents are not equal to the expected contents.')
开发者ID:jakubkulhan,项目名称:bayesian-spam-filter,代码行数:17,代码来源:test_corpus.py

示例4: test_corpusContainsAlsoSpecialFiles

# 需要导入模块: from corpus import Corpus [as 别名]
# 或者: from corpus.Corpus import emails_as_string [as 别名]
 def test_corpusContainsAlsoSpecialFiles(self):
     """Test reading the corpus with special files."""
     # Add a special file into the corpus dir
     fname = TRUTH_FILENAME
     contents = 'fake'
     save_file_to_corpus_dir(fname, contents, CORPUSDIR)        
     # Exercise the SUT
     corpus = Corpus(CORPUSDIR)
     nitems = 0
     for fname, contents in corpus.emails_as_string():
         nitems += 1
         # Validate results
         self.assertEqual(self.expected[fname], contents,
                          'The read file contents are not equal to the expected contents.')
     self.assertEqual(nitems, NEMAILS,
                      'The emails_as_string() method did not return the right number of files.')
开发者ID:MikkCZ,项目名称:OI-BC,代码行数:18,代码来源:test_corpus.py


注:本文中的corpus.Corpus.emails_as_string方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。