word counts - what is going on?
Richard Gaskin
ambassador at fourthworld.com
Wed Aug 15 09:55:04 EDT 2012
Michael Kann wrote:
> Sounds like a good project. If you haven't discovered it yourself I'll just mention one of my alltime favorite scripts. It outputs a frequency list of words in a text file. Something like:
>
> on mouseUp
> repeat for each word w in fileContent
> add 1 to wordCount[w]
> end repeat
> put keys(wordCount) into keyWords
> sort keyWords
> repeat for each line l in keyWords
> put l & tab & wordCount[l] & return after displayResult
> end repeat
> put displayResult into field "result"
> end mouseUp
>
> I think it came from Richard Gaskin, or perhaps the Almighty Himself (Scott Raney).
I picked it up from Dr. Raney. It was included as one of the Sample
Scripts in the original MetaCard Help.
LiveCode includes it too: in the LiveCode Resource Center see the
example titled "Listing all the Unique Words in a Piece of Text".
--
Richard Gaskin
Fourth World
LiveCode training and consulting: http://www.fourthworld.com
Webzine for LiveCode developers: http://www.LiveCodeJournal.com
Follow me on Twitter: http://twitter.com/FourthWorldSys
More information about the use-livecode
mailing list