Exemplo n.º 1
0
 def test_sota_sampler(self):
     local_file = os.path.abspath(os.path.dirname(__file__) + os.path.sep + "../../") + '/pkl_example/yelp_3000.pkl'
     localdata = LocalData(local_file, 'pkl', "business_id", ["name"], ["name", "full_address"])
     localdata_ids, localdata_query, localdata_er = localdata.getlocalData()
     initQueries = utils.queryGene(localdata_query, 2)
     sampler.sota_sampler(query_pool=initQueries, api=self.yelp, match_term=localdata.getQueryList(), top_k=300,
                          adjustment=1, samplenum=1)
     self.yelp.getSession().close()
     assert True
Exemplo n.º 2
0
 def setUp(self):
     search_term = 'q'
     parameters = {'h': 1000}
     self.dblp = PublApi(delay=5, search_term=search_term, **parameters)
     localdata_file = os.path.abspath(
         os.path.dirname(__file__) + os.path.sep +
         "../../") + '/example/dblp_10000.pkl'
     localdata = LocalData(localdata_file, 'pkl', "row['key']",
                           ["row['title']"], ["row['title']"])
     localdata_ids, localdata_query, localdata_er = localdata.getlocalData()
     initQueries = utils.queryGene(localdata_query, 2)
     self.initQueries = initQueries
Exemplo n.º 3
0
class LocaldataTestCase(unittest.TestCase):
    def setUp(self):
        data_file = os.path.abspath(os.path.dirname(__file__) + os.path.sep + "../../") + '/yelp_example/yelp_3000_AZ.csv'
        self.localdata = LocalData(data_file, 'csv', "business_id", ["name"],
                                   ["name", "full_address"])

    def tearDown(self):
        self.localdata = None

    def test_loadLocalData(self):
        self.localdata.setlocalData(None, None, None)
        self.localdata.read_csv()
        localdata_ids, localdata_query, localdata_er = self.localdata.getlocalData()
        assert len(localdata_ids) == 3000
Exemplo n.º 4
0
 def setUp(self):
     search_term = 'q'
     parameters = {'h': 1000}
     self.dblp = PublApi(top_k=1000,
                         delay=5,
                         search_term=search_term,
                         **parameters)
     localdata_file = os.path.abspath(
         os.path.dirname(__file__) + os.path.sep +
         "../../") + '/csv_example/dblp_sample.csv'
     localdata = LocalData(localdata_file, 'csv', "key", ["title"],
                           ["title"])
     localdata_ids, localdata_query, localdata_er = localdata.getlocalData()
     initQueries = utils.queryGene(localdata_query, 2)
     self.initQueries = initQueries
Exemplo n.º 5
0
class LocaldataTestCase(unittest.TestCase):
    def setUp(self):
        data_file = os.path.abspath(
            os.path.dirname(__file__) + os.path.sep +
            "../../") + '/example/yelp_3000.pkl'
        self.localdata = LocalData(data_file, 'pkl', "row['business_id']",
                                   ["row['name']"],
                                   ["row['name']", "row['full_address']"])

    def tearDown(self):
        self.localdata = None

    def test_loadLocalData(self):
        self.localdata.setlocalData(None, None, None)
        self.localdata.read_pickle()
        localdata_ids, localdata_query, localdata_er = self.localdata.getlocalData(
        )
        assert len(localdata_ids) == 3000
Exemplo n.º 6
0
from deeperlib.api.yelp.searchapi import SearchApi
from deeperlib.core import utils
from deeperlib.data_processing.local_data import LocalData
from deeperlib.estimator import sampler

# ==== Sota-Sampler Yelp ====
client_id = "kCe2YbZePXsPnC204ZrXoQ"
client_secret = "s9KnvEEQW7jaA2wlrBi4X2fnDQ0F7asdklXVvJUidWp8i50ov24E8EjkHX2AUhoL"
search_term = 'term'
parameters = {'limit': 50, 'location': 'AZ'}
yelp = SearchApi(client_id=client_id,
                 client_secret=client_secret,
                 top_k=300,
                 delay=5,
                 search_term=search_term,
                 **parameters)
local_file = 'yelp_3000.pkl'
localdata = LocalData(local_file, 'pkl', "row['business_id']", ["row['name']"],
                      ["row['name']", "row['full_address']"])
localdata_ids, localdata_query, localdata_er = localdata.getlocalData()
initQueries = utils.queryGene(localdata_query, 2)
sampler.sota_sampler(query_pool=initQueries,
                     api=yelp,
                     match_term=localdata.getQueryList(),
                     top_k=300,
                     adjustment=1)
yelp.getSession().close()