def wrapperFunction(filePaths, outputFile): allData = [] for path in filePaths: corpus = trimFileEdges(absolutePath=path) test = ReadableTextFile() test.parseMetaData(corpus) test.parseMessageBody(corpus) allData.append(test.data) del test with open(outputFile, 'wb') as dataDump: for data in allData: dataDump.write(json.dumps(data) + "\n")
else: relevantPortion.append(line) return relevantPortion def removeExtremelyStrangeCharacters(s): '''First level of filtering, expects raw file''' return filter(lambda x: x in string.printable[0:98], s) def wrapperFunction(filePaths, outputFile): allData = [] for path in filePaths: corpus = trimFileEdges(absolutePath=path) test = ReadableTextFile() test.parseMetaData(corpus) test.parseMessageBody(corpus) allData.append(test.data) del test with open(outputFile, 'wb') as dataDump: for data in allData: dataDump.write(json.dumps(data) + "\n") relativePath = "../DesktopClient/GraphInterface/src/testData/Field2Emails/" corpus = trimFileEdges("Follow-up.msg", relativePath) test = ReadableTextFile() test.parseMetaData(corpus) test.parseMessageBody(corpus) print json.dumps(test.data)
else: if exitPhrase in line: break else: relevantPortion.append(line) return relevantPortion def removeExtremelyStrangeCharacters(s): '''First level of filtering, expects raw file''' return filter(lambda x: x in string.printable[0:98],s) def wrapperFunction(filePaths, outputFile): allData = [] for path in filePaths: corpus = trimFileEdges(absolutePath=path) test = ReadableTextFile() test.parseMetaData(corpus) test.parseMessageBody(corpus) allData.append(test.data) del test with open(outputFile, 'wb') as dataDump: for data in allData: dataDump.write(json.dumps(data) + "\n") relativePath = "../DesktopClient/GraphInterface/src/testData/Field2Emails/" corpus = trimFileEdges("Follow-up.msg", relativePath) test = ReadableTextFile() test.parseMetaData(corpus) test.parseMessageBody(corpus) print json.dumps(test.data)