Page 1 of 1

Words without quotes

Posted: Mon May 17, 2021 11:25 am
by richmond62
I am currently knocking up a word frequency counter . . .

Now my "customer" (OK, OK, my younger son) wants to be able to differentiate between "NATO" and NATO.

Using trueword it is dead easy to find all the occurrences of "NATO" with quotes by entering "NATO" in my search thing:
-
NATO.png
-
That gives me all the occurrences of "NATO".

However, if I enter NATO (without quotes) I get the occurrences of both "NATO" and NATO, and that is no good.

Re: Words without quotes

Posted: Mon May 17, 2021 11:43 am
by stam
Does search for text formatted as

Code: Select all

quote & "NATO" & quote
make any difference?

Re: Words without quotes

Posted: Mon May 17, 2021 2:32 pm
by dunbarx
Hi,

Try this. On a new card with a button and a field, put this in the button script:

Code: Select all

on mouseUp
   get fld 1
   repeat for each word tWord in it
      add 1 to wordCount[tWord]
   end repeat
   breakpoint
end mouseUp
Put this in the field:

Code: Select all

nato "nato" nato "nato" nato
Click the button, look at the array variable "wordCount".

How much do you charge your son?

Craig

Re: Words without quotes

Posted: Mon May 17, 2021 4:54 pm
by jacque
Craig's right, use "word" to include quotes. To avoid matches that occur within words, I'd check the search term for quotes and if they exist, use "word" and if not, use "trueword".