예제 #1
0
    def setUp(self):
        print 'Set up'
        self.value = NameExtractor.NameExtractor()
        self.value.full_name = 'Mr John Brown'
        self.value._parse_name()

        self.value1 = NameExtractor.NameExtractor()
        self.value1.full_name = 'Mr. John Paul Brown Phd'
        self.value1._parse_name()
def decompiler(path, file_path):
    global app_names, driver
    driver = webdriver.Chrome(path)
    driver.maximize_window()

    app_names = NameExtractor.name_extractor(file_path)
    for i in app_names:
        try:
            driver.refresh()
            driver.get("https://www.apkdecompilers.com/")
            time.sleep(5)

            # find element
            # extra code
            print(app_names)
            driver.get("https://www.apkdecompilers.com/")
            driver.find_element_by_id('apk')
            time.sleep(10)
            # send element
            element_send = driver.find_element_by_id("apk")
            element_send.send_keys(i)
            print(i)
            driver.find_element_by_id("submit-btn").click()
            time.sleep(270)
            # download element
            driver.find_element_by_xpath("/html/body/section[1]/div/div/div/div/div/div/div/div[2]/div/div/div/div/div/div/div[2]/a/b/u/h3").click()
            time.sleep(50)
        except:
            # find element
            # extra code
            driver.refresh()
            driver.get("http://www.javadecompilers.com/apk")
            # send element
            element_send = driver.find_element_by_id("upload_datafile")
            element_send.send_keys(i)
            print(i)
            send_element = driver.find_element_by_xpath("/html/body/div[2]/div/div[2]/div/div[2]/div/form/div/div/div/div[2]/div[1]/div/button")
            webdriver.ActionChains(driver).move_to_element(send_element).click(send_element).perform()
            time.sleep(270)
            # download element
            down_element = driver.find_element_by_xpath("/html/body/div[2]/div/div[2]/div/div[2]/div/div[2]/div/div[1]/div/div[2]/div/div[1]/div[2]/a")
            webdriver.ActionChains(driver).move_to_element(down_element).click(down_element).perform()
            time.sleep(50)

    driver.close()
예제 #3
0
def recursion(path2, folder):
    for root, subdirs, files in os.walk(path2):
        for filename in  files:
            # print("this is the name of file")
            # print(filename)
            # print("\n\n")
            if filename[-4:] == ".xml":
                path = os.path.join(root, filename)
                text,emails = out1_pro.callMe(path)
                if text != None:
                    list_of_names = NameExtractor.textToNames(text)
                    w = EmailToNameMapping.emailToNameMapping(emails,list_of_names)
                    for item in w:
                        # print(item, w[item],filename[:-4], folder)
                        try:
                            fire(w[item], item, filename[:-4], folder)
                        except Exception as e:
                            print("Exception in database updation " + str(e))
                            continue
예제 #4
0
def recursion(path2, folder):
    for root, subdirs, files in os.walk(path2):
        for filename in files:
            # print("this is the name of file")
            # print(filename)
            # print("\n\n")
            if filename[-4:] == ".xml":
                path = os.path.join(root, filename)
                text, emails = out1_pro.callMe(path)
                if text != None:
                    list_of_names = NameExtractor.textToNames(text)
                    w = EmailToNameMapping.emailToNameMapping(
                        emails, list_of_names)
                    for item in w:
                        # print(item, w[item],filename[:-4], folder)
                        try:
                            fire(w[item], item, filename[:-4], folder)
                        except Exception as e:
                            print("Exception in database updation " + str(e))
                            continue
예제 #5
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

import NameExtractor
import codecs
    
###########Extraction of named entity for Discours-Sarkozy############
fh = codecs.open("Discours-Sarkozy-v20111025.preproc.txt") 
text = fh.read()
fh.close()
dict_names = {}
dict_names,nb = NameExtractor.name_extraction(text, dict_names)
names = dict_names.keys()
file = open("result_discours_Sarkozy.txt","w",0)
file.write("Named entity for Discours Sarkozy \n\n\n")
for n in names:
    file.write(n+"\n")
file.close()