Exemplo n.º 1
0
 def test_find_with_changed_order(self):
     """Find the given token regardless of order"""
     string_list = ['asd', 'asdd', 'fre', 'glk', 'lkm']
     finder = Finder(string_list)
     find = finder.find('sad')
     expected = ['asd', 'asdd']
     assert find == expected
Exemplo n.º 2
0
 def test_find_with_none_param(self):
     """Find the empty given token"""
     string_list = ['asd', 'asdd', 'fre', 'glk', 'lkm']
     finder = Finder(string_list)
     find = finder.find(None)
     expected = []
     assert find == expected
def query(query_string, max_distance):
    model = ProjectionModel()
    model.load(configs['model_path'])
    ontobiotope = OntoBiotope(configs['ontobiotope_raw'])
    ontobiotope.load_graph(configs['ontobiotope_nx'])

    ontobiotope_enriched = OntoBiotope(configs['ontobiotope_raw'])
    ontobiotope_enriched.load_graph(configs['ontobiotope_enriched'])
    node_embeddings = OntoBiotope.load_embeddings(configs['node_embeddings'])

    finder = Finder()
    finder.construct_inverted_index(configs['train'])

    query_embedding = MentionSet.mention_to_embedding(
        query_string, pretrained_word_embeddings)
    predicted_node_id = model.predict(
        np.array(query_embedding).reshape((1, 100)), node_embeddings)[0]

    taxonomy_results = finder.find_related_docs(ontobiotope.graph,
                                                predicted_node_id,
                                                max_distance)
    finder.display_search_results(taxonomy_results, configs['train'],
                                  './data/taxonomy_results.txt')

    cooccurrence_results = finder.find_related_docs(ontobiotope_enriched.graph,
                                                    predicted_node_id,
                                                    max_distance)
    finder.display_search_results(cooccurrence_results, configs['train'],
                                  './data/cooccurrence_results.txt')
Exemplo n.º 4
0
 def test_find_with_big_initialization(self):
     """Find the given token regardless of order"""
     string_list = [
         'North America', 'South America', 'Asia', 'Africa', 'Europe',
         'Antartica', 'Australia'
     ]
     finder = Finder(string_list)
     find = finder.find('ac')
     expected_result = [
         'North America', 'South America', 'Africa', 'Antartica'
     ]
     assert find == expected_result
