def CompareTwoCellsComments(address1,key1,address2,key2,threshold,outputname, outputname2, outputname3): preCB = XMLinterpreter(address1) preAC = XMLinterpreter(address2) condition = [True, True, False, False] CB = CellCointainer(preCB, condition) AC = CellCointainer(preAC, condition) comments1 = CB.commentWithKeywordExtract(key1) comments2 = AC.commentWithKeywordExtract(key2) comments1.sort(key = lambda x:x[1]) comments2.sort(key = lambda x:x[1]) comments1a = XMLutility.sortNodes(comments1) CBAC =XMLutility.compareTwoCellForFirst(CB.scale,comments1, comments2, threshold, 1) CBACsorted =XMLutility.sortNodes(CBAC) # CBACsorted = XMLutility.dictToCluster(CBACsorted, 200) CBACsorted1 =XMLutility.DLtoDDtoDCL(CBAC,200) XMLutility.TempCvsCprinter(comments1a, CBACsorted1, outputname, key1) XMLutility.TempCvsCgrapher(comments1a, CBACsorted1) #print CBACsorted with open(outputname2, 'wt') as out: pprint.pprint(CBACsorted1, stream=out) printCBAC = XMLutility.XMLTempPrinter(CB.Parameter, CBACsorted, outputname3)
def CompareTwoCellsCommentsAndChangeComment(address1,key1,address2,key2,threshold,filename): preCB = XMLinterpreter(address1) preAC = XMLinterpreter(address2) condition = [True, True, True, True] CB = CellCointainer(preCB, condition) AC = CellCointainer(preAC, condition) comments1 = CB.commentWithKeywordExtract(key1) comments2 = AC.commentWithKeywordExtract(key2) comments1.sort(key = lambda x:x[1]) comments2.sort(key = lambda x:x[1]) CBAC =XMLutility.commentChanger(CB.scale,comments1, comments2, threshold) CBACsorted =XMLutility.sortNodes(CBAC) CB.Comments = CBACsorted XMLutility.CellPrinter(CB, filename)#
def CompareTwoCellsCommentAndEdgeAndPrint(address1, address2, threshold, outputname, *args): preCB = XMLinterpreter(address1) preAC = XMLinterpreter(address2) condition = [True, True, True, False] CB = CellCointainer(preCB, condition) AC = CellCointainer(preAC, condition) comments = CB.commentWithKeywordExtract(*args) comments.sort(key = lambda x:x[1]) edges = AC.allEdgesExtract(1) CBAC =XMLutility.compareTwoCellandReturnMidPoint(comments, edges, threshold, 1) CBACsorted =XMLutility.sortNodes(CBAC) CBACsorted = XMLutility.dictToCluster(CBACsorted, threshold) printCBAC = XMLutility.XMLTempPrinter1(CB.Parameter, CBACsorted, outputname)