ConvoKit is a toolkit for extracting conversational features and analyzing social phenomena in conversations. It includes several large conversational datasets along with scripts exemplifying the use of the toolkit on these datasets.
KeyError Traceback (most recent call last)
Cell In [21], line 1
----> 1 true_corpus.organize_speaker_convo_history()
File /usr/local/lib/python3.10/site-packages/convokit/model/corpus.py:1401, in Corpus.organize_speaker_convo_history(self, utterance_filter)
1399 for convo, utts in convo_utts.items():
1400 sorted_utts = sorted(utts, key=lambda x: (x[1], x[0]))
-> 1401 self.set_speaker_convo_info(
1402 speaker, convo, "utterance_ids", [x[0] for x in sorted_utts]
1403 )
1404 self.set_speaker_convo_info(speaker, convo, "start_time", sorted_utts[0][1])
1405 self.set_speaker_convo_info(speaker, convo, "n_utterances", len(sorted_utts))
File /usr/local/lib/python3.10/site-packages/convokit/model/corpus.py:1351, in Corpus.set_speaker_convo_info(self, speaker_id, convo_id, key, value)
1349 if convo_id not in speaker.meta["conversations"]:
1350 speaker.meta["conversations"][convo_id] = {}
-> 1351 speaker.meta["conversations"][convo_id][key] = value
Summary of the issue
KeyError Traceback (most recent call last) Cell In [21], line 1 ----> 1 true_corpus.organize_speaker_convo_history()
File /usr/local/lib/python3.10/site-packages/convokit/model/corpus.py:1401, in Corpus.organize_speaker_convo_history(self, utterance_filter) 1399 for convo, utts in convo_utts.items(): 1400 sorted_utts = sorted(utts, key=lambda x: (x[1], x[0])) -> 1401 self.set_speaker_convo_info( 1402 speaker, convo, "utterance_ids", [x[0] for x in sorted_utts] 1403 ) 1404 self.set_speaker_convo_info(speaker, convo, "start_time", sorted_utts[0][1]) 1405 self.set_speaker_convo_info(speaker, convo, "n_utterances", len(sorted_utts))
File /usr/local/lib/python3.10/site-packages/convokit/model/corpus.py:1351, in Corpus.set_speaker_convo_info(self, speaker_id, convo_id, key, value) 1349 if convo_id not in speaker.meta["conversations"]: 1350 speaker.meta["conversations"][convo_id] = {} -> 1351 speaker.meta["conversations"][convo_id][key] = value
KeyError: '1dhwyu'
Steps to reproduce
true_corpus = Corpus(filename=download('subreddit-TrueChristian'), storage_type="db") true_corpus.organize_speaker_convo_history()
Additional information
ConvoKit version: pip3 install git+https://github.com/CornellNLP/Cornell-Conversational-Analysis-Toolkit.git