convert mealmaster and mastercook recipes A.K.A. parse and recognize text lines

beatricemango

New Member
I am trying to convert (free) recipes mostly saved in mealmaster and mastercook's formats.(here you can find some to download: http://home.earthlink.net/~darkstar105/ (it's not my site)). I'd like to create XML files from them.The problem is that they are complex to convert since there aren't fixed rules for all.All that I've done for now (in Java) probably save 80% of the ingredients correctly, while for the others I fail to understand where ingredients begin and end and what is an ingredient and what is a measurement.Those are some examples:Mastercook:\[code\]* Exported from MasterCook II * A Texas Breakfast Casserole Recipe By : Serving Size : 8 Preparation Time :0:10 Categories : Casseroles Breakfastenter code here Amount Measure Ingredient -- Preparation Method -------- ------------ --------------------------------1 Can Crescent Rolls1 Pound Sausage -- cooked and drained Fresh Mushrooms -- sliced 3/4 Pound Monterey Jack Cheese -- grated6 Eggs -- beaten1 Can Cream Of Onion SoupLine a 13x9 inch Pyrex dish with rolls, sealing perforations. Cover with sausage, mushrooms and half the cheese. Mix eggs with soup and pour over casserole. Sprinkle remaining cheese on top. Chill overnight. Bake at 350 for 1 hour. Note: For variation, you can use cooked, crumbled bacon or bite-sized pieces of ham instead of sausage.\[/code\]Mealmaster:\[code\]---------- Recipe via Meal-Master (tm) v8.05 Title: Baked Breakfast Apples\[/code\]Categories: Brunch, Fruits Yield: 2 servings\[code\] 2 md Apples; cut in bite-size chu 2 tb Snipped dates 1/2 ts Ground cinnamon 1/2 c Apple juice 2 tb Raspberry all-fruit spread 1/4 c Reduced-fat granolaIn two individual casseroles combine the apples and dates. Sprinkle\[/code\]withetc.(SO formatting is definitely not helping me here)A parser for those two recipes seems easy, but it should work for all the variations those two programs allow.Mastercook seems to be the easier one, since I can use the ----- to determine where an Amount/Measure/Ingredient start and finish, but I'm not sure how to find the end of the ingredients list, since sometimes there are more spaces.Mealmaster makes it more difficult by having some recipes with two colums :(Note that mealmaster has some kind of documentation for the exported files, but there is a slightly hilarous/depressing note with it. :/ \[quote\]\[code\]NOTE: Beginning with v8.03, Meal-Master will attempt to align the quantity, unit, and name information prior to import. This means that ingredient lines do not have to follow the column alignment above, as Meal-Master will automatically align the quantity, unit, and name fields as long as they contain valid data.\[/code\]\[/quote\]
 
Back
Top