Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We were originally planning on using wolfram alpha api for a new project but unfortunately the cost was entirely way to high for what we were using it for. Essentially what we were doing is calculating the nutrition facts for food. (

Before taking the step of trying to build something that may work in its place for this use case is there any open source code anywhere that can do this kind of analysis and compile the data?

The hardest part in my opinion is what it has for assumptions and where it gets that data to power the calculations. Or another way to put it is, I cannot seem to wrap my head around building something that computes user input to return facts and knowledge. I know if I can convert the user input into some standardized form I can then compare that to a nutrition fact database to pull in the information I need. Does anyone know of any solutions to re-create this or APIs that can provide this kind of analysis?

Thanks for any advice. I am trying to figure out if this project is dead in the water before it even starts. This kind of programming is well beyond me so I can only hope for an API, open source, or some kind of analysis engine to interpret user input when I know what kind of data they are entering (measurements and food).

share|improve this question
@DannyVarod Done and done :-) – Dynamic Mar 19 '12 at 21:33
@DannyVarod Sorry about that, in the first version of this post I had in there a Ruby based open source solution. I then later realized the language did not matter. – Patrick Mar 19 '12 at 21:35
@ChaosPandion You are right. I was a little discouraged after learning about Wolfram pricing but I am ready to learn anything at this point! – Patrick Mar 19 '12 at 21:36
Here is a crazy idea. Hire a bunch of college kids to enter nutritional information into your own database. With the economy the way it is they should work for pennies on the dollar! – ChaosPandion Mar 19 '12 at 21:53

It sounds like you're looking for a closed domain question answering algorithm. If you search on those keywords you should find a number of examples that can get you started. Since you're talking about a closed domain, it's a bit easier to deal with than something open like Wolfram Alpha.

As Danny Varod indicated, the key to these systems is data and lots of it. On a project I'm working on, we're processing in over 100K different documents. The algorithms, which weren't that difficult to work out, have been done for the most part for some time. The data vetting and loading is quite time consuming.

share|improve this answer
I spent the last 24 hours trying to soak up as much information about closed domain qa systems. I understand what they are from a theory level but I am at a loss as how to start programming wise. Ive found several good research papers that offer some theory level insight on how to make it happen. Would you be willing to share on how you got started on your project or what open source or closed source solutions you are leveraging (if any)? – Patrick Mar 21 '12 at 0:22

The calculations are not complex - simple weighed sum and then division by recommended daily consumption.

Getting the data is another story. You will need to either purchase a data subscription to some nutrition value data source or find a free one (perhaps from some ministry of health e.g. and then feed it into your database (unless there is an online API which you can use). If you do not find an online version, you will need to buy a book a get permission to use its content or buy the data from some company.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.