示例#1
0
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")
示例#2
0
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")
示例#3
0
                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)
示例#4
0
			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)