Skip to content

Instantly share code, notes, and snippets.

@michelp
Created November 30, 2012 01:07
Show Gist options
  • Select an option

  • Save michelp/4173057 to your computer and use it in GitHub Desktop.

Select an option

Save michelp/4173057 to your computer and use it in GitHub Desktop.
>>> pprint(sorted(db.expand('sports cars', [('entity', 20, 1024, 1, 1)], language='en'), key=itemgetter(1), reverse=True))
[(u'entity:american', 943L),
(u'entity:british', 618L),
(u'entity:canada', 362L),
(u'entity:australia', 328L),
(u'entity:australian', 286L),
(u'entity:car', 120L),
(u'entity:ford', 119L),
(u'entity:"grand prix"', 112L),
(u'entity:"le mans"', 105L),
(u'entity:ferrari', 96L),
(u'entity:porsche', 70L),
(u'entity:lotus', 59L),
(u'entity:"french grand prix"', 54L),
(u'entity:"british grand prix"', 53L),
(u'entity:"belgian grand prix"', 52L),
(u'entity:"scuderia ferrari"', 50L),
(u'entity:fia', 48L),
(u'entity:"german grand prix"', 48L),
(u'entity:"united states grand prix"', 47L),
(u'entity:"italian grand prix"', 46L)]
>>> pprint(sorted(db.expand('sports cars', [('link', 20, 1024, 1, 1)], language='en'), key=itemgetter(1), reverse=True))
[(u'link:"formula one"', 133L),
(u'link:"indianapolis 500"', 90L),
(u'link:automobile', 86L),
(u'link:ferrari', 80L),
(u'link:"sports car"', 73L),
(u'link:"24 hours of le mans"', 66L),
(u'link:"tour de france"', 59L),
(u'link:"general motors"', 59L),
(u'link:"motor racing"', 59L),
(u'link:automotive', 58L),
(u'link:renault', 51L),
(u'link:porsche', 48L),
(u'link:"alfa romeo"', 42L),
(u'link:mclaren', 41L),
(u'link:manual', 41L),
(u'link:"monte carlo rally"', 40L),
(u'link:hatchback', 36L),
(u'link:brabham', 29L),
(u'link:cosworth', 26L),
(u'link:straight-4', 22L)]
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment