Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Pattern count/Keyword density probelm

Featured Replies

  • Newbies

Hi, 

I have a list of about 400 keywords Im looking for from a free form text field. What I am trying to accomplish is to find the number of occurrences of keywords from the list of keywords in the txt field where i have many paragraphs of text.

  • I have one field where I have all the keywords stored, all lower case
  • Another field where I have free form text, all lower case.

I am trying to see how many times keywords from the list come up as pattern matches from the text field of free form text.

 

For example

here is a short list words im looking for :

bob

went

store

and the text field has "bob went to the store, then bob went home."

I would like a 3rd field to say:

bob came up 3 times

went came up 2 times

store came up 1 times

 

Ive attached an example file. Thanks for any help you can give:)

pattern.fmp12.zip

Hi Barry

Please find enclosed a sample file.

The way it works is :-

Count the number of values in the search list

Go round a loop that many times, and for each value, use PatternCount to see how many times it appears, and add the result to the 'answer' field.

It runs as a script, rather than it being a calculation field, hope that is OK?

pattern.fmp12.zip

  • Author
  • Newbies

Thanks Rwoods, great solution!!! Saved me a bunch of time. Thanks again

2 hours ago, Barry K said:

I am trying to see how many times keywords from the list come up as pattern matches from the text field of free form text.

There can be a big difference between how many times a keyword comes up as a pattern match and how many times a keyword comes up as a word. Consider for example the following sentence:

Bob the nabob went home to eat kabobs and watch the skibobbing competition.

Using PatternCount() will return 4 occurrences of the pattern "bob" - while a custom function such as CountWordOccurrences() will detect only 1 occurrence of the word "bob".

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.