wp.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:prox-server 作者: mozilla-mobile 项目源码 文件源码
def search(coord, place_name):
    """Finds the Wikipedia page corresponding to the given place.

    The current implementation requires Wikipedia geotags, meaning it'll miss:
    - Chains (Starbucks)
    - Corporate pages (Lagunitas, as opposed to the brewery site)
    - Area-based things (49-mile drive in SF)

    :param coord: is (latitude, longitude)
    :return: A wikipedia page title.
    """
    # We don't use the title arg of `wikipedia.geosearch`. It will return exact title matches, even if the geo location
    # does not match, so "Boulevard" will return a street rather than the restaurant (which is "Boulevard (restaurant)").
    wiki_page_titles = wikipedia.geosearch(*coord)
    return _match_place_name_to_wiki_page(place_name, wiki_page_titles)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号