Esempio n. 1
0
 def testFTPDataOne(self):
     # datas = self.geneDatas()
     srcDatas, desDatas = FTPDataTuning().tuningHttpByregix()
     datas = []
     datas.extend(srcDatas)
     datas.extend(desDatas)
     vePara = {'diffMeasure': 'abs', 'vWayFre': 'loose', 'T': 0, 'r': 0.3}
     borders = self.msg.getFreBorders(vePara, datas)
     #borders = self.msg.getOrderBorders(vePara, datas)
     i = 0
     primDatas = []
     print(datas[0])
     while (i < len(datas)):
         primDatas.append(primeData(datas[i], borders[i], i))
         i = i + 1
     tree_builder = treeFormat(primDatas, 10, 0.2)
     #t_result = tree_builder.generateNT()
     t_result = tree_builder.generateSplitNT(5)
     Nodes = []
     Edges = []
     t_result.showTree(0)
     t_result.getGraph(0, Nodes, Edges, [0])
     self.TGraph.graph_buildTwo(
         Nodes, Edges,
         '/home/wxw/paper/researchresult/BinaryFormat/treeshow/Fre 5 20.png'
     )
Esempio n. 2
0
 def generateTree(self, primDatas, treeParas):
     height = treeParas['h']
     funNum = treeParas['fcNum']
     splitRate = treeParas['srate']
     tree_builder = treeFormat(primDatas, funNum, splitRate)
     t_result = tree_builder.generateSplitNT(height)
     t_json = t_result.transToDictTree()
     return t_json
Esempio n. 3
0
 def testMixTree(self):
     datas = self.getMixDatas()
     vePara = {'diffMeasure': 'abs', 'vWayFre': 'loose', 'T': 0, 'r': 0.3}
     # borders = self.msg.getFreBorders(vePara, datas)
     borders = self.msg.getOrderBorders(vePara, datas)
     i = 0
     primDatas = []
     print(datas[0])
     while (i < len(datas)):
         primDatas.append(primeData(datas[i], borders[i], i))
         i = i + 1
     tree_builder = treeFormat(primDatas, 10, 0.2)
     # t_result = tree_builder.generateNT()
     t_result = tree_builder.generateSplitNT(5)
     print(t_result.transToDictTree())
Esempio n. 4
0
 def testFTPData(self):
     #datas = self.geneDatas()
     srcDatas, desDatas = FTPDataTuning().tuningHttpByregix()
     datas = []
     datas.extend(srcDatas)
     datas.extend(desDatas)
     vePara = {'diffMeasure': 'abs', 'vWayFre': 'loose', 'T': 0, 'r': 0.3}
     borders = self.msg.getFreBorders(vePara, datas)
     i = 0
     primDatas = []
     print(datas[0])
     while (i < len(datas)):
         primDatas.append(primeData(datas[i], borders[i], i))
         i = i + 1
     tree_builder = treeFormat(primDatas, 20, 0.2)
     t_result = tree_builder.generateNT()
     t_result.depth_traverse()
     for f in t_result.result:
         print("format start")
         for node_i in f:
             print(node_i.loc, node_i.word_type, node_i.value)
Esempio n. 5
0
 def testModData(self):
     datas = self.geneDatas()
     vePara = {'diffMeasure': 'abs', 'vWayFre': 'loose', 'T': 0, 'r': 0.3}
     #borders = self.msg.getFreBorders(vePara, datas)
     borders = self.msg.getOrderBorders(vePara, datas)
     i = 0
     primDatas = []
     print(datas[0])
     while (i < len(datas)):
         primDatas.append(primeData(datas[i], borders[i], i))
         i = i + 1
     tree_builder = treeFormat(primDatas, 20, 0.2)
     # t_result = tree_builder.generateNT()
     t_result = tree_builder.generateSplitNT(5)
     Nodes = []
     Edges = []
     t_result.showTree(0)
     t_result.getGraph(0, Nodes, Edges, [0])
     self.TGraph.graph_buildTwo(
         Nodes, Edges,
         '/home/wxw/paper/researchresult/BinaryFormat/treeshow/Modbus Order 10 20.png'
     )
Esempio n. 6
0
def getFormat(datas, tR, tC):
    formatTree = treeFormat(datas, tC, tR)
    formatTree.generate_T()
    return formatTree.tree
Esempio n. 7
0
from Inferformat.treeFormat import treeFormat
from common.Model.PrimData import primeData


def getFormat(datas, tR, tC):
    formatTree = treeFormat(datas, tC, tR)
    formatTree.generate_T()
    return formatTree.tree


def convertTreeToList(tree):
    tree.depth_traverse()
    tree.print_tree('single')


if __name__ == '__main__':
    t_temp = []
    t_temp.append(primeData('11122', [0, 1, 3, 5, 7], 1))
    t_temp.append(primeData('11222', [0, 1, 3, 5, 9], 2))
    t_temp.append(primeData('112234', [0, 1, 3, 5, 10], 3))
    t_temp.append(primeData('123423', [0, 2, 4, 6, 7], 4))
    t_temp.append(primeData('1121', [0, 2, 4, 6, 8], 5))
    t_temp.append(primeData('123123', [0, 2, 4, 6, 10], 6))
    tree_builder = treeFormat(t_temp, 3, 0.2)
    t_result = tree_builder.generate_T()
    t_result.depth_traverse()
    for f in t_result.result:
        print("format start")
        for node_i in f:
            print(node_i.loc)
            print(node_i.getNodeData())