Jump to content

Pattern count/Keyword density probelm


This topic is 2576 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • 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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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".

  • Like 1
Link to comment
Share on other sites

This topic is 2576 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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