10 Replies Latest reply on Jun 26, 2009 6:54 AM by MattMinde

    Count telephone numbers as one word in Wordcount

    MattMinde

      Title

      Count telephone numbers as one word in Wordcount

      Post

      Hello everybody! We run a small newspaper here, and have used FMPRo for Classifieds since v2. However, I'm implementing a rate calculation based on wordcount and some other parameters. Everything seems to work fine, except that FMPro (v6) counts "555-2323" as two words, and "999-555-2323" as three. How can I define a numeric wild card that would recognize and define any number string "###-####" as one word? I've thought of a workaround and get FMPro to subtract 2 from the wordcount for every occurrence of "###-####", and so on. But how? I'd be grateful for any help on this, even if it means upgrading to a newer version of FMPro. THANKS!

        • 1. Re: Count telephone numbers as one word in Wordcount
          philmodjunk
            

          If you upgrade to FMP 10, the phone number will be counted as one word.

           

          However, the upgrade from 6 to 10 is a big jump and the conversion could create other problems when it solves this one. I'd download a trial copy of 10 and experiment with it before deciding to convert the file.

           

          By the way, you seem to have started this thread twice. If you want, you can delete the other one by clicking on the options menu above the Kudos control.

          • 2. Re: Count telephone numbers as one word in Wordcount
            philmodjunk
              

            A version 6 work around might be:

             

            wordcount(Substitute(textfield, "-", ""))

            • 3. Re: Count telephone numbers as one word in Wordcount
              MattMinde
                

              Dear PhiModJunk: I think that did it! As I gather, the substitution of the "-" for "" does not actually eliminate it from the copy, but just for the wordcount calculation, yes? Because we need the hypens in the phone numbers when we export the text. This is wonderful, so far! THANKS!

               

              By the way: Is there a wildcard for recognizing numbers, especially a string of numbers? i.e., searching for (###), where "#" is any number, and converting it to ### (removing the parentheses), for sake of calculation? This would make wordcount of phone numbers more compatible with the different manners in which people submit phone numbers. Of course, the clunky thing would be to make formatting consistent, manually. Hmmm...

              • 4. Re: Count telephone numbers as one word in Wordcount
                philmodjunk
                  

                "As I gather, the substitution of the "-" for "" does not actually eliminate it from the copy, but just for the wordcount calculation, yes? Because we need the hypens in the phone numbers when we export the text."

                 

                You gather correctly. Be aware that since the hyphen could be used for other purposes in your text, it may affect your word count when the hyphen is used for another purpose in the text.

                • 5. Re: Count telephone numbers as one word in Wordcount
                  MattMinde
                    

                  (Forgive me, I am new to this and hopefully am not doing something against forum posting etiquette...)

                   

                  Thanks, PhilModJunk. Yes, the "-" substitution does alter the wordcount for things like "two-bedroom", which we count as two words. Again, is there no numeric wildcard in FMPro6? Or is there a way to define a term where "#" ="0–9", and then insert that into the wordcount solution?

                  • 6. Re: Count telephone numbers as one word in Wordcount
                    philmodjunk
                       The only wildcards are in find requests that I know of--which won't do what you want.
                    • 7. Re: Count telephone numbers as one word in Wordcount
                      comment_1
                        

                      Assuming you don't want "alpha-bravo-charlie" to count as one word, try a series of nested substitutions:

                       

                      1. Substitute all digits other than "0" with "0";

                      2. Substitute  "0-0" with "00"

                       

                      Count the words of the result.

                       

                       

                      (Pardon me for not spelling this out, as it's very tedious to do in version 6 syntax - one more reason to upgrade.)

                      • 8. Re: Count telephone numbers as one word in Wordcount
                        MattMinde
                          
                        Thanks both of you for the advice so far. I have been drawing on my HS algebra to remember how the nesting rules work. I just cannot get the proper nesting order for the substitution to work. I've tried:
                        WordCount(((((((((Substitute(Copy, "1", "0") and (Substitute(Copy, "2", "0") ... (Substitute(Copy, "0-0", "00")))))))))))
                        I know the nested substitution functions have to be enclosed within the WordCount function, but do they add or do they require a logical "and"? I've tried both and some results return a count only when there's a hyphenated number, other times, I get "1" as the total count, no matter how many words are in the "Copy" field.
                        Could you help me with the pattern or structure of a couple of nesting terms, so that I could experiment further? THANKS again!

                        • 9. Re: Count telephone numbers as one word in Wordcount
                          comment_1
                            

                          The first three:

                           

                          Substitute (
                          Substitute (
                          Substitute ( YourField,
                          "1", "0" ),
                          "2", "0" ),
                          "3", "0" )

                           


                           



                          • 10. Re: Count telephone numbers as one word in Wordcount
                            MattMinde
                               Brillant!!! Thank you both for your above and beyond the call help. I can only hope to get so proficient that I'd be able to help someone in such a bind. Anytime you want to submit a classified ad in Yellow Springs, the wordcount will be accurate now. —MM