On 08/25/2018 03:25 AM, Keith Clarke via use-livecode wrote:
Folks,
I’m working on a simple utility to count the most popular words in a text file but
my current code runs for a while & then causes LiveCode to crash.
I would also do what Alex does there with an array. Your code doesn't
crash
On 8/25/18 6:04 AM, Alex Tweedly via use-livecode wrote:
On 25/08/2018 12:01, Alex Tweedly via use-livecode wrote:
Not sure why yours is crashing, and I admit I haven't really looked
closely :-)
I'm trying to figure out why it crashes too.
on mouseUp
local tSource, tNoise, tWords
Thanks Alex & Paul - that’s working nicely now.
It has also introduced me to:
A unicode text subtlety that I’d missed since I last dabbled with LiveCode pre-7
Arrays, with a useful worked example, which are clearly more efficient for this
kind of process but a learning curve that I’d been
If you are LC 7 or higher, use trueWord chunk type vs word. See trueWord
in the dictionary. Also suggest using an array as in:
-- tText contains the text
local tWordArray
repeat for each trueWord tWord in tText
add 1 to tWordArray[tWord]
end repeat
-- the keys of tWordArray are you unique
On 25/08/2018 12:01, Alex Tweedly via use-livecode wrote:
Not sure why yours is crashing, and I admit I haven't really looked
closely :-)
I have a similar word count - so I tweaked it slightly :
- stack with 3 fields - fNoiseWords, fSource and outputs results to "F"
- button to make it
Not sure why yours is crashing, and I admit I haven't really looked
closely :-)
I have a similar word count - so I tweaked it slightly :
- stack with 3 fields - NoiseWords, Source and outputs results to "F"
- button to make it run
*on*mouseUp*
local*tSource, tNoise, tWord*s
Folks,
I’m working on a simple utility to count the most popular words in a text file
but my current code runs for a while & then causes LiveCode to crash.
It runs fine when I merely extract a list of unique words that are not in a
‘NoiseWords’ list but when I attempt to add a word count as the