The introduction of Wolfram|Alpha defined a fundamentally new paradigm for getting knowledge and answers—not by searching the web, but by doing dynamic computations based on a vast collection of built-in data, algorithms and methods.
Wolfram Alpha .NET is an open source software library for interacting with the Wolfram Alpha API on the .NET platform.
Create a WolframAlphaService with your APP ID:
WolframAlphaService service = new WolframAlphaService("YOUR APP ID");
Create a request to query with WolframAlphaRequest:
WolframAlphaRequest request = new WolframAlphaRequest
{
Input = "YOUR QUERY"
};
Send the request to WolframAlpha
WolframAlphaResult result = await service.Compute(request);
WolframAlphaResult is a class that holds the QueryResult.
Some values may or may not be defined in the result, since it depends on the query and the response given by the Wolfram Alpha Webservice API. For instance, there may be cases in which Wolfram Alpha returns or not Assumptions, Tips, Errors, etc. However, all the properties are defined in the code, and you'll be able to see them when coding (code prediction with Intellisense on Visual Studio)
And if you'd like to print on the console the Pods with text returned, you could do it this way:
foreach (var pod in result.QueryResult.Pods)
{
if(pod.SubPods != null)
{
Console.WriteLine(pod.Title);
foreach (var subpod in pod.SubPods)
{
Console.WriteLine(" " + subpod.Plaintext);
}
}
}
Which will print the following in the case of querying "Stephen Wolfram":
You can filter and do more complex queries by including other properties on the WolframAlphaRequest object such as the Pod Ids , Units (Metric, non metric), formats, your location, etc. Look at parameter references.
We use GitHub issues for tracking requests and bugs.
- Wolfram Research Website
- Wolfram Alpha Website
- Wolfram Alpha Full Results API Reference
- Wolfram Alpha Webservice API Reference
Learn more about the Wolfram community at the community page of Wolfram for a few ways to participate.
Contributions are always welcome! Fork this repo and submit a Pull Request
Caught a mistake or want to contribute to the documentation? Edit this page on Github
MIT
GitHub @xjose97x · Twitter @xjose97x · Linkedin Jose Escudero