Exemplo n.º 5
0
 def test_find_with_large_initialization(self):
     """Find the given token regardless of order with a big input"""
     string_list = [
         'Afghanistan', 'Albania', 'Algeria', 'Andorra', 'Angola',
         'Antigua & Deps', 'Argentina', 'Armenia', 'Australia', 'Austria',
         'Azerbaijan', 'Bahamas', 'Bahrain', 'Bangladesh', 'Barbados',
         'Belarus', 'Belgium', 'Belize', 'Benin', 'Bhutan', 'Bolivia',
         'Bosnia Herzegovina', 'Botswana', 'Brazil', 'Brunei', 'Bulgaria',
         'Burkina', 'Burundi', 'Cambodia', 'Cameroon', 'Canada',
         'Cape Verde', 'Central African Rep', 'Chad', 'Chile', 'China',
         'Colombia', 'Comoros', 'Congo', 'Congo', 'Costa Rica', 'Croatia',
         'Cuba', 'Cyprus', 'Czech Republic', 'Denmark', 'Djibouti',
         'Dominica', 'Dominican Republic', 'East Timor', 'Ecuador', 'Egypt',
         'El Salvador', 'Equatorial Guinea', 'Eritrea', 'Estonia',
         'Ethiopia', 'Fiji', 'Finland', 'France', 'Gabon', 'Gambia',
         'Georgia', 'Germany', 'Ghana', 'Greece', 'Grenada', 'Guatemala',
         'Guinea', 'Guinea-Bissau', 'Guyana', 'Haiti', 'Honduras',
         'Hungary', 'Iceland', 'India', 'Indonesia', 'Iran', 'Iraq',
         'Ireland', 'Israel', 'Italy', 'Ivory Coast', 'Jamaica', 'Japan',
         'Jordan', 'Kazakhstan', 'Kenya', 'Kiribati', 'Korea North',
         'Korea South', 'Kosovo', 'Kuwait', 'Kyrgyzstan', 'Laos', 'Latvia',
         'Lebanon', 'Lesotho', 'Liberia', 'Libya', 'Liechtenstein',
         'Lithuania', 'Luxembourg', 'Macedonia', 'Madagascar', 'Malawi',
         'Malaysia', 'Maldives', 'Mali', 'Malta', 'Marshall Islands',
         'Mauritania', 'Mauritius', 'Mexico', 'Micronesia', 'Moldova',
         'Monaco', 'Mongolia', 'Montenegro', 'Morocco', 'Mozambique',
         'Myanmar', 'Namibia', 'Nauru', 'Nepal', 'Netherlands',
         'New Zealand', 'Nicaragua', 'Niger', 'Nigeria', 'Norway', 'Oman',
         'Pakistan', 'Palau', 'Panama', 'Papua New Guinea', 'Paraguay',
         'Peru', 'Philippines', 'Poland', 'Portugal', 'Qatar', 'Romania',
         'Russian Federation', 'Rwanda', 'St Kitts & Nevis', 'St Lucia',
         'Saint Vincent & the Grenadines', 'Samoa', 'San Marino',
         'Sao Tome & Principe', 'Saudi Arabia', 'Senegal', 'Serbia',
         'Seychelles', 'Sierra Leone', 'Singapore', 'Slovakia', 'Slovenia',
         'Solomon Islands', 'Somalia', 'South Africa', 'South Sudan',
         'Spain', 'Sri Lanka', 'Sudan', 'Suriname', 'Swaziland', 'Sweden',
         'Switzerland', 'Syria', 'Taiwan', 'Tajikistan', 'Tanzania',
         'Thailand', 'Togo', 'Tonga', 'Trinidad & Tobago', 'Tunisia',
         'Turkey', 'Turkmenistan', 'Tuvalu', 'Uganda', 'Ukraine',
         'United Arab Emirates', 'United Kingdom', 'United States',
         'Uruguay', 'Uzbekistan', 'Vanuatu', 'Vatican City', 'Venezuela',
         'Vietnam', 'Yemen', 'Zambia', 'Zimbabwe'
     ]
     finder = Finder(string_list)
     find = finder.find('tan')
     expected_result = [
         'Afghanistan', 'Bhutan', 'Kazakhstan', 'Kyrgyzstan', 'Mauritania',
         'Pakistan', 'Tajikistan', 'Turkmenistan', 'Uzbekistan', 'Vietnam'
     ]
     assert find == expected_result
 def __init__(self, username):
     self.bdAPI = bdAPI()  #экземпяр БД класса
     self.user_id = self.bdAPI.getUserIdFromName(username)
     self.f = Finder(self.user_id)  #экземпяр инстаграм класса
Exemplo n.º 7
0
def finder():
    return Finder()
Exemplo n.º 8
0
 def setup(self):
     self.finder = Finder()
Exemplo n.º 9
0
        # Formats the selected proxy.
        proxy = Proxy(args)

        if args.proxy is not None:
            args.proxy = proxy.format_proxy()
        else:
            if args.random_proxy:
                args.proxy = proxy.random_proxy()

        # Instance the "Check" class.
        request = Request(args)

        # Checks whether the target is online.
        if request.check_status() == 200:
            Color.println("{+} Target On: {G}%s{W}" % args.url)
        else:
            Color.println("{!} Error: Please verify your target.")
            exit()

        # Stores the selected word list in the variable.
        wordlist = Wordlist(args)
        args.wordlist = wordlist.run()

        ExploitFinder = Finder(args)  # Instance the "Finder" class.

        # Heimdall, find!
        ExploitFinder.dashboard()

        Color.println("\n{+} {G}Heimdall, find the dashboard!{W}\n")
        ExploitFinder.run()
Exemplo n.º 10
0
        Formats the selected proxy.
        """
        if args.proxy is not None:
            args.proxy = Set.proxy()
        """
        Instance the "Check" class.
        Checks whether the target is online.
        """
        Checkup = Check(args)
        try:
            Checkup.target()
            Color.println("{+} Target On: {G}%s{W}" % args.url)
        except Exception as ex:
            Color.println("{!} Error: %s" % ex)
            Color.println("{!} Please verify your target.")
            exit()
        """
        Stores the selected word list in the variable.
        """
        args.wordlist = Set.wordlist()
        """
        Instance the "Finder" class.
        Heimdall, find!
        """
        ExploitFinder = Finder(args)
        try:
            ExploitFinder.dashboard()
        except KeyboardInterrupt as ex:
            Color.println("\n{!} CTRL + C has pressed. %s" % ex)
    Color.println("{+} Finished!    :)")