Loading ...
Sorry, an error occurred while loading the content.

Help on Capitalizing Strrings

Expand Messages
  • John Shotsky
    I need some help coding the following task: I have text files that contain manufacturer s names and their product names. Often the capitalization is incorrect,
    Message 1 of 3 , Jan 5, 2011
    • 0 Attachment
      I need some help coding the following task:

      I have text files that contain manufacturer's names and their product names. Often the capitalization is incorrect, or
      is made incorrect by my other clip processing. I have been requested to provide a feature that will restore the proper
      casing to these product names, as a post process to the work my other clips perform. Because it refers to recipes, it
      means that virtually any food product that has a trademarked name can appear in the text, especially when people
      download recipes from the food manufacturer's sites.

      Because the capitalization will depend on the manufacturers' names, and not on proper English, I think an external text
      file with the proper strings with the proper casing would work, and is something that users can update themselves.

      The way I envision it working is this:
      An external text file with a list of product names with proper casing, punctuation, spelling and spacing.
      After my main body of clips runs, the text file would be used to search for those strings, and replace them with the
      strings found in the text file. I assume an array would be used, but I don't know how set it up.

      Product names that would be found in prodnames.txt:
      UNCLE BEN'S Boil-In-Bag Whole Grain Brown Rice
      UNCLE BEN'S Fast & Natural Whole Grain Instant Brown Rice
      UNCLE BEN'S READY RICE Long Grain & Wild Rice

      Here are a couple paragraphs that contains these product names, with changed casing:
      Uncle ben's provides many wonderful rice products. Uncle ben's boil-in-bag whole grain brown rice is prepared simply by
      dropping a plastic bag into a pot of boiling water.

      Uncle ben's fast & natural whole grain instant brown rice is 100% natural whole grain brown rice that cooks in just 10
      minutes. Uncle ben's ready rice long grain & wild rice contains both long grain and wild rice with 23 herbs and
      seasonings.

      Thanks for any assistance you can provide.

      John



      [Non-text portions of this message have been removed]
    • Axel Berger
      ... I m currently too lazy to flesh this out, but I envisage this solution: You have a list of one name per line. You copy that off into an array to save names
      Message 2 of 3 , Jan 5, 2011
      • 0 Attachment
        John Shotsky wrote:
        > UNCLE BEN'S Boil-In-Bag Whole Grain Brown Rice

        I'm currently too lazy to flesh this out, but I envisage this solution:

        You have a list of one name per line. You copy that off into an array to
        save names as is. You then make all letters lowercase and replace all
        non-letters except "&" by ".{0,3}". You then replace the n-th line by:

        ^!Replace "(?s)<n-th line>" >> "n-th array element" WRASTI

        The resulting file is the clip to run over your data.

        Axel
      • John Shotsky
        Thanks, Axel. I now have a working solution, so it s no longer an issue, at least not right now. Regards, John Recipe formatting tools:
        Message 3 of 3 , Jan 5, 2011
        • 0 Attachment
          Thanks, Axel.

          I now have a working solution, so it's no longer an issue, at least not right now.

          Regards,
          John
          Recipe formatting tools:
          <http://recipetools.gotdns.com/> http://recipetools.gotdns.com
          Beaverton WeatherCam:
          <http://shotsky.gotdns.com/> http://shotsky.gotdns.com


          From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Axel Berger
          Sent: Wednesday, January 05, 2011 11:03 AM
          To: ntb-clips@yahoogroups.com
          Subject: Re: [Clip] Help on Capitalizing Strrings


          John Shotsky wrote:
          > UNCLE BEN'S Boil-In-Bag Whole Grain Brown Rice

          I'm currently too lazy to flesh this out, but I envisage this solution:

          You have a list of one name per line. You copy that off into an array to
          save names as is. You then make all letters lowercase and replace all
          non-letters except "&" by ".{0,3}". You then replace the n-th line by:

          ^!Replace "(?s)<n-th line>" >> "n-th array element" WRASTI

          The resulting file is the clip to run over your data.

          Axel



          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.