Complex Text Calculation

I am trying to work out a complex text calculaton.
If I have a phrase that is say 2 to 5 words in length. Example “shop satellite tv dish”
and I have a list of say a hundred different phrases that may contain that phrase but with the words in a different order such as maybe “satellite tv dish shop”.
I would like to go through the list and find the exact words in that prhase regardless of what order they are in. The only requirement is that all the words have to be a match of the words in the original phrase.

I would also like it to ignore phrases that contan some of the words but I’m looking for a match of all of the words, regardless of the order they are in.

Is this possible or too complex?

This should help:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

That is a nice solution, thank you. But maybe I was not clear enough.

If the primary phrase contains “satellite tv dish shop”
and the paragraph comparing it to contains “my satelllite tv dish shop”
I would like to ignore it. I’m only looking for a exact match to all and only the words in the primary phrase such as “tv dish satellite shop” would be a match because all the words are there but no more or less.

Is this very different to fix?

That actually makes it easier:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

Thanks… .that’s great. Now that I have that down, I have to collect one more piece of data from the paragraphs…
If the list of match_phrases is
"90834 - dish network satellite
9445 - dish free network
7253 - direct dish network tv vs
6884 - dish network satellite tv
4962 - direct dish network tv
4383 - dish network receiver
3956 - dish network tv
3547 - dish network programming
3221 - dish network sbc
2703 - channel dish network
2678 - card dish network
2568 - dish guide network tv
2019 - dish dvr network
1760 - box dish network
"
And our test_phrase is “free dish network”
I would like to collect the number “9445” next to the phrase “dish free network” and assigne it to a variable I could put into a cell in filemaker. But not include that number in the phrase search. Just the words. Is this easy to do?

AppleScript knows about word so try this:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

That is amazing, thanks Jon.
If instead of “Return matched_phrases”, I just use “Set x to matched_phrases” to get back into filemaker, right?

Thanks again