コード例 #1
0
def main_func():
    directory = ''
    a_file = directory + "input.xml"
    tree = ET.parse(a_file)
    root = tree.getroot()
    footnotes.foot_main(root)
    tables_figures.tab_fig_main(root)
    url.url_main(root)
    return root
コード例 #2
0
def runScript():

    copyTime = 0
    pdftoxmltime = 0
    parseTime = 0
    footnotestime = 0
    tables_figures_time = 0
    urltime = 0
    cit2reftime = 0
    chunk1time = 0
    chunk2time = 0
    secMapTime = 0
    emailTime = 0
    affTime = 0
    titleTime = 0
    authorTime = 0
    mappingtime = 0
    xmlParsingTime = 0
    testFoldedDataTime = 0
    genrateCoraxmlTime = 0

    #print os.getcwd()
    os.chdir(directory)
    #print os.getcwd()

    #subprocess.call(directory + "./Clear.sh",shell=True)
    # print paperid
    file_name = glob.glob(directory + '*.pdf')
    #print "main_script_batch : ", file_name
    srno = 1
    for fname in file_name:
        #print srno
        srno = srno + 1
        # subprocess.call("rm " + directory + "input.pdf", shell=True)
        fn = fname.split('/')
        fn = fn[-1]
        #print fn
        # subprocess.call("clear", shell=True)
        startTime = time.time()
        # subprocess.call("cp " + directory + "testpdfs/" + fn + " " + directory + "input.pdf", shell=True)
        # copyTime += time.time()-startTime
        startTime = time.time()
        #print "Hello 1"
        subprocess.call(directory +
                        "pdftoxml.linux64.exe.1.2_7 -noImage -noImageInline " +
                        directory + "input.pdf " + directory + "input.xml",
                        shell=True)
        #print "Hello 2"
        pdftoxmltime += time.time() - startTime
        #subprocess.call("./Clear.sh", shell=True)
        #subprocess.call(directory + "./IntegratedShellScript.sh ", shell=True)
        try:
            a_file = directory + "input.xml"
            #print "Hello 3"

            startTime = time.time()
            tree = ET.parse(a_file)
            root = tree.getroot()
            parseTime += time.time() - startTime

            startTime = time.time()
            footnotes.foot_main(root)
            footnotestime += time.time() - startTime

            startTime = time.time()
            tables_figures.tab_fig_main(root)
            tables_figures_time += time.time() - startTime

            startTime = time.time()
            url.url_main(root)
            urltime += time.time() - startTime

            startTime = time.time()
            References_list = cit_final.mainf(root)
            cit2reftime += time.time() - startTime

        except Exception, inst:
            print "Exception : In main"
            #print e
            print type(inst)  # the exception instance
            print inst.args  # arguments stored in .args
            print inst  # __str__ allows args to be printed directly

        try:
            startTime = time.time()
            chunked_root_1, modalFS = chunk.chunk_1(root)
            chunk1time += time.time() - startTime
        except Exception, inst:
            print "Exception : In chunk1"
            #print e
            print type(inst)  # the exception instance
            print inst.args  # arguments stored in .args
            print inst  # __str__ allows args to be printed directly