Finding common words and phrases in a large block of text?

classic Classic list List threaded Threaded
30 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Finding common words and phrases in a large block of text?

Geoff Canyon via use-livecode
Hi – I’m looking to analyse some large block of text (journal abstracts from key educational technology journals over a several year period) to find common words and phrases. Finding common words should be easy enough but I’m not clear on what approach to take for finding common phrases (iterating through the text capturing overlapping word runs of various lengths?). Any ideas on how best to proceed?

TIA,

Terry...
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Finding common words and phrases in a large block of text?

Geoff Canyon via use-livecode
OK - was easier than I thought. I have something that works fast enough by iterating through runs of words in each sentence in a block of text, incrementing counts into an array and then sorting the contents of that array by phrase length and frequency.

Terry...

On 25/10/2018 4:56 pm, "use-livecode on behalf of Terry Judd via use-livecode" <[hidden email] on behalf of [hidden email]> wrote:

    Hi – I’m looking to analyse some large block of text (journal abstracts from key educational technology journals over a several year period) to find common words and phrases. Finding common words should be easy enough but I’m not clear on what approach to take for finding common phrases (iterating through the text capturing overlapping word runs of various lengths?). Any ideas on how best to proceed?
   
    TIA,
   
    Terry...
    _______________________________________________
    use-livecode mailing list
    [hidden email]
    Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
    http://lists.runrev.com/mailman/listinfo/use-livecode
   

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Finding common words and phrases in a large block of text?

Geoff Canyon via use-livecode
Hi Terry, glad you found a solution.....

I have a similar challenge.

I did a word count, but would love to recognize the same phrases.  Did you
just compare chunks? ... hash them? (probably redundant?)

Are there any more hints you can drop about this?

Thanks,

Tom

On Thu, Oct 25, 2018 at 4:27 AM Terry Judd via use-livecode <
[hidden email]> wrote:

> OK - was easier than I thought. I have something that works fast enough by
> iterating through runs of words in each sentence in a block of text,
> incrementing counts into an array and then sorting the contents of that
> array by phrase length and frequency.
>
> Terry...
>
> On 25/10/2018 4:56 pm, "use-livecode on behalf of Terry Judd via
> use-livecode" <[hidden email] on behalf of
> [hidden email]> wrote:
>
>     Hi – I’m looking to analyse some large block of text (journal
> abstracts from key educational technology journals over a several year
> period) to find common words and phrases. Finding common words should be
> easy enough but I’m not clear on what approach to take for finding common
> phrases (iterating through the text capturing overlapping word runs of
> various lengths?). Any ideas on how best to proceed?
>
>     TIA,
>
>     Terry...
>     _______________________________________________
>     use-livecode mailing list
>     [hidden email]
>     Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
>     http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Finding common words and phrases in a large block of text?

Geoff Canyon via use-livecode
On 26/10/2018 4:27 am, "use-livecode on behalf of Tom Glod via use-livecode" <[hidden email] on behalf of [hidden email]> wrote:

    Hi Terry, glad you found a solution.....
   
    I have a similar challenge.
   
    I did a word count, but would love to recognize the same phrases.  Did you
    just compare chunks? ... hash them? (probably redundant?)
   
    Are there any more hints you can drop about this?
   
    Thanks,
   
    Tom

Hi Tom - I've just done something like the code below, which accepts a block of text and the maximum 'phrase' length as input and provides an array with sorted counts of word runs (so not necessarily sensible phrases) of different lengths as output. I think it will be good enough for my purposes.

function getWordAndPhraseCounts pText, pMaxPhraseLength
   put empty into tA1
   set the itemDel to tab
   repeat for each sentence tSentence in pText
      put the number of words in tSentence into tMax
      repeat with i = 1 to pMaxPhraseLength
         repeat with j = 1 to (tMax-i+1)
            put word j to j+i-1 of tSentence into tPhrase
            add 1 to tA1[i][tPhrase]
         end repeat
      end repeat
   end repeat
   put empty into tA2
   repeat for each line tLength in the keys of tA1
      put empty into tList
      repeat for each line tPhrase in the keys of tA1[tLength]
         put tPhrase&tab& tA1[tLength][tPhrase]&cr after tList
      end repeat
      delete last char of tList
      sort lines of tList descending numeric by item 2 of each
      put tList into tA2[tLength]
   end repeat
   return tA2
end getWordAndPhraseCounts

   
    On Thu, Oct 25, 2018 at 4:27 AM Terry Judd via use-livecode <
    [hidden email]> wrote:
   
    > OK - was easier than I thought. I have something that works fast enough by
    > iterating through runs of words in each sentence in a block of text,
    > incrementing counts into an array and then sorting the contents of that
    > array by phrase length and frequency.
    >
    > Terry...
    >
    > On 25/10/2018 4:56 pm, "use-livecode on behalf of Terry Judd via
    > use-livecode" <[hidden email] on behalf of
    > [hidden email]> wrote:
    >
    >     Hi – I’m looking to analyse some large block of text (journal
    > abstracts from key educational technology journals over a several year
    > period) to find common words and phrases. Finding common words should be
    > easy enough but I’m not clear on what approach to take for finding common
    > phrases (iterating through the text capturing overlapping word runs of
    > various lengths?). Any ideas on how best to proceed?
    >
    >     TIA,
    >
    >     Terry...
    >     _______________________________________________
    >     use-livecode mailing list
    >     [hidden email]
    >     Please visit this url to subscribe, unsubscribe and manage your
    > subscription preferences:
    >     http://lists.runrev.com/mailman/listinfo/use-livecode
    >
    >
    > _______________________________________________
    > use-livecode mailing list
    > [hidden email]
    > Please visit this url to subscribe, unsubscribe and manage your
    > subscription preferences:
    > http://lists.runrev.com/mailman/listinfo/use-livecode
    _______________________________________________
    use-livecode mailing list
    [hidden email]
    Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
    http://lists.runrev.com/mailman/listinfo/use-livecode
   

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Finding common words and phrases in a large block of text?

Geoff Canyon via use-livecode
Hi Terry, I see, thanks for sharing your handler.  I'm going to run it on
some text and see the output.  LC is sooo good with chunks.....I find it
really fast as well.

All the best, Tom



On Thu, Oct 25, 2018 at 5:07 PM, Terry Judd via use-livecode <
[hidden email]> wrote:

> On 26/10/2018 4:27 am, "use-livecode on behalf of Tom Glod via
> use-livecode" <[hidden email] on behalf of
> [hidden email]> wrote:
>
>     Hi Terry, glad you found a solution.....
>
>     I have a similar challenge.
>
>     I did a word count, but would love to recognize the same phrases.  Did
> you
>     just compare chunks? ... hash them? (probably redundant?)
>
>     Are there any more hints you can drop about this?
>
>     Thanks,
>
>     Tom
>
> Hi Tom - I've just done something like the code below, which accepts a
> block of text and the maximum 'phrase' length as input and provides an
> array with sorted counts of word runs (so not necessarily sensible phrases)
> of different lengths as output. I think it will be good enough for my
> purposes.
>
> function getWordAndPhraseCounts pText, pMaxPhraseLength
>    put empty into tA1
>    set the itemDel to tab
>    repeat for each sentence tSentence in pText
>       put the number of words in tSentence into tMax
>       repeat with i = 1 to pMaxPhraseLength
>          repeat with j = 1 to (tMax-i+1)
>             put word j to j+i-1 of tSentence into tPhrase
>             add 1 to tA1[i][tPhrase]
>          end repeat
>       end repeat
>    end repeat
>    put empty into tA2
>    repeat for each line tLength in the keys of tA1
>       put empty into tList
>       repeat for each line tPhrase in the keys of tA1[tLength]
>          put tPhrase&tab& tA1[tLength][tPhrase]&cr after tList
>       end repeat
>       delete last char of tList
>       sort lines of tList descending numeric by item 2 of each
>       put tList into tA2[tLength]
>    end repeat
>    return tA2
> end getWordAndPhraseCounts
>
>
>     On Thu, Oct 25, 2018 at 4:27 AM Terry Judd via use-livecode <
>     [hidden email]> wrote:
>
>     > OK - was easier than I thought. I have something that works fast
> enough by
>     > iterating through runs of words in each sentence in a block of text,
>     > incrementing counts into an array and then sorting the contents of
> that
>     > array by phrase length and frequency.
>     >
>     > Terry...
>     >
>     > On 25/10/2018 4:56 pm, "use-livecode on behalf of Terry Judd via
>     > use-livecode" <[hidden email] on behalf of
>     > [hidden email]> wrote:
>     >
>     >     Hi – I’m looking to analyse some large block of text (journal
>     > abstracts from key educational technology journals over a several
> year
>     > period) to find common words and phrases. Finding common words
> should be
>     > easy enough but I’m not clear on what approach to take for finding
> common
>     > phrases (iterating through the text capturing overlapping word runs
> of
>     > various lengths?). Any ideas on how best to proceed?
>     >
>     >     TIA,
>     >
>     >     Terry...
>     >     _______________________________________________
>     >     use-livecode mailing list
>     >     [hidden email]
>     >     Please visit this url to subscribe, unsubscribe and manage your
>     > subscription preferences:
>     >     http://lists.runrev.com/mailman/listinfo/use-livecode
>     >
>     >
>     > _______________________________________________
>     > use-livecode mailing list
>     > [hidden email]
>     > Please visit this url to subscribe, unsubscribe and manage your
>     > subscription preferences:
>     > http://lists.runrev.com/mailman/listinfo/use-livecode
>     _______________________________________________
>     use-livecode mailing list
>     [hidden email]
>     Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
>     http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Numbering lines

