Folks,
Is there a single-pass mechanism or more efficient way of returning the 
wordOffset of each instance of ‘the’ in ‘the quick brown fox jumped over the 
lazy dog’ than to use two passes through the text?
Pass-1. Count the instances of ‘the’ into an array and then
Pass-2. Repeat for the count of instances using wordOffset, with a wordsToSkip 
variable derived from the previous loop’s offset

I’m I’m wondering if there’s something I’ve not yet learned about (nested?) 
arrays that might extend the unique word counter code that Alex, Paul & others 
helped me to fix a few days ago, to add a sub-array of wordOffset alongside 
word count? 

# Prepare noisewords array

repeat for each trueWord W in tNoiseWords

put true into tANoise[W]

end repeat


# Build unique words array

repeat for each trueWord W in tSource

if tANoise[W] then next repeat

add 1 to tAWords[W][N]

end repeat


# Convert unique words array to list


repeat for each key K in tAWords

put K && tAWords[K][N] & CR after fld "Words"

end repeat


sort lines of field "Words" descending numeric by word 2 of each


end repeat

Any ideas or steer towards a lesson / worked example greatly appreciated.
Best,
Keith
    
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to