DisambiguationError: perhaps a better response?
See original GitHub issueFor example:
wikipedia.summary('recommendation')
gives the following error and terminates the program:
290 may_refer_to = [li.a.get_text() for li in filtered_lis if li.a]
291
--> 292 raise DisambiguationError(self.title, may_refer_to)
293
294 else:
DisambiguationError: "Recommendation" may refer to:
norm (philosophy)
Recommender systems
European Union recommendation
W3C recommendation
letter of recommendation
Perhaps a better response, maybe in a JSON format, would help? without termination, and instead ask for further clarification?
Issue Analytics
- State:
- Created 10 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Wikipedia disambiguation error - python - Stack Overflow
A less-good but perhaps easier fix would be for you to simply try/except the DisambiguationError and try again.
Read more >Spurious Disambiguation Error Detection - Stefano Zacchiroli
Abstract. The disambiguation approach to the input of formulae en- ables the user to type correct formulae in a terse syntax close to...
Read more >DragonComputer/Lobby - Gitter
DisambiguationError : Today I'm only an user of Dragonfire, you would have some idea about exeptions handling in Dragonfire. Maybe you can let...
Read more >Wikipedia API for Python. In this tutorial let us understand the…
But sometimes be careful, you might run into a DisambiguationError . Which means the same words with different meanings. For example, the word...
Read more >Python page Examples, wikipedia.page Python Examples
DisambiguationError as e: for article in e.options: try: article ... page = wikipedia.page(error.options[0]) response['title'] = page.title response['url'] ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
yeah well that could be one option. I was thinking:
this would help counter the error and give the user a chance to select an input at run-time instead.
Sample output
the DisambiguationError object does store a list of the suggested article titles: