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

Capitalization without a loop

Expand Messages
  • John Shotsky
    RecipeClips work files have sections with titles (recipes). Each title is preceded by a tag of Title:: I want to capitalize each word in each title using the
    Message 1 of 12 , Oct 16, 2013
      RecipeClips work files have sections with titles (recipes). Each title is preceded by a tag of Title::
      I want to capitalize each word in each title using the Toolbar Capitalize command rather than a loop, which is how I currently do
      it.
      In order for the toolbar command to function, the text in the title needs to be selected.
      So, I would like to select only the titles, all at once, use the toolbar command and be done with it.
      Currently, each title is selected separately, then capitalized using
      ^!InsertText ^$StrCapitalize("^$GetSelection$")$
      It is slightly faster to use the InsertText command in a loop than the Toolbar Capitalize command, but that would still leave the
      whole process in a loop.
      I've been looking at ^$GetDocReplaceAll, but I can't see how to form a command that would do what I want.

      For testing, I have a list of about 13,000 tagged titles.
      Using a loop with the above InsertText command title cases 7200 of them in 10 minutes.
      Using the same loop with a Toolbar Capitalize command title cases 5100 of them in 10 minutes.
      Selecting them all, and using the Toolbar Capitalize command without a loop takes about 1 second.
      Clearly, if I can determine how to select them all at once, a single toolbar command would be sufficient.
      Any ideas?

      Here are some sample titles:
      Title::THE BIG EASY CRAWFISH OMELET
      Title::THE CLASSIC HOT BROWN
      Title::THE GORE CREEK BAGEL
      Title::THE GUADALAJARA
      Title::THE INVISIBLE SALMON WRAPPED IN GHOSTLY RICE PAPER LYING IN A TOMATO BLOOD PUDDLE ON BLACK BEAN PAVEMENT BY A BROCCOLI TREE
      Title::THE PERFECT CHEESECAKE
      Title::THE SANTA FE WRAP
      Regards,
      John
    • Ian NTnerd
      John, So in your data is every line a Title ? If not then your data sample does not help me test a solution. With your data sample, you just select the whole
      Message 2 of 12 , Oct 16, 2013
        John,

        So in your data is every line a "Title"? If not then your data sample
        does not help me test a solution.

        With your data sample, you just select the whole document and Capitalize
        that. I doubt that is what you mean.

        I am thinking that between each title is a recipe or some other data.

        Title::THE BIG EASY CRAWFISH OMELET
        Ingredients:
        etc
        Title::THE CLASSIC HOT BROWN



        Ian

        On 16/10/2013 8:48 PM, John Shotsky wrote:
        > RecipeClips work files have sections with titles (recipes). Each title is preceded by a tag of Title::
        > I want to capitalize each word in each title using the Toolbar Capitalize command rather than a loop, which is how I currently do
        > it.
        > In order for the toolbar command to function, the text in the title needs to be selected.
        > So, I would like to select only the titles, all at once, use the toolbar command and be done with it.
        > Currently, each title is selected separately, then capitalized using
        > ^!InsertText ^$StrCapitalize("^$GetSelection$")$
        > It is slightly faster to use the InsertText command in a loop than the Toolbar Capitalize command, but that would still leave the
        > whole process in a loop.
        > I've been looking at ^$GetDocReplaceAll, but I can't see how to form a command that would do what I want.
        >
        > For testing, I have a list of about 13,000 tagged titles.
        > Using a loop with the above InsertText command title cases 7200 of them in 10 minutes.
        > Using the same loop with a Toolbar Capitalize command title cases 5100 of them in 10 minutes.
        > Selecting them all, and using the Toolbar Capitalize command without a loop takes about 1 second.
        > Clearly, if I can determine how to select them all at once, a single toolbar command would be sufficient.
        > Any ideas?
        >
        > Here are some sample titles:
        > Title::THE BIG EASY CRAWFISH OMELET
        > Title::THE CLASSIC HOT BROWN
        > Title::THE GORE CREEK BAGEL
        > Title::THE GUADALAJARA
        > Title::THE INVISIBLE SALMON WRAPPED IN GHOSTLY RICE PAPER LYING IN A TOMATO BLOOD PUDDLE ON BLACK BEAN PAVEMENT BY A BROCCOLI TREE
        > Title::THE PERFECT CHEESECAKE
        > Title::THE SANTA FE WRAP
        > Regards,
        > John
        >
        >
        >
        >
        >
        > ------------------------------------
        >
        > Fookes Software: http://www.fookes.com/
        > NoteTab website: http://www.notetab.com/
        > NoteTab Discussion Lists: http://www.notetab.com/groups.php
        >
        > ***
        > Yahoo! Groups Links
        >
        >
        >
        >
      • John Shotsky
        Yes, the titles are randomly located at the tops of the recipes. So far, using replace statements only, and no loops (except IfError ), I have gotten all
        Message 3 of 12 , Oct 16, 2013
          Yes, the titles are randomly located at the tops of the recipes.
          So far, using replace statements only, and no loops (except 'IfError'), I have gotten all 13,500 titles from all upper case to
          capitalized on the first character of each word in 30 seconds flat. That is close to 40 times faster than the loops were, so it's
          looking good already. It's a large clip, because every letter and every high-order letter (accented, etc) must be handled
          individually, twice, so it's a little over 200 lines counting the IfError lines between each clip. The average file will have under
          100 titles, so that should now be an insignificant amount of time. The nice thing about the replaces is that they don't activate
          unless the action is needed. The loops process each line, whether needed or not.

          Regards,
          John
          RecipeTools Web Site: http://recipetools.gotdns.com/
          John's Mags Yahoo Group: http://groups.yahoo.com/group/johnsmags/


          -----Original Message-----
          From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Ian NTnerd
          Sent: Wednesday, October 16, 2013 08:31
          To: ntb-clips@yahoogroups.com
          Subject: Re: [Clip] Capitalization without a loop

          John,

          So in your data is every line a "Title"? If not then your data sample
          does not help me test a solution.

          With your data sample, you just select the whole document and Capitalize
          that. I doubt that is what you mean.

          I am thinking that between each title is a recipe or some other data.

          Title::THE BIG EASY CRAWFISH OMELET
          Ingredients:
          etc
          Title::THE CLASSIC HOT BROWN



          Ian

          On 16/10/2013 8:48 PM, John Shotsky wrote:
          > RecipeClips work files have sections with titles (recipes). Each title is preceded by a tag of Title::
          > I want to capitalize each word in each title using the Toolbar Capitalize command rather than a loop, which is how I currently do
          > it.
          > In order for the toolbar command to function, the text in the title needs to be selected.
          > So, I would like to select only the titles, all at once, use the toolbar command and be done with it.
          > Currently, each title is selected separately, then capitalized using
          > ^!InsertText ^$StrCapitalize("^$GetSelection$")$
          > It is slightly faster to use the InsertText command in a loop than the Toolbar Capitalize command, but that would still leave the
          > whole process in a loop.
          > I've been looking at ^$GetDocReplaceAll, but I can't see how to form a command that would do what I want.
          >
          > For testing, I have a list of about 13,000 tagged titles.
          > Using a loop with the above InsertText command title cases 7200 of them in 10 minutes.
          > Using the same loop with a Toolbar Capitalize command title cases 5100 of them in 10 minutes.
          > Selecting them all, and using the Toolbar Capitalize command without a loop takes about 1 second.
          > Clearly, if I can determine how to select them all at once, a single toolbar command would be sufficient.
          > Any ideas?
          >
          > Here are some sample titles:
          > Title::THE BIG EASY CRAWFISH OMELET
          > Title::THE CLASSIC HOT BROWN
          > Title::THE GORE CREEK BAGEL
          > Title::THE GUADALAJARA
          > Title::THE INVISIBLE SALMON WRAPPED IN GHOSTLY RICE PAPER LYING IN A TOMATO BLOOD PUDDLE ON BLACK BEAN PAVEMENT BY A BROCCOLI TREE
          > Title::THE PERFECT CHEESECAKE
          > Title::THE SANTA FE WRAP
          > Regards,
          > John
          >
          >
          >
          >
          >
          > ------------------------------------
          >
          > Fookes Software: http://www.fookes.com/
          > NoteTab website: http://www.notetab.com/
          > NoteTab Discussion Lists: http://www.notetab.com/groups.php
          >
          > ***
          > Yahoo! Groups Links
          >
          >
          >
          >



          ------------------------------------

          Fookes Software: http://www.fookes.com/
          NoteTab website: http://www.notetab.com/
          NoteTab Discussion Lists: http://www.notetab.com/groups.php

          ***
          Yahoo! Groups Links
        • Sheri
          You could again create a new clip that has a series of replacement commands. Creating the list could start with the result of a GetDocMatchAll to capture all
          Message 4 of 12 , Oct 16, 2013
            You could again create a new clip that has a series of replacement commands. Creating the list could start with the result of a GetDocMatchAll to capture all the titles. Then capitalize the whole list at once. Then transform each line with a regex replace-all into a whole-document case-insensitive replace command. Then insert library and clip headers. Then run the clip on the original document with a farclip command.

            Sent from my Nook HD+

            John Shotsky <jshotsky@...> wrote:

            >Yes, the titles are randomly located at the tops of the recipes.
            >So far, using replace statements only, and no loops (except 'IfError'), I have gotten all 13,500 titles from all upper case to
            >capitalized on the first character of each word in 30 seconds flat. That is close to 40 times faster than the loops were, so it's
            >looking good already. It's a large clip, because every letter and every high-order letter (accented, etc) must be handled
            >individually, twice, so it's a little over 200 lines counting the IfError lines between each clip. The average file will have under
            >100 titles, so that should now be an insignificant amount of time. The nice thing about the replaces is that they don't activate
            >unless the action is needed. The loops process each line, whether needed or not.
            >
            >Regards,
            >John
            >RecipeTools Web Site: http://recipetools.gotdns.com/
            >John's Mags Yahoo Group: http://groups.yahoo.com/group/johnsmags/
            >
            >
            >-----Original Message-----
            >From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Ian NTnerd
            >Sent: Wednesday, October 16, 2013 08:31
            >To: ntb-clips@yahoogroups.com
            >Subject: Re: [Clip] Capitalization without a loop
            >
            >John,
            >
            >So in your data is every line a "Title"? If not then your data sample
            >does not help me test a solution.
            >
            >With your data sample, you just select the whole document and Capitalize
            >that. I doubt that is what you mean.
            >
            >I am thinking that between each title is a recipe or some other data.
            >
            >Title::THE BIG EASY CRAWFISH OMELET
            >Ingredients:
            >etc
            >Title::THE CLASSIC HOT BROWN
            >
            >
            >
            >Ian
            >
            >On 16/10/2013 8:48 PM, John Shotsky wrote:
            >> RecipeClips work files have sections with titles (recipes). Each title is preceded by a tag of Title::
            >> I want to capitalize each word in each title using the Toolbar Capitalize command rather than a loop, which is how I currently do
            >> it.
            >> In order for the toolbar command to function, the text in the title needs to be selected.
            >> So, I would like to select only the titles, all at once, use the toolbar command and be done with it.
            >> Currently, each title is selected separately, then capitalized using
            >> ^!InsertText ^$StrCapitalize("^$GetSelection$")$
            >> It is slightly faster to use the InsertText command in a loop than the Toolbar Capitalize command, but that would still leave the
            >> whole process in a loop.
            >> I've been looking at ^$GetDocReplaceAll, but I can't see how to form a command that would do what I want.
            >>
            >> For testing, I have a list of about 13,000 tagged titles.
            >> Using a loop with the above InsertText command title cases 7200 of them in 10 minutes.
            >> Using the same loop with a Toolbar Capitalize command title cases 5100 of them in 10 minutes.
            >> Selecting them all, and using the Toolbar Capitalize command without a loop takes about 1 second.
            >> Clearly, if I can determine how to select them all at once, a single toolbar command would be sufficient.
            >> Any ideas?
            >>
            >> Here are some sample titles:
            >> Title::THE BIG EASY CRAWFISH OMELET
            >> Title::THE CLASSIC HOT BROWN
            >> Title::THE GORE CREEK BAGEL
            >> Title::THE GUADALAJARA
            >> Title::THE INVISIBLE SALMON WRAPPED IN GHOSTLY RICE PAPER LYING IN A TOMATO BLOOD PUDDLE ON BLACK BEAN PAVEMENT BY A BROCCOLI TREE
            >> Title::THE PERFECT CHEESECAKE
            >> Title::THE SANTA FE WRAP
            >> Regards,
            >> John
            >>
            >>
            >>
            >>
            >>
            >> ------------------------------------
            >>
            >> Fookes Software: http://www.fookes.com/
            >> NoteTab website: http://www.notetab.com/
            >> NoteTab Discussion Lists: http://www.notetab.com/groups.php
            >>
            >> ***
            >> Yahoo! Groups Links
            >>
            >>
            >>
            >>
            >
            >
            >
            >------------------------------------
            >
            >Fookes Software: http://www.fookes.com/
            >NoteTab website: http://www.notetab.com/
            >NoteTab Discussion Lists: http://www.notetab.com/groups.php
            >
            >***
            >Yahoo! Groups Links
            >
            >
            >
            >
            >
            >------------------------------------
            >
            >Fookes Software: http://www.fookes.com/
            >NoteTab website: http://www.notetab.com/
            >NoteTab Discussion Lists: http://www.notetab.com/groups.php
            >
            >***
            >Yahoo! Groups Links
            >
            >
            >
          • Ian NTnerd
            This seems like a RegEx problem. I could fine capitalised words in the Title with with this RE: ( p{Lu})( p{Lu}+)(?
            Message 5 of 12 , Oct 17, 2013
              This seems like a RegEx problem.
              I could fine capitalised words in the Title with with this RE: ( \p{Lu})(\p{Lu}+)(?<!^Title\:\:)
              But there seems to be no way to output $1$2 with $2 as lower case. Though in other versions of PCRE they support \U \L that would seem to do it. That is a feature request.

              On dummy data of 9722 lines it took less than one second using the above RE above to replace in 3402 Titles with unchanged data. A selective loop took 74 sec to execute with the correct result.

              But this took under a second also.

              ^!set %start%=^$GetDate(hh:mm:ss)$
              ^!Replace "(\p{Lu})(\p{Lu})(?<!^Title\:\:)" >> "$1##$2" RAWS
              ^!Replace "(\p{Lu})(\p{Lu})(?<!^Title\:\:)" >> "$1##$2" RAWS
              ^!Replace "##A" >> "a" ATWS
              ^!replace "##B" >> "b" ATWS
              ^!replace "##C" >> "c" ATWS
              ^!replace "##D" >> "d" ATWS
              ^!replace "##E" >> "e" ATWS
              ^!replace "##F" >> "f" ATWS
              ^!replace "##G" >> "g" ATWS
              ^!replace "##H" >> "h" ATWS
              ^!replace "##I" >> "i" ATWS
              ^!replace "##J" >> "j" ATWS
              ^!replace "##K" >> "k" ATWS
              ^!replace "##L" >> "l" ATWS
              ^!replace "##M" >> "m" ATWS
              ^!replace "##N" >> "n" ATWS
              ^!replace "##O" >> "o" ATWS
              ^!replace "##P" >> "p" ATWS
              ^!replace "##Q" >> "q" ATWS
              ^!replace "##R" >> "r" ATWS
              ^!replace "##S" >> "s" ATWS
              ^!replace "##T" >> "t" ATWS
              ^!replace "##U" >> "u" ATWS
              ^!replace "##V" >> "v" ATWS
              ^!replace "##W" >> "w" ATWS
              ^!replace "##X" >> "x" ATWS
              ^!replace "##Y" >> "y" ATWS
              ^!replace "##Z" >> "z" ATWS
              ^!info Started ^%start% - Ended ^$GetDate(hh:mm:ss)$

              The RegEx need to be run twice to catch all the occurrences. But the rest only once. Though it needs to be extended for the accented characters.
              The first line turns:
              Title::THE BIG EASY CRAWFISH OMELET
              into:
              Title::T##HE B##IG E##AS##Y C##RA##WF##IS##H O##ME##LE##T
              the next RE creates:
              Title::T##H##E B##I##G E##A##S##Y C##R##A##W##F##I##S##H O##M##E##L##E##T

              Some one on this list used the tagging with ## type thing some where else. I don' remember who to credit you?

              The tagging can be something else if you use ##A elsewhere.

              The rest is straight forward.

              Ian

              On 17/10/2013 12:02 AM, John Shotsky wrote:
              Yes, the titles are randomly located at the tops of the recipes. 
              So far, using replace statements only, and no loops (except 'IfError'), I have gotten all 13,500 titles from all upper case to
              capitalized on the first character of each word in 30 seconds flat. That is close to 40 times faster than the loops were, so it's
              looking good already. It's a large clip, because every letter and every high-order letter (accented, etc) must be handled
              individually, twice, so it's a little over 200 lines counting the IfError lines between each clip. The average file will have under
              100 titles, so that should now be an insignificant amount of time. The nice thing about the replaces is that they don't activate
              unless the action is needed. The loops process each line, whether needed or not.
              
              Regards,
              John
              RecipeTools Web Site: http://recipetools.gotdns.com/
              John's Mags Yahoo Group:  http://groups.yahoo.com/group/johnsmags/
              
              
              -----Original Message-----
              From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Ian NTnerd
              Sent: Wednesday, October 16, 2013 08:31
              To: ntb-clips@yahoogroups.com
              Subject: Re: [Clip] Capitalization without a loop
              
              John,
              
              So in your data is every line a "Title"? If not then your data sample 
              does not help me test a solution.
              
              With your data sample, you just select the whole document and Capitalize 
              that. I doubt that is what you mean.
              
              I am thinking that between each title is a recipe or some other data.
              
              Title::THE BIG EASY CRAWFISH OMELET
              Ingredients:
              etc
              Title::THE CLASSIC HOT BROWN
              
              
              
              Ian
              
              On 16/10/2013 8:48 PM, John Shotsky wrote:
              
              RecipeClips work files have sections with titles (recipes). Each title is preceded by a tag of Title::
              I want to capitalize each word in each title using the Toolbar Capitalize command rather than a loop, which is how I currently do
              it.
              In order for the toolbar command to function, the text in the title needs to be selected.
              So, I would like to select only the titles, all at once, use the toolbar command and be done with it.
              Currently, each title is selected separately, then capitalized using
              ^!InsertText ^$StrCapitalize("^$GetSelection$")$
              It is slightly faster to use the InsertText command in a loop than the Toolbar Capitalize command, but that would still leave the
              whole process in a loop.
              I've been looking at ^$GetDocReplaceAll, but I can't see how to form a command that would do what I want.
              
              For testing, I have a list of about 13,000 tagged titles.
              Using a loop with the above InsertText command title cases 7200 of them in 10 minutes.
              Using the same loop with a Toolbar Capitalize command title cases 5100 of them in 10 minutes.
              Selecting them all, and using the Toolbar Capitalize command without a loop takes about 1 second.
              Clearly, if I can determine how to select them all at once, a single toolbar command would be sufficient.
              Any ideas?
              
              Here are some sample titles:
              Title::THE BIG EASY CRAWFISH OMELET
              Title::THE CLASSIC HOT BROWN
              Title::THE GORE CREEK BAGEL
              Title::THE GUADALAJARA
              Title::THE INVISIBLE SALMON WRAPPED IN GHOSTLY RICE PAPER LYING IN A TOMATO BLOOD PUDDLE ON BLACK BEAN PAVEMENT BY A BROCCOLI TREE
              Title::THE PERFECT CHEESECAKE
              Title::THE SANTA FE WRAP
              Regards,
              John
              
              
              
              
              
              ------------------------------------
              
              Fookes Software: http://www.fookes.com/
              NoteTab website: http://www.notetab.com/
              NoteTab Discussion Lists: http://www.notetab.com/groups.php
              
              ***
              Yahoo! Groups Links
              
              
              
              
              
              
              
              ------------------------------------
              
              Fookes Software: http://www.fookes.com/
              NoteTab website: http://www.notetab.com/
              NoteTab Discussion Lists: http://www.notetab.com/groups.php
              
              ***
              Yahoo! Groups Links
              
              
              
              
              
              ------------------------------------
              
              Fookes Software: http://www.fookes.com/
              NoteTab website: http://www.notetab.com/
              NoteTab Discussion Lists: http://www.notetab.com/groups.php
              
              ***
              Yahoo! Groups Links
              
              <*> To visit your group on the web, go to:
                  http://groups.yahoo.com/group/ntb-clips/
              
              <*> Your email settings:
                  Individual Email | Traditional
              
              <*> To change settings online go to:
                  http://groups.yahoo.com/group/ntb-clips/join
                  (Yahoo! ID required)
              
              <*> To change settings via email:
                  ntb-clips-digest@yahoogroups.com 
                  ntb-clips-fullfeatured@yahoogroups.com
              
              <*> To unsubscribe from this group, send an email to:
                  ntb-clips-unsubscribe@yahoogroups.com
              
              <*> Your use of Yahoo! Groups is subject to:
                  http://info.yahoo.com/legal/us/yahoo/utos/terms/
              
              
              

            • John Shotsky
              My approach was similar, only I didn t use any extra characters. I just lower cased each letter after the first letter of each word (regardless of case) p{L},
              Message 6 of 12 , Oct 17, 2013

                My approach was similar, only I didn't use any extra characters. I just lower cased each letter after the first letter of each word (regardless of case) \p{L}, then upper cased the first letter of each word, with a similar, letter by letter approach. Then I used a list of words that are not to be capitalized (using a farclip) for a 3rd pass through the titles, all with replaces. I have screen update off, and the whole thing runs in just 30 seconds for the 13,500 upper case titles.

                 

                Even though this works and is almost 50 times faster than the original loop method, I am considering Sheri's approach, since it represents a learning opportunity, and would be even faster.

                 

                Regards,
                John
                RecipeTools Web Site: http://recipetools.gotdns.com/
                John's Mags Yahoo Group:  http://groups.yahoo.com/group/johnsmags/

                 

                From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Ian NTnerd
                Sent: Thursday, October 17, 2013 00:56
                To: ntb-clips@yahoogroups.com
                Subject: Re: [Clip] Capitalization without a loop

                 

                 

                This seems like a RegEx problem.
                I could fine capitalised words in the Title with with this RE: ( \p{Lu})(\p{Lu}+)(?<!^Title\:\:)
                But there seems to be no way to output $1$2 with $2 as lower case. Though in other versions of PCRE they support \U \L that would seem to do it. That is a feature request.

                On dummy data of 9722 lines it took less than one second using the above RE above to replace in 3402 Titles with unchanged data. A selective loop took 74 sec to execute with the correct result.

                But this took under a second also.

                ^!set %start%=^$GetDate(hh:mm:ss)$
                ^!Replace "(\p{Lu})(\p{Lu})(?<!^Title\:\:)" >> "$1##$2" RAWS
                ^!Replace "(\p{Lu})(\p{Lu})(?<!^Title\:\:)" >> "$1##$2" RAWS
                ^!Replace "##A" >> "a" ATWS
                ^!replace "##B" >> "b" ATWS
                ^!replace "##C" >> "c" ATWS
                ^!replace "##D" >> "d" ATWS
                ^!replace "##E" >> "e" ATWS
                ^!replace "##F" >> "f" ATWS
                ^!replace "##G" >> "g" ATWS
                ^!replace "##H" >> "h" ATWS
                ^!replace "##I" >> "i" ATWS
                ^!replace "##J" >> "j" ATWS
                ^!replace "##K" >> "k" ATWS
                ^!replace "##L" >> "l" ATWS
                ^!replace "##M" >> "m" ATWS
                ^!replace "##N" >> "n" ATWS
                ^!replace "##O" >> "o" ATWS
                ^!replace "##P" >> "p" ATWS
                ^!replace "##Q" >> "q" ATWS
                ^!replace "##R" >> "r" ATWS
                ^!replace "##S" >> "s" ATWS
                ^!replace "##T" >> "t" ATWS
                ^!replace "##U" >> "u" ATWS
                ^!replace "##V" >> "v" ATWS
                ^!replace "##W" >> "w" ATWS
                ^!replace "##X" >> "x" ATWS
                ^!replace "##Y" >> "y" ATWS
                ^!replace "##Z" >> "z" ATWS
                ^!info Started ^%start% - Ended ^$GetDate(hh:mm:ss)$

                The RegEx need to be run twice to catch all the occurrences. But the rest only once. Though it needs to be extended for the accented characters.
                The first line turns:
                Title::THE BIG EASY CRAWFISH OMELET
                into:
                Title::T##HE B##IG E##AS##Y C##RA##WF##IS##H O##ME##LE##T
                the next RE creates:
                Title::T##H##E B##I##G E##A##S##Y C##R##A##W##F##I##S##H O##M##E##L##E##T

                Some one on this list used the tagging with ## type thing some where else. I don' remember who to credit you?

                The tagging can be something else if you use ##A elsewhere.

                The rest is straight forward.

                Ian

                On 17/10/2013 12:02 AM, John Shotsky wrote:

                Yes, the titles are randomly located at the tops of the recipes. 
                So far, using replace statements only, and no loops (except 'IfError'), I have gotten all 13,500 titles from all upper case to
                capitalized on the first character of each word in 30 seconds flat. That is close to 40 times faster than the loops were, so it's
                looking good already. It's a large clip, because every letter and every high-order letter (accented, etc) must be handled
                individually, twice, so it's a little over 200 lines counting the IfError lines between each clip. The average file will have under
                100 titles, so that should now be an insignificant amount of time. The nice thing about the replaces is that they don't activate
                unless the action is needed. The loops process each line, whether needed or not.
                  
                Regards,
                John
                RecipeTools Web Site: http://recipetools.gotdns.com/
                John's Mags Yahoo Group:  http://groups.yahoo.com/group/johnsmags/
                  
                  
                -----Original Message-----
                From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Ian NTnerd
                Sent: Wednesday, October 16, 2013 08:31
                To: ntb-clips@yahoogroups.com
                Subject: Re: [Clip] Capitalization without a loop
                  
                John,
                  
                So in your data is every line a "Title"? If not then your data sample 
                does not help me test a solution.
                  
                With your data sample, you just select the whole document and Capitalize 
                that. I doubt that is what you mean.
                  
                I am thinking that between each title is a recipe or some other data.
                  
                Title::THE BIG EASY CRAWFISH OMELET
                Ingredients:
                etc
                Title::THE CLASSIC HOT BROWN
                  
                  
                  
                Ian
                  
                On 16/10/2013 8:48 PM, John Shotsky wrote:
                RecipeClips work files have sections with titles (recipes). Each title is preceded by a tag of Title::
                I want to capitalize each word in each title using the Toolbar Capitalize command rather than a loop, which is how I currently do
                it.
                In order for the toolbar command to function, the text in the title needs to be selected.
                So, I would like to select only the titles, all at once, use the toolbar command and be done with it.
                Currently, each title is selected separately, then capitalized using
                ^!InsertText ^$StrCapitalize("^$GetSelection$")$
                It is slightly faster to use the InsertText command in a loop than the Toolbar Capitalize command, but that would still leave the
                whole process in a loop.
                I've been looking at ^$GetDocReplaceAll, but I can't see how to form a command that would do what I want.
                  
                For testing, I have a list of about 13,000 tagged titles.
                Using a loop with the above InsertText command title cases 7200 of them in 10 minutes.
                Using the same loop with a Toolbar Capitalize command title cases 5100 of them in 10 minutes.
                Selecting them all, and using the Toolbar Capitalize command without a loop takes about 1 second.
                Clearly, if I can determine how to select them all at once, a single toolbar command would be sufficient.
                Any ideas?
                  
                Here are some sample titles:
                Title::THE BIG EASY CRAWFISH OMELET
                Title::THE CLASSIC HOT BROWN
                Title::THE GORE CREEK BAGEL
                Title::THE GUADALAJARA
                Title::THE INVISIBLE SALMON WRAPPED IN GHOSTLY RICE PAPER LYING IN A TOMATO BLOOD PUDDLE ON BLACK BEAN PAVEMENT BY A BROCCOLI TREE
                Title::THE PERFECT CHEESECAKE
                Title::THE SANTA FE WRAP
                Regards,
                John
                  
                  
                  
                  
                  
                ------------------------------------
                  
                Fookes Software: http://www.fookes.com/
                NoteTab website: http://www.notetab.com/
                NoteTab Discussion Lists: http://www.notetab.com/groups.php
                  
                ***
                Yahoo! Groups Links
                  
                  
                  
                  
                  
                  
                  
                ------------------------------------
                  
                Fookes Software: http://www.fookes.com/
                NoteTab website: http://www.notetab.com/
                NoteTab Discussion Lists: http://www.notetab.com/groups.php
                  
                ***
                Yahoo! Groups Links
                  
                  
                  
                  
                  
                ------------------------------------
                  
                Fookes Software: http://www.fookes.com/
                NoteTab website: http://www.notetab.com/
                NoteTab Discussion Lists: http://www.notetab.com/groups.php
                  
                ***
                Yahoo! Groups Links
                  
                <*> To visit your group on the web, go to:
                    http://groups.yahoo.com/group/ntb-clips/
                  
                <*> Your email settings:
                    Individual Email | Traditional
                  
                <*> To change settings online go to:
                    http://groups.yahoo.com/group/ntb-clips/join
                    (Yahoo! ID required)
                  
                <*> To change settings via email:
                    ntb-clips-digest@yahoogroups.com 
                    ntb-clips-fullfeatured@yahoogroups.com
                  
                <*> To unsubscribe from this group, send an email to:
                    ntb-clips-unsubscribe@yahoogroups.com
                  
                <*> Your use of Yahoo! Groups is subject to:
                    http://info.yahoo.com/legal/us/yahoo/utos/terms/
                  
                  

                 

              • Sheri
                ... PCRE is only responsible for the matching part. Substituting the match with something else is done by the regex component used in NoteTab. I once inquired
                Message 7 of 12 , Oct 17, 2013
                  > But there seems to be no way to output $1$2 with $2 as lower case. Though in other versions of PCRE they support \U \L that would seem to do it. That is a feature request.

                  PCRE is only responsible for the matching part. Substituting the match with something else is done by the regex component used in NoteTab. I once inquired about it, learned it was "DIRegex", and tried to get the author of DIRegex to support case transformation tokens. Unfortunately he insisted that since output tokens like \L, \U, and \T are not standardized, he won't add them. I'm on his support mailing list and the issue comes up from time to time, but the answer is always the same. I guess Perl is his standard, but Perl doesn't need tokens since its capitalization functions can be applied directly to output substrings.

                  Sent from my Nook HD+
                • John Shotsky
                  With Sheri s help, I implemented this solution to see if it would be faster. It was not. It was fast to get the case changing part done, but the replaces took
                  Message 8 of 12 , Oct 17, 2013

                    With Sheri's help, I implemented this solution to see if it would be faster. It was not. It was fast to get the case changing part done, but the replaces took a long time - only 1000 titles in 2 minutes, where I stopped the test. So it appears that doing it character by character is the fastest. (30 seconds for everything)

                     

                    It makes sense, since my clips amounted to around 200 lines of code, passing through the characters twice (once to lower case, once to upper case) plus some extra code for specific cases. This new method creates 13,500 separate replace statements, which would take a long time to complete - I'd guess 25+ minutes. Additionally, all the spaces, hyphens and other non letters are in this type of replace as opposed to just the letters themselves.

                     

                    Still, I learned something and have the much faster implementation I was seeking.

                     

                    Thanks for the ideas!
                    John
                    RecipeTools Web Site: http://recipetools.gotdns.com/
                    John's Mags Yahoo Group:  http://groups.yahoo.com/group/johnsmags/

                     

                    From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Sheri
                    Sent: Wednesday, October 16, 2013 11:25
                    To: ntb-clips@yahoogroups.com
                    Subject: RE: [Clip] Capitalization without a loop

                     

                     

                    You could again create a new clip that has a series of replacement commands. Creating the list could start with the result of a GetDocMatchAll to capture all the titles. Then capitalize the whole list at once. Then transform each line with a regex replace-all into a whole-document case-insensitive replace command. Then insert library and clip headers. Then run the clip on the original document with a farclip command.

                    Sent from my Nook HD+

                    John Shotsky <jshotsky@...> wrote:

                    >Yes, the titles are randomly located at the tops of the recipes.
                    >So far, using replace statements only, and no loops (except 'IfError'), I have gotten all 13,500 titles from all upper case to
                    >capitalized on the first character of each word in 30 seconds flat. That is close to 40 times faster than the loops were, so it's
                    >looking good already. It's a large clip, because every letter and every high-order letter (accented, etc) must be handled
                    >individually, twice, so it's a little over 200 lines counting the IfError lines between each clip. The average file will have under
                    >100 titles, so that should now be an insignificant amount of time. The nice thing about the replaces is that they don't activate
                    >unless the action is needed. The loops process each line, whether needed or not.
                    >
                    >Regards,
                    >John
                    >RecipeTools Web Site: http://recipetools.gotdns.com/
                    >John's Mags Yahoo Group: http://groups.yahoo.com/group/johnsmags/
                    >
                    >
                    >-----Original Message-----
                    >From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Ian NTnerd
                    >Sent: Wednesday, October 16, 2013 08:31
                    >To: ntb-clips@yahoogroups.com
                    >Subject: Re: [Clip] Capitalization without a loop
                    >
                    >John,
                    >
                    >So in your data is every line a "Title"? If not then your data sample
                    >does not help me test a solution.
                    >
                    >With your data sample, you just select the whole document and Capitalize
                    >that. I doubt that is what you mean.
                    >
                    >I am thinking that between each title is a recipe or some other data.
                    >
                    >Title::THE BIG EASY CRAWFISH OMELET
                    >Ingredients:
                    >etc
                    >Title::THE CLASSIC HOT BROWN
                    >
                    >
                    >
                    >Ian
                    >
                    >On 16/10/2013 8:48 PM, John Shotsky wrote:
                    >> RecipeClips work files have sections with titles (recipes). Each title is preceded by a tag of Title::
                    >> I want to capitalize each word in each title using the Toolbar Capitalize command rather than a loop, which is how I currently do
                    >> it.
                    >> In order for the toolbar command to function, the text in the title needs to be selected.
                    >> So, I would like to select only the titles, all at once, use the toolbar command and be done with it.
                    >> Currently, each title is selected separately, then capitalized using
                    >> ^!InsertText ^$StrCapitalize("^$GetSelection$")$
                    >> It is slightly faster to use the InsertText command in a loop than the Toolbar Capitalize command, but that would still leave the
                    >> whole process in a loop.
                    >> I've been looking at ^$GetDocReplaceAll, but I can't see how to form a command that would do what I want.
                    >>
                    >> For testing, I have a list of about 13,000 tagged titles.
                    >> Using a loop with the above InsertText command title cases 7200 of them in 10 minutes.
                    >> Using the same loop with a Toolbar Capitalize command title cases 5100 of them in 10 minutes.
                    >> Selecting them all, and using the Toolbar Capitalize command without a loop takes about 1 second.
                    >> Clearly, if I can determine how to select them all at once, a single toolbar command would be sufficient.
                    >> Any ideas?
                    >>
                    >> Here are some sample titles:
                    >> Title::THE BIG EASY CRAWFISH OMELET
                    >> Title::THE CLASSIC HOT BROWN
                    >> Title::THE GORE CREEK BAGEL
                    >> Title::THE GUADALAJARA
                    >> Title::THE INVISIBLE SALMON WRAPPED IN GHOSTLY RICE PAPER LYING IN A TOMATO BLOOD PUDDLE ON BLACK BEAN PAVEMENT BY A BROCCOLI TREE
                    >> Title::THE PERFECT CHEESECAKE
                    >> Title::THE SANTA FE WRAP
                    >> Regards,
                    >> John
                    >>
                    >>
                    >>
                    >>
                    >>
                    >> ------------------------------------
                    >>
                    >> Fookes Software: http://www.fookes.com/
                    >> NoteTab website: http://www.notetab.com/
                    >> NoteTab Discussion Lists: http://www.notetab.com/groups.php
                    >>
                    >> ***
                    >> Yahoo! Groups Links
                    >>
                    >>
                    >>
                    >>
                    >
                    >
                    >
                    >------------------------------------
                    >
                    >Fookes Software: http://www.fookes.com/
                    >NoteTab website: http://www.notetab.com/
                    >NoteTab Discussion Lists: http://www.notetab.com/groups.php
                    >
                    >***
                    >Yahoo! Groups Links
                    >
                    >
                    >
                    >
                    >
                    >------------------------------------
                    >
                    >Fookes Software: http://www.fookes.com/
                    >NoteTab website: http://www.notetab.com/
                    >NoteTab Discussion Lists: http://www.notetab.com/groups.php
                    >
                    >***
                    >Yahoo! Groups Links
                    >
                    >
                    >

                  • Sheri
                    You re likely right but could you post one of 13000+ the replace commands? Possibly the only option that needs to be on them is I (for case insensitive). Sent
                    Message 9 of 12 , Oct 17, 2013
                      You're likely right but could you post one of 13000+ the replace commands? Possibly the only option that needs to be on them is I (for case insensitive).

                      Sent from my Nook HD+
                    • John Shotsky
                      Sure… ^!Replace Title::Floribbean Grouper With Red Pepper-Papaya Jam Title::Floribbean Grouper With Red Pepper-Papaya Jam AIRSW I realize the
                      Message 10 of 12 , Oct 17, 2013

                        Sure…

                        ^!Replace "Title::Floribbean Grouper With Red Pepper-Papaya Jam" >> "Title::Floribbean Grouper With Red Pepper-Papaya Jam" AIRSW

                        I realize the 'Title::' part didn't need to be replaced but this was just a basic test to see how fast it might be at replacing whole lines. Once it got to replacing lines, it was almost slow enough to read each line as it was processed. I also tried screen update off and minimizeapp, but it had little effect overall.

                        It also means that every line and every character is replaced, even if it didn't need any changes. I think that is probably the biggest slowdown.

                        With my version, only upper case letters that should be lower case are changed, and only the first letter of any word is capitalized if it is lower case to start with. So lots of replaces are not even performed.

                        Regards,
                        John
                        RecipeTools Web Site: http://recipetools.gotdns.com/
                        John's Mags Yahoo Group:  http://groups.yahoo.com/group/johnsmags/

                         

                        From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Sheri
                        Sent: Thursday, October 17, 2013 10:56
                        To: ntb-clips@yahoogroups.com
                        Subject: RE: [Clip] Capitalization without a loop

                         

                         

                        You're likely right but could you post one of 13000+ the replace commands? Possibly the only option that needs to be on them is I (for case insensitive).

                        Sent from my Nook HD+

                      • Sheri
                        On 10/17/2013 2:23 PM, John Shotsky wrote: Sure… ^!Replace Title:: Floribbean Grouper With Red Pepper-Papaya Jam Title:: Floribbean Grouper With Red
                        Message 11 of 12 , Oct 17, 2013
                          On 10/17/2013 2:23 PM, John Shotsky wrote:

                          Sure…

                          ^!Replace "Title::Floribbean Grouper With Red Pepper-Papaya Jam" >> "Title::Floribbean Grouper With Red Pepper-Papaya Jam" AIRSW


                          Can't predict how much better, but it should improve the speed to use only IS options. You will also need to insert a command at the beginning to jump to the start of document. Instead of traversing the entire recipe file for each of the replace commands, the cursor should move through the document only once. Each of the titles replaced in the order they occur in the recipe file, so there is no need to use W or A options, and it is inappropriate to use R.

                          Regards,
                          Sheri

                        • John Shotsky
                          Good thinking - It did 3600 in 2 minutes. So it would probably complete in about 7.5 minutes. It is definitely faster than the way I had it, by about 3x. My
                          Message 12 of 12 , Oct 17, 2013

                            Good thinking -

                            It did 3600 in 2 minutes. So it would probably complete in about 7.5 minutes. It is definitely faster than the way I had it, by about 3x. My current method, though will burn through 27,000 in one minute.

                             

                            Regards,
                            John
                            RecipeTools Web Site: http://recipetools.gotdns.com/
                            John's Mags Yahoo Group:  http://groups.yahoo.com/group/johnsmags/

                             

                            From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Sheri
                            Sent: Thursday, October 17, 2013 15:35
                            To: ntb-clips@yahoogroups.com
                            Subject: Re: [Norton AntiSpam]RE: [Clip] Capitalization without a loop

                             

                             

                            On 10/17/2013 2:23 PM, John Shotsky wrote:

                            Sure…

                            ^!Replace "Title::Floribbean Grouper With Red Pepper-Papaya Jam" >> "Title::Floribbean Grouper With Red Pepper-Papaya Jam" AIRSW


                            Can't predict how much better, but it should improve the speed to use only IS options. You will also need to insert a command at the beginning to jump to the start of document. Instead of traversing the entire recipe file for each of the replace commands, the cursor should move through the document only once. Each of the titles replaced in the order they occur in the recipe file, so there is no need to use W or A options, and it is inappropriate to use R.

                            Regards,
                            Sheri

                          Your message has been successfully submitted and would be delivered to recipients shortly.