Geoff Canyon via use-livecode
Hello folks

I am doing a content analysis of online chat and messaging.  Sometimes very large files, thousands or even hundreds of thousands of messages.  I am finding filter and find to be delightfully fast.

However…. Sometimes I want to prefix each line with the line number, and do this:

put  1 into tcount
 repeat for each line j in it
      put tcount &  j into line tcount of it
      put tcount + 1 into tcount
      set the thumbpos of scrollbar "filterprog" to tcount
   end repeat
   put it into field  “numberedtext”

I use ‘it’ because of a dim memory (superstition? Myth?) from long ago that it is faster than an arbitrarily named variable.  Still, the whole process is pretty darned  slow.  Any brilliant suggestions?


Best Wishes,
David Glasgow


 <http://www.i-psych.co.uk/> <https://twitter.com/iPsychApps>

 <https://twitter.com/iPsychApps> <http://uk.linkedin.com/in/davidvglasgow>
 <http://uk.linkedin.com/in/davidvglasgow>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Numbering lines

Geoff Canyon via use-livecode
I think your issue is where you say “put tcount & j into line tcount of it” — The line X of … call is very slow as it has to count every line from 1 - X.
try this:

local tBuffer
put 1 into tCount
repeat for each line j in pText
  put tCount & j & lf after tBuffer
  add 1 to tCount
  set the thumbpos of scrollbar “filterprog” to tCount
end repeat
delete line -1 of tBuffer
put tBuffer into pText //If you want to update the initial variable with the numbered lines
put tBuffer into field “numberedtext"

- Mark Hsu



> On Oct 26, 2018, at 10:27 AM, David V Glasgow via use-livecode <[hidden email]> wrote:
>
> Hello folks
>
> I am doing a content analysis of online chat and messaging.  Sometimes very large files, thousands or even hundreds of thousands of messages.  I am finding filter and find to be delightfully fast.
>
> However…. Sometimes I want to prefix each line with the line number, and do this:
>
> put  1 into tcount
> repeat for each line j in it
>      put tcount &  j into line tcount of it
>      put tcount + 1 into tcount
>      set the thumbpos of scrollbar "filterprog" to tcount
>   end repeat
>   put it into field  “numberedtext”
>
> I use ‘it’ because of a dim memory (superstition? Myth?) from long ago that it is faster than an arbitrarily named variable.  Still, the whole process is pretty darned  slow.  Any brilliant suggestions?
>
>
> Best Wishes,
> David Glasgow
>
>
> <http://www.i-psych.co.uk/> <https://twitter.com/iPsychApps>
>
> <https://twitter.com/iPsychApps> <http://uk.linkedin.com/in/davidvglasgow>
> <http://uk.linkedin.com/in/davidvglasgow>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Numbering lines

Geoff Canyon via use-livecode
Thanks Mark.  What you said makes sense, but when I actually  tested it, your routine is about the same as  mine - 3200 lines in 106 seconds (on my fairly old MacBook).

Cheers,

David G

> On 26 Oct 2018, at 6:41 pm, Mark Hsu via use-livecode <[hidden email]> wrote:
>
> I think your issue is where you say “put tcount & j into line tcount of it” — The line X of … call is very slow as it has to count every line from 1 - X.
> try this:
>
> local tBuffer
> put 1 into tCount
> repeat for each line j in pText
>  put tCount & j & lf after tBuffer
>  add 1 to tCount
>  set the thumbpos of scrollbar “filterprog” to tCount
> end repeat
> delete line -1 of tBuffer
> put tBuffer into pText //If you want to update the initial variable with the numbered lines
> put tBuffer into field “numberedtext"
>
> - Mark Hsu
>
>
>
>> On Oct 26, 2018, at 10:27 AM, David V Glasgow via use-livecode <[hidden email]> wrote:
>>
>> Hello folks
>>
>> I am doing a content analysis of online chat and messaging.  Sometimes very large files, thousands or even hundreds of thousands of messages.  I am finding filter and find to be delightfully fast.
>>
>> However…. Sometimes I want to prefix each line with the line number, and do this:
>>
>> put  1 into tcount
>> repeat for each line j in it
>>     put tcount &  j into line tcount of it
>>     put tcount + 1 into tcount
>>     set the thumbpos of scrollbar "filterprog" to tcount
>>  end repeat
>>  put it into field  “numberedtext”
>>
>> I use ‘it’ because of a dim memory (superstition? Myth?) from long ago that it is faster than an arbitrarily named variable.  Still, the whole process is pretty darned  slow.  Any brilliant suggestions?
>>
>>
>> Best Wishes,
>> David Glasgow
>>
>>
>> <http://www.i-psych.co.uk/> <https://twitter.com/iPsychApps>
>>
>> <https://twitter.com/iPsychApps> <http://uk.linkedin.com/in/davidvglasgow>
>> <http://uk.linkedin.com/in/davidvglasgow>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Numbering lines

Geoff Canyon via use-livecode
Another issue may be the line that updates the scrollbar. Try commenting
out that line as a test just to see if that's the problem. If so, you might
opt for a spinner or progress bar instead.

--
Jacqueline Landman Gay | [hidden email]
HyperActive Software | http://www.hyperactivesw.com
On October 27, 2018 10:49:30 AM David V Glasgow via use-livecode
<[hidden email]> wrote:

> Thanks Mark.  What you said makes sense, but when I actually  tested it,
> your routine is about the same as  mine - 3200 lines in 106 seconds (on my
> fairly old MacBook).
>
> Cheers,
>
> David G
>
>> On 26 Oct 2018, at 6:41 pm, Mark Hsu via use-livecode
>> <[hidden email]> wrote:
>>
>> I think your issue is where you say “put tcount & j into line tcount of it”
>> — The line X of … call is very slow as it has to count every line from 1 - X.
>> try this:
>>
>> local tBuffer
>> put 1 into tCount
>> repeat for each line j in pText
>>  put tCount & j & lf after tBuffer
>>  add 1 to tCount
>>  set the thumbpos of scrollbar “filterprog” to tCount
>> end repeat
>> delete line -1 of tBuffer
>> put tBuffer into pText //If you want to update the initial variable with
>> the numbered lines
>> put tBuffer into field “numberedtext"
>>
>> - Mark Hsu
>>
>>
>>
>>> On Oct 26, 2018, at 10:27 AM, David V Glasgow via use-livecode
>>> <[hidden email]> wrote:
>>>
>>> Hello folks
>>>
>>> I am doing a content analysis of online chat and messaging.  Sometimes very
>>> large files, thousands or even hundreds of thousands of messages.  I am
>>> finding filter and find to be delightfully fast.
>>>
>>> However…. Sometimes I want to prefix each line with the line number, and do
>>> this:
>>>
>>> put  1 into tcount
>>> repeat for each line j in it
>>>     put tcount &  j into line tcount of it
>>>     put tcount + 1 into tcount
>>>     set the thumbpos of scrollbar "filterprog" to tcount
>>>  end repeat
>>>  put it into field  “numberedtext”
>>>
>>> I use ‘it’ because of a dim memory (superstition? Myth?) from long ago that
>>> it is faster than an arbitrarily named variable.  Still, the whole process
>>> is pretty darned  slow.  Any brilliant suggestions?
>>>
>>>
>>> Best Wishes,
>>> David Glasgow
>>>
>>>
>>> <http://www.i-psych.co.uk/> <https://twitter.com/iPsychApps>
>>>
>>> <https://twitter.com/iPsychApps> <http://uk.linkedin.com/in/davidvglasgow>
>>> <http://uk.linkedin.com/in/davidvglasgow>
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Numbering lines

