On 9/18/18 10:41 AM, Sannyasin Brahmanathaswami via use-livecode wrote:
I want to analyse the quote by going through each word.
*----------*
*repeat* withx = 1tothenumberofwordsoffld"_quote"
# get the location of the word, put it into variable tWordLocation
put tWordLocation to the WordLocationA[x][??][tWordLocation]
end repeat
-------
that we end with
WordLocationA["Cut"][1][100,320]
WordLocationA["Cut"][2][300,320]
WordLocationA["the"][1][200,320]
WordLocationA["the"][2][400,320]
WordLocationA["apple"][2][500,320]
WordLocationA["banana"][2][500,320]
I think this will get you close:
put fld 1 into tQuote
repeat with x = 1 to the number of truewords in tQuote
put tWordLocation into tWordLocationA[trueword x of
tQuote][x][tWordLocation]
end repeat
You could count word instances incrementally with more scripting, but
this short way gives you something similar. It stores the word position
to get this:
tWordLocationA["Cut"][1][100,320]
tWordLocationA["Cut"][4][300,320]
tWordLocationA["the"][2][200,320]
tWordLocationA["the"][5][400,320]
tWordLocationA["apple"][3][500,320]
tWordLocationA["banana"][6][500,320]
If you do want an incremental word count, check the number of elements
in each array key and add 1 to it instead of using "x" as the counter
when filling the array.
--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
_______________________________________________
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