ostafen / smart

String Matching Algorithms Research Tool
https://smart-tool.github.io/smart/
GNU General Public License v3.0
4 stars 2 forks source link

Pattern lengths to search. #22

Closed nishihatapalmer closed 1 year ago

nishihatapalmer commented 1 year ago

We currently have several options to control pattern length. These are the current options:

--plen lets you limit searches in the predefined range 2-4096 to be between two values. sometimes useful. --short limits searches to predefined lengths 2-32 --vshort limits searches to predefined lengths 1-16

I often want to search for different kinds of length. For example:

nishihatapalmer commented 1 year ago

I think most scenarios can be modeled using a lower bound L , an upper bound U, an operator (+ or *) and a step/ratio value.

There is no reason why the ratio or step has to be an integer. You could have:

You just have to be careful to always increment the pattern length by at least one, if the ratio is too small to give a whole number increase (or round up). Also reject ratio/steps less than 1.0.

nishihatapalmer commented 1 year ago

Suggestion for syntax. Modify the existing --plen option as follows:

--plen L U [op val] where op value default to * 2.0 if not specified.

If you said --plen 32 16384 it would give you pattern lengths between 32 and 16384 inclusive, using powers of two.

If you specify the [op and val], you could say:

--plen 2 64 + 4 - all lengths from 2 to max 64 in steps of 4. --plen 2 256 * 1.75 - all lengths from 2 to 256 going up in a ratio of 1.75 from the last pattern len (rounded up).

nishihatapalmer commented 1 year ago

closed by PR #56