Geoff Canyon via use-livecode
In reply to this post by Geoff Canyon via use-livecode
1. Besides removing scroll-update, which takes most of the time, you could
try the following array-methods (which are essentially from my stack
http://forums.livecode.com/viewtopic.php?p=101301#p101301 , see there
card "LineNums, tab "Nb2").

This needs here on a medium fast machine (Mac mini, 2.5GHz) in average
with LC 9.0.1 (which is at about 30% faster than LC 8.1.10 with that):

680 ms for 10000 lines to add the line numbers,
650 ms for 10000 lines to remove the line numbers,
both incl. the field update (a lot of long lines are to break).

-- Add "inline line numbers" [-hh fecit, 2014]
-- Uses separator ": " (In LC 6 use one single char, remove below needs that)
on mouseUp
  lock screen; lock messages
  put the millisecs into m1
  set cursor to watch
  put fld "IN" into T
  split T by return
  put the keys of T into K
  sort K numeric
  repeat for each line L in K
    put cr & L & ": " & T[L] after S --> change separator here
  end repeat
  set text of fld "OUT" to char 2 to -1 of S
  put -1+the num of lines of S & " lines: " & \
        the millisecs -m1 & " ms" into fld "timing"
end mouseUp

-- Remove "inline line numbers" [-hh fecit, 2014]
-- Uses separator ": " (the above, in LC 6 you have to use one single char)
on mouseUp
  lock screen; lock messages
  put the millisecs into m1
  set cursor to watch
  put the text of fld "OUT" into S
  split S by return and ": " --> change separator here
  put the keys of S into K
  sort K numeric
  repeat for each line L in K
    put cr & S[L] after T
  end repeat
  put char 2 to -1 of T into fld "IN2"
  put -1+the num of lines of T & " lines: " & \
        the millisecs -m1 & " ms : " & (fld "IN2" is fld "IN") into fld "timing"
end mouseUp

2. All "big" editors that show line numbers never update the whole long text
** but only a few lines more than the visible line range **. Using that, nearly
every LCS method (that locks the screen (and messages)) will be fast enough.

> JLG wrote:
> Another issue may be the line that updates the scrollbar. Try commenting out
> that line as a test just to see if that's the problem. If so, you might opt
> for a spinner or progress bar instead.
>
> > David Glasgow wrote:
> > your routine is about the same as mine - 3200 lines in 106 seconds (on my
> > fairly old MacBook).
> >> Mark Hsu wrote:
> >> <use-livecode at lists.runrev.com> wrote:
> >>
> >> I think your issue is where you say “put tcount & j into line tcount of it”
> >> — The line X of … call is very slow as it has to count every line from 1 - X.
> >> try this:
> >>
> >> local tBuffer
> >> put 1 into tCount
> >> repeat for each line j in pText
> >> put tCount & j & lf after tBuffer
> >> add 1 to tCount
> >> set the thumbpos of scrollbar “filterprog” to tCount
> >> end repeat
> >> delete line -1 of tBuffer
> >> put tBuffer into pText //If you want to update the initial variable with
> >> the numbered lines
> >> put tBuffer into field “numberedtext"
> >>> David V Glasgow  wrote:
> >>>
> >>> Hello folks
> >>>
> >>> I am doing a content analysis of online chat and messaging. Sometimes very
> >>> large files, thousands or even hundreds of thousands of messages. I am
> >>> finding filter and find to be delightfully fast.
> >>>
> >>> However…. Sometimes I want to prefix each line with the line number, and do
> >>> this:
> >>>
> >>> put 1 into tcount
> >>> repeat for each line j in it
> >>> put tcount & j into line tcount of it
> >>> put tcount + 1 into tcount
> >>> set the thumbpos of scrollbar "filterprog" to tcount
> >>> end repeat
> >>> put it into field “numberedtext”
> >>>
> >>> I use ‘it’ because of a dim memory (superstition? Myth?) from long ago that
> >>> it is faster than an arbitrarily named variable. Still, the whole process
> >>> is pretty darned slow. Any brilliant suggestions?

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Numbering lines

Geoff Canyon via use-livecode
Converted to functions with the text and delimiter as paramaters for ease
of use:

-- Add "inline line numbers" [-hh fecit, 2014]
function numberText T,D
   split T by return
   put "1:" && T[1] into R
   repeat with K = 2 to item 2 of the extents of T
      put cr & K & D & T[K] after R
   end repeat
   return R
end numberText

-- Remove "inline line numbers" [-hh fecit, 2014]
function unNumberText T,D
   split T by return and D
   put the keys of T into K
   sort K numeric
   repeat for each line L in K
      put cr & T[L] after R
   end repeat
   return char 2 to -1 of R
end unNumberText



On Sat, Oct 27, 2018 at 11:54 AM hh via use-livecode <
[hidden email]> wrote:

> 1. Besides removing scroll-update, which takes most of the time, you could
> try the following array-methods (which are essentially from my stack
> http://forums.livecode.com/viewtopic.php?p=101301#p101301 , see there
> card "LineNums, tab "Nb2").
>
> This needs here on a medium fast machine (Mac mini, 2.5GHz) in average
> with LC 9.0.1 (which is at about 30% faster than LC 8.1.10 with that):
>
> 680 ms for 10000 lines to add the line numbers,
> 650 ms for 10000 lines to remove the line numbers,
> both incl. the field update (a lot of long lines are to break).
>
> -- Add "inline line numbers" [-hh fecit, 2014]
> -- Uses separator ": " (In LC 6 use one single char, remove below needs
> that)
> on mouseUp
>   lock screen; lock messages
>   put the millisecs into m1
>   set cursor to watch
>   put fld "IN" into T
>   split T by return
>   put the keys of T into K
>   sort K numeric
>   repeat for each line L in K
>     put cr & L & ": " & T[L] after S --> change separator here
>   end repeat
>   set text of fld "OUT" to char 2 to -1 of S
>   put -1+the num of lines of S & " lines: " & \
>         the millisecs -m1 & " ms" into fld "timing"
> end mouseUp
>
> -- Remove "inline line numbers" [-hh fecit, 2014]
> -- Uses separator ": " (the above, in LC 6 you have to use one single char)
> on mouseUp
>   lock screen; lock messages
>   put the millisecs into m1
>   set cursor to watch
>   put the text of fld "OUT" into S
>   split S by return and ": " --> change separator here
>   put the keys of S into K
>   sort K numeric
>   repeat for each line L in K
>     put cr & S[L] after T
>   end repeat
>   put char 2 to -1 of T into fld "IN2"
>   put -1+the num of lines of T & " lines: " & \
>         the millisecs -m1 & " ms : " & (fld "IN2" is fld "IN") into fld
> "timing"
> end mouseUp
>
> 2. All "big" editors that show line numbers never update the whole long
> text
> ** but only a few lines more than the visible line range **. Using that,
> nearly
> every LCS method (that locks the screen (and messages)) will be fast
> enough.
>
> > JLG wrote:
> > Another issue may be the line that updates the scrollbar. Try commenting
> out
> > that line as a test just to see if that's the problem. If so, you might
> opt
> > for a spinner or progress bar instead.
> >
> > > David Glasgow wrote:
> > > your routine is about the same as mine - 3200 lines in 106 seconds (on
> my
> > > fairly old MacBook).
> > >> Mark Hsu wrote:
> > >> <use-livecode at lists.runrev.com> wrote:
> > >>
> > >> I think your issue is where you say “put tcount & j into line tcount
> of it”
> > >> — The line X of … call is very slow as it has to count every line
> from 1 - X.
> > >> try this:
> > >>
> > >> local tBuffer
> > >> put 1 into tCount
> > >> repeat for each line j in pText
> > >> put tCount & j & lf after tBuffer
> > >> add 1 to tCount
> > >> set the thumbpos of scrollbar “filterprog” to tCount
> > >> end repeat
> > >> delete line -1 of tBuffer
> > >> put tBuffer into pText //If you want to update the initial variable
> with
> > >> the numbered lines
> > >> put tBuffer into field “numberedtext"
> > >>> David V Glasgow  wrote:
> > >>>
> > >>> Hello folks
> > >>>
> > >>> I am doing a content analysis of online chat and messaging.
> Sometimes very
> > >>> large files, thousands or even hundreds of thousands of messages. I
> am
> > >>> finding filter and find to be delightfully fast.
> > >>>
> > >>> However…. Sometimes I want to prefix each line with the line number,
> and do
> > >>> this:
> > >>>
> > >>> put 1 into tcount
> > >>> repeat for each line j in it
> > >>> put tcount & j into line tcount of it
> > >>> put tcount + 1 into tcount
> > >>> set the thumbpos of scrollbar "filterprog" to tcount
> > >>> end repeat
> > >>> put it into field “numberedtext”
> > >>>
> > >>> I use ‘it’ because of a dim memory (superstition? Myth?) from long
> ago that
> > >>> it is faster than an arbitrarily named variable. Still, the whole
> process
> > >>> is pretty darned slow. Any brilliant suggestions?
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Numbering lines

Geoff Canyon via use-livecode
Sorry, missed a delimiter reference:

function numberText T,D
   split T by return
   put "1" & D & T[1] into R
   repeat with K = 2 to item 2 of the extents of T
      put cr & K & D & T[K] after R --> change separator here
   end repeat
   return R
end numberText

On Sat, Oct 27, 2018 at 5:27 PM Geoff Canyon <[hidden email]> wrote:

> Converted to functions with the text and delimiter as paramaters for ease
> of use:
>
> -- Add "inline line numbers" [-hh fecit, 2014]
> function numberText T,D
>    split T by return
>    put "1:" && T[1] into R
>    repeat with K = 2 to item 2 of the extents of T
>       put cr & K & D & T[K] after R
>    end repeat
>    return R
> end numberText
>
> -- Remove "inline line numbers" [-hh fecit, 2014]
> function unNumberText T,D
>    split T by return and D
>    put the keys of T into K
>    sort K numeric
>    repeat for each line L in K
>       put cr & T[L] after R
>    end repeat
>    return char 2 to -1 of R
> end unNumberText
>
>
>
> On Sat, Oct 27, 2018 at 11:54 AM hh via use-livecode <
> [hidden email]> wrote:
>
>> 1. Besides removing scroll-update, which takes most of the time, you could
>> try the following array-methods (which are essentially from my stack
>> http://forums.livecode.com/viewtopic.php?p=101301#p101301 , see there
>> card "LineNums, tab "Nb2").
>>
>> This needs here on a medium fast machine (Mac mini, 2.5GHz) in average
>> with LC 9.0.1 (which is at about 30% faster than LC 8.1.10 with that):
>>
>> 680 ms for 10000 lines to add the line numbers,
>> 650 ms for 10000 lines to remove the line numbers,
>> both incl. the field update (a lot of long lines are to break).
>>
>> -- Add "inline line numbers" [-hh fecit, 2014]
>> -- Uses separator ": " (In LC 6 use one single char, remove below needs
>> that)
>> on mouseUp
>>   lock screen; lock messages
>>   put the millisecs into m1
>>   set cursor to watch
>>   put fld "IN" into T
>>   split T by return
>>   put the keys of T into K
>>   sort K numeric
>>   repeat for each line L in K
>>     put cr & L & ": " & T[L] after S --> change separator here
>>   end repeat
>>   set text of fld "OUT" to char 2 to -1 of S
>>   put -1+the num of lines of S & " lines: " & \
>>         the millisecs -m1 & " ms" into fld "timing"
>> end mouseUp
>>
>> -- Remove "inline line numbers" [-hh fecit, 2014]
>> -- Uses separator ": " (the above, in LC 6 you have to use one single
>> char)
>> on mouseUp
>>   lock screen; lock messages
>>   put the millisecs into m1
>>   set cursor to watch
>>   put the text of fld "OUT" into S
>>   split S by return and ": " --> change separator here
>>   put the keys of S into K
>>   sort K numeric
>>   repeat for each line L in K
>>     put cr & S[L] after T
>>   end repeat
>>   put char 2 to -1 of T into fld "IN2"
>>   put -1+the num of lines of T & " lines: " & \
>>         the millisecs -m1 & " ms : " & (fld "IN2" is fld "IN") into fld
>> "timing"
>> end mouseUp
>>
>> 2. All "big" editors that show line numbers never update the whole long
>> text
>> ** but only a few lines more than the visible line range **. Using that,
>> nearly
>> every LCS method (that locks the screen (and messages)) will be fast
>> enough.
>>
>> > JLG wrote:
>> > Another issue may be the line that updates the scrollbar. Try
>> commenting out
>> > that line as a test just to see if that's the problem. If so, you might
>> opt
>> > for a spinner or progress bar instead.
>> >
>> > > David Glasgow wrote:
>> > > your routine is about the same as mine - 3200 lines in 106 seconds
>> (on my
>> > > fairly old MacBook).
>> > >> Mark Hsu wrote:
>> > >> <use-livecode at lists.runrev.com> wrote:
>> > >>
>> > >> I think your issue is where you say “put tcount & j into line tcount
>> of it”
>> > >> — The line X of … call is very slow as it has to count every line
>> from 1 - X.
>> > >> try this:
>> > >>
>> > >> local tBuffer
>> > >> put 1 into tCount
>> > >> repeat for each line j in pText
>> > >> put tCount & j & lf after tBuffer
>> > >> add 1 to tCount
>> > >> set the thumbpos of scrollbar “filterprog” to tCount
>> > >> end repeat
>> > >> delete line -1 of tBuffer
>> > >> put tBuffer into pText //If you want to update the initial variable
>> with
>> > >> the numbered lines
>> > >> put tBuffer into field “numberedtext"
>> > >>> David V Glasgow  wrote:
>> > >>>
>> > >>> Hello folks
>> > >>>
>> > >>> I am doing a content analysis of online chat and messaging.
>> Sometimes very
>> > >>> large files, thousands or even hundreds of thousands of messages. I
>> am
>> > >>> finding filter and find to be delightfully fast.
>> > >>>
>> > >>> However…. Sometimes I want to prefix each line with the line
>> number, and do
>> > >>> this:
>> > >>>
>> > >>> put 1 into tcount
>> > >>> repeat for each line j in it
>> > >>> put tcount & j into line tcount of it
>> > >>> put tcount + 1 into tcount
>> > >>> set the thumbpos of scrollbar "filterprog" to tcount
>> > >>> end repeat
>> > >>> put it into field “numberedtext”
>> > >>>
>> > >>> I use ‘it’ because of a dim memory (superstition? Myth?) from long
>> ago that
>> > >>> it is faster than an arbitrarily named variable. Still, the whole
>> process
>> > >>> is pretty darned slow. Any brilliant suggestions?
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Numbering lines

Geoff Canyon via use-livecode
And of course if retaining the order isn't critical you could just go with:

function numberText T,D
   split T by cr
   combine T by cr and D
   return T
end numberText

function unNumberText T,D
   split T by cr and D
   combine T by cr
   return T
end unNumberText

On Sat, Oct 27, 2018 at 5:29 PM Geoff Canyon <[hidden email]> wrote:

> Sorry, missed a delimiter reference:
>
> function numberText T,D
>    split T by return
>    put "1" & D & T[1] into R
>    repeat with K = 2 to item 2 of the extents of T
>       put cr & K & D & T[K] after R --> change separator here
>    end repeat
>    return R
> end numberText
>
> On Sat, Oct 27, 2018 at 5:27 PM Geoff Canyon <[hidden email]> wrote:
>
>> Converted to functions with the text and delimiter as paramaters for ease
>> of use:
>>
>> -- Add "inline line numbers" [-hh fecit, 2014]
>> function numberText T,D
>>    split T by return
>>    put "1:" && T[1] into R
>>    repeat with K = 2 to item 2 of the extents of T
>>       put cr & K & D & T[K] after R
>>    end repeat
>>    return R
>> end numberText
>>
>> -- Remove "inline line numbers" [-hh fecit, 2014]
>> function unNumberText T,D
>>    split T by return and D
>>    put the keys of T into K
>>    sort K numeric
>>    repeat for each line L in K
>>       put cr & T[L] after R
>>    end repeat
>>    return char 2 to -1 of R
>> end unNumberText
>>
>>
>>
>> On Sat, Oct 27, 2018 at 11:54 AM hh via use-livecode <
>> [hidden email]> wrote:
>>
>>> 1. Besides removing scroll-update, which takes most of the time, you
>>> could
>>> try the following array-methods (which are essentially from my stack
>>> http://forums.livecode.com/viewtopic.php?p=101301#p101301 , see there
>>> card "LineNums, tab "Nb2").
>>>
>>> This needs here on a medium fast machine (Mac mini, 2.5GHz) in average
>>> with LC 9.0.1 (which is at about 30% faster than LC 8.1.10 with that):
>>>
>>> 680 ms for 10000 lines to add the line numbers,
>>> 650 ms for 10000 lines to remove the line numbers,
>>> both incl. the field update (a lot of long lines are to break).
>>>
>>> -- Add "inline line numbers" [-hh fecit, 2014]
>>> -- Uses separator ": " (In LC 6 use one single char, remove below needs
>>> that)
>>> on mouseUp
>>>   lock screen; lock messages
>>>   put the millisecs into m1
>>>   set cursor to watch
>>>   put fld "IN" into T
>>>   split T by return
>>>   put the keys of T into K
>>>   sort K numeric
>>>   repeat for each line L in K
>>>     put cr & L & ": " & T[L] after S --> change separator here
>>>   end repeat
>>>   set text of fld "OUT" to char 2 to -1 of S
>>>   put -1+the num of lines of S & " lines: " & \
>>>         the millisecs -m1 & " ms" into fld "timing"
>>> end mouseUp
>>>
>>> -- Remove "inline line numbers" [-hh fecit, 2014]
>>> -- Uses separator ": " (the above, in LC 6 you have to use one single
>>> char)
>>> on mouseUp
>>>   lock screen; lock messages
>>>   put the millisecs into m1
>>>   set cursor to watch
>>>   put the text of fld "OUT" into S
>>>   split S by return and ": " --> change separator here
>>>   put the keys of S into K
>>>   sort K numeric
>>>   repeat for each line L in K
>>>     put cr & S[L] after T
>>>   end repeat
>>>   put char 2 to -1 of T into fld "IN2"
>>>   put -1+the num of lines of T & " lines: " & \
>>>         the millisecs -m1 & " ms : " & (fld "IN2" is fld "IN") into fld
>>> "timing"
>>> end mouseUp
>>>
>>> 2. All "big" editors that show line numbers never update the whole long
>>> text
>>> ** but only a few lines more than the visible line range **. Using that,
>>> nearly
>>> every LCS method (that locks the screen (and messages)) will be fast
>>> enough.
>>>
>>> > JLG wrote:
>>> > Another issue may be the line that updates the scrollbar. Try
>>> commenting out
>>> > that line as a test just to see if that's the problem. If so, you
>>> might opt
>>> > for a spinner or progress bar instead.
>>> >
>>> > > David Glasgow wrote:
>>> > > your routine is about the same as mine - 3200 lines in 106 seconds
>>> (on my
>>> > > fairly old MacBook).
>>> > >> Mark Hsu wrote:
>>> > >> <use-livecode at lists.runrev.com> wrote:
>>> > >>
>>> > >> I think your issue is where you say “put tcount & j into line
>>> tcount of it”
>>> > >> — The line X of … call is very slow as it has to count every line
>>> from 1 - X.
>>> > >> try this:
>>> > >>
>>> > >> local tBuffer
>>> > >> put 1 into tCount
>>> > >> repeat for each line j in pText
>>> > >> put tCount & j & lf after tBuffer
>>> > >> add 1 to tCount
>>> > >> set the thumbpos of scrollbar “filterprog” to tCount
>>> > >> end repeat
>>> > >> delete line -1 of tBuffer
>>> > >> put tBuffer into pText //If you want to update the initial variable
>>> with
>>> > >> the numbered lines
>>> > >> put tBuffer into field “numberedtext"
>>> > >>> David V Glasgow  wrote:
>>> > >>>
>>> > >>> Hello folks
>>> > >>>
>>> > >>> I am doing a content analysis of online chat and messaging.
>>> Sometimes very
>>> > >>> large files, thousands or even hundreds of thousands of messages.
>>> I am
>>> > >>> finding filter and find to be delightfully fast.
>>> > >>>
>>> > >>> However…. Sometimes I want to prefix each line with the line
>>> number, and do
>>> > >>> this:
>>> > >>>
>>> > >>> put 1 into tcount
>>> > >>> repeat for each line j in it
>>> > >>> put tcount & j into line tcount of it
>>> > >>> put tcount + 1 into tcount
>>> > >>> set the thumbpos of scrollbar "filterprog" to tcount
>>> > >>> end repeat
>>> > >>> put it into field “numberedtext”
>>> > >>>
>>> > >>> I use ‘it’ because of a dim memory (superstition? Myth?) from long
>>> ago that
>>> > >>> it is faster than an arbitrarily named variable. Still, the whole
>>> process
>>> > >>> is pretty darned slow. Any brilliant suggestions?
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Numbering lines

Geoff Canyon via use-livecode
Thanks Geoff, I did play with Split, but one of the reasons for numbering is to make any identical lines unique.  With split, for any that are not, all but one is deleted.  So definitely not the result I wanted.

I’ll sacrifice the progress bar and see where that leaves me.

Thanks folks.

> On 28 Oct 2018, at 1:32 am, Geoff Canyon via use-livecode <[hidden email]> wrote:
>
> And of course if retaining the order isn't critical you could just go with:
>
> function numberText T,D
>   split T by cr
>   combine T by cr and D
>   return T
> end numberText
>
> function unNumberText T,D
>   split T by cr and D
>   combine T by cr
>   return T
> end unNumberText
>
> On Sat, Oct 27, 2018 at 5:29 PM Geoff Canyon <[hidden email]> wrote:
>
>> Sorry, missed a delimiter reference:
>>
>> function numberText T,D
>>   split T by return
>>   put "1" & D & T[1] into R
>>   repeat with K = 2 to item 2 of the extents of T
>>      put cr & K & D & T[K] after R --> change separator here
>>   end repeat
>>   return R
>> end numberText
>>
>> On Sat, Oct 27, 2018 at 5:27 PM Geoff Canyon <[hidden email]> wrote:
>>
>>> Converted to functions with the text and delimiter as paramaters for ease
>>> of use:
>>>
>>> -- Add "inline line numbers" [-hh fecit, 2014]
>>> function numberText T,D
>>>   split T by return
>>>   put "1:" && T[1] into R
>>>   repeat with K = 2 to item 2 of the extents of T
>>>      put cr & K & D & T[K] after R
>>>   end repeat
>>>   return R
>>> end numberText
>>>
>>> -- Remove "inline line numbers" [-hh fecit, 2014]
>>> function unNumberText T,D
>>>   split T by return and D
>>>   put the keys of T into K
>>>   sort K numeric
>>>   repeat for each line L in K
>>>      put cr & T[L] after R
>>>   end repeat
>>>   return char 2 to -1 of R
>>> end unNumberText
>>>
>>>
>>>
>>> On Sat, Oct 27, 2018 at 11:54 AM hh via use-livecode <
>>> [hidden email]> wrote:
>>>
>>>> 1. Besides removing scroll-update, which takes most of the time, you
>>>> could
>>>> try the following array-methods (which are essentially from my stack
>>>> http://forums.livecode.com/viewtopic.php?p=101301#p101301 , see there
>>>> card "LineNums, tab "Nb2").
>>>>
>>>> This needs here on a medium fast machine (Mac mini, 2.5GHz) in average
>>>> with LC 9.0.1 (which is at about 30% faster than LC 8.1.10 with that):
>>>>
>>>> 680 ms for 10000 lines to add the line numbers,
>>>> 650 ms for 10000 lines to remove the line numbers,
>>>> both incl. the field update (a lot of long lines are to break).
>>>>
>>>> -- Add "inline line numbers" [-hh fecit, 2014]
>>>> -- Uses separator ": " (In LC 6 use one single char, remove below needs
>>>> that)
>>>> on mouseUp
>>>>  lock screen; lock messages
>>>>  put the millisecs into m1
>>>>  set cursor to watch
>>>>  put fld "IN" into T
>>>>  split T by return
>>>>  put the keys of T into K
>>>>  sort K numeric
>>>>  repeat for each line L in K
>>>>    put cr & L & ": " & T[L] after S --> change separator here
>>>>  end repeat
>>>>  set text of fld "OUT" to char 2 to -1 of S
>>>>  put -1+the num of lines of S & " lines: " & \
>>>>        the millisecs -m1 & " ms" into fld "timing"
>>>> end mouseUp
>>>>
>>>> -- Remove "inline line numbers" [-hh fecit, 2014]
>>>> -- Uses separator ": " (the above, in LC 6 you have to use one single
>>>> char)
>>>> on mouseUp
>>>>  lock screen; lock messages
>>>>  put the millisecs into m1
>>>>  set cursor to watch
>>>>  put the text of fld "OUT" into S
>>>>  split S by return and ": " --> change separator here
>>>>  put the keys of S into K
>>>>  sort K numeric
>>>>  repeat for each line L in K
>>>>    put cr & S[L] after T
>>>>  end repeat
>>>>  put char 2 to -1 of T into fld "IN2"
>>>>  put -1+the num of lines of T & " lines: " & \
>>>>        the millisecs -m1 & " ms : " & (fld "IN2" is fld "IN") into fld
>>>> "timing"
>>>> end mouseUp
>>>>
>>>> 2. All "big" editors that show line numbers never update the whole long
>>>> text
>>>> ** but only a few lines more than the visible line range **. Using that,
>>>> nearly
>>>> every LCS method (that locks the screen (and messages)) will be fast
>>>> enough.
>>>>
>>>>> JLG wrote:
>>>>> Another issue may be the line that updates the scrollbar. Try
>>>> commenting out
>>>>> that line as a test just to see if that's the problem. If so, you
>>>> might opt
>>>>> for a spinner or progress bar instead.
>>>>>
>>>>>> David Glasgow wrote:
>>>>>> your routine is about the same as mine - 3200 lines in 106 seconds
>>>> (on my
>>>>>> fairly old MacBook).
>>>>>>> Mark Hsu wrote:
>>>>>>> <use-livecode at lists.runrev.com> wrote:
>>>>>>>
>>>>>>> I think your issue is where you say “put tcount & j into line
>>>> tcount of it”
>>>>>>> — The line X of … call is very slow as it has to count every line
>>>> from 1 - X.
>>>>>>> try this:
>>>>>>>
>>>>>>> local tBuffer
>>>>>>> put 1 into tCount
>>>>>>> repeat for each line j in pText
>>>>>>> put tCount & j & lf after tBuffer
>>>>>>> add 1 to tCount
>>>>>>> set the thumbpos of scrollbar “filterprog” to tCount
>>>>>>> end repeat
>>>>>>> delete line -1 of tBuffer
>>>>>>> put tBuffer into pText //If you want to update the initial variable
>>>> with
>>>>>>> the numbered lines
>>>>>>> put tBuffer into field “numberedtext"
>>>>>>>> David V Glasgow  wrote:
>>>>>>>>
>>>>>>>> Hello folks
>>>>>>>>
>>>>>>>> I am doing a content analysis of online chat and messaging.
>>>> Sometimes very
>>>>>>>> large files, thousands or even hundreds of thousands of messages.
>>>> I am
>>>>>>>> finding filter and find to be delightfully fast.
>>>>>>>>
>>>>>>>> However…. Sometimes I want to prefix each line with the line
>>>> number, and do
>>>>>>>> this:
>>>>>>>>
>>>>>>>> put 1 into tcount
>>>>>>>> repeat for each line j in it
>>>>>>>> put tcount & j into line tcount of it
>>>>>>>> put tcount + 1 into tcount
>>>>>>>> set the thumbpos of scrollbar "filterprog" to tcount
>>>>>>>> end repeat
>>>>>>>> put it into field “numberedtext”
>>>>>>>>
>>>>>>>> I use ‘it’ because of a dim memory (superstition? Myth?) from long
>>>> ago that
>>>>>>>> it is faster than an arbitrarily named variable. Still, the whole
>>>> process
>>>>>>>> is pretty darned slow. Any brilliant suggestions?
>>>>
>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> [hidden email]
>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Numbering lines

Geoff Canyon via use-livecode
In reply to this post by Geoff Canyon via use-livecode
> David G. wrote:
> Thanks Geoff, I did play with Split, but one of the reasons for numbering
> is to make any identical lines unique.  With split, for any that are not,
> all but one is deleted.  So definitely not the result I wanted.

I am not Geoff (who played with the simple array methods I suggested).
But your post attacks indirectly my suggested handlers below as wrong, as if
they would not hit your question.

My handlers (which are at least 600 times faster than your first script)
output exactly the same what your first script outputs, seen apart from the
optional delimiter.

> So definitely not the result I wanted.
LOL: You mention above the "unique"-side-condition the first time...

With your new side condition from above several others (and I) know also
how this is doable very fast, once again using arrays. And it is an
invertible method, that is, the original text is exactly restorable.

But first post YOU your new handler, to see *all* your new side conditions,
that is, or to see what you really want:
Certainly not a line numbering, rather indexing a text file.

> >>> David G. wrote: [This is the first script]
> >>> However….
> >>> Sometimes I want to prefix each line with the line number, and do this:
> >>>
> >>> put 1 into tcount
> >>> repeat for each line j in it
> >>> put tcount & j into line tcount of it
> >>> put tcount + 1 into tcount
> >>> set the thumbpos of scrollbar "filterprog" to tcount
> >>> end repeat
> >>> put it into field “numberedtext”
> >>>
> >>> I use ‘it’ because of a dim memory (superstition? Myth?) from long ago that
> >>> it is faster than an arbitrarily named variable. Still, the whole process
> >>> is pretty darned slow. Any brilliant suggestions?
>
>> Geoff C. wrote:
>> And of course if retaining the order isn't critical you could just go with:
>>
>> function numberText T,D
>>    split T by cr
>>    combine T by cr and D
>>    return T
>> end numberText
>>
>> function unNumberText T,D
>>    split T by cr and D
>>    combine T by cr
>>    return T
>> end unNumberText
>
>>> Hermann H. wrote:
>>> 1. Besides removing scroll-update, which takes most of the time, you could
>>> try the following array-methods (which are essentially from my stack
>>>
>>> http://forums.livecode.com/viewtopic.php?p=101301#p101301
>>>  , see there
>>> card "LineNums, tab "Nb2").
>>>
>>> This needs here on a medium fast machine (Mac mini, 2.5GHz) in average
>>> with LC 9.0.1 (which is at about 30% faster than LC 8.1.10 with that):
>>>
>>> 680 ms for 10000 lines to add the line numbers,
>>> 650 ms for 10000 lines to remove the line numbers,
>>> both incl. the field update (a lot of long lines are to break).
>>>
>>> -- Add "inline line numbers" [-hh fecit, 2014]
>>> -- Uses separator ": " (In LC 6 use one single char, remove below needs that)
>>> on mouseUp
>>>   lock screen; lock messages
>>>   put the millisecs into m1
>>>   set cursor to watch
>>>   put fld "IN" into T
>>>   split T by return
>>>   put the keys of T into K
>>>   sort K numeric
>>>   repeat for each line L in K
>>>     put cr & L & ": " & T[L] after S --> change separator here
>>>   end repeat
>>>   set text of fld "OUT" to char 2 to -1 of S
>>>   put -1+the num of lines of S & " lines: " & \
>>>         the millisecs -m1 & " ms" into fld "timing"
>>> end mouseUp
>>>
>>> -- Remove "inline line numbers" [-hh fecit, 2014]
>>> -- Uses separator ": " (the above, in LC 6 you have to use one single char)
>>> on mouseUp
>>>   lock screen; lock messages
>>>   put the millisecs into m1
>>>   set cursor to watch
>>>   put the text of fld "OUT" into S
>>>   split S by return and ": " --> change separator here
>>>   put the keys of S into K
>>>   sort K numeric
>>>   repeat for each line L in K
>>>     put cr & S[L] after T
>>>   end repeat
>>>   put char 2 to -1 of T into fld "IN2"
>>>   put -1+the num of lines of T & " lines: " & \
>>>         the millisecs -m1 & " ms : " & (fld "IN2" is fld "IN") into fld "timing"
>>> end mouseUp

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Numbering lines

Geoff Canyon via use-livecode
Thanks for this, although I’m not sure I understand.  In fact I am sure I don’t.    I know how amazingly fast the array method is, I use it elsewhere in the same stack, and it is great.

I also don’t understand the distinction between line numbering and indexing.  If I was guessing, I would go for line numbering prepends to each line in a text field a number, and indexing is adding a numerical key to a database or array.  The former is what I described in my original post.

The reason the issue arrises is because some of the text/chat message records I referred to have the date and time stamps stripped out.  So in the following exchange…

1757 Shadowknave: U gotta b there
1758 What_goes_Moo: kk
1759 Shadowknave: no let down?
1760 What_goes_Moo: kk
1761 Shadowknave: U b there 8?
1762 What_goes_Moo: I wil

… lines 2 and 4 would be identical but for the line number I added via the script. And of course, the integrity of the dialogue must be maintained.

 I had believed that collapsing duplicates and alphabetising are unavoidable with split.  If there is an array method which doesn’t mess with the text message order or content, then I would be delighted.  Is that what this is below, but I haven’t appreciated it?

Cheers,

David G


> On 28 Oct 2018, at 1:47 pm, hh via use-livecode <[hidden email]> wrote:
>
>> David G. wrote:
>> Thanks Geoff, I did play with Split, but one of the reasons for numbering
>> is to make any identical lines unique.  With split, for any that are not,
>> all but one is deleted.  So definitely not the result I wanted.
>
> I am not Geoff (who played with the simple array methods I suggested).
> But your post attacks indirectly my suggested handlers below as wrong, as if
> they would not hit your question.
>
> My handlers (which are at least 600 times faster than your first script)
> output exactly the same what your first script outputs, seen apart from the
> optional delimiter.
>
>> So definitely not the result I wanted.
> LOL: You mention above the "unique"-side-condition the first time...
>
> With your new side condition from above several others (and I) know also
> how this is doable very fast, once again using arrays. And it is an
> invertible method, that is, the original text is exactly restorable.
>
> But first post YOU your new handler, to see *all* your new side conditions,
> that is, or to see what you really want:
> Certainly not a line numbering, rather indexing a text file.
>
>>>>> David G. wrote: [This is the first script]
>>>>> However….
>>>>> Sometimes I want to prefix each line with the line number, and do this:
>>>>>
>>>>> put 1 into tcount
>>>>> repeat for each line j in it
>>>>> put tcount & j into line tcount of it
>>>>> put tcount + 1 into tcount
>>>>> set the thumbpos of scrollbar "filterprog" to tcount
>>>>> end repeat
>>>>> put it into field “numberedtext”
>>>>>
>>>>> I use ‘it’ because of a dim memory (superstition? Myth?) from long ago that
>>>>> it is faster than an arbitrarily named variable. Still, the whole process
>>>>> is pretty darned slow. Any brilliant suggestions?
>>
>>> Geoff C. wrote:
>>> And of course if retaining the order isn't critical you could just go with:
>>>
>>> function numberText T,D
>>>   split T by cr
>>>   combine T by cr and D
>>>   return T
>>> end numberText
>>>
>>> function unNumberText T,D
>>>   split T by cr and D
>>>   combine T by cr
>>>   return T
>>> end unNumberText
>>
>>>> Hermann H. wrote:
>>>> 1. Besides removing scroll-update, which takes most of the time, you could
>>>> try the following array-methods (which are essentially from my stack
>>>>
>>>> http://forums.livecode.com/viewtopic.php?p=101301#p101301
>>>> , see there
>>>> card "LineNums, tab "Nb2").
>>>>
>>>> This needs here on a medium fast machine (Mac mini, 2.5GHz) in average
>>>> with LC 9.0.1 (which is at about 30% faster than LC 8.1.10 with that):
>>>>
>>>> 680 ms for 10000 lines to add the line numbers,
>>>> 650 ms for 10000 lines to remove the line numbers,
>>>> both incl. the field update (a lot of long lines are to break).
>>>>
>>>> -- Add "inline line numbers" [-hh fecit, 2014]
>>>> -- Uses separator ": " (In LC 6 use one single char, remove below needs that)
>>>> on mouseUp
>>>>  lock screen; lock messages
>>>>  put the millisecs into m1
>>>>  set cursor to watch
>>>>  put fld "IN" into T
>>>>  split T by return
>>>>  put the keys of T into K
>>>>  sort K numeric
>>>>  repeat for each line L in K
>>>>    put cr & L & ": " & T[L] after S --> change separator here
>>>>  end repeat
>>>>  set text of fld "OUT" to char 2 to -1 of S
>>>>  put -1+the num of lines of S & " lines: " & \
>>>>        the millisecs -m1 & " ms" into fld "timing"
>>>> end mouseUp
>>>>
>>>> -- Remove "inline line numbers" [-hh fecit, 2014]
>>>> -- Uses separator ": " (the above, in LC 6 you have to use one single char)
>>>> on mouseUp
>>>>  lock screen; lock messages
>>>>  put the millisecs into m1
>>>>  set cursor to watch
>>>>  put the text of fld "OUT" into S
>>>>  split S by return and ": " --> change separator here
>>>>  put the keys of S into K
>>>>  sort K numeric
>>>>  repeat for each line L in K
>>>>    put cr & S[L] after T
>>>>  end repeat
>>>>  put char 2 to -1 of T into fld "IN2"
>>>>  put -1+the num of lines of T & " lines: " & \
>>>>        the millisecs -m1 & " ms : " & (fld "IN2" is fld "IN") into fld "timing"
>>>> end mouseUp
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Numbering lines

Geoff Canyon via use-livecode
David,

I think you are correct - there is no magic version of split or array
that will do what you want.

You require to keep the line ordering completely unchanged - and
Hermann's superfast method can't meet that need.

The best solution (AFAIK) will be the one Mark Hsu and/or Jacqueline
already gave, and indeed you already tried. However, your test was
unsuccessful, because the time spent updating the progress bar swamped
the (relatively small) amount of actual work to be done. Without any
progress bar updates, my aging MacBookPro does 3000 lines in 14 ms
(lines of 50 chars each).

If you may encounter much larger data sets, then you should have a
progress indicator of some kind.

I would say you should NEVER update a progress bar every time round a
loop without a check against doing it too frequently.


The simple way is something like

put the millisecs into timeLastUpdated
put 50 into  kMinUpdateTime
repeat ....
     .... do something ...
     if the millisecs - timeLastUpdated < kMinUpdateTime then
         ... update the scrollbar
         put the millisecs into timeLastUpdated
     end if
where end repeat

NB kMinUpdateTime should be adjusted depending on how important the
updates are, and how frequently you want them I'd say rarely below 50ms
- I'd usually use 200ms or longer.

-- Alex.

On 28/10/2018 18:14, David V Glasgow via use-livecode wrote:

> Thanks for this, although I’m not sure I understand.  In fact I am sure I don’t.    I know how amazingly fast the array method is, I use it elsewhere in the same stack, and it is great.
>
> I also don’t understand the distinction between line numbering and indexing.  If I was guessing, I would go for line numbering prepends to each line in a text field a number, and indexing is adding a numerical key to a database or array.  The former is what I described in my original post.
>
> The reason the issue arrises is because some of the text/chat message records I referred to have the date and time stamps stripped out.  So in the following exchange…
>
> 1757 Shadowknave: U gotta b there
> 1758 What_goes_Moo: kk
> 1759 Shadowknave: no let down?
> 1760 What_goes_Moo: kk
> 1761 Shadowknave: U b there 8?
> 1762 What_goes_Moo: I wil
>
> … lines 2 and 4 would be identical but for the line number I added via the script. And of course, the integrity of the dialogue must be maintained.
>
>   I had believed that collapsing duplicates and alphabetising are unavoidable with split.  If there is an array method which doesn’t mess with the text message order or content, then I would be delighted.  Is that what this is below, but I haven’t appreciated it?
>
> Cheers,
>
> David G
>
>
>> On 28 Oct 2018, at 1:47 pm, hh via use-livecode <[hidden email]> wrote:
>>
>>> David G. wrote:
>>> Thanks Geoff, I did play with Split, but one of the reasons for numbering
>>> is to make any identical lines unique.  With split, for any that are not,
>>> all but one is deleted.  So definitely not the result I wanted.
>> I am not Geoff (who played with the simple array methods I suggested).
>> But your post attacks indirectly my suggested handlers below as wrong, as if
>> they would not hit your question.
>>
>> My handlers (which are at least 600 times faster than your first script)
>> output exactly the same what your first script outputs, seen apart from the
>> optional delimiter.
>>
>>> So definitely not the result I wanted.
>> LOL: You mention above the "unique"-side-condition the first time...
>>
>> With your new side condition from above several others (and I) know also
>> how this is doable very fast, once again using arrays. And it is an
>> invertible method, that is, the original text is exactly restorable.
>>
>> But first post YOU your new handler, to see *all* your new side conditions,
>> that is, or to see what you really want:
>> Certainly not a line numbering, rather indexing a text file.
>>
>>>>>> David G. wrote: [This is the first script]
>>>>>> However….
>>>>>> Sometimes I want to prefix each line with the line number, and do this:
>>>>>>
>>>>>> put 1 into tcount
>>>>>> repeat for each line j in it
>>>>>> put tcount & j into line tcount of it
>>>>>> put tcount + 1 into tcount
>>>>>> set the thumbpos of scrollbar "filterprog" to tcount
>>>>>> end repeat
>>>>>> put it into field “numberedtext”
>>>>>>
>>>>>> I use ‘it’ because of a dim memory (superstition? Myth?) from long ago that
>>>>>> it is faster than an arbitrarily named variable. Still, the whole process
>>>>>> is pretty darned slow. Any brilliant suggestions?
>>>> Geoff C. wrote:
>>>> And of course if retaining the order isn't critical you could just go with:
>>>>
>>>> function numberText T,D
>>>>    split T by cr
>>>>    combine T by cr and D
>>>>    return T
>>>> end numberText
>>>>
>>>> function unNumberText T,D
>>>>    split T by cr and D
>>>>    combine T by cr
>>>>    return T
>>>> end unNumberText
>>>>> Hermann H. wrote:
>>>>> 1. Besides removing scroll-update, which takes most of the time, you could
>>>>> try the following array-methods (which are essentially from my stack
>>>>>
>>>>> http://forums.livecode.com/viewtopic.php?p=101301#p101301
>>>>> , see there
>>>>> card "LineNums, tab "Nb2").
>>>>>
>>>>> This needs here on a medium fast machine (Mac mini, 2.5GHz) in average
>>>>> with LC 9.0.1 (which is at about 30% faster than LC 8.1.10 with that):
>>>>>
>>>>> 680 ms for 10000 lines to add the line numbers,
>>>>> 650 ms for 10000 lines to remove the line numbers,
>>>>> both incl. the field update (a lot of long lines are to break).
>>>>>
>>>>> -- Add "inline line numbers" [-hh fecit, 2014]
>>>>> -- Uses separator ": " (In LC 6 use one single char, remove below needs that)
>>>>> on mouseUp
>>>>>   lock screen; lock messages
>>>>>   put the millisecs into m1
>>>>>   set cursor to watch
>>>>>   put fld "IN" into T
>>>>>   split T by return
>>>>>   put the keys of T into K
>>>>>   sort K numeric
>>>>>   repeat for each line L in K
>>>>>     put cr & L & ": " & T[L] after S --> change separator here
>>>>>   end repeat
>>>>>   set text of fld "OUT" to char 2 to -1 of S
>>>>>   put -1+the num of lines of S & " lines: " & \
>>>>>         the millisecs -m1 & " ms" into fld "timing"
>>>>> end mouseUp
>>>>>
>>>>> -- Remove "inline line numbers" [-hh fecit, 2014]
>>>>> -- Uses separator ": " (the above, in LC 6 you have to use one single char)
>>>>> on mouseUp
>>>>>   lock screen; lock messages
>>>>>   put the millisecs into m1
>>>>>   set cursor to watch
>>>>>   put the text of fld "OUT" into S
>>>>>   split S by return and ": " --> change separator here
>>>>>   put the keys of S into K
>>>>>   sort K numeric
>>>>>   repeat for each line L in K
>>>>>     put cr & S[L] after T
>>>>>   end repeat
>>>>>   put char 2 to -1 of T into fld "IN2"
>>>>>   put -1+the num of lines of T & " lines: " & \
>>>>>         the millisecs -m1 & " ms : " & (fld "IN2" is fld "IN") into fld "timing"
>>>>> end mouseUp
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Numbering lines

Geoff Canyon via use-livecode
In reply to this post by Geoff Canyon via use-livecode
You're right, split deletes duplicates. In fact, I use it as a quick way
to do just that.

I don't see any way to add line numbers without looking at each line.
But you could keep a counter in a variable and put the text into an
array with the counter integer as the key. That might be faster than
keeping a text list. I haven't followed this thread closely, so probably
that's already been suggested.

I think if you remove the speed hit that updates the field scroll, it
might get fast enough.

On 10/28/18 1:14 PM, David V Glasgow via use-livecode wrote:
>   I had believed that collapsing duplicates and alphabetising are unavoidable with split.  If there is an array method which doesn’t mess with the text message order or content, then I would be delighted.  Is that what this is below, but I haven’t appreciated it?


--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Numbering lines

Geoff Canyon via use-livecode
In reply to this post by Geoff Canyon via use-livecode
>> David G. wrote:
>> Thanks Geoff, I did play with Split, but one of the reasons for numbering
>> is to make any identical lines unique.  With split, for any that are not,
>> all but one is deleted.  So definitely not the result I wanted.

From that previous answer I concluded you intend to index a text file, that is
to find different lines of a text and save them together with their line number
offsets in the original.

But now (after your last post) I think you want still a simple line numbering.
But this is what my handlers do:
Even if you have 10000 identical lines then they are numbered, as they appear, from
1 up to 10000. Your answer shows that you didn't even try ...
(Following the proposal of Geoff C. here once again the methods as functions:

-- D is the separator for numbers and text lines, usually space or ": "
-- T is the input text, delimited with return
-- prepends the number and separator to each line:
function addLineNumbers D,T
  split T by return
  put the keys of T into K
  sort K numeric
  repeat for each line L in K
    put cr & L & D & T[L] after S
  end repeat
  return char 2 to -1 of S
end addLineNumbers

-- D is the separator for numbers and text lines, usually space or ": "
-- T is the input text, delimited with return
-- removes the number and separator from each line:
function removeLineNumbers D,T
  split T by return and D
  put the keys of T into K
  sort K numeric
  repeat for each line L in K
    put cr & T[L] after S
  end repeat
  return char 2 to -1 of S
end removeLineNumbers
 

> David G. wrote:
> Thanks for this, although I’m not sure I understand.  In fact I am sure I don’t.    I know how amazingly fast the array method is, I use it elsewhere in the same stack, and it is great.
>
> I also don’t understand the distinction between line numbering and indexing.  If I was guessing, I would go for line numbering prepends to each line in a text field a number, and indexing is adding a numerical key to a database or array.  The former is what I described in my original post.
>
> The reason the issue arrises is because some of the text/chat message records I referred to have the date and time stamps stripped out.  So in the following exchange…
>
> 1757 Shadowknave: U gotta b there
> 1758 What_goes_Moo: kk
> 1759 Shadowknave: no let down?
> 1760 What_goes_Moo: kk
> 1761 Shadowknave: U b there 8?
> 1762 What_goes_Moo: I wil
>
> … lines 2 and 4 would be identical but for the line number I added via the script. And of course, the integrity of the dialogue must be maintained.
>
>  I had believed that collapsing duplicates and alphabetising are unavoidable with split.  If there is an array method which doesn’t mess with the text message order or content, then I would be delighted.  Is that what this is below, but I haven’t appreciated it?
>

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Numbering lines

Geoff Canyon via use-livecode
In reply to this post by Geoff Canyon via use-livecode
> Alex T. wrote:
> You require to keep the line ordering completely unchanged -
> and Hermann's superfast method can't meet that need.

> JLG wrote:
> You're right, split deletes duplicates. In fact, I use it as a quick way
> to do just that.

You are both spendidly wrong:
Could you please simply try my functions and read the dictionary in order
to understand why you are wrong? Please!

Is it not yet Halloween ...

-- D is the separator for numbers and text lines, usually space or ": "
-- T is the input text, delimited with return
-- prepends the number and separator to each line:
function addLineNumbers D,T
  split T by return
  put the keys of T into K
  sort K numeric
  repeat for each line L in K
    put cr & L & D & T[L] after S
  end repeat
  return char 2 to -1 of S
end addLineNumbers

-- D is the separator for numbers and text lines, usually space or ": "
-- T is the input text, delimited with return
-- removes the number and separator from each line:
function removeLineNumbers D,T
  split T by return and D
  put the keys of T into K
  sort K numeric
  repeat for each line L in K
    put cr & T[L] after S
  end repeat
  return char 2 to -1 of S
end removeLineNumbers




_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
12