finding repeating patterns

2006-08-26 Thread jbv
Hi list, Does anyone have (or know of) an algorithm to find repeating patterns of characters in a string ? I'm not sure Transcript (er... Revolution) is fast enough for that kind of task, but anyway I thought it was worth asking... Thanks, JB ___ use-r

Re: finding repeating patterns

2006-08-26 Thread jbv
well, I just realized that my question isn't very clear... I DON'T WANT to find how many times pattern "ta" appears in string "tatata" (for instance)... What I want to find is : is there any repeating pattern of chars in any string, which are they and (that's easy) how many times each pattern app

Re: finding repeating patterns

2006-08-26 Thread Dar Scott
On Aug 26, 2006, at 3:17 PM, jbv wrote: Does anyone have (or know of) an algorithm to find repeating patterns of characters in a string ? This brute-force method came to my mind. Decide on a min and max length of patterns. Try all possible substrings. (Outer loop is start position, inn

Re: finding repeating patterns

2006-08-26 Thread jbv
Dar, I came up to something similar... Here's a (very raw and quite slow) first approach (it checks only groups of 6 to 20 chars) : on mouseUp set cursor to watch lock screen put fld 1 into myST put "" into myL set the casesensitive to true repeat with k=1 to 1000 repeat with i

Re: finding repeating patterns

2006-08-26 Thread jbv
for those interested, here's something much faster : on mouseUp set cursor to watch lock screen put fld 1 into myST put number of chars of myST into n put "" into myL set the casesensitive to true put 1 into k repeat while k<=1000 repeat with i=100 down to 6 put k+i-1 int

Re: finding repeating patterns

2006-08-27 Thread Rob Cozens
All, Does anyone have (or know of) an algorithm to find repeating patterns of characters in a string ? This started out as a mental exercise for moi, and the mouseUp logic is untested: on mouseUp put field 1 into sourceString put empty into patternList put 6 into minPatternLength -- o

Re: finding repeating patterns

2006-08-27 Thread Mark Smith
Here's my version: function getRepeatingPatterns tString,minLength,maxLength set the caseSensitive to true repeat with n = minLength to maxLength put empty into testString put 0 into charCount repeat for each char c in tString put c after testString get length(testSt

Re: finding repeating patterns

2006-08-28 Thread Peter Brigham
On Sun, 27 Aug 2006 10:00:24 -0700 Rob Cozens <[EMAIL PROTECTED]> wrote: This started out as a mental exercise for moi, and the mouseUp logic is untested: .. OTOH, working on it led me to the following offsets function, which has been tested. function offsets targetString, sourceStrin