wikipedia.summary() raises error on common words if auto_suggest is set to True(which is by default).
Also see #284, #279, #266 for more details.
In simple words if you use wikipedia.summary("loki") then it will raise wikipedia.exceptions.DisambiguationError: "lok" may refer to: . Which suggests that it is searching for lok instead of loki.
Cause of Problem
When calling the summary function, it calls the page function. where is auto_suggest is true then we try to check for the valid title through search function which return the results and suggestion.
But while assigning the title variable title = suggestion or results[0] like this we are applying the suggestion first and if suggestion not found then result. Which causes this problem.
Actually title = results[0] or suggestion should be used which means set title to results[0] first and if results[0] is not available then set it to suggestion.
Problem
wikipedia.summary()
raises error on common wordsif auto_suggest is set to True(which is by default)
.wikipedia.summary("loki")
then it will raisewikipedia.exceptions.DisambiguationError
:"lok"
may refer to: . Which suggests that it is searching forlok
instead ofloki
.Cause of Problem
summary
function, it calls thepage
function. where is auto_suggest is true then we try to check for the valid title throughsearch
function which return theresults and suggestion
.title = suggestion or results[0]
like this we are applying thesuggestion first
and if suggestion not found then result. Which causes this problem.title = results[0] or suggestion
should be used which means set title toresults[0] first
and if results[0] is not available then set it to suggestion.Changes
Fixes
284
279
266