def loadConversations(self, dirName):
"""
Args:
dirName (str): folder to load
Return:
array(question, answer): the extracted QA pairs
"""
conversations = []
dirList = self.filesInDir(dirName)
for filepath in tqdm(dirList, "OpenSubtitles data files"):
if filepath.endswith('gz'):
try:
doc = self.getXML(filepath)
conversations.extend(self.genList(doc))
except ValueError:
tqdm.write("Skipping file %s with errors." % filepath)
except:
print("Unexpected error:", sys.exc_info()[0])
raise
return conversations
评论列表
文章目录