goldsmith / Wikipedia

A Pythonic wrapper for the Wikipedia API
https://wikipedia.readthedocs.org/
MIT License
2.89k stars 519 forks source link

It does not spot all disambiguation pages #252

Closed ghost closed 3 years ago

ghost commented 4 years ago

I just tried "Arla" keyword and it is refered as a disambiguation page see https://en.wikipedia.org/wiki/Arla

import wikipedia
import random
ee = None
try:
    p = wikipedia.summary("Arla")
except wikipedia.DisambiguationError as e:
    ee = e
    s = random.choice(e.options)
    p = wikipedia.page(s)

How to deal with this, I have a lot of keywords that I want to retrieve only articles that fall in a specific category (topic "food and beverages)

Many thanks !

KairaNithin commented 3 years ago

try wikipedia.summary("Arla",auto_suggest=False) as suggested by @wlerin. But this do not work with few words.