kpedini Posted May 20, 2009 Share Posted May 20, 2009 I'm building a website that compiles user submitted recipes and was wondering if anyone had a technique to extract a list of ingredients in a text area and then categorize those ingredients. For example, the user would enter the following: 1/2 cup of flour 2 cups of butter I would then be able to extract "flour" and "butter" and compare those strings so I can categorize those ingredients as "baking supplies" and "dairy" in the database. The desired result is to be able to compile the various ingredients provided and generate a shopping list. My thought is to explode the text into an array of values and then do a compare on each word against an array of predefined ingredients to find the appropriate category. This approach seems like it could be rather processor intensive, however. I was wondering if anyone had a different approach that would make more sense. Any help is greatly appreciated. Thanks. Link to comment https://forums.phpfreaks.com/topic/158964-comparing-text-against-a-database/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.