예제 #1
0
 def test_crawl_single(self):
     twit = MockTwitterResource()
     gis = MockGisgraphyResource()
     user = User(_id=6)
     results = sprawl.crawl_single(user, twit, gis, fast=False)
     self.assertEqual(results.nebrs[0]._id, 1)
     self.assertEqual(results.nebrs[0].local_ratio, 1)
     self.assertEqual(results.ats, [7])
예제 #2
0
def _crawl_pred_one(user, twit, gis, pred, fast):
    if user.location and not user.geonames_place:
        user.geonames_place = gis.twitter_loc(user.location)

    gnp = user.geonames_place
    if gnp and gnp.mdist < MAX_GNP_MDIST:
        user.pred_loc = gnp.to_tup()
        return

    nebrs, ats, ated = sprawl.crawl_single(user, twit, gis, fast=fast)
    if nebrs:
        clf = "friendloc_nearcut" if fast else "friendloc_cut"
        user.pred_loc = pred.predict(user, nebrs, ats, ated, clf)