Message Boards Message Boards

0
|
13955 Views
|
7 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Return Wikipedia Summary

Posted 9 years ago

Hello, I would like to create a wolfram application that returns only the Wikipedia summary. Is this possible with the Wolfram Alpha API? I am using Python.

Any help is appreciated.

POSTED BY: Glenn Cameron
7 Replies

This looks a lot like a bug in W|A API. You should contact Wolfram support. Alternatively, you could download the summary using one of the Python modules for accessing Wikipedia, or just use the plain old urllib2.

No, you wouldn't use the Wolfram|Alpha API for this. You would use Mathematica or Mathematica online to make an API.

The code to do this in the WolframLanguage is :

WikipediaData["Elephant", "SummaryPlaintext"]

This returns the summary for the wikipedia article on "Elephant". We can create an API to do this with just one line:

CloudDeploy[APIFunction[{"Title" -> "String"}, WikipediaData[#Title, "SummaryPlaintext"] &], Permissions -> "Public"]

There is also a function called EmbedCode which produces Python code that will call an automatically generated API. You can learn more about these functions in the Wolfram Language documentation:

http://reference.wolfram.com/language/ref/EmbedCode.html

POSTED BY: Sean Clarke
Posted 9 years ago

Thanks for the response Sean. I guess I cannot use this package then? https://pypi.python.org/pypi/wolframalpha

POSTED BY: Glenn Cameron

You can use the WolframAlpha API to interact with Wolfram|Alpha.

Wolfram|Alpha doesn't do this thing you want with Wikipedia articles, does it? Wolfram|Alpha is mostly free to use. You can try it and see it what it does.

POSTED BY: Sean Clarke
Posted 9 years ago

Hey Sean,

Wolfram|Alpha does give me the wikipedia summary if I run the queries here http://www.wolframalpha.com/ but it doesnt if I use the python package. This is why I am a bit confused.

Thanks, Glenn

POSTED BY: Glenn Cameron

What query are you using to get the wikipedia summary? What does your API query look like?

Have you tried using the API explorer? http://products.wolframalpha.com/api/explorer.html

POSTED BY: Sean Clarke
Posted 9 years ago

Let's say I ask "Who is Iron Man" in the website. http://www.wolframalpha.com/input/?i=who+is+iron+man I will get a response with the wikipedia summary.

I have tried the API explorer. But when I use it for the same query the Wikipedia summary is absent. http://products.wolframalpha.com/api/explorer.html

Thanks again for your help. Wolfram is pretty awesome.

POSTED BY: Glenn Cameron
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract