def testBuild(self):
d = HashDictionary(self.texts, myhash=zlib.adler32)
expected = {5232: 2,
5798: 3,
10608: 2,
12466: 2,
12736: 3,
15001: 2,
18451: 3,
23844: 3,
28591: 2,
29104: 2,
31002: 2,
31049: 2}
self.assertEqual(d.dfs, expected)
expected = {'minors': 15001, 'graph': 18451, 'system': 5798, 'trees': 23844, 'eps': 31049, 'computer': 10608, 'survey': 28591, 'user': 12736, 'human': 31002, 'time': 29104, 'interface': 12466, 'response': 5232}
for ex in expected:
self.assertEqual(d.token2id[ex], expected[ex])
test_corpora_hashdictionary.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录