def test_corpus_dump(self): corpus1 = Corpus(utterances=[ Utterance(id="0", text="hello world", speaker=Speaker(id="alice")), Utterance(id="1", text="my name is bob", speaker=Speaker( id="bob")), Utterance( id="2", text="this is a test", speaker=Speaker(id="charlie")), ]) corpus1.get_utterance("0").meta['foo'] = 'bar' corpus1.get_utterance("1").meta['foo'] = 'bar2' corpus1.get_utterance("2").meta['hey'] = 'jude' corpus1.get_conversation(None).meta['convo_meta'] = 1 corpus1.get_speaker("alice").meta['surname'] = 1.0 corpus1.dump('test_index_meta_corpus', base_path="./") corpus2 = Corpus(filename="test_index_meta_corpus") self.assertEqual(corpus1.meta_index.utterances_index, corpus2.meta_index.utterances_index) self.assertEqual(corpus1.meta_index.speakers_index, corpus2.meta_index.speakers_index) self.assertEqual(corpus1.meta_index.conversations_index, corpus2.meta_index.conversations_index) self.assertEqual(corpus1.meta_index.overall_index, corpus2.meta_index.overall_index)
def test_load_dump_subreddit(self): corpus = Corpus(download('subreddit-hey')) corpus.dump('subreddit')
def test_load_dump_switchboard(self): corpus = Corpus(download("switchboard-corpus")) corpus.dump('switchboard-corpus')
def test_load_dump_politeness(self): corpus = Corpus(download('wikipedia-politeness-corpus')) corpus.dump('wikipedia-politeness-corpus')
def test_load_dump_tennis(self): corpus = Corpus(download('tennis-corpus')) corpus.dump('tennis-corpus')