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

Re: [Clip] word count

Expand Messages
  • hsavage
    ... Ed, Would a list similar to this; Word Frequency gegenschein 4 bract 4
    Message 1 of 18 , May 2, 2004
      Ed Brown wrote:

      > John,
      > Thanks, I did not know about the right click.
      > When I try to paste and copy the percent column also
      > appears in part in the I get the following mish mash.
      >
      > Word Frequency %
      >
      > gegenschein 4 0.24
      > bract 4 0.24
      > shun 3 0.18
      > shield 3 0.18
      > rodney 3 0.18
      > retrograde 3 0.18
      > placater 3 0.18
      > phantom 3 0.18
      > over 3 0.18
      > northeast 3 0.18
      > noontime 3 0.18
      > mutt 3 0.18
      > mccauley 3 0.18
      > l'vov 3 0.18
      >
      > I would like to have them fall into even columns and
      > the percent column is not necessary.
      > Ed

      Ed,

      Would a list similar to this;

      Word Frequency

      gegenschein 4

      bract 4

      shun 3

      shield 3

      rodney 3

      retrograde 3

      placater 3

      phantom 3

      over 3

      northeast 3

      noontime 3

      mutt 3

      mccauley 3

      l'vov 3


      be suitable.

      If so this clip will help and need very few corrections.

      Just copy and paste from the Text Statistics window to a blank document
      and insure there is a blank line at the bottom. With that new document
      focused run this clip. I works good for me with almost no trouble. In
      the fill variable the space is a non-breaking space.

      The aligned columns above will be single-line spaced in NoteTab, this
      result is due to the email client.

      H="Format Statistics"
      ^!SetScreenUpdate 0
      ^!SetDebug 0
      ^!Replace ^ >> ¤ TWSA
      ^!Jump 1
      :LOOP
      ^!Select EOL
      ^!Replace {.*}\t{.*}\t{.*} >> \1Ø\2 TIHRS
      ^!Select BOL
      ^!SetCode %line%=^$GetSelection$
      ^!Set %size%=^$StrSize(^%line%)$
      ^!Set %fill%="^$StrFill(" ";^$Calc(40-^%size%)$)$"
      ^!Replace Ø >> ^%fill% TIHS
      ^!Jump +1
      ^!If ^$GetRow$ > ^$GetTextLineCount$ NEXT ELSE LOOP
      ^!Replace ¤ >> ^ TWSA


      hrs
    • Ed Brown
      John, The clip works just as it should. And thanks to Larry, I have the tabs set right and everything falls into place just as I wanted. Thanks guys, Ed ...
      Message 2 of 18 , May 2, 2004
        John,
        The clip works just as it should. And thanks to Larry, I have the tabs set right and everything falls into place just as I wanted.
        Thanks guys,
        Ed
        ----- Original Message -----
        From: John Zeman
        To: ntb-clips@yahoogroups.com
        Sent: Sunday, May 02, 2004 11:28 AM
        Subject: Re: [Clip] word count


        --- In ntb-clips@yahoogroups.com, "Ed Brown" <ebrown27@b...> wrote:
        > John,
        > Thanks, I did not know about the right click. It shows enough of
        what I want to be able to past and copy it to a separate document.
        Now if there was only away to get rid of the % column and to make
        the print larger in the stats window.
        > When I try to paste and copy the percent column also appears in
        part in the I get the following mish mash.
        > Word Frequency %
        >
        > gegenschein 4 0.24
        > bract 4 0.24
        > shun 3 0.18
        > shield 3 0.18
        > rodney 3 0.18
        > retrograde 3 0.18
        > placater 3 0.18
        > phantom 3 0.18
        > over 3 0.18
        > northeast 3 0.18
        > noontime 3 0.18
        > mutt 3 0.18
        > mccauley 3 0.18
        > l'vov 3 0.18
        >
        > I would like to have them fall into even columns and the percent
        column is not necessary.



        This hasn't been tested much Ed, but try this clip.

        But before you do, first have the document open you want the stats
        for, get the text statistics as you have been, press the MORE button
        as you have done, then right click and sort the list the way you
        want. Then right click again and select "Save All" and save
        the "words.txt" file. Next open that "words.txt" file in NoteTab and
        run the following clip. On my machine it removes the percentages.

        If that does what you want, you could continue modifying the clip to
        lay the remaining text out the way you want it to look.

        John

        ^!Replace "{^.*}\t[0-9]+\.[0-9]+$" >> "\1" AIWRS






        Yahoo! Groups Sponsor
        ADVERTISEMENT





        ------------------------------------------------------------------------------
        Yahoo! Groups Links

        a.. To visit your group on the web, go to:
        http://groups.yahoo.com/group/ntb-clips/

        b.. To unsubscribe from this group, send an email to:
        ntb-clips-unsubscribe@yahoogroups.com

        c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



        [Non-text portions of this message have been removed]
      • Ed Brown
        However, when I run the clip from hsavage on the large list I get a syntax error in line 11. And I get this if I use the Text Statistics and then Fromat
        Message 3 of 18 , May 2, 2004
          However, when I run the clip from hsavage on the large list I get a syntax error in line 11. And I get this if I use the Text Statistics and then Fromat Statistics even after I changed the tabs.
          WordFrequency

          gegenschein4
          bract4
          .4
          shun3
          shield3
          rodney3
          retrograde3
          placater3
          phantom3
          over3
          northeast3
          noontime3
          mutt3
          mccauley3
          l'vov3
          kowloon3
          incondensable3
          hurst3

          While the shorter clip which I named Text Stats gives me this or similar, the email does not reproduce it as good as it really is .
          Word Frequency %

          gegenschein 4
          bract 4
          rodney 3
          retrograde 3
          placater 3
          phantom 3

          So while I do not know enough to find it I do believe that there must be an error in syntax in the second clip. I see possiblities in both. I am examining them to try to learn a little more about writing clips. Thanks guys. I do appreciate all the work that you have done in my behalf.
          Ed
          Yahoo! Groups Links

          a.. To visit your group on the web, go to:
          http://groups.yahoo.com/group/ntb-clips/

          b.. To unsubscribe from this group, send an email to:
          ntb-clips-unsubscribe@yahoogroups.com

          c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



          [Non-text portions of this message have been removed]
        • hsavage
          ... Ed, If I understand what you said you are changing tabs to something else before you run the clip. Don t change anything, the tabs must be in place for the
          Message 4 of 18 , May 2, 2004
            Ed Brown wrote:

            > However, when I run the clip from hsavage on
            > the large list I get a syntax error in line 11.
            > And I get this if I use the Text Statistics and
            > then Format Statistics even after I changed the tabs.

            > WordFrequency
            >
            > gegenschein4
            > bract4
            > .4

            Ed,

            If I understand what you said you are changing tabs to something else
            before you run the clip.

            Don't change anything, the tabs must be in place for the clip to work.

            The only thing that gave me an error a line with a first word that was
            too long.

            That could be worked around, I think, by adding the line,
            ^!SetErrorLabel NEXT, near the top of the clip.

            hrs
          • Ed Brown
            ... before you run the clip. ... too long. ... ^!SetErrorLabel NEXT, near the top of the clip. I would like to put the tabs back in place, I set them larger.
            Message 5 of 18 , May 2, 2004
              hrs wrote:

              >Ed,

              >If I understand what you said you are changing tabs to something else
              before you run the clip.

              >Don't change anything, the tabs must be in place for the clip to work.

              >The only thing that gave me an error a line with a first word that was
              too long.

              >That could be worked around, I think, by adding the line,
              ^!SetErrorLabel NEXT, near the top of the clip.

              I would like to put the tabs back in place, I set them larger. But now I do not see a way to reset them to the original settings. I will try the clip line near the top and see what happens.
              E

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

              Yahoo! Groups Links

              a.. To visit your group on the web, go to:
              http://groups.yahoo.com/group/ntb-clips/

              b.. To unsubscribe from this group, send an email to:
              ntb-clips-unsubscribe@yahoogroups.com

              c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



              [Non-text portions of this message have been removed]
            • Larry Thomas
              Hi Ed, ... do not see a way to reset them to the original settings. I will try the clip line near the top and see what happens. There is another way with clips
              Message 6 of 18 , May 3, 2004
                Hi Ed,

                At 11:36 PM 5/2/04 -0500, you wrote:
                >before you run the clip.
                >
                >>Don't change anything, the tabs must be in place for the clip to work.
                >
                >>The only thing that gave me an error a line with a first word that was
                >too long.
                >
                >>That could be worked around, I think, by adding the line,
                >^!SetErrorLabel NEXT, near the top of the clip.
                >
                >I would like to put the tabs back in place, I set them larger. But now I
                do not see a way to reset them to the original settings. I will try the
                clip line near the top and see what happens.

                There is another way with clips using ^!Keyboard commands to set and reset
                tabs. You do this manually from the menu bar on the current document only
                by selecting Document/Properties and then setting the tab size from there.
                The clip commands would be:

                ______[Copy below this line]_______
                H="Set Tab Size to 35"
                ^!Keyboard Alt+D P &100 Alt+S #35# Enter

                H="Restore Default Tab Size"
                ^!Keyboard Alt+D P &100 Alt+S Delete Enter
                _____[Copy above this line]______
                | right click over the clipbook |
                | and choose "Add from Clipboard" |
                ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

                You might have to change the &100 delay to a different number depending on
                your computer's setup speed.

                Regards,

                Larry
                lrt@... e¿ê
              • Larry Thomas
                Hi Ed, This clip combines with John s clip and it does the whole thing. It runs text statistics on the current open document. It copies the advanced page to
                Message 7 of 18 , May 3, 2004
                  Hi Ed,

                  This clip combines with John's clip and it does the whole thing. It runs
                  text statistics on the current open document. It copies the advanced page
                  to the clipboard and then pastes it to a new document. It then runs John's
                  replace clip and deletes the percent column. It then sets the tab size to
                  35 and replaces the tabs with spaces. And finally, it restores the tab
                  size to the default setting.

                  You can modify it to suit your tastes.

                  ______[Copy below this line]_______
                  H="Get Text Statistics"
                  ;lrt@... e¿ê
                  ;05/03/2004, 06:56:39 AM
                  ^!Keyboard Alt+T S M Ctrl+A &200 Alt+C &200 Shift+Ctrl+V Ctrl+Home
                  ^!Replace "{^.*}\t[0-9]+\.[0-9]+$" >> "\1" AIWRS
                  ;
                  ;----------------------[begin long line]---------------------------
                  ^!Keyboard Alt+D P &100 Alt+S #35# Enter &200 Alt+M S B Ctrl+Home &200
                  Alt+D P &100 Alt+S Delete Enter
                  ;-----------------------[end long line]----------------------------
                  ;
                  _____[Copy above this line]______
                  | right click over the clipbook |
                  | and choose "Add from Clipboard" |
                  ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

                  Be sure to restore the long line in the clip before you try to use it.

                  Regards,

                  Larry
                  lrt@... e¿ê
                • Ed Brown
                  Works exactly as advertised. Great. Now I have a question. The second line is exactly the same as the first clip. ^!Replace {^.*} t[0-9]+ .[0-9]+$ 1
                  Message 8 of 18 , May 3, 2004
                    Works exactly as advertised. Great.

                    Now I have a question. The second line is exactly the same as the first clip.
                    ^!Replace "{^.*}\t[0-9]+\.[0-9]+$" >> "\1" AIWRS
                    Does this mean to replace the order of the words in the list with the ones used most, the words used second most, etc. and that is why the first [0-9]? IF so what does {^.*} mean or I guess what action is perfomed by this. Then we have \t . what does this do for us? That is followed by the first [0-9]. What does the +\. do? then we have the second [0-9]+S Altogether at this point we have this equation.
                    ^!Replace "{^.*}\t[0-9]+\.[0-9]+$"
                    With the part after "Replace space" enclosed in quotation marks. This followed with >> "\1" AIWRS . Would you explain how this complete clip works in detail? Or is this too rudimentary? I have been pouring over the clip help for several weeks and so far it makes little or no sense to me. How did you know to use "Replace" instead of "List" as in "list the following words in this order etc."? Or why not "Get" the words listed most often in numerical order, etc.? I would like to see a beginners clip class in which we began with writing some simple clips and branch off into the student writing a few simple clips and then advance to the next level with using several different commands, gradually increasing in difficult with an instructor to catch our mistakes and show us why we made those errors.

                    I see many clips with multiple lines beginning ^!Set. What are we setting in those lines. Why use Set? If this is too basic to be answered here that is OK. I understand I am just trying to learn the ABC's and asking a Doctor of English to teach me the ABC's. :-) After all you cannot build a word until you know the ABC's and you cannot make a sentence until you have a vocabulary of words and neither can I write much of a clip until I understand what each symbol means and what it does and then build a vocabulary of clip parts and actions. Does this make any sense at all?
                    Ed


                    ----- Original Message -----
                    From: Larry Thomas
                    To: ntb-clips@yahoogroups.com
                    Sent: Monday, May 03, 2004 7:02 AM
                    Subject: Re: [Clip] word count



                    Hi Ed,

                    This clip combines with John's clip and it does the whole thing. It runs
                    text statistics on the current open document. It copies the advanced page
                    to the clipboard and then pastes it to a new document. It then runs John's
                    replace clip and deletes the percent column. It then sets the tab size to
                    35 and replaces the tabs with spaces. And finally, it restores the tab
                    size to the default setting.

                    You can modify it to suit your tastes.

                    ______[Copy below this line]_______
                    H="Get Text Statistics"
                    ;lrt@... e¿ê
                    ;05/03/2004, 06:56:39 AM
                    ^!Keyboard Alt+T S M Ctrl+A &200 Alt+C &200 Shift+Ctrl+V Ctrl+Home
                    ^!Replace "{^.*}\t[0-9]+\.[0-9]+$" >> "\1" AIWRS
                    ;
                    ;----------------------[begin long line]---------------------------
                    ^!Keyboard Alt+D P &100 Alt+S #35# Enter &200 Alt+M S B Ctrl+Home &200
                    Alt+D P &100 Alt+S Delete Enter
                    ;-----------------------[end long line]----------------------------
                    ;
                    _____[Copy above this line]______
                    | right click over the clipbook |
                    | and choose "Add from Clipboard" |
                    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

                    Be sure to restore the long line in the clip before you try to use it.

                    Regards,

                    Larry
                    lrt@... e¿ê


                    Yahoo! Groups Sponsor
                    ADVERTISEMENT





                    ------------------------------------------------------------------------------
                    Yahoo! Groups Links

                    a.. To visit your group on the web, go to:
                    http://groups.yahoo.com/group/ntb-clips/

                    b.. To unsubscribe from this group, send an email to:
                    ntb-clips-unsubscribe@yahoogroups.com

                    c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



                    [Non-text portions of this message have been removed]
                  • John Zeman
                    ... first clip. ... the ones used most, the words used second most, etc. and that is why the first [0-9]? IF so what does {^.*} mean or I guess what action is
                    Message 9 of 18 , May 3, 2004
                      --- In ntb-clips@yahoogroups.com, "Ed Brown" <ebrown27@b...> wrote:
                      > Works exactly as advertised. Great.
                      >
                      > Now I have a question. The second line is exactly the same as the
                      first clip.
                      > ^!Replace "{^.*}\t[0-9]+\.[0-9]+$" >> "\1" AIWRS
                      > Does this mean to replace the order of the words in the list with
                      the ones used most, the words used second most, etc. and that is why
                      the first [0-9]? IF so what does {^.*} mean or I guess what action
                      is perfomed by this. Then we have \t . what does this do for us? That
                      is followed by the first [0-9]. What does the +\. do? then we have
                      the second [0-9]+S Altogether at this point we have this equation.
                      > ^!Replace "{^.*}\t[0-9]+\.[0-9]+$"
                      > With the part after "Replace space" enclosed in quotation marks.
                      This followed with >> "\1" AIWRS . Would you explain how this
                      complete clip works in detail?


                      I'll answer the part on the ^!Replace line Ed since I'm the one who
                      wrote it. If what I'm about to say here doesn't help anyone, it
                      ought to at least cure insomnia. <Grin>

                      "^!Replace" is a NoteTab clip command where NoteTab searches for some
                      text and then replaces that text with something else. To resolve
                      your problem of wanting to eliminate the percentages, I used a
                      regular expression that I'll further explain below. Regular
                      expressions are not unique to NoteTab, they are used in a great
                      number of programs. A normal find and replace operation is limited
                      to specific text and wildcards, regular expressions do that and so
                      much more. The only downer to RegExp is at first, it seems like
                      total gobbledygook. For me it took patience and a lot of time to
                      gradually figure them out.

                      Here's how the following ^!Replace clip works

                      ^!Replace "{^.*}\t[0-9]+\.[0-9]+$" >> "\1" AIWRS


                      ^!Replace "this" >> "that" AIWRS
                      Start the NoteTab clip command to find "this" and replace it
                      with "that" in a document. What is in between each set of double
                      quotes represents what is searched for and what the replacement text
                      is. The AIWRS represent the ^!Replace options and their definitions
                      can be found in the clip help section.
                      A = Replaces all occurrences of the found text in the document.
                      I = Ignore character case (I really didn't need it in this situation).
                      W = Searches the entire document.
                      R = Means the ^!Replace criteria is a regular expression
                      S = Silent, just do the replacing without any messages.

                      Ok, now to explain how the regular expression part of the clip line
                      works.

                      ^!Replace "{^.*}\t[0-9]+\.[0-9]+$" >> "\1" AIWRS

                      ^!Replace "
                      In a replace operation, the first " marks the beginning of where the
                      searched for text will be defined.

                      ^!Replace "{
                      The { marks the beginning of what is called a tagged match. A tagged
                      match is text found during the search, that is to be used in the
                      replacement. In other words what is in between a set of { } brackets
                      can be referred to in the replacement operation by using \1. If
                      there are two sets of { } brackets, then \2 represents what is found
                      in between the second set of brackets. I think you can have up to 9
                      sets of brackets.

                      ^!Replace "{^
                      The ^ means "starting at the very beginning of each line".

                      ^!Replace "{^.
                      The . means to match ANY single character. A number, an alphabet
                      letter, punctuation, a space, a tab, anything at all.

                      ^!Replace "{^.*
                      The * means to match the character that precedes the * 0 or more
                      times. So the combination of ^.* means to match anything at all that
                      starts at the beginning of each line.

                      ^!Replace "{^.*}
                      Ok, now we have the closing } which ends the tagged match. If this
                      were the only criteria the ^!Replace command was looking for,
                      everything in the document would be replaced. Which isn't useful so
                      we need to add more to it.

                      ^!Replace "{^.*}\t
                      \t represents a tab.

                      ^!Replace "{^.*}\t[0-9]
                      [0-9] represents any one single digit. Anything from 0 through 9.

                      ^!Replace "{^.*}\t[0-9]+
                      The + represents 1 or more matches of the one thing that precedes
                      it. Since 0-9 is enclosed in between a set of [ ] that entire [0-9]
                      represents one thing, a single digit.

                      ^!Replace "{^.*}\t[0-9]+\.
                      The \. represents a period. Remember that normally a period has a
                      special meaning in regular expressions so if you want to actually
                      search for a period, you have to escape the period with a \

                      ^!Replace "{^.*}\t[0-9]+\.[0-9]+
                      Like the previous [0-9]+ the second [0-9]+ simply means to find one
                      or more digits grouped together.

                      ^!Replace "{^.*}\t[0-9]+\.[0-9]+$
                      The $ represents the end of a line (where someone has hit ENTER on
                      their keyboard).

                      ^!Replace "{^.*}\t[0-9]+\.[0-9]+$"
                      The second " represents the end of the "find this" section of the ^!
                      Replace command.

                      ^!Replace "{^.*}\t[0-9]+\.[0-9]+$" >>
                      The >> tells NoteTab that what follows it will be the text to use to
                      replace the text that was found.

                      ^!Replace "{^.*}\t[0-9]+\.[0-9]+$" >> "\1"
                      And "\1" represents the text that was found in between the set of { }

                      So here is how the above clip works.
                      Starting at the beginning of each line in the document, search for
                      anything at all as long as it ends the line with a TAB followed by
                      one or more numbers, followed by a period, followed by one or more
                      numbers, and then finally the end of the line. Since we wanted to
                      keep everything but the last TAB, the last numbers, etc, we used the
                      curly brackets to collect the other text so it could be used as the
                      replacement text.

                      John
                    • Larry Thomas
                      ... in those lines. Why use Set? If this is too basic to be answered here that is OK. I understand I am just trying to learn the ABC s and asking a Doctor
                      Message 10 of 18 , May 3, 2004
                        At 10:59 AM 5/3/04 -0500, you wrote:
                        >Works exactly as advertised. Great.
                        >
                        >I see many clips with multiple lines beginning ^!Set. What are we setting
                        in those lines. Why use Set? If this is too basic to be answered here
                        that is OK. I understand I am just trying to learn the ABC's and asking a
                        Doctor of English to teach me the ABC's. :-) After all you cannot build a
                        word until you know the ABC's and you cannot make a sentence until you have
                        a vocabulary of words and neither can I write much of a clip until I
                        understand what each symbol means and what it does and then build a
                        vocabulary of clip parts and actions. Does this make any sense at all?
                        >Ed

                        You are seeing the clip storing information in a named memory location
                        called a variable. The informaation can be a value (any number) or a
                        string (a group of characters). A number can be treated either as a value
                        as in 2 + 2 or as a string as in "2 + 2" which is actually five characters
                        - a two folloed by a space followed by a + followed by a space followed by
                        a two.

                        You can define any variable by using the ^!Set Command with the variable
                        name you choose enclosed in percent characters. Example:

                        ^!Set %Name%=Ed Brown

                        Creates a variable named %Name% which contains the string "Ed Brown". To
                        use the variable in a clip you just place and circumflex (^) in front of
                        it. Example:

                        ^%Name%

                        Placed on a line by itself will insert the string "Ed Brown" into the
                        currently open document at the current cursor position.

                        You can learn all about variables by going to the main help file. Go to
                        the menu bar and select Help/Help Topics.

                        FOR VARIABLES:
                        Go down the left panel to "Reference Information" and under that go to
                        "Tools" and under that go to "Editor Clipbook" and under that go to "Clip
                        Programming". On the right panel go down the page until you come to "Clip
                        Language - Variables" and click on it. This will give you all of the
                        information on variables and how to use them.

                        FOR REGULAR EXPRESSIONS:
                        Go down the left panel to "Reference Information" and under that go to
                        "Dialog Boxes" and underr that go to "Regular Expressions" and you will see
                        all of the information about how regular expressions work.

                        Regards,

                        Larry
                        lrt@... e¿ê
                      Your message has been successfully submitted and would be delivered to recipients shortly.